1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        statline.cpp
3 // Purpose:
4 // Author:      Robert Roebling
5 // Id:          $Id: statline.cpp 35650 2005-09-23 12:56:45Z MR $
6 // Copyright:   (c) 1998 Robert Roebling
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12 
13 #include "wx/statline.h"
14 
15 #if wxUSE_STATLINE
16 
17 #include "gdk/gdk.h"
18 #include "gtk/gtk.h"
19 
20 //-----------------------------------------------------------------------------
21 // wxStaticLine
22 //-----------------------------------------------------------------------------
23 
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine,wxControl)24 IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
25 
26 wxStaticLine::wxStaticLine()
27 {
28 }
29 
wxStaticLine(wxWindow * parent,wxWindowID id,const wxPoint & pos,const wxSize & size,long style,const wxString & name)30 wxStaticLine::wxStaticLine( wxWindow *parent, wxWindowID id,
31                             const wxPoint &pos, const wxSize &size,
32                             long style, const wxString &name )
33 {
34     Create( parent, id, pos, size, style, name );
35 }
36 
Create(wxWindow * parent,wxWindowID id,const wxPoint & pos,const wxSize & size,long style,const wxString & name)37 bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
38                            const wxPoint &pos, const wxSize &size,
39                            long style, const wxString &name )
40 {
41     m_needParent = TRUE;
42 
43     if (!PreCreation( parent, pos, size ) ||
44         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
45     {
46         wxFAIL_MSG( wxT("wxStaticLine creation failed") );
47         return FALSE;
48     }
49 
50     if ( IsVertical() )
51     {
52         m_widget = gtk_vseparator_new();
53         if (size.x == -1)
54         {
55             wxSize new_size( size );
56             new_size.x = 4;
57             SetSize( new_size );
58         }
59     }
60     else
61     {
62         m_widget = gtk_hseparator_new();
63         if (size.y == -1)
64         {
65             wxSize new_size( size );
66             new_size.y = 4;
67             SetSize( new_size );
68         }
69     }
70 
71     m_parent->DoAddChild( this );
72 
73     PostCreation(size);
74 
75     return TRUE;
76 }
77 
78 // static
79 wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant WXUNUSED (variant))80 wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
81 {
82     return GetDefaultAttributesFromGTKWidget(gtk_vseparator_new);
83 }
84 
85 #endif
86