]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/statbox.cpp
Added some missing tests; replaced scrolwin.cpp with scrlwng.cpp
[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/defs.h"
15
16 #if wxUSE_STATBOX
17
18 #include "wx/statbox.h"
19
20 #include "gdk/gdk.h"
21 #include "gtk/gtk.h"
22
23 //-----------------------------------------------------------------------------
24 // wxStaticBox
25 //-----------------------------------------------------------------------------
26
27 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox,wxControl)
28
29 wxStaticBox::wxStaticBox(void)
30 {
31 }
32
33 wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
34 const wxPoint &pos, const wxSize &size,
35 long style, const wxString &name )
36 {
37 Create( parent, id, label, pos, size, style, name );
38 }
39
40 bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
41 const wxPoint &pos, const wxSize &size,
42 long style, const wxString &name )
43 {
44 m_needParent = TRUE;
45
46 if (!PreCreation( parent, pos, size ) ||
47 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
48 {
49 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
50 return FALSE;
51 }
52
53 m_isStaticBox = TRUE;
54
55 if (label.IsEmpty())
56 m_widget = gtk_frame_new( (char*) NULL );
57 else
58 m_widget = gtk_frame_new( m_label.mbc_str() );
59
60 m_parent->DoAddChild( this );
61
62 PostCreation();
63
64 SetLabel(label);
65
66 SetFont( parent->GetFont() );
67
68 SetBackgroundColour( parent->GetBackgroundColour() );
69 SetForegroundColour( parent->GetForegroundColour() );
70
71 Show( TRUE );
72
73 return TRUE;
74 }
75
76 void wxStaticBox::SetLabel( const wxString &label )
77 {
78 wxControl::SetLabel( label );
79 GtkFrame *frame = GTK_FRAME( m_widget );
80 gtk_frame_set_label( frame, GetLabel().mbc_str() );
81 }
82
83 void wxStaticBox::ApplyWidgetStyle()
84 {
85 SetWidgetStyle();
86 gtk_widget_set_style( m_widget, m_widgetStyle );
87 }
88
89 #endif // wxUSE_STATBOX