]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/statbox.cpp
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
15 #include "wx/statbox.h"
16 #include "wx/gtk1/private.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 wxStaticBox::wxStaticBox()
29 wxStaticBox::wxStaticBox( wxWindow
*parent
,
31 const wxString
&label
,
35 const wxString
& name
)
37 Create( parent
, id
, label
, pos
, size
, style
, name
);
40 bool wxStaticBox::Create( wxWindow
*parent
,
42 const wxString
& label
,
46 const wxString
& name
)
50 if (!PreCreation( parent
, pos
, size
) ||
51 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
53 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
57 m_widget
= gtk_frame_new(NULL
);
60 m_parent
->DoAddChild( this );
64 // need to set non default alignment?
66 if ( style
& wxALIGN_CENTER
)
68 else if ( style
& wxALIGN_RIGHT
)
73 if ( style
& (wxALIGN_RIGHT
| wxALIGN_CENTER
) ) // left alignment is default
74 gtk_frame_set_label_align(GTK_FRAME( m_widget
), xalign
, 0.5);
79 void wxStaticBox::SetLabel( const wxString
& label
)
81 wxCHECK_RET( m_widget
!= NULL
, wxT("invalid staticbox") );
83 GTKSetLabelForFrame(GTK_FRAME(m_widget
), label
);
86 void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle
*style
)
88 gtk_widget_modify_style(m_widget
, style
);
93 wxStaticBox::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
95 return GetDefaultAttributesFromGTKWidget(gtk_frame_new
);
98 #endif // wxUSE_STATBOX