]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statbox.cpp
Added a const to be consistent with the generic class
[wxWidgets.git] / src / gtk / statbox.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
4d23a4bf 2// Name: gtk/statbox.cpp
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
a81258be
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
904f68c7 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
14f355c2 10#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c801d85f
KB
11#pragma implementation "statbox.h"
12#endif
13
14f355c2
VS
14// For compilers that support precompilation, includes "wx.h".
15#include "wx/wxprec.h"
c801d85f 16
dcf924a3
RR
17#if wxUSE_STATBOX
18
1e6feb95 19#include "wx/statbox.h"
fab591c5 20#include "wx/gtk/private.h"
1e6feb95 21
83624f79
RR
22#include "gdk/gdk.h"
23#include "gtk/gtk.h"
24
c801d85f
KB
25//-----------------------------------------------------------------------------
26// wxStaticBox
27//-----------------------------------------------------------------------------
28
4d23a4bf 29IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
c801d85f 30
4d23a4bf 31wxStaticBox::wxStaticBox()
c801d85f 32{
3f659fd6 33}
c801d85f 34
4d23a4bf
VZ
35wxStaticBox::wxStaticBox( wxWindow *parent,
36 wxWindowID id,
37 const wxString &label,
38 const wxPoint& pos,
39 const wxSize& size,
40 long style,
41 const wxString& name )
c801d85f 42{
1ecc4d80 43 Create( parent, id, label, pos, size, style, name );
3f659fd6 44}
c801d85f 45
4d23a4bf
VZ
46bool wxStaticBox::Create( wxWindow *parent,
47 wxWindowID id,
48 const wxString& label,
49 const wxPoint& pos,
50 const wxSize& size,
51 long style,
52 const wxString& name )
c801d85f 53{
1ecc4d80 54 m_needParent = TRUE;
904f68c7 55
4dcaf11a
RR
56 if (!PreCreation( parent, pos, size ) ||
57 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
58 {
223d09f6 59 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
1e6feb95 60 return FALSE;
4dcaf11a 61 }
c801d85f 62
fa2540e3
VZ
63 wxControl::SetLabel(label);
64
fab591c5 65 m_widget = gtk_frame_new(m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
904f68c7 66
f03fc89f 67 m_parent->DoAddChild( this );
1e6feb95 68
1ecc4d80 69 PostCreation();
904f68c7 70
4d23a4bf 71 InheritAttributes();
db434467 72
4d23a4bf
VZ
73 // need to set non default alignment?
74 gfloat xalign;
75 if ( style & wxALIGN_CENTER )
76 xalign = 0.5;
77 else if ( style & wxALIGN_RIGHT )
78 xalign = 1.0;
79 else // wxALIGN_LEFT
80 xalign = 0.0;
58614078 81
4d23a4bf
VZ
82 if ( xalign )
83 gtk_frame_set_label_align(GTK_FRAME( m_widget ), xalign, 0.0);
0154a297 84
1ecc4d80 85 Show( TRUE );
904f68c7 86
1ecc4d80 87 return TRUE;
3f659fd6 88}
d3904ceb
RR
89
90void wxStaticBox::SetLabel( const wxString &label )
91{
1ecc4d80 92 wxControl::SetLabel( label );
4d23a4bf 93
0154a297 94 gtk_frame_set_label( GTK_FRAME( m_widget ),
fab591c5 95 m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
d3904ceb 96}
58614078
RR
97
98void wxStaticBox::ApplyWidgetStyle()
99{
1ecc4d80
RR
100 SetWidgetStyle();
101 gtk_widget_set_style( m_widget, m_widgetStyle );
58614078 102}
dcf924a3 103
1e6feb95 104#endif // wxUSE_STATBOX