]>
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"
18 #include "wx/control.h"
23 #pragma message disable nosimpint
27 #pragma message enable nosimpint
30 IMPLEMENT_ABSTRACT_CLASS(wxControl
, wxWindow
)
32 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 bool wxControl::Create( wxWindow
*parent
,
53 const wxValidator
& validator
,
56 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
59 SetValidator(validator
);
65 wxControl::~wxControl()
67 // If we delete an item, we should initialize the parent panel,
68 // because it could now be invalid.
69 wxPanel
*panel
= wxDynamicCast(GetParent(), wxPanel
);
72 if ( (wxControl
*)panel
->GetDefaultItem() == this)
73 panel
->SetDefaultItem((wxButton
*) NULL
);
77 void wxControl::SetLabel(const wxString
& label
)
79 Widget widget
= (Widget
) GetLabelWidget() ;
83 wxStripMenuCodes((char*) (const char*) label
, wxBuffer
);
85 XmString text
= XmStringCreateSimple (wxBuffer
);
86 XtVaSetValues (widget
,
88 XmNlabelType
, XmSTRING
,
93 wxString
wxControl::GetLabel() const
95 Widget widget
= (Widget
) GetLabelWidget() ;
101 XtVaGetValues (widget
,
102 XmNlabelString
, &text
,
105 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
114 // XmStringFree(text);
115 return wxEmptyString
;
119 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
121 #if WXWIN_COMPATIBILITY
124 (void)(*m_callback
)(this, event
);
129 #endif // WXWIN_COMPATIBILITY
131 return GetEventHandler()->ProcessEvent(event
);