]> git.saurik.com Git - wxWidgets.git/blame - src/gtk1/statbox.cpp
Applied #15375 to stop event-sending in generic wxSpinCtrl ctor (eco)
[wxWidgets.git] / src / gtk1 / statbox.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/gtk1/statbox.cpp
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
a81258be 5// Copyright: (c) 1998 Robert Roebling
65571936 6// Licence: wxWindows licence
c801d85f
KB
7/////////////////////////////////////////////////////////////////////////////
8
14f355c2
VS
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
c801d85f 11
dcf924a3
RR
12#if wxUSE_STATBOX
13
1e6feb95 14#include "wx/statbox.h"
3cbab641 15#include "wx/gtk1/private.h"
1e6feb95 16
83624f79
RR
17#include "gdk/gdk.h"
18#include "gtk/gtk.h"
19
c801d85f
KB
20//-----------------------------------------------------------------------------
21// wxStaticBox
22//-----------------------------------------------------------------------------
23
4d23a4bf 24wxStaticBox::wxStaticBox()
c801d85f 25{
3f659fd6 26}
c801d85f 27
4d23a4bf
VZ
28wxStaticBox::wxStaticBox( wxWindow *parent,
29 wxWindowID id,
30 const wxString &label,
31 const wxPoint& pos,
32 const wxSize& size,
33 long style,
34 const wxString& name )
c801d85f 35{
1ecc4d80 36 Create( parent, id, label, pos, size, style, name );
3f659fd6 37}
c801d85f 38
4d23a4bf
VZ
39bool wxStaticBox::Create( wxWindow *parent,
40 wxWindowID id,
41 const wxString& label,
42 const wxPoint& pos,
43 const wxSize& size,
44 long style,
45 const wxString& name )
c801d85f 46{
1ecc4d80 47 m_needParent = TRUE;
904f68c7 48
4dcaf11a
RR
49 if (!PreCreation( parent, pos, size ) ||
50 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
51 {
223d09f6 52 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
1e6feb95 53 return FALSE;
4dcaf11a 54 }
c801d85f 55
b2ff89d6
VZ
56 m_widget = gtk_frame_new(NULL);
57 SetLabel(label);
904f68c7 58
f03fc89f 59 m_parent->DoAddChild( this );
1e6feb95 60
abdeb9e7 61 PostCreation(size);
db434467 62
4d23a4bf
VZ
63 // need to set non default alignment?
64 gfloat xalign;
65 if ( style & wxALIGN_CENTER )
66 xalign = 0.5;
67 else if ( style & wxALIGN_RIGHT )
68 xalign = 1.0;
69 else // wxALIGN_LEFT
70 xalign = 0.0;
58614078 71
c77a6796 72 if ( style & (wxALIGN_RIGHT | wxALIGN_CENTER) ) // left alignment is default
308a5aeb 73 gtk_frame_set_label_align(GTK_FRAME( m_widget ), xalign, 0.5);
0154a297 74
1ecc4d80 75 return TRUE;
3f659fd6 76}
d3904ceb 77
b2ff89d6 78void wxStaticBox::SetLabel( const wxString& label )
d3904ceb 79{
b2ff89d6 80 wxCHECK_RET( m_widget != NULL, wxT("invalid staticbox") );
4d23a4bf 81
b2ff89d6 82 GTKSetLabelForFrame(GTK_FRAME(m_widget), label);
d3904ceb 83}
58614078 84
7545e132 85void wxStaticBox::DoApplyWidgetStyle(GtkRcStyle *style)
e3716844 86{
7545e132 87 gtk_widget_modify_style(m_widget, style);
e3716844
RR
88}
89
9d522606
RD
90// static
91wxVisualAttributes
92wxStaticBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
93{
94 return GetDefaultAttributesFromGTKWidget(gtk_frame_new);
95}
96
1e6feb95 97#endif // wxUSE_STATBOX