1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/control.cpp
3 // Purpose: wxControl class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
14 #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()
42 bool wxControl::Create( wxWindow
*parent
,
47 const wxValidator
& validator
,
50 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
53 SetValidator(validator
);
59 bool wxControl::CreateControl(wxWindow
*parent
,
64 const wxValidator
& validator
,
67 if( !wxControlBase::CreateControl( parent
, id
, pos
, size
, style
,
74 void wxControl::SetLabel(const wxString
& label
)
76 Widget widget
= (Widget
) GetLabelWidget() ;
80 wxXmString
label_str(GetLabelText(label
));
82 XtVaSetValues (widget
,
83 XmNlabelString
, label_str(),
84 XmNlabelType
, XmSTRING
,
88 wxString
wxControl::GetLabel() const
90 Widget widget
= (Widget
) GetLabelWidget() ;
95 XtVaGetValues (widget
,
96 XmNlabelString
, &text
,
99 return wxXmStringToString( text
);
102 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
104 return HandleWindowEvent(event
);
107 wxSize
wxControl::DoGetBestSize() const
109 Widget w
= (Widget
)GetTopWidget();
111 // Do not return any arbitrary default value...
112 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
114 XtWidgetGeometry preferred
;
115 XtQueryGeometry (w
, NULL
, &preferred
);
117 return wxSize(preferred
.width
, preferred
.height
);