]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/gtk1/statbox.cpp
Tests for wxTE_PROCESS_TAB again in line with other ports
[wxWidgets.git] / src / gtk1 / statbox.cpp
... / ...
CommitLineData
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#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11#pragma implementation "statbox.h"
12#endif
13
14// For compilers that support precompilation, includes "wx.h".
15#include "wx/wxprec.h"
16
17#if wxUSE_STATBOX
18
19#include "wx/statbox.h"
20#include "wx/gtk/private.h"
21
22#include "gdk/gdk.h"
23#include "gtk/gtk.h"
24
25//-----------------------------------------------------------------------------
26// wxStaticBox
27//-----------------------------------------------------------------------------
28
29IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
30
31wxStaticBox::wxStaticBox()
32{
33}
34
35wxStaticBox::wxStaticBox( wxWindow *parent,
36 wxWindowID id,
37 const wxString &label,
38 const wxPoint& pos,
39 const wxSize& size,
40 long style,
41 const wxString& name )
42{
43 Create( parent, id, label, pos, size, style, name );
44}
45
46bool wxStaticBox::Create( wxWindow *parent,
47 wxWindowID id,
48 const wxString& label,
49 const wxPoint& pos,
50 const wxSize& size,
51 long style,
52 const wxString& name )
53{
54 m_needParent = TRUE;
55
56 if (!PreCreation( parent, pos, size ) ||
57 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
58 {
59 wxFAIL_MSG( wxT("wxStaticBox creation failed") );
60 return FALSE;
61 }
62
63 wxControl::SetLabel(label);
64
65 m_widget = gtk_frame_new(m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
66
67 m_parent->DoAddChild( this );
68
69 PostCreation(size);
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 return TRUE;
84}
85
86void wxStaticBox::SetLabel( const wxString &label )
87{
88 wxControl::SetLabel( label );
89
90 gtk_frame_set_label( GTK_FRAME( m_widget ),
91 m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
92}
93
94// static
95wxVisualAttributes
96wxStaticBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
97{
98 return GetDefaultAttributesFromGTKWidget(gtk_frame_new);
99}
100
101#endif // wxUSE_STATBOX