X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f37907ff76827b0f77f61448abfd0acabf029843..5a410e4453e28ee77ee3ad7a407ca71692f9f30f:/src/motif/radiobut.cpp diff --git a/src/motif/radiobut.cpp b/src/motif/radiobut.cpp index 46906f1a93..b633e9cb20 100644 --- a/src/motif/radiobut.cpp +++ b/src/motif/radiobut.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "radiobut.h" #endif @@ -25,12 +25,8 @@ #ifdef __VMS__ #pragma message disable nosimpint #endif -#include -#include #include #include -#include -#include #ifdef __VMS__ #pragma message enable nosimpint #endif @@ -53,28 +49,16 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - SetName(name); - SetValidator(validator); - m_backgroundColour = parent->GetBackgroundColour(); - m_foregroundColour = parent->GetForegroundColour(); - m_font = parent->GetFont(); - - if (parent) parent->AddChild(this); - - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - m_windowStyle = style ; + if( !CreateControl( parent, id, pos, size, style, validator, name ) ) + return false; Widget parentWidget = (Widget) parent->GetClientWidget(); wxString label1(wxStripMenuCodes(label)); - XmString text = XmStringCreateSimple ((char*) (const char*) label1); + wxXmString text( label1 ); - XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget)); + WXFontType fontType = m_font.GetFontType(XtDisplay(parentWidget)); Widget radioButtonWidget = XtVaCreateManagedWidget ("toggle", #if wxUSE_GADGETS @@ -82,22 +66,23 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, #else xmToggleButtonWidgetClass, parentWidget, #endif - XmNfontList, fontList, - XmNlabelString, text, + wxFont::GetFontTag(), fontType, + XmNlabelString, text(), XmNfillOnSelect, True, XmNindicatorType, XmONE_OF_MANY, // diamond-shape NULL); - XmStringFree (text); - XtAddCallback (radioButtonWidget, XmNvalueChangedCallback, (XtCallbackProc) wxRadioButtonCallback, - (XtPointer) this); + XtAddCallback (radioButtonWidget, + XmNvalueChangedCallback, + (XtCallbackProc)wxRadioButtonCallback, + (XtPointer)this); m_mainWidget = (WXWidget) radioButtonWidget; XtManageChild (radioButtonWidget); - SetCanAddEventHandler(TRUE); - AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); + AttachWidget (parent, m_mainWidget, (WXWidget) NULL, + pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); @@ -112,7 +97,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, { /* search backward for last group start */ wxRadioButton *chief = (wxRadioButton*) NULL; - wxWindowList::Node *node = parent->GetChildren().GetLast(); + wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast(); while (node) { wxWindow *child = node->GetData(); @@ -152,28 +137,18 @@ void wxRadioButton::Command (wxCommandEvent & event) ProcessCommand (event); } -void wxRadioButton::ChangeFont(bool keepOriginalSize) -{ - wxWindow::ChangeFont(keepOriginalSize); -} - void wxRadioButton::ChangeBackgroundColour() { wxWindow::ChangeBackgroundColour(); // What colour should this be? - int selectPixel = wxBLACK->AllocColour(wxGetDisplay()); + int selectPixel = wxBLACK->AllocColour(XtDisplay((Widget)m_mainWidget)); XtVaSetValues ((Widget) GetMainWidget(), XmNselectColor, selectPixel, NULL); } -void wxRadioButton::ChangeForegroundColour() -{ - wxWindow::ChangeForegroundColour(); -} - void wxRadioButtonCallback (Widget w, XtPointer clientData, XmToggleButtonCallbackStruct * cbs) {