]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/notebook.cpp
Cleanup
[wxWidgets.git] / src / gtk / notebook.cpp
index 6b0b569e00082a6ac54c4139219321b8c28a1249..fa18809974dab424a65ec6d29ac17cce7122de21 100644 (file)
@@ -7,10 +7,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "notebook.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -83,7 +79,7 @@ public:
 
 
 #include "wx/listimpl.cpp"
-WX_DEFINE_LIST(wxGtkNotebookPagesList);
+WX_DEFINE_LIST(wxGtkNotebookPagesList)
 
 
 //-----------------------------------------------------------------------------
@@ -343,11 +339,11 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
     m_parent->DoAddChild( this );
 
-    if (m_windowStyle & wxNB_RIGHT)
+    if (m_windowStyle & wxBK_RIGHT)
         gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_RIGHT );
-    if (m_windowStyle & wxNB_LEFT)
+    if (m_windowStyle & wxBK_LEFT)
         gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_LEFT );
-    if (m_windowStyle & wxNB_BOTTOM)
+    if (m_windowStyle & wxBK_BOTTOM)
         gtk_notebook_set_tab_pos( GTK_NOTEBOOK(m_widget), GTK_POS_BOTTOM );
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
@@ -664,13 +660,7 @@ bool wxNotebook::InsertPage( size_t position,
     gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
       GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );
 
-#ifndef __VMS
-   // On VMS position is unsigned and thus always positive
-   if (position < 0)
-        gtk_notebook_append_page( notebook, win->m_widget, nb_page->m_box );
-    else
-#endif
-     gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );
+    gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );
 
     nb_page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;
 
@@ -716,13 +706,7 @@ bool wxNotebook::InsertPage( size_t position,
     gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
     if (select && (m_pagesData.GetCount() > 1))
     {
-#ifndef __VMS
-   // On VMS position is unsigned and thus always positive
-        if (position < 0)
-            SetSelection( GetPageCount()-1 );
-        else
-#endif
-            SetSelection( position );
+      SetSelection( position );
     }
 
     gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
@@ -752,7 +736,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
     const gint y = m_widget->allocation.y;
 
     const size_t count = GetPageCount();
-    for ( size_t i = 0; i < count; i++ )
+    size_t i = 0;
+
+#ifdef __WXGTK20__
+    GtkNotebook * notebook = GTK_NOTEBOOK(m_widget);
+    if (gtk_notebook_get_scrollable(notebook));
+        i = g_list_position( notebook->children, notebook->first_tab );
+#endif
+
+    for ( ; i < count; i++ )
     {
         wxGtkNotebookPage* nb_page = GetNotebookPage(i);
         GtkWidget *box = nb_page->m_box;