X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02e8b2f9fbdfcd25080c42082d637da257c20094..e29b83a455bead3dae44300f631d07aa9635d3e9:/src/motif/checkbox.cpp?ds=sidebyside diff --git a/src/motif/checkbox.cpp b/src/motif/checkbox.cpp index 4f2330ab32..ed697a0c19 100644 --- a/src/motif/checkbox.cpp +++ b/src/motif/checkbox.cpp @@ -40,6 +40,9 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, SetName(name); SetValidator(validator); m_windowStyle = style; + m_backgroundColour = parent->GetBackgroundColour(); + m_foregroundColour = parent->GetForegroundColour(); + m_windowFont = parent->GetFont(); if (parent) parent->AddChild(this); @@ -52,9 +55,11 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, XmString text = XmStringCreateSimple (label1); Widget parentWidget = (Widget) parent->GetClientWidget(); + XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget)); m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("toggle", xmToggleButtonWidgetClass, parentWidget, + XmNfontList, fontList, XmNlabelString, text, NULL); XmStringFree (text); @@ -67,18 +72,15 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, SetCanAddEventHandler(TRUE); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); - ChangeColour(m_mainWidget); - SetFont(* parent->GetFont()); - + ChangeBackgroundColour(); return TRUE; } void wxCheckBox::SetValue(bool val) { - // TODO: m_inSetValue - // inSetValue = TRUE; + m_inSetValue = TRUE; XmToggleButtonSetState ((Widget) m_mainWidget, (Boolean) val, TRUE); - // inSetValue = FALSE; + m_inSetValue = FALSE; } bool wxCheckBox::GetValue() const @@ -140,12 +142,39 @@ void wxCheckBoxCallback (Widget w, XtPointer clientData, XtPointer ptr) { wxCheckBox *item = (wxCheckBox *) clientData; - // TODO - // if (item->inSetValue) - // return; + + if (item->InSetValue()) + return; wxCommandEvent event (wxEVT_COMMAND_CHECKBOX_CLICKED, item->GetId()); event.SetInt((int) item->GetValue ()); event.SetEventObject(item); item->ProcessCommand (event); } + +void wxCheckBox::ChangeFont(bool keepOriginalSize) +{ + wxWindow::ChangeFont(keepOriginalSize); +} + +void wxCheckBox::ChangeBackgroundColour() +{ + wxComputeColours (XtDisplay((Widget) m_mainWidget), & m_backgroundColour, + (wxColour*) NULL); + + XtVaSetValues ((Widget) m_mainWidget, + XmNbackground, g_itemColors[wxBACK_INDEX].pixel, + XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel, + XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel, + XmNforeground, g_itemColors[wxFORE_INDEX].pixel, + NULL); + + XtVaSetValues ((Widget) m_mainWidget, + XmNselectColor, g_itemColors[wxSELE_INDEX].pixel, + NULL); +} + +void wxCheckBox::ChangeForegroundColour() +{ + wxWindow::ChangeForegroundColour(); +}