#endif
#include "wx/control.h"
+#include "wx/utils.h"
+
+#include <Xm/Xm.h>
#if !USE_SHARED_LIBRARY
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
m_backgroundColour = *wxWHITE;
m_foregroundColour = *wxBLACK;
m_callback = 0;
+ m_inSetValue = FALSE;
}
wxControl::~wxControl()
void wxControl::SetLabel(const wxString& label)
{
- // TODO
+ Widget widget = (Widget) GetLabelWidget() ;
+ if (!widget)
+ return;
+
+ wxStripMenuCodes((char*) (const char*) label, wxBuffer);
+
+ XmString text = XmStringCreateSimple (wxBuffer);
+ XtVaSetValues (widget,
+ XmNlabelString, text,
+ XmNlabelType, XmSTRING,
+ NULL);
+ XmStringFree (text);
}
wxString wxControl::GetLabel() const
{
- // TODO
- return wxString("");
+ Widget widget = (Widget) GetLabelWidget() ;
+ if (!widget)
+ return wxEmptyString;
+
+ XmString text;
+ char *s;
+ XtVaGetValues (widget,
+ XmNlabelString, &text,
+ NULL);
+
+ if (XmStringGetLtoR (text, XmSTRING_DEFAULT_CHARSET, &s))
+ {
+ wxString str(s);
+ XtFree (s);
+ XmStringFree(text);
+ return str;
+ }
+ else
+ {
+ XmStringFree(text);
+ return wxEmptyString;
+ }
}
void wxControl::ProcessCommand (wxCommandEvent & event)