]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/radiobox.cpp
OnExit() is called for modules which were initialized even if the init of
[wxWidgets.git] / src / motif / radiobox.cpp
index 152e1d38883084dc4dfeab9fa333ddb79f166ab5..4efaf974f3b883df5a3027b7cd8d46017d80f316 100644 (file)
@@ -59,6 +59,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
     m_radioButtonLabels = (wxString*) NULL;
     m_backgroundColour = parent->GetBackgroundColour();
     m_foregroundColour = parent->GetForegroundColour();
+    m_windowFont = parent->GetFont();
 
     SetName(name);
     SetValidator(val);
@@ -93,6 +94,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
 
     m_formWidget = (WXWidget) formWidget;
 
+    XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget));
     if (label1 != "")
     {
         text = XmStringCreateSimple ((char*) (const char*) label1);
@@ -104,16 +106,10 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
 #else
                                             xmLabelWidgetClass, formWidget,
 #endif
+                                             XmNfontList, fontList,
                                             XmNlabelString, text,
                                             NULL);
 
-/* TODO: change label font
-        if (labelFont)
-               XtVaSetValues (labelWidget,
-                      XmNfontList, labelFont->GetInternalFont (XtDisplay(formWidget)),
-                      NULL);
-*/
-
         XmStringFree (text);
     }
 
@@ -159,25 +155,22 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title,
 #else
                                    xmToggleButtonWidgetClass, radioBoxWidget,
 #endif
+                                    XmNfontList, fontList,
                                                 NULL);
         XtAddCallback ((Widget) m_radioButtons[i], XmNvalueChangedCallback, (XtCallbackProc) wxRadioBoxCallback,
                     (XtCallbackProc) this);
 
-/* TODO: set font
-        if (buttonFont)
-               XtVaSetValues ((Widget) m_radioButtons[i],
-                      XmNfontList, buttonFont->GetInternalFont (XtDisplay(formWidget)),
-                      NULL);
-*/
     }
     SetSelection (0);
 
+    m_windowFont = parent->GetFont();
+    ChangeFont(FALSE);
+
     XtManageChild (radioBoxWidget);
 
     SetCanAddEventHandler(TRUE);
     AttachWidget (parent, m_mainWidget, m_formWidget, pos.x, pos.y, size.x, size.y);
 
-    SetFont(* parent->GetFont());
     ChangeBackgroundColour();
 
     return TRUE;
@@ -188,6 +181,7 @@ wxRadioBox::~wxRadioBox()
 {
     delete[] m_radioButtonLabels;
     delete[] m_radioButtons;
+    DetachWidget(m_formWidget);
 }
 
 wxString wxRadioBox::GetLabel(int item) const
@@ -391,19 +385,48 @@ void wxRadioBox::Command (wxCommandEvent & event)
     ProcessCommand (event);
 }
 
-void wxRadioBox::ChangeFont()
+void wxRadioBox::ChangeFont(bool keepOriginalSize)
 {
-    // TODO
+    wxWindow::ChangeFont(keepOriginalSize);
+
+    XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay((Widget) GetTopWidget()));
+
+    int i;
+    for (i = 0; i < m_noItems; i++)
+    {
+        WXWidget radioButton = m_radioButtons[i];
+
+        XtVaSetValues ((Widget) radioButton,
+                       XmNfontList, fontList,
+                      XmNtopAttachment, XmATTACH_FORM,
+                       NULL);
+    }
 }
 
 void wxRadioBox::ChangeBackgroundColour()
 {
-    // TODO
+    wxWindow::ChangeBackgroundColour();
+
+    int i;
+    for (i = 0; i < m_noItems; i++)
+    {
+        WXWidget radioButton = m_radioButtons[i];
+
+        DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE);
+    }
 }
 
 void wxRadioBox::ChangeForegroundColour()
 {
-    // TODO
+    wxWindow::ChangeForegroundColour();
+
+    int i;
+    for (i = 0; i < m_noItems; i++)
+    {
+        WXWidget radioButton = m_radioButtons[i];
+
+        DoChangeForegroundColour(radioButton, m_foregroundColour);
+    }
 }
 
 void wxRadioBoxCallback (Widget w, XtPointer clientData,