#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
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();
}