1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/control.cpp
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"
15 #include "wx/control.h"
20 #pragma message disable nosimpint
24 #pragma message enable nosimpint
27 #include "wx/motif/private.h"
29 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
31 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
35 wxControl::wxControl()
37 m_backgroundColour
= *wxWHITE
;
38 m_foregroundColour
= *wxBLACK
;
43 bool wxControl::Create( wxWindow
*parent
,
48 const wxValidator
& validator
,
51 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
54 SetValidator(validator
);
60 bool wxControl::CreateControl(wxWindow
*parent
,
65 const wxValidator
& validator
,
68 if( !wxControlBase::CreateControl( parent
, id
, pos
, size
, style
,
72 m_backgroundColour
= parent
->GetBackgroundColour();
73 m_foregroundColour
= parent
->GetForegroundColour();
74 m_font
= parent
->GetFont();
79 void wxControl::SetLabel(const wxString
& label
)
81 Widget widget
= (Widget
) GetLabelWidget() ;
85 wxXmString
label_str(wxStripMenuCodes(label
));
87 XtVaSetValues (widget
,
88 XmNlabelString
, label_str(),
89 XmNlabelType
, XmSTRING
,
93 wxString
wxControl::GetLabel() const
95 Widget widget
= (Widget
) GetLabelWidget() ;
100 XtVaGetValues (widget
,
101 XmNlabelString
, &text
,
104 return wxXmStringToString( text
);
107 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
109 return GetEventHandler()->ProcessEvent(event
);
112 wxSize
wxControl::DoGetBestSize() const
114 Widget w
= (Widget
)GetTopWidget();
116 // Do not return any arbitrary default value...
117 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
119 XtWidgetGeometry preferred
;
120 XtQueryGeometry (w
, NULL
, &preferred
);
122 return wxSize(preferred
.width
, preferred
.height
);