]>
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 if ( GetParent()->panel
->GetDefaultItem() == this)
70 panel
->SetDefaultItem(NULL
);
73 void wxControl::SetLabel(const wxString
& label
)
75 Widget widget
= (Widget
) GetLabelWidget() ;
79 wxStripMenuCodes((char*) (const char*) label
, wxBuffer
);
81 XmString text
= XmStringCreateSimple (wxBuffer
);
82 XtVaSetValues (widget
,
84 XmNlabelType
, XmSTRING
,
89 wxString
wxControl::GetLabel() const
91 Widget widget
= (Widget
) GetLabelWidget() ;
97 XtVaGetValues (widget
,
98 XmNlabelString
, &text
,
101 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
110 // XmStringFree(text);
111 return wxEmptyString
;
115 bool wxControl::ProcessCommand(wxCommandEvent
& event
)
117 #if WXWIN_COMPATIBILITY
120 (void)(*m_callback
)(this, event
);
125 #endif // WXWIN_COMPATIBILITY
127 return GetEventHandler()->ProcessEvent(event
);