]>
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 #if !USE_SHARED_LIBRARY
29 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
31 BEGIN_EVENT_TABLE(wxControl
, wxWindow
)
36 wxControl::wxControl()
38 m_backgroundColour
= *wxWHITE
;
39 m_foregroundColour
= *wxBLACK
;
41 #if WXWIN_COMPATIBILITY
43 #endif // WXWIN_COMPATIBILITY
48 wxControl::~wxControl()
50 // If we delete an item, we should initialize the parent panel,
51 // because it could now be invalid.
52 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
55 if (panel
->GetDefaultItem() == this)
56 panel
->SetDefaultItem((wxButton
*) NULL
);
60 void wxControl::SetLabel(const wxString
& label
)
62 Widget widget
= (Widget
) GetLabelWidget() ;
66 wxStripMenuCodes((char*) (const char*) label
, wxBuffer
);
68 XmString text
= XmStringCreateSimple (wxBuffer
);
69 XtVaSetValues (widget
,
71 XmNlabelType
, XmSTRING
,
76 wxString
wxControl::GetLabel() const
78 Widget widget
= (Widget
) GetLabelWidget() ;
84 XtVaGetValues (widget
,
85 XmNlabelString
, &text
,
88 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
97 // XmStringFree(text);
102 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
104 #if WXWIN_COMPATIBILITY
107 (void)(*m_callback
)(this, event
);
112 #endif // WXWIN_COMPATIBILITY
114 return GetEventHandler()->ProcessEvent(event
);