1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
17 #include "wx/control.h"
22 #pragma message disable nosimpint
26 #pragma message enable nosimpint
29 #include "wx/motif/private.h"
31 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
33 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
37 wxControl::wxControl()
39 m_backgroundColour
= *wxWHITE
;
40 m_foregroundColour
= *wxBLACK
;
45 bool wxControl::Create( wxWindow
*parent
,
50 const wxValidator
& validator
,
53 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
56 SetValidator(validator
);
62 bool wxControl::CreateControl(wxWindow
*parent
,
67 const wxValidator
& validator
,
70 if( !wxControlBase::CreateControl( parent
, id
, pos
, size
, style
,
74 m_backgroundColour
= parent
->GetBackgroundColour();
75 m_foregroundColour
= parent
->GetForegroundColour();
76 m_font
= parent
->GetFont();
81 void wxControl::SetLabel(const wxString
& label
)
83 Widget widget
= (Widget
) GetLabelWidget() ;
87 wxXmString
label_str(wxStripMenuCodes(label
));
89 XtVaSetValues (widget
,
90 XmNlabelString
, label_str(),
91 XmNlabelType
, XmSTRING
,
95 wxString
wxControl::GetLabel() const
97 Widget widget
= (Widget
) GetLabelWidget() ;
101 XmString text
= NULL
;
102 XtVaGetValues (widget
,
103 XmNlabelString
, &text
,
106 return wxXmStringToString( text
);
109 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
111 return GetEventHandler()->ProcessEvent(event
);
114 wxSize
wxControl::DoGetBestSize() const
116 Widget w
= (Widget
)GetTopWidget();
118 // Do not return any arbitrary default value...
119 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
121 XtWidgetGeometry preferred
;
122 XtQueryGeometry (w
, NULL
, &preferred
);
124 return wxSize(preferred
.width
, preferred
.height
);