extern "C" {
static void
-switch_page_after(GtkWidget* widget, GtkNotebookPage*, guint, wxNotebook* win)
+switch_page_after(GtkNotebook* widget, GtkNotebookPage*, guint, wxNotebook* win)
{
g_signal_handlers_block_by_func(widget, (void*)switch_page_after, win);
- win->SendPageChangedEvent(win->m_oldSelection);
+
+ win->GTKOnPageChanged();
}
}
// wxNotebook
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook,wxBookCtrlBase)
-
BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
g_signal_handlers_unblock_by_func(m_widget, (void*)switch_page, this);
}
+ m_selection = page;
+
wxNotebookPage *client = GetPage(page);
if ( client )
client->SetFocus();
return selOld;
}
+void wxNotebook::GTKOnPageChanged()
+{
+ m_selection = gtk_notebook_get_current_page(GTK_NOTEBOOK(m_widget));
+
+ SendPageChangedEvent(m_oldSelection);
+}
+
bool wxNotebook::SetPageText( size_t page, const wxString &text )
{
wxCHECK_MSG(page < GetPageCount(), false, "invalid notebook index");
pageData->m_image, false, false, m_padding);
}
else
+ {
wxFAIL_MSG("invalid notebook imagelist");
+ }
}
/* set the label text */
if ( style )
{
gtk_widget_modify_style(pageData->m_label, style);
- gtk_rc_style_unref(style);
+ g_object_unref(style);
}
if (select && GetPageCount() > 1)
IsPointInsideWidget(const wxPoint& pt, GtkWidget *w,
gint x, gint y, gint border = 0)
{
+ GtkAllocation a;
+ gtk_widget_get_allocation(w, &a);
return
- (pt.x >= w->allocation.x - x - border) &&
- (pt.x <= w->allocation.x - x + border + w->allocation.width) &&
- (pt.y >= w->allocation.y - y - border) &&
- (pt.y <= w->allocation.y - y + border + w->allocation.height);
+ (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
{
- const gint x = m_widget->allocation.x;
- const gint y = m_widget->allocation.y;
+ 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++ )
{
GdkWindow *wxNotebook::GTKGetWindow(wxArrayGdkWindows& windows) const
{
- windows.push_back(m_widget->window);
+ windows.push_back(gtk_widget_get_window(m_widget));
windows.push_back(GTK_NOTEBOOK(m_widget)->event_window);
return NULL;