]>
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 bool wxControl::Create( wxWindow
*parent
,
51 const wxValidator
& validator
,
54 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
57 SetValidator(validator
);
63 wxControl::~wxControl()
65 // If we delete an item, we should initialize the parent panel,
66 // because it could now be invalid.
67 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
70 if ( (wxControl
*)panel
->GetDefaultItem() == this)
71 panel
->SetDefaultItem((wxButton
*) NULL
);
75 void wxControl::SetLabel(const wxString
& label
)
77 Widget widget
= (Widget
) GetLabelWidget() ;
81 wxStripMenuCodes((char*) (const char*) label
, wxBuffer
);
83 XmString text
= XmStringCreateSimple (wxBuffer
);
84 XtVaSetValues (widget
,
86 XmNlabelType
, XmSTRING
,
91 wxString
wxControl::GetLabel() const
93 Widget widget
= (Widget
) GetLabelWidget() ;
99 XtVaGetValues (widget
,
100 XmNlabelString
, &text
,
103 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
112 // XmStringFree(text);
113 return wxEmptyString
;
117 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
119 #if WXWIN_COMPATIBILITY
122 (void)(*m_callback
)(this, event
);
127 #endif // WXWIN_COMPATIBILITY
129 return GetEventHandler()->ProcessEvent(event
);