]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/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/gtk/private.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
27 wxStaticBox::wxStaticBox()
31 wxStaticBox::wxStaticBox( wxWindow
*parent
,
33 const wxString
&label
,
37 const wxString
& name
)
39 Create( parent
, id
, label
, pos
, size
, style
, name
);
42 bool wxStaticBox::Create( wxWindow
*parent
,
44 const wxString
& label
,
48 const wxString
& name
)
52 if (!PreCreation( parent
, pos
, size
) ||
53 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
55 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
59 wxControl::SetLabel(label
);
61 m_widget
= gtk_frame_new(m_label
.empty() ? (char *)NULL
: (const char*) wxGTK_CONV( m_label
) );
63 m_parent
->DoAddChild( this );
67 // need to set non default alignment?
69 if ( style
& wxALIGN_CENTER
)
71 else if ( style
& wxALIGN_RIGHT
)
76 if ( style
& (wxALIGN_RIGHT
| wxALIGN_CENTER
) ) // left alignment is default
77 gtk_frame_set_label_align(GTK_FRAME( m_widget
), xalign
, 0.5);
82 void wxStaticBox::SetLabel( const wxString
&label
)
84 wxControl::SetLabel( label
);
86 gtk_frame_set_label( GTK_FRAME( m_widget
),
87 m_label
.empty() ? (char *)NULL
: (const char*) wxGTK_CONV( m_label
) );
90 void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle
*style
)
92 gtk_widget_modify_style(m_widget
, style
);
94 gtk_widget_modify_style(GTK_FRAME(m_widget
)->label_widget
, style
);
100 wxStaticBox::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
102 return GetDefaultAttributesFromGTKWidget(gtk_frame_new
);
105 #endif // wxUSE_STATBOX