]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbox.cpp
5b09be49d10a699b15db1fc5a32e78f652edf28d
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/statbox.cpp
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11 #pragma implementation "statbox.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
19 #include "wx/statbox.h"
20 #include "wx/gtk/private.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
31 wxStaticBox::wxStaticBox()
35 wxStaticBox::wxStaticBox( wxWindow
*parent
,
37 const wxString
&label
,
41 const wxString
& name
)
43 Create( parent
, id
, label
, pos
, size
, style
, name
);
46 bool wxStaticBox::Create( wxWindow
*parent
,
48 const wxString
& label
,
52 const wxString
& name
)
56 if (!PreCreation( parent
, pos
, size
) ||
57 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
59 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
63 wxControl::SetLabel(label
);
65 m_widget
= gtk_frame_new(m_label
.empty() ? (char *)NULL
: (const char*) wxGTK_CONV( m_label
) );
67 m_parent
->DoAddChild( this );
71 // need to set non default alignment?
73 if ( style
& wxALIGN_CENTER
)
75 else if ( style
& wxALIGN_RIGHT
)
81 gtk_frame_set_label_align(GTK_FRAME( m_widget
), xalign
, 0.5);
86 void wxStaticBox::SetLabel( const wxString
&label
)
88 wxControl::SetLabel( label
);
90 gtk_frame_set_label( GTK_FRAME( m_widget
),
91 m_label
.empty() ? (char *)NULL
: (const char*) wxGTK_CONV( m_label
) );
94 void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle
*style
)
96 gtk_widget_modify_style(m_widget
, style
);
98 gtk_widget_modify_style(GTK_FRAME(m_widget
)->label_widget
, style
);
104 wxStaticBox::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
106 return GetDefaultAttributesFromGTKWidget(gtk_frame_new
);
109 #endif // wxUSE_STATBOX