X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4bb6408c2631988fab9925014c6619358bf867de..184b5d99a5382cd7a19888c85aff11f8a21af2f6:/src/motif/control.cpp diff --git a/src/motif/control.cpp b/src/motif/control.cpp index aa0baba9eb..64369b26d2 100644 --- a/src/motif/control.cpp +++ b/src/motif/control.cpp @@ -14,6 +14,9 @@ #endif #include "wx/control.h" +#include "wx/utils.h" + +#include #if !USE_SHARED_LIBRARY IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) @@ -28,6 +31,7 @@ wxControl::wxControl() m_backgroundColour = *wxWHITE; m_foregroundColour = *wxBLACK; m_callback = 0; + m_inSetValue = FALSE; } wxControl::~wxControl() @@ -44,13 +48,44 @@ 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)