]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/stattext.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticText
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "stattext.h"
17 #include "wx/stattext.h"
22 #include <Xm/LabelG.h>
23 #include <Xm/PushBG.h>
25 #if !USE_SHARED_LIBRARY
26 IMPLEMENT_DYNAMIC_CLASS(wxStaticText
, wxControl
)
29 bool wxStaticText::Create(wxWindow
*parent
, wxWindowID id
,
30 const wxString
& label
,
37 if (parent
) parent
->AddChild(this);
39 m_backgroundColour
= parent
->GetBackgroundColour();
40 m_foregroundColour
= parent
->GetForegroundColour();
43 m_windowId
= (int)NewControlId();
47 m_windowStyle
= style
;
48 m_font
= parent
->GetFont();
50 #if 0 // gcc 2.95 doesn't like this apparently
51 char* label1
= (label
.IsNull() ? "" : (char*) (const char*) label
);
54 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
56 #if 0 // gcc 2.95 doesn't like this apparently
57 // Use XmStringCreateLtoR(), since XmStringCreateSimple
58 // doesn't obey separators.
59 // XmString text = XmStringCreateSimple (label1);
60 XmString text
= XmStringCreateLtoR (label1
, XmSTRING_DEFAULT_CHARSET
);
63 XmString text
= XmStringCreateLtoR ((char *)(const char*)label
, XmSTRING_DEFAULT_CHARSET
);
65 XmFontList fontList
= (XmFontList
) m_font
.GetFontList(1.0, XtDisplay(parentWidget
));
67 m_mainWidget
= (WXWidget
) XtVaCreateManagedWidget ((char*) (const char*) name
,
70 XmNfontList
, fontList
,
73 ((style
& wxALIGN_RIGHT
) ? XmALIGNMENT_END
:
74 ((style
& wxALIGN_CENTRE
) ? XmALIGNMENT_CENTER
:
75 XmALIGNMENT_BEGINNING
)),
80 SetCanAddEventHandler(TRUE
);
81 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
83 ChangeBackgroundColour ();
88 void wxStaticText::ChangeFont(bool keepOriginalSize
)
90 wxWindow::ChangeFont(keepOriginalSize
);
93 void wxStaticText::ChangeBackgroundColour()
95 wxWindow::ChangeBackgroundColour();
98 void wxStaticText::ChangeForegroundColour()
100 wxWindow::ChangeForegroundColour();