]>
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 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
16 #define XtDisplay XTDISPLAY
23 #include "wx/stattext.h"
26 #pragma message disable nosimpint
30 #pragma message enable nosimpint
33 #include "wx/motif/private.h"
35 IMPLEMENT_DYNAMIC_CLASS(wxStaticText
, wxControl
)
37 bool wxStaticText::Create(wxWindow
*parent
, wxWindowID id
,
38 const wxString
& label
,
44 if( !CreateControl( parent
, id
, pos
, size
, style
,
45 wxDefaultValidator
, name
) )
48 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
51 (Widget
) wxCreateBorderWidget( (WXWidget
)parentWidget
, style
);
52 wxXmString
text( wxStripMenuCodes( label
) );
55 XtVaCreateManagedWidget (wxConstCast(name
.c_str(), char),
57 borderWidget
? borderWidget
: parentWidget
,
58 wxFont::GetFontTag(), m_font
.GetFontTypeC(XtDisplay(parentWidget
)),
59 XmNlabelString
, text(),
60 XmNalignment
, ((style
& wxALIGN_RIGHT
) ? XmALIGNMENT_END
:
61 ((style
& wxALIGN_CENTRE
) ? XmALIGNMENT_CENTER
:
62 XmALIGNMENT_BEGINNING
)),
63 XmNrecomputeSize
, ((style
& wxST_NO_AUTORESIZE
) ? TRUE
: FALSE
),
66 m_mainWidget
= borderWidget
? borderWidget
: m_labelWidget
;
68 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
,
69 pos
.x
, pos
.y
, size
.x
, size
.y
);
71 ChangeBackgroundColour ();
76 void wxStaticText::SetLabel(const wxString
& label
)
78 wxXmString
label_str(wxStripMenuCodes(label
));
80 // This variable means we don't need so many casts later.
81 Widget widget
= (Widget
) m_labelWidget
;
84 XmNlabelString
, label_str(),
85 XmNlabelType
, XmSTRING
,
89 #endif // wxUSE_STATTEXT