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