X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/94b49b9303a9fd119e24d1b07263f5bb0643afa5..cfad3750c3ecc821ffae8b9b3de852551270846d:/src/motif/radiobox.cpp diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index fd6c929cd3..feb57fe5d4 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -41,6 +42,7 @@ wxRadioBox::wxRadioBox() m_majorDim = 0 ; m_formWidget = (WXWidget) 0; + m_frameWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; m_radioButtons = (WXWidget*) NULL; m_radioButtonLabels = (wxString*) NULL; @@ -54,6 +56,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, { m_selectedButton = -1; m_noItems = n; + m_formWidget = (WXWidget) 0; + m_frameWidget = (WXWidget) 0; m_labelWidget = (WXWidget) 0; m_radioButtons = (WXWidget*) NULL; m_radioButtonLabels = (wxString*) NULL; @@ -113,6 +117,15 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, XmStringFree (text); } + Widget frameWidget = XtVaCreateManagedWidget ("frame", + xmFrameWidgetClass, formWidget, + XmNshadowType, XmSHADOW_IN, +// XmNmarginHeight, 0, +// XmNmarginWidth, 0, + NULL); + + m_frameWidget = (WXWidget) frameWidget; + Arg args[3]; majorDim = (n + majorDim - 1) / majorDim; @@ -121,7 +134,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, XmHORIZONTAL : XmVERTICAL)); XtSetArg (args[1], XmNnumColumns, majorDim); - Widget radioBoxWidget = XmCreateRadioBox (formWidget, "radioBoxWidget", args, 2); + Widget radioBoxWidget = XmCreateRadioBox (frameWidget, "radioBoxWidget", args, 2); m_mainWidget = (WXWidget) radioBoxWidget; @@ -137,6 +150,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, XmNtopWidget, m_labelWidget ? (Widget) m_labelWidget : formWidget, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, + XmNrightAttachment, XmATTACH_FORM, NULL); // if (style & wxFLAT) @@ -166,6 +180,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, m_windowFont = parent->GetFont(); ChangeFont(FALSE); + // XtManageChild((Widget) m_formWidget); XtManageChild (radioBoxWidget); SetCanAddEventHandler(TRUE); @@ -181,6 +196,18 @@ wxRadioBox::~wxRadioBox() { delete[] m_radioButtonLabels; delete[] m_radioButtons; + + DetachWidget(m_formWidget); + DetachWidget(m_mainWidget); + + if (m_labelWidget) + XtDestroyWidget((Widget) m_labelWidget); + XtDestroyWidget((Widget) m_mainWidget); + XtDestroyWidget((Widget) m_formWidget); + + m_mainWidget = (WXWidget) 0; + m_formWidget = (WXWidget) 0; + m_labelWidget = (WXWidget) 0; } wxString wxRadioBox::GetLabel(int item) const @@ -327,6 +354,12 @@ void wxRadioBox::Enable(bool enable) XtSetSensitive ((Widget) m_radioButtons[i], (Boolean) enable); } +bool wxRadioBox::Show(bool show) +{ + // TODO: show/hide all children + return wxControl::Show(show); +} + // Show a specific button void wxRadioBox::Show(int n, bool show) { @@ -406,12 +439,20 @@ void wxRadioBox::ChangeBackgroundColour() { wxWindow::ChangeBackgroundColour(); + DoChangeBackgroundColour((Widget) m_frameWidget, m_backgroundColour); + + int selectPixel = wxBLACK->AllocColour(wxGetDisplay()); + int i; for (i = 0; i < m_noItems; i++) { WXWidget radioButton = m_radioButtons[i]; DoChangeBackgroundColour(radioButton, m_backgroundColour, TRUE); + + XtVaSetValues ((Widget) radioButton, + XmNselectColor, selectPixel, + NULL); } }