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