예제 #1
0
// --------------------------------------------------------------------------------------
ControlRef CreateIconDataBrowser(WindowRef window, const Rect *dbRect, ControlRef *userPanes)
{
    ControlRef dataBrowserControl;
    DataBrowserListViewColumnDesc columnDesc;
    DataBrowserItemID firstItem;

    CreateDataBrowserControl(window, dbRect, kDataBrowserListView, &dataBrowserControl);

    SetDataBrowserHasScrollBars(dataBrowserControl, false, true);
    SetDataBrowserSelectionFlags(dataBrowserControl, kDataBrowserDragSelect |
                                 kDataBrowserSelectOnlyOne);
    SetDataBrowserListViewHeaderBtnHeight(dataBrowserControl, 0);	// no header button
    SetDataBrowserTableViewHiliteStyle(dataBrowserControl, kDataBrowserTableViewFillHilite);
    // because kDataBrowserTableViewMinimalHilite would require us to provide a hit test
    // callback which we would just return true from anyways

    columnDesc.propertyDesc.propertyID = kCategoryProperty;
    columnDesc.propertyDesc.propertyType = kDataBrowserCustomType;	// because
    // kDataBrowserIconAndTextType doesn't draw the way we want
    columnDesc.propertyDesc.propertyFlags = kDataBrowserDefaultPropertyFlags |
                                            kDataBrowserListViewSelectionColumn;
    columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
    columnDesc.headerBtnDesc.minimumWidth = kColumnWidth;
    columnDesc.headerBtnDesc.maximumWidth = kColumnWidth;
    columnDesc.headerBtnDesc.titleOffset = 0;
    columnDesc.headerBtnDesc.titleString = NULL;
    columnDesc.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing;
    columnDesc.headerBtnDesc.btnFontStyle.flags = 0;
    columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
    AddDataBrowserListViewColumn(dataBrowserControl, &columnDesc,
                                 kDataBrowserListViewAppendColumn);

    /* We need to wait to set the row height until here because
       AddDataBrowserListViewColumn will resize the row height. */
#if TARGET_API_MAC_OSX
    SetDataBrowserTableViewRowHeight(dataBrowserControl, kRowHeight);
#else		// Mac OS 8/9 under CarbonLib adds 1 to the row height you provide
    SetDataBrowserTableViewRowHeight(dataBrowserControl, kRowHeight - 1);
#endif

    SetDataBrowserListViewUsePlainBackground(dataBrowserControl, true);

    if (gCallbackRefCount == 0)
    {
        gIconDBCallbacks.u.v1.itemNotificationCallback = NewDataBrowserItemNotificationUPP(IconDataBrowserItemSelectionCB);
        gIconDBCustomCallbacks.u.v1.drawItemCallback = NewDataBrowserDrawItemUPP(DrawIconDataBrowserItemCB);
    }
    SetDataBrowserCallbacks(dataBrowserControl, &gIconDBCallbacks);
    SetDataBrowserCustomCallbacks(dataBrowserControl, &gIconDBCustomCallbacks);
    gCallbackRefCount++;

    firstItem = addItemsToIconDB(dataBrowserControl, userPanes);
    SetDataBrowserSelectedItems(dataBrowserControl, 1, &firstItem, kDataBrowserItemsAssign);
    SetKeyboardFocus(window, dataBrowserControl, kControlFocusNextPart);

    return dataBrowserControl;
}
예제 #2
0
OSStatus wxMacDataBrowserControl::SetHeaderButtonHeight(UInt16 height)
{
    return SetDataBrowserListViewHeaderBtnHeight( m_controlRef, height );
}