+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);
+}
+
+
+// These implement functions needed by wxControlWithItems.
+// Unfortunately, they're not all implemented yet.
+
+int wxChoice::GetCount() const
+{
+ return Number();
+}
+
+int wxChoice::DoAppend(const wxString& item)
+{
+ Append(item);
+ return GetCount() - 1;
+}
+
+// Just appends, doesn't yet insert
+void wxChoice::DoInsertItems(const wxArrayString& items, int WXUNUSED(pos))
+{
+ size_t nItems = items.GetCount();
+
+ for ( size_t n = 0; n < nItems; n++ )
+ {
+ Append( items[n]);
+ }
+}
+
+void wxChoice::DoSetItems(const wxArrayString& items, void **WXUNUSED(clientData))
+{
+ Clear();
+ size_t nItems = items.GetCount();
+
+ for ( size_t n = 0; n < nItems; n++ )
+ {
+ Append(items[n]);
+ }
+}
+
+void wxChoice::DoSetFirstItem(int WXUNUSED(n))
+{
+ wxFAIL_MSG( wxT("wxChoice::DoSetFirstItem not implemented") );
+}
+
+void wxChoice::DoSetItemClientData(int n, void* clientData)
+{
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientData") );
+
+ node->SetData( (wxObject*) clientData );
+}
+
+void* wxChoice::DoGetItemClientData(int n) const
+{
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_MSG( node, NULL, wxT("invalid index in wxChoice::DoGetItemClientData") );
+
+ return node->Data();
+}
+
+void wxChoice::DoSetItemClientObject(int n, wxClientData* clientData)
+{
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_RET( node, wxT("invalid index in wxChoice::DoSetItemClientObject") );
+
+ wxClientData *cd = (wxClientData*) node->Data();
+ delete cd;
+
+ node->SetData( (wxObject*) clientData );
+}
+
+wxClientData* wxChoice::DoGetItemClientObject(int n) const
+{
+ wxNode *node = m_clientList.Nth( n );
+ wxCHECK_MSG( node, (wxClientData *)NULL,
+ wxT("invalid index in wxChoice::DoGetItemClientObject") );
+
+ return (wxClientData*) node->Data();
+}
+
+void wxChoice::Select(int n)
+{
+ SetSelection(n);
+}
+
+void wxChoice::SetString(int WXUNUSED(n), const wxString& WXUNUSED(s))
+{
+ wxFAIL_MSG( wxT("wxChoice::SetString not implemented") );
+}