]>
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"
17 #define XtDisplay XTDISPLAY
22 #include "wx/statbox.h"
26 #pragma message disable nosimpint
31 #pragma message enable nosimpint
34 #include "wx/motif/private.h"
36 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
38 BEGIN_EVENT_TABLE(wxStaticBox
, wxControl
)
39 //EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 // helper class to reduce code duplication
52 wxXmSizeKeeper( Widget w
)
55 XtVaGetValues( m_widget
,
65 XtVaGetValues( m_widget
,
69 if( x
!= m_x
|| y
!= m_y
)
70 XtVaSetValues( m_widget
,
81 wxStaticBox::wxStaticBox()
83 m_labelWidget
= (WXWidget
) 0;
86 bool wxStaticBox::Create(wxWindow
*parent
, wxWindowID id
,
87 const wxString
& label
,
93 if( !CreateControl( parent
, id
, pos
, size
, style
,
94 wxDefaultValidator
, name
) )
97 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
99 m_mainWidget
= XtVaCreateManagedWidget ("staticboxframe",
100 xmFrameWidgetClass
, parentWidget
,
101 // MBN: why override default?
102 // XmNshadowType, XmSHADOW_IN,
105 bool hasLabel
= (!label
.IsNull() && !label
.IsEmpty()) ;
108 WXFontType fontType
= m_font
.GetFontType( XtDisplay( parentWidget
) );
109 wxString
label1(wxStripMenuCodes(label
));
110 wxXmString
text(label1
);
112 m_labelWidget
= (WXWidget
) XtVaCreateManagedWidget ("staticboxlabel",
113 xmLabelWidgetClass
, (Widget
)m_mainWidget
,
114 wxFont::GetFontTag(), fontType
,
115 XmNlabelString
, text(),
116 #if wxCHECK_MOTIF_VERSION( 2, 0 )
117 XmNframeChildType
, XmFRAME_TITLE_CHILD
,
119 XmNchildType
, XmFRAME_TITLE_CHILD
,
124 AttachWidget (parent
, m_mainWidget
, NULL
, pos
.x
, pos
.y
, size
.x
, size
.y
);
125 ChangeBackgroundColour();
130 wxStaticBox::~wxStaticBox()
132 DetachWidget(m_mainWidget
);
133 XtDestroyWidget((Widget
) m_mainWidget
);
135 m_mainWidget
= (WXWidget
) 0;
136 m_labelWidget
= (WXWidget
) 0;
139 void wxStaticBox::SetLabel( const wxString
& label
)
141 wxXmSizeKeeper
sk( (Widget
)GetMainWidget() );
143 wxStaticBoxBase::SetLabel( label
);