- 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 ) );
-
- 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.btnFontStyle.font = kControlFontViewSystemFont;
- columnDesc.headerBtnDesc.btnFontStyle.style = normal;
- columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" );
-
- // check column
-
- columnDesc.headerBtnDesc.minimumWidth = 30 ;
- columnDesc.headerBtnDesc.maximumWidth = 30;
-
- columnDesc.propertyDesc.propertyID = kCheckboxColumnId;
- columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType;
- columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn |
- kDataBrowserDefaultPropertyFlags;
- verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
-
- // text column
-
- columnDesc.headerBtnDesc.minimumWidth = 0;
- columnDesc.headerBtnDesc.maximumWidth = 10000;
-
- columnDesc.propertyDesc.propertyID = kTextColumnId;
- columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
- columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn
-#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
- | kDataBrowserListViewTypeSelectColumn
-#endif
- ;
-
-
- 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 ) ) ;
-
- DataBrowserCallbacks callbacks ;
- callbacks.version = kDataBrowserLatestCallbacks;
- InitDataBrowserCallbacks(&callbacks);
- callbacks.u.v1.itemDataCallback = NewDataBrowserItemDataUPP(ListBoxGetSetItemData);
- callbacks.u.v1.itemNotificationCallback =
-#if TARGET_API_MAC_OSX
- (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ;
-#else
- NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
-#endif
- m_peer->SetCallbacks( &callbacks);
-
-#if 0
- // shouldn't be necessary anymore under 10.2
- m_peer->SetData( kControlNoPart, kControlDataBrowserIncludesFrameAndFocusTag, (Boolean) false ) ;
- m_peer->SetNeedsFocusRect( true ) ;
-#endif
-
- MacPostControlCreate(pos,size) ;
-
- for ( int i = 0 ; i < n ; i++ )
- {
- Append( choices[i] ) ;
- }
-
- SetBestSize(size); // Needed because it is a wxControlWithItems