- {
- wxMacCFStringHolder cf( list->GetString(i) , list->GetFont().GetEncoding() ) ;
- verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ;
- err = noErr ;
- }
- }
- }
- break;
-
- default:
-
- break;
- }
- }
-
- return err;
-}
-bool wxListBox::Create(wxWindow *parent, wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- int n, const wxString choices[],
- long style,
- const wxValidator& validator,
- const wxString& name)
-{
- m_macIsUserPane = FALSE ;
+ {
+ wxMacCFStringHolder cf( list->GetString( i ) , list->GetFont().GetEncoding() ) ;
+ verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ;
+ err = noErr ;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return err;
+}
+
+static pascal void ListBoxDrawProc( ControlRef browser , DataBrowserItemID item , DataBrowserPropertyID property ,
+ DataBrowserItemState itemState , const Rect *itemRect , SInt16 depth , Boolean isColorDevice )
+{
+ CFStringRef cfString;
+ ThemeDrawingState themeState ;
+ long systemVersion;
+
+ GetThemeDrawingState( &themeState ) ;
+ cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item );
+
+ // In this sample we handle the "selected" state; all others fall through to our "active" state
+ if ( itemState == kDataBrowserItemIsSelected )
+ {
+ ThemeBrush colorBrushID;
+
+ Gestalt( gestaltSystemVersion, &systemVersion );
+
+ // TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor is incorporated
+ // Panther DB starts using kThemeBrushSecondaryHighlightColor for inactive browser hilighting
+ if ( (systemVersion >= 0x00001030) && !IsControlActive( browser ) )
+ colorBrushID = kThemeBrushSecondaryHighlightColor;
+ else
+ colorBrushID = kThemeBrushPrimaryHighlightColor;
+
+ // First paint the hilite rect, then the text on top
+ SetThemePen( colorBrushID, 32, true );
+ PaintRect( itemRect );
+ SetThemeDrawingState( themeState , false ) ;
+ }
+
+ DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL );
+ SetThemeDrawingState( themeState , true ) ;
+
+ if ( cfString != NULL )
+ CFRelease( cfString );
+}
+
+// Listbox item
+wxListBox::wxListBox()
+{
+ m_noItems = 0;
+ m_selected = 0;
+ m_macList = NULL ;
+ m_suppressSelection = false ;
+}
+
+bool wxListBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ wxCArrayString chs(choices);
+
+ return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+ style, validator, name);
+}
+
+bool wxListBox::Create(wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ m_macIsUserPane = false ;