X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/de6185e212ebc37ff11ff70278e3c4f68419b097..6c73e20df7f3a7ea8c2059a816ffd3655ea2b848:/src/gtk/notebook.cpp

diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp
index 38938182da..25efc437f8 100644
--- a/src/gtk/notebook.cpp
+++ b/src/gtk/notebook.cpp
@@ -18,11 +18,12 @@
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/utils.h"
+    #include "wx/panel.h"
+    #include "wx/msgdlg.h"
+    #include "wx/bitmap.h"
 #endif
 
-#include "wx/panel.h"
 #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 <gdk/gdkkeysyms.h>
 
-#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 ))
     {
@@ -694,7 +696,7 @@ bool wxNotebook::InsertPage( size_t position,
     /* set the label text */
 
     nb_page->m_text = text;
-    if (nb_page->m_text.empty()) nb_page->m_text = wxT("");
+    if (nb_page->m_text.empty()) nb_page->m_text = wxEmptyString;
 
     nb_page->m_label = GTK_LABEL( gtk_label_new(wxGTK_CONV(nb_page->m_text)) );
     gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );
@@ -793,7 +795,22 @@ int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
     }
 
     if ( flags )
+    {
         *flags = wxNB_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 |= wxNB_HITTEST_ONPAGE;
+        }
+    }
 
     return wxNOT_FOUND;
 }