]> git.saurik.com Git - wxWidgets.git/blob - src/gtk1/statbox.cpp
Dislaying popup tip windows seems to work right now.
[wxWidgets.git] / src / gtk1 / statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: gtk/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()
30 {
31 }
32
33 wxStaticBox::wxStaticBox( wxWindow *parent,
34 wxWindowID id,
35 const wxString &label,
36 const wxPoint& pos,
37 const wxSize& size,
38 long style,
39 const wxString& name )
40 {
41 Create( parent, id, label, pos, size, style, name );
42 }
43
44 bool wxStaticBox::Create( wxWindow *parent,
45 wxWindowID id,
46 const wxString& label,
47 const wxPoint& pos,
48 const wxSize& size,
49 long style,
50 const wxString& name )
51 {
52 m_needParent = TRUE;
53
54 if (!PreCreation( parent, pos, size ) ||
55 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
56 {
57 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
58 return FALSE;
59 }
60
61 m_widget = gtk_frame_new(m_label.empty() ? (char *)NULL : m_label.mbc_str());
62
63 m_parent->DoAddChild( this );
64
65 PostCreation();
66
67 SetLabel(label);
68
69 InheritAttributes();
70
71 // need to set non default alignment?
72 gfloat xalign;
73 if ( style & wxALIGN_CENTER )
74 xalign = 0.5;
75 else if ( style & wxALIGN_RIGHT )
76 xalign = 1.0;
77 else // wxALIGN_LEFT
78 xalign = 0.0;
79
80 if ( xalign )
81 gtk_frame_set_label_align(GTK_FRAME( m_widget ), xalign, 0.0);
82
83 Show( TRUE );
84
85 return TRUE;
86 }
87
88 void wxStaticBox::SetLabel( const wxString &label )
89 {
90 wxControl::SetLabel( label );
91
92 gtk_frame_set_label( GTK_FRAME( m_widget ), GetLabel().mbc_str() );
93 }
94
95 void wxStaticBox::ApplyWidgetStyle()
96 {
97 SetWidgetStyle();
98 gtk_widget_set_style( m_widget, m_widgetStyle );
99 }
100
101 #endif // wxUSE_STATBOX