]> git.saurik.com Git - wxWidgets.git/blob - src/gtk/statline.cpp
Merge wxBitmapButton and wxButton panels in the xrc sample.
[wxWidgets.git] / src / gtk / 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 // 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
24 IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
25
26 wxStaticLine::wxStaticLine()
27 {
28 }
29
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
37 bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
38 const wxPoint &pos, const wxSize &size,
39 long style, const wxString &name )
40 {
41 if (!PreCreation( parent, pos, size ) ||
42 !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
43 {
44 wxFAIL_MSG( wxT("wxStaticLine creation failed") );
45 return FALSE;
46 }
47
48 if ( IsVertical() )
49 {
50 m_widget = gtk_vseparator_new();
51 if (size.x == -1)
52 {
53 wxSize new_size( size );
54 new_size.x = 4;
55 SetSize( new_size );
56 }
57 }
58 else
59 {
60 m_widget = gtk_hseparator_new();
61 if (size.y == -1)
62 {
63 wxSize new_size( size );
64 new_size.y = 4;
65 SetSize( new_size );
66 }
67 }
68 g_object_ref(m_widget);
69
70 m_parent->DoAddChild( this );
71
72 PostCreation(size);
73
74 return TRUE;
75 }
76
77 // static
78 wxVisualAttributes
79 wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
80 {
81 return GetDefaultAttributesFromGTKWidget(gtk_vseparator_new);
82 }
83
84 #endif