]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix HitTest to return the proper tab index in case there are more tabs than fit ...
authorMart Raudsepp <leio@gentoo.org>
Tue, 13 Dec 2005 01:20:41 +0000 (01:20 +0000)
committerMart Raudsepp <leio@gentoo.org>
Tue, 13 Dec 2005 01:20:41 +0000 (01:20 +0000)
arrows), and the first visible tab isn't the first real tab. Before counting started from the visible tab, not real
tab.
While doing this, I noticed lots of "interesting" bugs wrt tab indexes and the whole wxGtkNotebookPage hack in the
code. In my opinion, to fix some of the bugs I noticed during testing, wxGtkNotebookPage has to be nuked and the
necessary parts rewritten.
Meanwhile, the HitTest fix works with wxNB_TOP styled notebooks that haven't modified tabs in a way that would have
mess up the wxGtkNotebookPage index sync. For other cases it might depend on the phase of the moon, and other factors.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36376 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/notebook.cpp
src/gtk1/notebook.cpp

index 3b0b8fe5ab3998b9afbbcc1d00f052e87305a735..fa18809974dab424a65ec6d29ac17cce7122de21 100644 (file)
@@ -736,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;
index 3b0b8fe5ab3998b9afbbcc1d00f052e87305a735..fa18809974dab424a65ec6d29ac17cce7122de21 100644 (file)
@@ -736,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;