1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticText
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "stattext.h"
17 #define XtDisplay XTDISPLAY
21 #include "wx/stattext.h"
26 #pragma message disable nosimpint
29 #include <Xm/LabelG.h>
30 #include <Xm/PushBG.h>
32 #pragma message enable nosimpint
35 IMPLEMENT_DYNAMIC_CLASS(wxStaticText
, wxControl
)
37 bool wxStaticText::Create(wxWindow
*parent
, wxWindowID id
,
38 const wxString
& label
,
45 if (parent
) parent
->AddChild(this);
47 m_backgroundColour
= parent
->GetBackgroundColour();
48 m_foregroundColour
= parent
->GetForegroundColour();
51 m_windowId
= (int)NewControlId();
55 m_windowStyle
= style
;
56 m_font
= parent
->GetFont();
58 #if 0 // gcc 2.95 doesn't like this apparently
59 char* label1
= (label
.IsNull() ? "" : (char*) (const char*) label
);
62 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
64 #if 0 // gcc 2.95 doesn't like this apparently
65 // Use XmStringCreateLtoR(), since XmStringCreateSimple
66 // doesn't obey separators.
67 // XmString text = XmStringCreateSimple (label1);
68 XmString text
= XmStringCreateLtoR (label1
, XmSTRING_DEFAULT_CHARSET
);
71 XmString text
= XmStringCreateLtoR ((char *)(const char*)label
, XmSTRING_DEFAULT_CHARSET
);
73 XmFontList fontList
= (XmFontList
) m_font
.GetFontList(1.0, XtDisplay(parentWidget
));
75 m_mainWidget
= (WXWidget
) XtVaCreateManagedWidget ((char*) (const char*) name
,
78 XmNfontList
, fontList
,
81 ((style
& wxALIGN_RIGHT
) ? XmALIGNMENT_END
:
82 ((style
& wxALIGN_CENTRE
) ? XmALIGNMENT_CENTER
:
83 XmALIGNMENT_BEGINNING
)),
88 SetCanAddEventHandler(TRUE
);
89 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
91 ChangeBackgroundColour ();
96 void wxStaticText::ChangeFont(bool keepOriginalSize
)
98 wxWindow::ChangeFont(keepOriginalSize
);
101 void wxStaticText::ChangeBackgroundColour()
103 wxWindow::ChangeBackgroundColour();
106 void wxStaticText::ChangeForegroundColour()
108 wxWindow::ChangeForegroundColour();