X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07b8d7ecc39cfc6cce17156b91c6de1cfb56ce5b..abfcca57dd0d805ceec9e19c4be207614d79252a:/src/msw/notebook.cpp diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 707a2f1db4..424201d9c6 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -145,23 +145,22 @@ bool wxNotebook::Create(wxWindow *parent, if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) return FALSE; - // colors and font - m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE)); - m_foregroundColour = *wxBLACK; + parent->AddChild(this); // style m_windowStyle = style | wxTAB_TRAVERSAL; - long tabStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | TCS_TABS; + long tabStyle = WS_TABSTOP | TCS_TABS; + if ( m_windowStyle & wxBORDER ) + tabStyle |= WS_BORDER; if ( m_windowStyle & wxCLIP_SIBLINGS ) tabStyle |= WS_CLIPSIBLINGS; if (m_windowStyle & wxCLIP_CHILDREN) tabStyle |= WS_CLIPCHILDREN; + if ( m_windowStyle & wxTC_MULTILINE ) tabStyle |= TCS_MULTILINE; - if ( m_windowStyle & wxBORDER ) - tabStyle &= WS_BORDER; if (m_windowStyle & wxNB_FIXEDWIDTH) tabStyle |= TCS_FIXEDWIDTH ; if (m_windowStyle & wxNB_BOTTOM) @@ -171,23 +170,14 @@ bool wxNotebook::Create(wxWindow *parent, if (m_windowStyle & wxNB_RIGHT) tabStyle |= TCS_VERTICAL|TCS_RIGHT; - - if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL, - this, NULL, pos.x, pos.y, size.x, size.y, - tabStyle, NULL, 0) ) + // note that we don't want to have the default WS_EX_CLIENTEDGE style for the + // notebook, so explicitly specify 0 as last parameter + if ( !MSWCreateControl(WC_TABCONTROL, tabStyle, pos, size, _T(""), 0) ) { return FALSE; } - // Not all compilers recognise SetWindowFont - ::SendMessage(GetHwnd(), WM_SETFONT, - (WPARAM)::GetStockObject(DEFAULT_GUI_FONT), TRUE); - - - if ( parent != NULL ) - parent->AddChild(this); - - SubclassWin(m_hWnd); + SetBackgroundColour(wxColour(::GetSysColor(COLOR_BTNFACE))); return TRUE; } @@ -326,7 +316,7 @@ bool wxNotebook::DeletePage(int nPage) TabCtrl_DeleteItem(m_hwnd, nPage); delete m_pages[nPage]; - m_pages.Remove(nPage); + m_pages.RemoveAt(nPage); if ( m_pages.IsEmpty() ) { // no selection if the notebook became empty @@ -342,13 +332,12 @@ bool wxNotebook::DeletePage(int nPage) // remove one page from the notebook, without deleting wxNotebookPage *wxNotebook::DoRemovePage(int nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), NULL, wxT("notebook page out of range") ); + wxNotebookPage *pageRemoved = wxNotebookBase::DoRemovePage(nPage); + if ( !pageRemoved ) + return NULL; TabCtrl_DeleteItem(m_hwnd, nPage); - wxNotebookPage *pageRemoved = m_pages[nPage]; - m_pages.Remove(nPage); - if ( m_pages.IsEmpty() ) m_nSelection = -1; else