- m_noItems = 0 ; // this will be increased by our append command
- m_selected = 0;
-
- Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
-
- m_peer = new wxMacControl(this) ;
- verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , m_peer->GetControlRefAddr() ) );
-
- DataBrowserSelectionFlags options = kDataBrowserDragSelect ;
- if ( style & wxLB_MULTIPLE )
- {
- options += kDataBrowserAlwaysExtendSelection + kDataBrowserCmdTogglesSelection ;
- }
- else if ( style & wxLB_EXTENDED )
- {
- // default behaviour
- }
- else
- {
- options += kDataBrowserSelectOnlyOne ;
- }
- verify_noerr(m_peer->SetSelectionFlags( options ) );
-
- if ( gDataBrowserItemDataUPP == NULL ) gDataBrowserItemDataUPP = NewDataBrowserItemDataUPP(ListBoxGetSetItemData) ;
- if ( gDataBrowserItemNotificationUPP == NULL )
- {
- gDataBrowserItemNotificationUPP =
-#if TARGET_API_MAC_OSX
- (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ;
-#else
- NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
-#endif
- }
- if ( gDataBrowserDrawItemUPP == NULL ) gDataBrowserDrawItemUPP = NewDataBrowserDrawItemUPP(ListBoxDrawProc) ;
-
- DataBrowserCallbacks callbacks ;
- InitializeDataBrowserCallbacks( &callbacks , kDataBrowserLatestCallbacks ) ;
-
- callbacks.u.v1.itemDataCallback = gDataBrowserItemDataUPP;
- callbacks.u.v1.itemNotificationCallback = gDataBrowserItemNotificationUPP;
- m_peer->SetCallbacks( &callbacks);
-
- DataBrowserCustomCallbacks customCallbacks ;
- InitializeDataBrowserCustomCallbacks( &customCallbacks , kDataBrowserLatestCustomCallbacks ) ;
-
- customCallbacks.u.v1.drawItemCallback = gDataBrowserDrawItemUPP ;
-
- SetDataBrowserCustomCallbacks( m_peer->GetControlRef() , &customCallbacks ) ;
-
- DataBrowserListViewColumnDesc columnDesc ;
- columnDesc.headerBtnDesc.titleOffset = 0;
- columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
-
- columnDesc.headerBtnDesc.btnFontStyle.flags =
- kControlUseFontMask | kControlUseJustMask;
-
- columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
- columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault;
- columnDesc.headerBtnDesc.minimumWidth = 0;
- columnDesc.headerBtnDesc.maximumWidth = 10000;
-
- columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
- columnDesc.headerBtnDesc.btnFontStyle.style = normal;
- columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" );
-
- columnDesc.propertyDesc.propertyID = kTextColumnId;
- columnDesc.propertyDesc.propertyType = kDataBrowserTextType ; // kDataBrowserCustomType;
- columnDesc.propertyDesc.propertyFlags =
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
- kDataBrowserListViewTypeSelectColumn |
-#endif
- kDataBrowserTableViewSelectionColumn ;
-
- verify_noerr(m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
- verify_noerr(m_peer->AutoSizeListViewColumns() ) ;
- verify_noerr(m_peer->SetHasScrollBars(false , true ) ) ;
- verify_noerr(m_peer->SetTableViewHiliteStyle(kDataBrowserTableViewFillHilite ) ) ;
- verify_noerr(m_peer->SetListViewHeaderBtnHeight( 0 ) ) ;
-
-#if 0
- // shouldn't be necessary anymore under 10.2
- m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean) false ) ;
- m_peer->SetNeedsFocusRect( true ) ;
-#endif