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