1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "control.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
21 #include "wx/control.h"
26 #pragma message disable nosimpint
30 #pragma message enable nosimpint
33 #include "wx/motif/private.h"
35 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
37 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
41 wxControl::wxControl()
43 m_backgroundColour
= *wxWHITE
;
44 m_foregroundColour
= *wxBLACK
;
49 bool wxControl::Create( wxWindow
*parent
,
54 const wxValidator
& validator
,
57 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
60 SetValidator(validator
);
66 bool wxControl::CreateControl(wxWindow
*parent
,
71 const wxValidator
& validator
,
74 if( !wxControlBase::CreateControl( parent
, id
, pos
, size
, style
,
78 m_backgroundColour
= parent
->GetBackgroundColour();
79 m_foregroundColour
= parent
->GetForegroundColour();
80 m_font
= parent
->GetFont();
85 void wxControl::SetLabel(const wxString
& label
)
87 Widget widget
= (Widget
) GetLabelWidget() ;
91 wxXmString
label_str(wxStripMenuCodes(label
));
93 XtVaSetValues (widget
,
94 XmNlabelString
, label_str(),
95 XmNlabelType
, XmSTRING
,
99 wxString
wxControl::GetLabel() const
101 Widget widget
= (Widget
) GetLabelWidget() ;
103 return wxEmptyString
;
105 XmString text
= NULL
;
106 XtVaGetValues (widget
,
107 XmNlabelString
, &text
,
110 return wxXmStringToString( text
);
113 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
115 return GetEventHandler()->ProcessEvent(event
);
118 wxSize
wxControl::DoGetBestSize() const
120 Widget w
= (Widget
)GetTopWidget();
122 // Do not return any arbitrary default value...
123 wxASSERT_MSG (w
, wxT("DoGetBestSize called before creation"));
125 XtWidgetGeometry preferred
;
126 XtQueryGeometry (w
, NULL
, &preferred
);
128 return wxSize(preferred
.width
, preferred
.height
);