Get(Class)DefaultAttributes() for wxGTK controls
[wxWidgets.git] / src / gtk1 / statline.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statline.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 "statline.h"
12 #endif
13
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
16
17 #include "wx/statline.h"
18
19 #if wxUSE_STATLINE
20
21 #include "gdk/gdk.h"
22 #include "gtk/gtk.h"
23
24 //-----------------------------------------------------------------------------
25 // wxStaticLine
26 //-----------------------------------------------------------------------------
27
28 IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
29
30 wxStaticLine::wxStaticLine()
31 {
32 }
33
34 wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
35 const wxPoint &pos, const wxSize &size,
36 long style, const wxString &name )
37 {
38 Create( parent, id, pos, size, style, name );
39 }
40
41 bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
42 const wxPoint &pos, const wxSize &size,
43 long style, const wxString &name )
44 {
45 m_needParent = TRUE;
46
47 if (!PreCreation( parent, pos, size ) ||
48 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
49 {
50 wxFAIL_MSG( wxT("wxStaticLine creation failed") );
51 return FALSE;
52 }
53
54 if ( IsVertical() )
55 {
56 m_widget = gtk_vseparator_new();
57 if (size.x == -1)
58 {
59 wxSize new_size( size );
60 new_size.x = 4;
61 SetSize( new_size );
62 }
63 }
64 else
65 {
66 m_widget = gtk_hseparator_new();
67 if (size.y == -1)
68 {
69 wxSize new_size( size );
70 new_size.y = 4;
71 SetSize( new_size );
72 }
73 }
74
75 m_parent->DoAddChild( this );
76
77 PostCreation(size);
78
79 return TRUE;
80 }
81
82 // static
83 wxVisualAttributes
84 wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
85 {
86 return GetDefaultAttributesFromGTKWidget(gtk_vseparator_new);
87 }
88
89 #endif