]>
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"
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
25 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
30 wxControl::wxControl()
32 m_backgroundColour
= *wxWHITE
;
33 m_foregroundColour
= *wxBLACK
;
35 #if WXWIN_COMPATIBILITY
37 #endif // WXWIN_COMPATIBILITY
42 wxControl::~wxControl()
44 // If we delete an item, we should initialize the parent panel,
45 // because it could now be invalid.
46 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
49 if (panel
->GetDefaultItem() == this)
50 panel
->SetDefaultItem((wxButton
*) NULL
);
54 void wxControl::SetLabel(const wxString
& label
)
56 Widget widget
= (Widget
) GetLabelWidget() ;
60 wxStripMenuCodes((char*) (const char*) label
, wxBuffer
);
62 XmString text
= XmStringCreateSimple (wxBuffer
);
63 XtVaSetValues (widget
,
65 XmNlabelType
, XmSTRING
,
70 wxString
wxControl::GetLabel() const
72 Widget widget
= (Widget
) GetLabelWidget() ;
78 XtVaGetValues (widget
,
79 XmNlabelString
, &text
,
82 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
91 // XmStringFree(text);
96 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
98 #if WXWIN_COMPATIBILITY
101 (void)(*m_callback
)(this, event
);
106 #endif // WXWIN_COMPATIBILITY
108 return GetEventHandler()->ProcessEvent(event
);