]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/stattext.cpp
OnExit() is called for modules which were initialized even if the init of
[wxWidgets.git] / src / motif / stattext.cpp
index 294f51036cb77dd8167cc23d4416fbcb4761812a..ed8ee2a9e626beb2b15e6b09ccb7d0dab4192085 100644 (file)
 
 #include <stdio.h>
 
+#include <Xm/Label.h>
+#include <Xm/LabelG.h>
+#include <Xm/PushBG.h>
+
 #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();
 }