]>
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 #define XtDisplay XTDISPLAY
21 #include "wx/stattext.h"
24 #pragma message disable nosimpint
28 #pragma message enable nosimpint
31 #include "wx/motif/private.h"
33 IMPLEMENT_DYNAMIC_CLASS(wxStaticText
, wxControl
);
35 bool wxStaticText::Create(wxWindow
*parent
, wxWindowID id
,
36 const wxString
& label
,
42 if( !CreateControl( parent
, id
, pos
, size
, style
,
43 wxDefaultValidator
, name
) )
46 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
49 (Widget
) wxCreateBorderWidget( (WXWidget
)parentWidget
, style
);
50 wxXmString
text( label
);
51 WXFontType fontType
= m_font
.GetFontType(XtDisplay(parentWidget
));
53 m_labelWidget
= XtVaCreateManagedWidget (wxConstCast(name
.c_str(), char),
55 borderWidget
? borderWidget
: parentWidget
,
56 wxFont::GetFontTag(), fontType
,
57 XmNlabelString
, text(),
59 ((style
& wxALIGN_RIGHT
) ? XmALIGNMENT_END
:
60 ((style
& wxALIGN_CENTRE
) ? XmALIGNMENT_CENTER
:
61 XmALIGNMENT_BEGINNING
)),
64 m_mainWidget
= borderWidget
? borderWidget
: m_labelWidget
;
66 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
,
67 pos
.x
, pos
.y
, size
.x
, size
.y
);
69 ChangeBackgroundColour ();
74 void wxStaticText::SetLabel(const wxString
& label
)
76 wxXmString
label_str(wxStripMenuCodes(label
));
78 // This variable means we don't need so many casts later.
79 Widget widget
= (Widget
) m_labelWidget
;
81 if (GetWindowStyle() & wxST_NO_AUTORESIZE
)
83 XtUnmanageChild(widget
);
84 Dimension width
, height
;
85 XtVaGetValues(widget
, XmNwidth
, &width
, XmNheight
, &height
, NULL
);
88 XmNlabelString
, label_str(),
89 XmNlabelType
, XmSTRING
,
95 XtManageChild(widget
);
100 XmNlabelString
, label_str(),
101 XmNlabelType
, XmSTRING
,