]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statbox.cpp
Use NSColor from wxColour and wxBrush
[wxWidgets.git] / src / gtk / statbox.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
4d23a4bf 2// Name: gtk/statbox.cpp
c801d85f
KB
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
1e6feb95 14#include "wx/defs.h"
c801d85f 15
dcf924a3
RR
16#if wxUSE_STATBOX
17
1e6feb95 18#include "wx/statbox.h"
fab591c5 19#include "wx/gtk/private.h"
1e6feb95 20
83624f79
RR
21#include "gdk/gdk.h"
22#include "gtk/gtk.h"
23
c801d85f
KB
24//-----------------------------------------------------------------------------
25// wxStaticBox
26//-----------------------------------------------------------------------------
27
4d23a4bf 28IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
c801d85f 29
4d23a4bf 30wxStaticBox::wxStaticBox()
c801d85f 31{
3f659fd6 32}
c801d85f 33
4d23a4bf
VZ
34wxStaticBox::wxStaticBox( wxWindow *parent,
35 wxWindowID id,
36 const wxString &label,
37 const wxPoint& pos,
38 const wxSize& size,
39 long style,
40 const wxString& name )
c801d85f 41{
1ecc4d80 42 Create( parent, id, label, pos, size, style, name );
3f659fd6 43}
c801d85f 44
4d23a4bf
VZ
45bool wxStaticBox::Create( wxWindow *parent,
46 wxWindowID id,
47 const wxString& label,
48 const wxPoint& pos,
49 const wxSize& size,
50 long style,
51 const wxString& name )
c801d85f 52{
1ecc4d80 53 m_needParent = TRUE;
904f68c7 54
4dcaf11a
RR
55 if (!PreCreation( parent, pos, size ) ||
56 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
57 {
223d09f6 58 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
1e6feb95 59 return FALSE;
4dcaf11a 60 }
c801d85f 61
fa2540e3
VZ
62 wxControl::SetLabel(label);
63
fab591c5 64 m_widget = gtk_frame_new(m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
904f68c7 65
f03fc89f 66 m_parent->DoAddChild( this );
1e6feb95 67
1ecc4d80 68 PostCreation();
904f68c7 69
4d23a4bf 70 InheritAttributes();
db434467 71
4d23a4bf
VZ
72 // need to set non default alignment?
73 gfloat xalign;
74 if ( style & wxALIGN_CENTER )
75 xalign = 0.5;
76 else if ( style & wxALIGN_RIGHT )
77 xalign = 1.0;
78 else // wxALIGN_LEFT
79 xalign = 0.0;
58614078 80
4d23a4bf
VZ
81 if ( xalign )
82 gtk_frame_set_label_align(GTK_FRAME( m_widget ), xalign, 0.0);
0154a297 83
1ecc4d80 84 Show( TRUE );
904f68c7 85
1ecc4d80 86 return TRUE;
3f659fd6 87}
d3904ceb
RR
88
89void wxStaticBox::SetLabel( const wxString &label )
90{
1ecc4d80 91 wxControl::SetLabel( label );
4d23a4bf 92
0154a297 93 gtk_frame_set_label( GTK_FRAME( m_widget ),
fab591c5 94 m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
d3904ceb 95}
58614078
RR
96
97void wxStaticBox::ApplyWidgetStyle()
98{
1ecc4d80
RR
99 SetWidgetStyle();
100 gtk_widget_set_style( m_widget, m_widgetStyle );
58614078 101}
dcf924a3 102
1e6feb95 103#endif // wxUSE_STATBOX