]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/statbox.cpp
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 // For compilers that support precompilation, includes "wx.h".
10 #include "wx/wxprec.h"
14 #include "wx/statbox.h"
15 #include "wx/gtk1/private.h"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 wxStaticBox::wxStaticBox()
28 wxStaticBox::wxStaticBox( wxWindow
*parent
,
30 const wxString
&label
,
34 const wxString
& name
)
36 Create( parent
, id
, label
, pos
, size
, style
, name
);
39 bool wxStaticBox::Create( wxWindow
*parent
,
41 const wxString
& label
,
45 const wxString
& name
)
49 if (!PreCreation( parent
, pos
, size
) ||
50 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
52 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
56 m_widget
= gtk_frame_new(NULL
);
59 m_parent
->DoAddChild( this );
63 // need to set non default alignment?
65 if ( style
& wxALIGN_CENTER
)
67 else if ( style
& wxALIGN_RIGHT
)
72 if ( style
& (wxALIGN_RIGHT
| wxALIGN_CENTER
) ) // left alignment is default
73 gtk_frame_set_label_align(GTK_FRAME( m_widget
), xalign
, 0.5);
78 void wxStaticBox::SetLabel( const wxString
& label
)
80 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid staticbox") );
82 GTKSetLabelForFrame(GTK_FRAME(m_widget
), label
);
85 void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle
*style
)
87 gtk_widget_modify_style(m_widget
, style
);
92 wxStaticBox::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
94 return GetDefaultAttributesFromGTKWidget(gtk_frame_new
);
97 #endif // wxUSE_STATBOX