X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4bb6408c2631988fab9925014c6619358bf867de..341c92a8b4c813cbfb606687937dcdf5d8c3c2fe:/src/motif/stattext.cpp diff --git a/src/motif/stattext.cpp b/src/motif/stattext.cpp index 294f51036c..996cf9315e 100644 --- a/src/motif/stattext.cpp +++ b/src/motif/stattext.cpp @@ -18,6 +18,10 @@ #include +#include +#include +#include + #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) #endif @@ -29,32 +33,64 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - SetName(name); - if (parent) parent->AddChild(this); + SetName(name); + if (parent) parent->AddChild(this); + + m_backgroundColour = parent->GetBackgroundColour(); + m_foregroundColour = parent->GetForegroundColour(); + + if ( id == -1 ) + m_windowId = (int)NewControlId(); + else + m_windowId = id; + + m_windowStyle = style; + m_windowFont = parent->GetFont(); + + char* label1 = (label.IsNull() ? "" : (char*) (const char*) label); + + Widget parentWidget = (Widget) parent->GetClientWidget(); - SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; - SetForegroundColour(parent->GetDefaultForegroundColour()) ; + // Use XmStringCreateLtoR(), since XmStringCreateSimple + // doesn't obey separators. +// XmString text = XmStringCreateSimple (label1); + XmString text = XmStringCreateLtoR (label1, XmSTRING_DEFAULT_CHARSET); - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; + XmFontList fontList = (XmFontList) m_windowFont.GetFontList(1.0, XtDisplay(parentWidget)); - m_windowStyle = style; + m_mainWidget = (WXWidget) XtVaCreateManagedWidget ((char*) (const char*) name, + xmLabelWidgetClass, + parentWidget, + XmNfontList, fontList, + XmNlabelString, text, + XmNalignment, + ((style & wxALIGN_RIGHT) ? XmALIGNMENT_END : + ((style & wxALIGN_CENTRE) ? XmALIGNMENT_CENTER : + XmALIGNMENT_BEGINNING)), + NULL); - SetFont(* parent->GetFont()); + XmStringFree (text); - // TODO - return FALSE; + SetCanAddEventHandler(TRUE); + AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); + + ChangeBackgroundColour (); + + return TRUE; +} + +void wxStaticText::ChangeFont(bool keepOriginalSize) +{ + wxWindow::ChangeFont(keepOriginalSize); } -void wxStaticText::SetSize(int x, int y, int width, int height, int sizeFlags) +void wxStaticText::ChangeBackgroundColour() { - // TODO + wxWindow::ChangeBackgroundColour(); } -void wxStaticText::SetLabel(const wxString& label) +void wxStaticText::ChangeForegroundColour() { - // TODO + wxWindow::ChangeForegroundColour(); }