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"
23 #pragma message disable nosimpint
27 #pragma message enable nosimpint
30 #include "wx/motif/private.h"
32 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
34 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
38 wxControl::wxControl()
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
,
75 void wxControl::SetLabel(const wxString
& label
)
77 Widget widget
= (Widget
) GetLabelWidget() ;
81 wxXmString
label_str(GetLabelText(label
));
83 XtVaSetValues (widget
,
84 XmNlabelString
, label_str(),
85 XmNlabelType
, XmSTRING
,
89 wxString
wxControl::GetLabel() const
91 Widget widget
= (Widget
) GetLabelWidget() ;
96 XtVaGetValues (widget
,
97 XmNlabelString
, &text
,
100 return wxXmStringToString( text
);
103 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
105 return HandleWindowEvent(event
);
108 wxSize
wxControl::DoGetBestSize() const
110 Widget w
= (Widget
)GetTopWidget();
112 // Do not return any arbitrary default value...
113 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
115 XtWidgetGeometry preferred
;
116 XtQueryGeometry (w
, NULL
, &preferred
);
118 return wxSize(preferred
.width
, preferred
.height
);