X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4bb6408c2631988fab9925014c6619358bf867de..184b5d99a5382cd7a19888c85aff11f8a21af2f6:/src/motif/stattext.cpp diff --git a/src/motif/stattext.cpp b/src/motif/stattext.cpp index 294f51036c..ed8ee2a9e6 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,61 @@ 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()) ; + XmString text = XmStringCreateSimple (label1); - 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(); }