]>
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 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "statbox.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
20 #define XtDisplay XTDISPLAY
25 #include "wx/statbox.h"
29 #pragma message disable nosimpint
34 #pragma message enable nosimpint
37 #include "wx/motif/private.h"
39 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
41 BEGIN_EVENT_TABLE(wxStaticBox
, wxControl
)
42 //EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
45 // ----------------------------------------------------------------------------
47 // ----------------------------------------------------------------------------
49 // helper class to reduce code duplication
55 wxXmSizeKeeper( Widget w
)
58 XtVaGetValues( m_widget
,
68 XtVaGetValues( m_widget
,
72 if( x
!= m_x
|| y
!= m_y
)
73 XtVaSetValues( m_widget
,
84 wxStaticBox::wxStaticBox()
86 m_labelWidget
= (WXWidget
) 0;
89 bool wxStaticBox::Create(wxWindow
*parent
, wxWindowID id
,
90 const wxString
& label
,
96 if( !CreateControl( parent
, id
, pos
, size
, style
,
97 wxDefaultValidator
, name
) )
100 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
102 m_mainWidget
= XtVaCreateManagedWidget ("staticboxframe",
103 xmFrameWidgetClass
, parentWidget
,
104 // MBN: why override default?
105 // XmNshadowType, XmSHADOW_IN,
108 bool hasLabel
= (!label
.IsNull() && !label
.IsEmpty()) ;
111 WXFontType fontType
= m_font
.GetFontType( XtDisplay( parentWidget
) );
112 wxString
label1(wxStripMenuCodes(label
));
113 wxXmString
text(label1
);
115 m_labelWidget
= (WXWidget
) XtVaCreateManagedWidget ("staticboxlabel",
116 xmLabelWidgetClass
, (Widget
)m_mainWidget
,
117 wxFont::GetFontTag(), fontType
,
118 XmNlabelString
, text(),
119 #if wxCHECK_MOTIF_VERSION( 2, 0 )
120 XmNframeChildType
, XmFRAME_TITLE_CHILD
,
122 XmNchildType
, XmFRAME_TITLE_CHILD
,
127 AttachWidget (parent
, m_mainWidget
, NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
128 ChangeBackgroundColour();
133 wxStaticBox::~wxStaticBox()
135 DetachWidget(m_mainWidget
);
136 XtDestroyWidget((Widget
) m_mainWidget
);
138 m_mainWidget
= (WXWidget
) 0;
139 m_labelWidget
= (WXWidget
) 0;
142 void wxStaticBox::SetLabel( const wxString
& label
)
144 wxXmSizeKeeper
sk( (Widget
)GetMainWidget() );
146 wxStaticBoxBase::SetLabel( label
);