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