+const short kTextColumnId = 1024 ;
+
+// new databrowserbased version
+// because of the limited insert
+// functionality of DataBrowser,
+// we just introduce id s corresponding
+// to the line number
+
+DataBrowserItemDataUPP gDataBrowserItemDataUPP = NULL ;
+DataBrowserItemNotificationUPP gDataBrowserItemNotificationUPP = NULL ;
+DataBrowserDrawItemUPP gDataBrowserDrawItemUPP = NULL ;
+
+#if TARGET_API_MAC_OSX
+static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
+ DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
+#else
+static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
+ DataBrowserItemNotification message)
+#endif
+{
+ long ref = GetControlReference( browser ) ;
+ if ( ref )
+ {
+ wxListBox* list = wxDynamicCast( (wxObject*) ref , wxListBox ) ;
+ int i = itemID - 1 ;
+ if (i >= 0 && i < list->GetCount() )
+ {
+ bool trigger = false ;
+ wxCommandEvent event(
+ wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
+ switch( message )
+ {
+ case kDataBrowserItemDeselected :
+ if ( list->HasMultipleSelection() )
+ trigger = !list->MacIsSelectionSuppressed() ;
+ break ;
+ case kDataBrowserItemSelected :
+ trigger = !list->MacIsSelectionSuppressed() ;
+ break ;
+ case kDataBrowserItemDoubleClicked :
+ event.SetEventType(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED) ;
+ trigger = true ;
+ break ;
+ default :
+ break ;
+ }
+ if ( trigger )
+ {
+ event.SetEventObject( list );
+ if ( list->HasClientObjectData() )
+ event.SetClientObject( list->GetClientObject(i) );
+ else if ( list->HasClientUntypedData() )
+ event.SetClientData( list->GetClientData(i) );
+ event.SetString( list->GetString(i) );
+ event.SetInt(i) ;
+ event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : TRUE );
+ wxPostEvent( list->GetEventHandler() , event ) ;
+ // direct notification is not always having the listbox GetSelection() having in synch with event
+ // list->GetEventHandler()->ProcessEvent(event) ;
+ }
+ }
+ }
+}
+
+static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
+ DataBrowserItemID itemID, DataBrowserPropertyID property,
+ DataBrowserItemDataRef itemData, Boolean changeValue)
+{
+ OSStatus err = errDataBrowserPropertyNotSupported;