+ XmComboBoxSetSelection ((Widget) m_mainWidget, (XmTextPosition) from, (XmTextPosition) to,
+ (Time) 0);
+}
+
+void wxComboBoxCallback (Widget WXUNUSED(w), XtPointer clientData,
+ XmComboBoxSelectionCallbackStruct * cbs)
+{
+ wxComboBox *item = (wxComboBox *) clientData;
+
+ switch (cbs->reason)
+ {
+ case XmCR_SINGLE_SELECT:
+ case XmCR_BROWSE_SELECT:
+ {
+ wxCommandEvent event (wxEVT_COMMAND_COMBOBOX_SELECTED, item->GetId());
+ event.m_commandInt = cbs->index - 1;
+ event.m_commandString = item->GetString (event.m_commandInt);
+ if ( item->HasClientObjectData() )
+ event.SetClientObject( item->GetClientObject(cbs->index - 1) );
+ else if ( item->HasClientUntypedData() )
+ event.SetClientData( item->GetClientData(cbs->index - 1) );
+ event.m_extraLong = TRUE;
+ event.SetEventObject(item);
+ item->ProcessCommand (event);
+ break;
+ }
+ case XmCR_VALUE_CHANGED:
+ {
+ wxCommandEvent event (wxEVT_COMMAND_TEXT_UPDATED, item->GetId());
+ event.m_commandInt = -1;
+ event.m_commandString = item->GetValue();
+ event.m_extraLong = TRUE;
+ event.SetEventObject(item);
+ item->ProcessCommand (event);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+void wxComboBox::ChangeFont(bool keepOriginalSize)
+{
+ // Don't use the base class wxChoice's ChangeFont
+ wxWindow::ChangeFont(keepOriginalSize);
+}
+
+void wxComboBox::ChangeBackgroundColour()
+{
+ wxWindow::ChangeBackgroundColour();
+}
+
+void wxComboBox::ChangeForegroundColour()
+{
+ wxWindow::ChangeForegroundColour();
+}
+
+wxSize wxComboBox::DoGetBestSize() const
+{
+ if( (GetWindowStyle() & wxCB_DROPDOWN) == wxCB_DROPDOWN ||
+ (GetWindowStyle() & wxCB_READONLY) == wxCB_READONLY )
+ {
+ wxSize items = GetItemsSize();
+ // FIXME arbitrary constants
+ return wxSize( ( items.x ? items.x + 50 : 120 ),
+ items.y + 10 );
+ }
+ else
+ return wxWindow::DoGetBestSize();