+ GtkAllocation a;
+ gtk_widget_get_allocation(m_widget, &a);
+ const int x = a.x;
+ const int y = a.y;
+
+ const size_t count = GetPageCount();
+ size_t i = 0;
+
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GSEAL_ENABLE)
+ 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* pageData = GetNotebookPage(i);
+ GtkWidget* box = pageData->m_box;
+
+ const gint border = gtk_container_get_border_width(GTK_CONTAINER(box));
+
+ if ( IsPointInsideWidget(pt, box, x, y, border) )
+ {
+ // ok, we're inside this tab -- now find out where, if needed
+ if ( flags )
+ {
+ if (pageData->m_image && IsPointInsideWidget(pt, pageData->m_image, x, y))
+ {
+ *flags = wxBK_HITTEST_ONICON;
+ }
+ else if (IsPointInsideWidget(pt, pageData->m_label, x, y))
+ {
+ *flags = wxBK_HITTEST_ONLABEL;
+ }
+ else
+ {
+ *flags = wxBK_HITTEST_ONITEM;
+ }
+ }
+
+ return i;
+ }
+ }
+
+ if ( flags )
+ {
+ *flags = wxBK_HITTEST_NOWHERE;
+ wxWindowBase * page = GetCurrentPage();
+ if ( page )
+ {
+ // rect origin is in notebook's parent coordinates
+ wxRect rect = page->GetRect();
+
+ // adjust it to the notebook's coordinates
+ wxPoint pos = GetPosition();
+ rect.x -= pos.x;
+ rect.y -= pos.y;
+ if ( rect.Contains( pt ) )
+ *flags |= wxBK_HITTEST_ONPAGE;
+ }
+ }
+
+ return wxNOT_FOUND;