X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e609c82594a57104ff5e0d4044b2e2697a4b576..a2cccbc3f36e724dce04a1c81ca134f910c1b1ec:/src/gtk/notebook.cpp diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 34dd2bf59d..b8dfb49c81 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -19,10 +19,11 @@ #include "wx/log.h" #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 @@ -36,8 +37,6 @@ #include -#include "wx/msgdlg.h" - // ---------------------------------------------------------------------------- // events // ---------------------------------------------------------------------------- @@ -325,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 )) { @@ -776,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; } } @@ -793,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; }