]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/statline.cpp
Make wxWindow::HasScrollbar() respect wxScrolled::ShowScrollbars().
[wxWidgets.git] / src / gtk / statline.cpp
index cd67c8a642a6fa0a2452765ff2b2227cdc658b04..a9b52ab88ed5b84267e0afe4db67c2ddcdf25065 100644 (file)
@@ -1,29 +1,25 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        statline.cpp
+// Name:        src/gtk/statline.cpp
 // Purpose:
 // Author:      Robert Roebling
-// Id:          $Id$
 // Copyright:   (c) 1998 Robert Roebling
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "statline.h"
-#endif
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
 
 #include "wx/statline.h"
 
 #if wxUSE_STATLINE
 
-#include "gdk/gdk.h"
-#include "gtk/gtk.h"
+#include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 //-----------------------------------------------------------------------------
 // wxStaticLine
 //-----------------------------------------------------------------------------
 
-IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
-
 wxStaticLine::wxStaticLine()
 {
 }
@@ -39,43 +35,47 @@ bool wxStaticLine::Create( wxWindow *parent, wxWindowID id,
                            const wxPoint &pos, const wxSize &size,
                            long style, const wxString &name )
 {
-    m_needParent = TRUE;
-
     if (!PreCreation( parent, pos, size ) ||
         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
     {
-        wxFAIL_MSG( _T("wxStaticLine creation failed") );
-       return FALSE;
+        wxFAIL_MSG( wxT("wxStaticLine creation failed") );
+        return FALSE;
     }
 
-    if ( IsVertical() )
+    const bool isVertical = IsVertical();
+    m_widget = gtk_separator_new(GtkOrientation(isVertical));
+    g_object_ref(m_widget);
+    if (isVertical)
     {
-        m_widget = gtk_vseparator_new();
-       if (size.x == -1)
-       {
-           wxSize new_size( size );
-           new_size.x = 4;
-           SetSize( new_size );
-       }
+        if (size.x == -1)
+        {
+            wxSize new_size( size );
+            new_size.x = 4;
+            SetSize( new_size );
+        }
     }
     else
     {
-        m_widget = gtk_hseparator_new();
-       if (size.y == -1)
-       {
-           wxSize new_size( size );
-           new_size.y = 4;
-           SetSize( new_size );
-       }
+        if (size.y == -1)
+        {
+            wxSize new_size( size );
+            new_size.y = 4;
+            SetSize( new_size );
+        }
     }
 
     m_parent->DoAddChild( this );
 
-    PostCreation();
-
-    Show( TRUE );
+    PostCreation(size);
 
     return TRUE;
 }
 
+// static
+wxVisualAttributes
+wxStaticLine::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_separator_new(GTK_ORIENTATION_VERTICAL));
+}
+
 #endif