]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/control.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "control.h"
16 #include "wx/control.h"
21 #pragma message disable nosimpint
25 #pragma message enable nosimpint
28 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
30 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
34 wxControl::wxControl()
36 m_backgroundColour
= *wxWHITE
;
37 m_foregroundColour
= *wxBLACK
;
39 #if WXWIN_COMPATIBILITY
41 #endif // WXWIN_COMPATIBILITY
46 wxControl::wxControl( wxWindow
*parent
,
51 const wxString
&name
)
53 (void)Create(parent
, id
, pos
, size
, style
, name
);
57 wxControl::wxControl( wxWindow
*parent
,
62 const wxValidator
& validator
,
65 (void)Create(parent
, id
, pos
, size
, style
, name
);
66 SetValidator(validator
);
70 wxControl::~wxControl()
72 // If we delete an item, we should initialize the parent panel,
73 // because it could now be invalid.
74 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
77 if (panel
->GetDefaultItem() == this)
78 panel
->SetDefaultItem((wxButton
*) NULL
);
82 void wxControl::SetLabel(const wxString
& label
)
84 Widget widget
= (Widget
) GetLabelWidget() ;
88 wxStripMenuCodes((char*) (const char*) label
, wxBuffer
);
90 XmString text
= XmStringCreateSimple (wxBuffer
);
91 XtVaSetValues (widget
,
93 XmNlabelType
, XmSTRING
,
98 wxString
wxControl::GetLabel() const
100 Widget widget
= (Widget
) GetLabelWidget() ;
102 return wxEmptyString
;
106 XtVaGetValues (widget
,
107 XmNlabelString
, &text
,
110 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
119 // XmStringFree(text);
120 return wxEmptyString
;
124 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
126 #if WXWIN_COMPATIBILITY
129 (void)(*m_callback
)(this, event
);
134 #endif // WXWIN_COMPATIBILITY
136 return GetEventHandler()->ProcessEvent(event
);