+wxStaticBox::wxStaticBox()
+{
+}
+
+wxStaticBox::wxStaticBox( wxWindow *parent,
+ wxWindowID id,
+ const wxString &label,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name )
+{
+ Create( parent, id, label, pos, size, style, name );
+}
+
+bool wxStaticBox::Create( wxWindow *parent,
+ wxWindowID id,
+ const wxString& label,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style,
+ const wxString& name )
+{
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+ {
+ wxFAIL_MSG( wxT("wxStaticBox creation failed") );
+ return false;
+ }
+
+ m_widget = GTKCreateFrame(label);
+ g_object_ref(m_widget);
+
+ // only base SetLabel needs to be called after GTKCreateFrame
+ wxControl::SetLabel(label);
+
+ m_parent->DoAddChild( this );
+
+ PostCreation(size);
+
+ // need to set non default alignment?
+ gfloat xalign = 0;
+ if ( style & wxALIGN_CENTER )
+ xalign = 0.5;
+ else if ( style & wxALIGN_RIGHT )
+ xalign = 1.0;
+
+ gtk_frame_set_label_align(GTK_FRAME(m_widget), xalign, 0.5);
+
+#ifndef __WXGTK3__
+ if (gtk_check_version(2, 12, 0))
+ {
+ // we connect this signal to perform label-clipping as GTK >= 2.12 does
+ g_signal_connect(m_widget, "size_allocate", G_CALLBACK(size_allocate), NULL);
+ }
+#endif
+
+ m_container.DisableSelfFocus();
+
+ return true;
+}
+
+void wxStaticBox::AddChild( wxWindowBase *child )
+{
+ if (!m_wxwindow)
+ {
+ // make this window a container of other wxWindows by instancing a wxPizza
+ // and packing it into the GtkFrame:
+ m_wxwindow = wxPizza::New();
+ gtk_widget_show( m_wxwindow );
+ gtk_container_add( GTK_CONTAINER (m_widget), m_wxwindow );
+ }
+
+ wxStaticBoxBase::AddChild(child);
+}
+
+void wxStaticBox::SetLabel( const wxString& label )
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid staticbox") );
+
+ GTKSetLabelForFrame(GTK_FRAME(m_widget), label);
+}
+
+void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+ GTKFrameApplyWidgetStyle(GTK_FRAME(m_widget), style);
+}
+
+bool wxStaticBox::GTKWidgetNeedsMnemonic() const
+{
+ return true;
+}