Header changes (gtk.h etc no longer included in defs.h
[wxWidgets.git] / src / gtk / statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbox.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifdef __GNUG__
11 #pragma implementation "statbox.h"
12 #endif
13
14 #include "wx/statbox.h"
15
16 #include "gdk/gdk.h"
17 #include "gtk/gtk.h"
18
19 //-----------------------------------------------------------------------------
20 // wxStaticBox
21 //-----------------------------------------------------------------------------
22
23 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox,wxControl)
24
25 wxStaticBox::wxStaticBox(void)
26 {
27 }
28
29 wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
30 const wxPoint &pos, const wxSize &size,
31 long style, const wxString &name )
32 {
33 Create( parent, id, label, pos, size, style, name );
34 }
35
36 bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
37 const wxPoint &pos, const wxSize &size,
38 long style, const wxString &name )
39 {
40 m_needParent = TRUE;
41
42 PreCreation( parent, id, pos, size, style, name );
43
44 m_isStaticBox = TRUE;
45
46 m_widget = gtk_frame_new(m_label);
47
48 m_parent->AddChild( this );
49
50 (m_parent->m_insertCallback)( m_parent, this );
51
52 PostCreation();
53
54 SetLabel(label);
55
56 SetBackgroundColour( parent->GetBackgroundColour() );
57 SetForegroundColour( parent->GetForegroundColour() );
58
59 Show( TRUE );
60
61 return TRUE;
62 }
63
64 void wxStaticBox::SetLabel( const wxString &label )
65 {
66 wxControl::SetLabel( label );
67 GtkFrame *frame = GTK_FRAME( m_widget );
68 gtk_frame_set_label( frame, GetLabel() );
69 }
70
71 void wxStaticBox::ApplyWidgetStyle()
72 {
73 SetWidgetStyle();
74 gtk_widget_set_style( m_widget, m_widgetStyle );
75 }
76