Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page >

'DBC#'リソースタイプのフリップ

PowerPlantのLDataBrowserクラスを使用する場合は、'DBC#'リソースを使用している可能性があります。使用している場合は、Listing D-2に示すようなリソースフリッパーを作成する必要があります。

Listing D-2  'DBC#'ソースタイプをフリップするコード

struct DataBrowserColumnSetup {
    DataBrowserTableViewColumnID    propertyID;         // UInt32
    DataBrowserPropertyType         propertyType;       // unsigned  long
    SInt32                          nameStrIndex;
    DataBrowserPropertyFlags        propertyFlags;      // UInt32
    UInt16                          minimumWidth;
    UInt16                          maximumWidth;
    UInt16                          initialWidth;
    ControlContentType              btnContentType;     // SInt16
    ControlButtonGraphicAlignment   btnContentAlign;    // SInt16
    SInt16                          btnContentDataID;
    ControlButtonGraphicAlignment   titleAlignment;     // SInt16
    ControlButtonTextPlacement      titlePlacement;     // SInt16
    SInt16                          titleFontTypeID;
    SInt16                          titleFontStyle;
    SInt16                          titleFontSize;
    UInt16                          titleOffset;
};
typedef struct DataBrowserColumnSetup   DataBrowserColumnSetup;
 
OSStatus FlipDBC_(OSType dataDomain, OSType dataType,
                  short id, void* dataPtr, UInt32 dataSize,
                  Boolean currentlyNative, void* refcon)
{
    DataBrowserColumnSetup *dbc;
    UInt16 count;
    int i;
 
    if (currentlyNative) {
        count = *(UInt16 *) dataPtr;
        *(UInt16 *) dataPtr = EndianU16_NtoB(count);
    } else {
        *(UInt16 *) dataPtr = EndianU16_BtoN(count);
        count = *(UInt16 *) dataPtr;
    }
    dataPtr += sizeof(UInt16);
    dbc = (DataBrowserColumnSetup *) dataPtr;
    for(i = 0; i < count; i++, dbc++) {
        dbc->propertyID = Endian32_Swap(dbc->propertyID);
        dbc->propertyType = Endian32_Swap(dbc->propertyType);
        dbc->nameStrIndex = Endian32_Swap(dbc->nameStrIndex);
        dbc->propertyFlags = Endian32_Swap(dbc->propertyFlags);
        dbc->minimumWidth = Endian16_Swap(dbc->minimumWidth);
        dbc->maximumWidth = Endian16_Swap(dbc->maximumWidth);
        dbc->initialWidth = Endian16_Swap(dbc->initialWidth);
        dbc->btnContentType = Endian16_Swap(dbc->btnContentType);
        dbc->titleAlignment = Endian16_Swap(dbc->titleAlignment);
        dbc->titlePlacement = Endian16_Swap(dbc->titlePlacement);
        dbc->titleFontTypeID = Endian16_Swap(dbc->titleFontTypeID);
        dbc->titleFontStyle = Endian16_Swap(dbc->titleFontStyle);
        dbc->titleFontSize = Endian16_Swap(dbc->titleFontSize);
        dbc->titleOffset = Endian16_Swap(dbc->titleOffset);
    }
    return noErr;
}


< Previous PageNext Page >


Last updated: 2006-03-08




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice