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()
40 m_backgroundColour
= *wxWHITE
;
41 m_foregroundColour
= *wxBLACK
;
46 bool wxControl::Create( wxWindow
*parent
,
51 const wxValidator
& validator
,
54 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
57 SetValidator(validator
);
63 bool wxControl::CreateControl(wxWindow
*parent
,
68 const wxValidator
& validator
,
71 if( !wxControlBase::CreateControl( parent
, id
, pos
, size
, style
,
75 m_backgroundColour
= parent
->GetBackgroundColour();
76 m_foregroundColour
= parent
->GetForegroundColour();
77 m_font
= parent
->GetFont();
82 void wxControl::SetLabel(const wxString
& label
)
84 Widget widget
= (Widget
) GetLabelWidget() ;
88 wxXmString
label_str(GetLabelText(label
));
90 XtVaSetValues (widget
,
91 XmNlabelString
, label_str(),
92 XmNlabelType
, XmSTRING
,
96 wxString
wxControl::GetLabel() const
98 Widget widget
= (Widget
) GetLabelWidget() ;
100 return wxEmptyString
;
102 XmString text
= NULL
;
103 XtVaGetValues (widget
,
104 XmNlabelString
, &text
,
107 return wxXmStringToString( text
);
110 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
112 return GetEventHandler()->ProcessEvent(event
);
115 wxSize
wxControl::DoGetBestSize() const
117 Widget w
= (Widget
)GetTopWidget();
119 // Do not return any arbitrary default value...
120 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
122 XtWidgetGeometry preferred
;
123 XtQueryGeometry (w
, NULL
, &preferred
);
125 return wxSize(preferred
.width
, preferred
.height
);