+void wxChoiceCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
+{
+ wxChoice *item = (wxChoice *) clientData;
+ if (item)
+ {
+ if (item->InSetValue())
+ return;
+
+ char *s = NULL;
+ XtVaGetValues (w, XmNuserData, &s, NULL);
+ if (s)
+ {
+ wxCommandEvent event (wxEVT_COMMAND_CHOICE_SELECTED, item->GetId());
+ event.SetEventObject(item);
+ event.m_commandInt = item->FindString (s);
+ // event.m_commandString = s;
+ item->ProcessCommand (event);
+ }
+ }
+}
+
+void wxChoice::ChangeFont(bool keepOriginalSize)
+{
+ // Note that this causes the widget to be resized back
+ // to its original size! We therefore have to set the size
+ // back again. TODO: a better way in Motif?
+ if (m_font.Ok())
+ {
+ int width, height, width1, height1;
+ GetSize(& width, & height);
+
+ XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay((Widget) m_mainWidget));
+ XtVaSetValues ((Widget) m_mainWidget, XmNfontList, fontList, NULL);
+ XtVaSetValues ((Widget) m_buttonWidget, XmNfontList, fontList, NULL);
+
+ /* TODO: why does this cause a crash in XtWidgetToApplicationContext?
+ int i;
+ for (i = 0; i < m_noStrings; i++)
+ XtVaSetValues ((Widget) m_widgetList[i], XmNfontList, fontList, NULL);
+ */
+ GetSize(& width1, & height1);
+ if (keepOriginalSize && (width != width1 || height != height1))
+ {
+ SetSize(-1, -1, width, height);
+ }
+ }
+}
+
+void wxChoice::ChangeBackgroundColour()
+{
+ DoChangeBackgroundColour(m_formWidget, m_backgroundColour);
+ DoChangeBackgroundColour(m_buttonWidget, m_backgroundColour);
+ DoChangeBackgroundColour(m_menuWidget, m_backgroundColour);
+ int i;
+ for (i = 0; i < m_noStrings; i++)
+ DoChangeBackgroundColour(m_widgetList[i], m_backgroundColour);
+}
+
+void wxChoice::ChangeForegroundColour()
+{
+ DoChangeForegroundColour(m_formWidget, m_foregroundColour);
+ DoChangeForegroundColour(m_buttonWidget, m_foregroundColour);
+ DoChangeForegroundColour(m_menuWidget, m_foregroundColour);
+ int i;
+ for (i = 0; i < m_noStrings; i++)
+ DoChangeForegroundColour(m_widgetList[i], m_foregroundColour);
+}