X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/246c5004eb5a1d6bd592cbc0981cf6c3e10895de..758127221440af60e7416da0f2eb04579340fa6d:/src/gtk/notebook.cpp?ds=sidebyside diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index c074dcb480..b8dfb49c81 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -20,10 +20,10 @@ #include "wx/utils.h" #include "wx/panel.h" #include "wx/msgdlg.h" + #include "wx/bitmap.h" #endif #include "wx/imaglist.h" -#include "wx/bitmap.h" #include "wx/fontutil.h" // FIXME: Use GtkImage instead of GtkPixmap. Don't use gtk_container_border_width @@ -324,6 +324,9 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id, m_acceptsFocus = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInNotebook; + if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) + style |= wxBK_TOP; + if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { @@ -775,15 +778,15 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const if ( pixmap && IsPointInsideWidget(pt, pixmap, x, y) ) { - *flags = wxNB_HITTEST_ONICON; + *flags = wxBK_HITTEST_ONICON; } else if ( IsPointInsideWidget(pt, GTK_WIDGET(nb_page->m_label), x, y) ) { - *flags = wxNB_HITTEST_ONLABEL; + *flags = wxBK_HITTEST_ONLABEL; } else { - *flags = wxNB_HITTEST_ONITEM; + *flags = wxBK_HITTEST_ONITEM; } } @@ -792,7 +795,22 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const } if ( flags ) - *flags = wxNB_HITTEST_NOWHERE; + { + *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.Inside( pt ) ) + *flags |= wxBK_HITTEST_ONPAGE; + } + } return wxNOT_FOUND; }