]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/statline.cpp
Misc validity fixes to samples/xrc/rc/*.xrc.
[wxWidgets.git] / src / gtk / statline.cpp
CommitLineData
b0351fc9 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: src/gtk/statline.cpp
b0351fc9
RR
3// Purpose:
4// Author: Robert Roebling
b0351fc9 5// Copyright: (c) 1998 Robert Roebling
65571936 6// Licence: wxWindows licence
b0351fc9
RR
7/////////////////////////////////////////////////////////////////////////////
8
14f355c2
VS
9// For compilers that support precompilation, includes "wx.h".
10#include "wx/wxprec.h"
11
b0351fc9
RR
12#include "wx/statline.h"
13
dcf924a3
RR
14#if wxUSE_STATLINE
15
1897abe1
PC
16#include <gtk/gtk.h>
17#include "wx/gtk/private/gtk2-compat.h"
b0351fc9
RR
18
19//-----------------------------------------------------------------------------
20// wxStaticLine
21//-----------------------------------------------------------------------------
22
c50f1fb9 23wxStaticLine::wxStaticLine()
b0351fc9
RR
24{
25}
26
27wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
c50f1fb9
VZ
28 const wxPoint &pos, const wxSize &size,
29 long style, const wxString &name )
b0351fc9
RR
30{
31 Create( parent, id, pos, size, style, name );
32}
33
c50f1fb9
VZ
34bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
35 const wxPoint &pos, const wxSize &size,
36 long style, const wxString &name )
b0351fc9 37{
4dcaf11a
RR
38 if (!PreCreation( parent, pos, size ) ||
39 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
40 {
223d09f6 41 wxFAIL_MSG( wxT("wxStaticLine creation failed") );
3ca6a5f0 42 return FALSE;
4dcaf11a 43 }
b0351fc9 44
1897abe1
PC
45 const bool isVertical = IsVertical();
46 m_widget = gtk_separator_new(GtkOrientation(isVertical));
47 g_object_ref(m_widget);
48 if (isVertical)
073478b3 49 {
3ca6a5f0
BP
50 if (size.x == -1)
51 {
52 wxSize new_size( size );
53 new_size.x = 4;
54 SetSize( new_size );
55 }
073478b3 56 }
b0351fc9 57 else
073478b3 58 {
3ca6a5f0
BP
59 if (size.y == -1)
60 {
61 wxSize new_size( size );
62 new_size.y = 4;
63 SetSize( new_size );
64 }
073478b3 65 }
c50f1fb9 66
f03fc89f 67 m_parent->DoAddChild( this );
c50f1fb9 68
abdeb9e7 69 PostCreation(size);
c50f1fb9 70
b0351fc9
RR
71 return TRUE;
72}
73
9d522606
RD
74// static
75wxVisualAttributes
76wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
77{
1897abe1 78 return GetDefaultAttributesFromGTKWidget(gtk_separator_new(GTK_ORIENTATION_VERTICAL));
9d522606
RD
79}
80
c50f1fb9 81#endif