]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/statbox.cpp
Corrected wxScrolledWindow's OnSize behaviour.
[wxWidgets.git] / src / gtk1 / statbox.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbox.cpp
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
10#ifdef __GNUG__
11#pragma implementation "statbox.h"
12#endif
13
1e6feb95 14#include "wx/defs.h"
c801d85f 15
dcf924a3
RR
16#if wxUSE_STATBOX
17
1e6feb95
VZ
18#include "wx/statbox.h"
19
83624f79
RR
20#include "gdk/gdk.h"
21#include "gtk/gtk.h"
22
c801d85f
KB
23//-----------------------------------------------------------------------------
24// wxStaticBox
25//-----------------------------------------------------------------------------
26
27IMPLEMENT_DYNAMIC_CLASS(wxStaticBox,wxControl)
28
29wxStaticBox::wxStaticBox(void)
30{
3f659fd6 31}
c801d85f 32
904f68c7
VZ
33wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
34 const wxPoint &pos, const wxSize &size,
debe6624 35 long style, const wxString &name )
c801d85f 36{
1ecc4d80 37 Create( parent, id, label, pos, size, style, name );
3f659fd6 38}
c801d85f 39
904f68c7
VZ
40bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
41 const wxPoint &pos, const wxSize &size,
debe6624 42 long style, const wxString &name )
c801d85f 43{
1ecc4d80 44 m_needParent = TRUE;
904f68c7 45
4dcaf11a
RR
46 if (!PreCreation( parent, pos, size ) ||
47 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
48 {
223d09f6 49 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
1e6feb95 50 return FALSE;
4dcaf11a 51 }
c801d85f 52
1ecc4d80 53 m_isStaticBox = TRUE;
1e6feb95 54
2e0e025e
RR
55 if (label.IsEmpty())
56 m_widget = gtk_frame_new( (char*) NULL );
57 else
58 m_widget = gtk_frame_new( m_label.mbc_str() );
904f68c7 59
f03fc89f 60 m_parent->DoAddChild( this );
1e6feb95 61
1ecc4d80 62 PostCreation();
904f68c7 63
1ecc4d80 64 SetLabel(label);
1e6feb95 65
db434467 66 SetFont( parent->GetFont() );
db434467 67
1ecc4d80
RR
68 SetBackgroundColour( parent->GetBackgroundColour() );
69 SetForegroundColour( parent->GetForegroundColour() );
58614078 70
1ecc4d80 71 Show( TRUE );
904f68c7 72
1ecc4d80 73 return TRUE;
3f659fd6 74}
d3904ceb
RR
75
76void wxStaticBox::SetLabel( const wxString &label )
77{
1ecc4d80
RR
78 wxControl::SetLabel( label );
79 GtkFrame *frame = GTK_FRAME( m_widget );
9f15c5fe 80 gtk_frame_set_label( frame, GetLabel().mbc_str() );
d3904ceb 81}
58614078
RR
82
83void wxStaticBox::ApplyWidgetStyle()
84{
1ecc4d80
RR
85 SetWidgetStyle();
86 gtk_widget_set_style( m_widget, m_widgetStyle );
58614078 87}
dcf924a3 88
1e6feb95 89#endif // wxUSE_STATBOX