]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticBox
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "statbox.h"
17 #define XtDisplay XTDISPLAY
22 #include "wx/statbox.h"
26 #pragma message disable nosimpint
31 #include <Xm/LabelG.h>
33 #pragma message enable nosimpint
36 #include "wx/motif/private.h"
38 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
40 BEGIN_EVENT_TABLE(wxStaticBox
, wxControl
)
41 //EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
49 wxStaticBox::wxStaticBox()
51 m_labelWidget
= (WXWidget
) 0;
54 bool wxStaticBox::Create(wxWindow
*parent
, wxWindowID id
,
55 const wxString
& label
,
61 m_backgroundColour
= parent
->GetBackgroundColour();
62 m_foregroundColour
= parent
->GetForegroundColour();
63 m_font
= parent
->GetFont();
67 if (parent
) parent
->AddChild(this);
70 m_windowId
= (int)NewControlId();
74 m_windowStyle
= style
;
76 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
78 m_mainWidget
= XtVaCreateManagedWidget ("staticboxframe",
79 xmFrameWidgetClass
, parentWidget
,
80 XmNshadowType
, XmSHADOW_IN
,
85 bool hasLabel
= (!label
.IsNull() && !label
.IsEmpty()) ;
88 XmFontList fontList
= (XmFontList
) m_font
.GetFontList(1.0, XtDisplay(parentWidget
));
89 wxString
label1(wxStripMenuCodes(label
));
90 wxXmString
text(label1
);
91 m_labelWidget
= (WXWidget
) XtVaCreateManagedWidget (label1
.c_str(),
92 xmLabelWidgetClass
, (Widget
)m_mainWidget
,
93 XmNfontList
, fontList
,
94 XmNlabelString
, text(),
95 #if (XmVersion > 1200)
96 XmNframeChildType
, XmFRAME_TITLE_CHILD
,
98 XmNchildType
, XmFRAME_TITLE_CHILD
,
103 SetCanAddEventHandler(TRUE
);
104 AttachWidget (parent
, m_mainWidget
, NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
105 ChangeBackgroundColour();
110 wxStaticBox::~wxStaticBox()
112 DetachWidget(m_mainWidget
);
113 XtDestroyWidget((Widget
) m_mainWidget
);
115 m_mainWidget
= (WXWidget
) 0;
116 m_labelWidget
= (WXWidget
) 0;
119 void wxStaticBox::SetLabel(const wxString
& label
)
126 wxString
label1(wxStripMenuCodes(label
));
128 wxXmString
text(label1
);
129 XtVaSetValues ((Widget
) m_labelWidget
,
130 XmNlabelString
, text(),
131 XmNlabelType
, XmSTRING
,
136 wxString
wxStaticBox::GetLabel() const
139 return wxEmptyString
;
143 XtVaGetValues ((Widget
) m_labelWidget
,
144 XmNlabelString
, &text
,
148 return wxEmptyString
;
150 if (XmStringGetLtoR (text
, XmSTRING_DEFAULT_CHARSET
, &s
))
158 return wxEmptyString
;
162 void wxStaticBox::ChangeFont(bool keepOriginalSize
)
164 wxWindow::ChangeFont(keepOriginalSize
);