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