+ return FALSE;
+ }
+
+ // succeeded: save the pointer to the page
+ m_pages.Insert(pPage, nPage);
+
+ // for the first page (only) we need to adjust the size again because the
+ // notebook size changed: the tabs which hadn't been there before are now
+ // shown
+ if ( m_pages.GetCount() == 1 )
+ {
+ AdjustPageSize(pPage);
+ }
+
+ // hide the page: unless it is selected, it shouldn't be shown (and if it
+ // is selected it will be shown later)
+ HWND hwnd = GetWinHwnd(pPage);
+ SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VISIBLE);
+
+ // this updates internal flag too -- otherwise it would get out of sync
+ // with the real state
+ pPage->Show(FALSE);
+
+
+ // now deal with the selection
+ // ---------------------------
+
+ // if the inserted page is before the selected one, we must update the
+ // index of the selected page
+ if ( nPage <= m_nSelection )
+ {
+ // one extra page added
+ m_nSelection++;
+ }
+
+ // some page should be selected: either this one or the first one if there
+ // is still no selection
+ int selNew = -1;
+ if ( bSelect )
+ selNew = nPage;
+ else if ( m_nSelection == -1 )
+ selNew = 0;
+
+ if ( selNew != -1 )
+ SetSelection(selNew);
+
+ return TRUE;
+}
+
+// Hit test
+int wxNotebook::HitTest(const wxPoint& pt, long& flags)
+{
+ TC_HITTESTINFO hitTestInfo;
+ hitTestInfo.pt.x = pt.x;
+ hitTestInfo.pt.y = pt.y;
+ int item = TabCtrl_HitTest( (HWND) GetHWND(), & hitTestInfo ) ;
+ flags = 0;
+
+ if ((hitTestInfo.flags & TCHT_NOWHERE) == TCHT_NOWHERE)
+ flags |= wxNB_HITTEST_NOWHERE;
+ if ((hitTestInfo.flags & TCHT_ONITEMICON) == TCHT_ONITEMICON)
+ flags |= wxNB_HITTEST_ONICON;
+ if ((hitTestInfo.flags & TCHT_ONITEMLABEL) == TCHT_ONITEMLABEL)
+ flags |= wxNB_HITTEST_ONLABEL;
+
+ return item;