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"
24 #pragma message disable nosimpint
28 #pragma message enable nosimpint
31 #include "wx/motif/private.h"
33 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
35 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
39 wxControl::wxControl()
41 m_backgroundColour
= *wxWHITE
;
42 m_foregroundColour
= *wxBLACK
;
47 bool wxControl::Create( wxWindow
*parent
,
52 const wxValidator
& validator
,
55 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
58 SetValidator(validator
);
64 bool wxControl::CreateControl(wxWindow
*parent
,
69 const wxValidator
& validator
,
72 if( !wxControlBase::CreateControl( parent
, id
, pos
, size
, style
,
76 m_backgroundColour
= parent
->GetBackgroundColour();
77 m_foregroundColour
= parent
->GetForegroundColour();
78 m_font
= parent
->GetFont();
83 void wxControl::SetLabel(const wxString
& label
)
85 Widget widget
= (Widget
) GetLabelWidget() ;
89 wxXmString
label_str(wxStripMenuCodes(label
));
91 XtVaSetValues (widget
,
92 XmNlabelString
, label_str(),
93 XmNlabelType
, XmSTRING
,
97 wxString
wxControl::GetLabel() const
99 Widget widget
= (Widget
) GetLabelWidget() ;
101 return wxEmptyString
;
103 XmString text
= NULL
;
104 XtVaGetValues (widget
,
105 XmNlabelString
, &text
,
108 return wxXmStringToString( text
);
111 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
113 return GetEventHandler()->ProcessEvent(event
);
116 wxSize
wxControl::DoGetBestSize() const
118 Widget w
= (Widget
)GetTopWidget();
120 // Do not return any arbitrary default value...
121 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
123 XtWidgetGeometry preferred
;
124 XtQueryGeometry (w
, NULL
, &preferred
);
126 return wxSize(preferred
.width
, preferred
.height
);