- /* set the label text */
- nb_page->m_text = text;
- if (nb_page->m_text.IsEmpty()) nb_page->m_text = wxT("");
-
- nb_page->m_label = GTK_LABEL( gtk_label_new(nb_page->m_text.mbc_str()) );
- gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );
-
- /* show the label */
- gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
- if (select && (m_pagesData.GetCount() > 1))
+ InvalidateBestSize();
+ return true;
+}
+
+// helper for HitTest(): check if the point lies inside the given widget which
+// is the child of the notebook whose position and border size are passed as
+// parameters
+static bool
+IsPointInsideWidget(const wxPoint& pt, GtkWidget *w,
+ gint x, gint y, gint border = 0)
+{
+ GtkAllocation a;
+ gtk_widget_get_allocation(w, &a);
+ return
+ (pt.x >= a.x - x - border) &&
+ (pt.x <= a.x - x + border + a.width) &&
+ (pt.y >= a.y - y - border) &&
+ (pt.y <= a.y - y + border + a.height);
+}
+
+int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
+{
+ 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;
+
+#ifndef __WXGTK3__
+ 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++ )