X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/21323df7fe84193504be91f0ee20a869707e8412..ba75c6bb8c85705aca6b46871e0fc6548f15a73d:/src/os2/notebook.cpp diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp index af5ac8b27e..f792c76a60 100644 --- a/src/os2/notebook.cpp +++ b/src/os2/notebook.cpp @@ -14,9 +14,10 @@ #if wxUSE_NOTEBOOK -// wxWindows +// wxWidgets #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/dcclient.h" #include "wx/string.h" #include "wx/settings.h" #endif // WX_PRECOMP @@ -157,7 +158,7 @@ WXDWORD wxNotebook::OS2GetStyle ( ,pdwExstyle ); - dwTabStyle |= WS_TABSTOP | BKS_SOLIDBIND | BKS_ROUNDEDTABS | BKS_TABTEXTCENTER; + dwTabStyle |= WS_TABSTOP | BKS_SOLIDBIND | BKS_ROUNDEDTABS | BKS_TABTEXTCENTER | BKS_TABBEDDIALOG; if (lStyle & wxNB_BOTTOM) dwTabStyle |= BKS_MAJORTABBOTTOM | BKS_BACKPAGESBL; @@ -188,9 +189,6 @@ WXDWORD wxNotebook::OS2GetStyle ( size_t wxNotebook::GetPageCount() const { - int nPageInternal = m_pages.Count(); - int nPageAPI = (int)::WinSendMsg(GetHWND(), BKM_QUERYPAGECOUNT, (MPARAM)0, (MPARAM)BKA_END); - // // Consistency check // @@ -208,12 +206,12 @@ int wxNotebook::GetRowCount() const } // end of wxNotebook::GetRowCount int wxNotebook::SetSelection( - int nPage + size_t nPage ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); - if (nPage != m_nSelection) + if (nPage != (size_t)m_nSelection) { wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING ,m_windowId @@ -231,8 +229,6 @@ int wxNotebook::SetSelection( vEvent.SetEventType(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED); GetEventHandler()->ProcessEvent(vEvent); - ULONG ulPageId = (ULONG)m_alPageId[nPage]; - ::WinSendMsg( GetHWND() ,BKM_TURNTOPAGE ,MPFROMLONG((ULONG)m_alPageId[nPage]) @@ -245,15 +241,11 @@ int wxNotebook::SetSelection( } // end of wxNotebook::SetSelection bool wxNotebook::SetPageText( - int nPage + size_t nPage , const wxString& rsStrText ) { wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") ); - - - ULONG ulPageId = (ULONG)m_alPageId[nPage]; - return (bool)::WinSendMsg( m_hWnd ,BKM_SETTABTEXT ,MPFROMLONG((ULONG)m_alPageId[nPage]) @@ -262,7 +254,7 @@ bool wxNotebook::SetPageText( } // end of wxNotebook::SetPageText wxString wxNotebook::GetPageText ( - int nPage + size_t nPage ) const { BOOKTEXT vBookText; @@ -272,9 +264,6 @@ wxString wxNotebook::GetPageText ( wxCHECK_MSG( IS_VALID_PAGE(nPage), wxT(""), wxT("notebook page out of range") ); - - ULONG ulPageId = (ULONG)m_alPageId[nPage]; - memset(&vBookText, '\0', sizeof(BOOKTEXT)); vBookText.textLen = 0; // This will get the length ulRc = LONGFROMMR(::WinSendMsg( m_hWnd @@ -282,9 +271,9 @@ wxString wxNotebook::GetPageText ( ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,MPFROMP(&vBookText) )); - if (ulRc == BOOKERR_INVALID_PARAMETERS || ulRc == 0L) + if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L) { - if (ulRc == BOOKERR_INVALID_PARAMETERS) + if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS) { wxLogError(wxT("Invalid Page Id for page text querry.")); } @@ -301,7 +290,7 @@ wxString wxNotebook::GetPageText ( ,MPFROMLONG((ULONG)m_alPageId[nPage]) ,MPFROMP(&vBookText) )); - if (ulRc == BOOKERR_INVALID_PARAMETERS || ulRc == 0L) + if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L) { return wxEmptyString; } @@ -314,7 +303,7 @@ wxString wxNotebook::GetPageText ( } // end of wxNotebook::GetPageText int wxNotebook::GetPageImage ( - int nPage + size_t nPage ) const { wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, wxT("notebook page out of range") ); @@ -326,29 +315,28 @@ int wxNotebook::GetPageImage ( } // end of wxNotebook::GetPageImage bool wxNotebook::SetPageImage ( - int nPage + size_t nPage , int nImage ) { - wxBitmap* pBitmap = (wxBitmap*)m_imageList->GetBitmap(nImage); - - - ULONG ulPageId = (ULONG)m_alPageId[nPage]; + wxBitmap vBitmap = (wxBitmap)m_imageList->GetBitmap(nImage); return (bool)::WinSendMsg( GetHWND() ,BKM_SETTABBITMAP ,MPFROMLONG((ULONG)m_alPageId[nPage]) - ,(MPARAM)pBitmap->GetHBITMAP() + ,(MPARAM)vBitmap.GetHBITMAP() ); } // end of wxNotebook::SetPageImage void wxNotebook::SetImageList ( - wxImageList* WXUNUSED(pImageList) + wxImageList* pImageList ) { - // - // Does nothing under OS/2 - // + // + // Does not really do anything yet, but at least we need to + // update the base class. + // + wxNotebookBase::SetImageList(pImageList); } // end of wxNotebook::SetImageList // ---------------------------------------------------------------------------- @@ -358,22 +346,7 @@ void wxNotebook::SetPageSize ( const wxSize& rSize ) { - RECTL vRect; - - // - // Transform the page size into the notebook size - // - vRect.xLeft = vRect.yTop = 0; - vRect.xRight = rSize.x; - vRect.yBottom = rSize.y; - - - // - // And now set it - // - SetSize( vRect.xRight - vRect.xLeft - ,vRect.yBottom - vRect.yTop - ); + SetSize(rSize); } // end of wxNotebook::SetPageSize void wxNotebook::SetPadding ( @@ -406,7 +379,7 @@ void wxNotebook::SetTabSize ( // Remove one page from the notebook, without deleting // wxNotebookPage* wxNotebook::DoRemovePage ( - int nPage + size_t nPage ) { wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage); @@ -414,9 +387,6 @@ wxNotebookPage* wxNotebook::DoRemovePage ( if (!pPageRemoved) return NULL; - - ULONG ulPageId = (ULONG)m_alPageId[nPage]; - ::WinSendMsg( GetHWND() ,BKM_DELETEPAGE ,MPFROMLONG((ULONG)m_alPageId[nPage]) @@ -436,14 +406,14 @@ wxNotebookPage* wxNotebook::DoRemovePage ( // int nSelNew; - if (m_nSelection == GetPageCount()) + if (m_nSelection == (int)GetPageCount()) { // // Last page deleted, make the new last page the new selection // nSelNew = m_nSelection - 1; } - else if (nPage <= m_nSelection) + else if (nPage <= (size_t)m_nSelection) { // // We must show another page, even if it has the same index @@ -518,7 +488,7 @@ bool wxNotebook::AddPage ( // Same as AddPage() but does it at given position // bool wxNotebook::InsertPage ( - int nPage + size_t nPage , wxNotebookPage* pPage , const wxString& rsStrText , bool bSelect @@ -593,7 +563,7 @@ bool wxNotebook::InsertPage ( // If the inserted page is before the selected one, we must update the // index of the selected page // - if (nPage <= m_nSelection) + if (nPage <= (size_t)m_nSelection) { // // One extra page added @@ -621,7 +591,7 @@ bool wxNotebook::InsertPage ( vDC.GetTextExtent(rsStrText, &nTextX, &nTextY); nTextY *= 2; - nTextX *= 1.3; + nTextX = (wxCoord)(nTextX * 1.3); if (nTextX > m_nTabSize) { m_nTabSize = nTextX; @@ -686,6 +656,9 @@ bool wxNotebook::InsertPage ( if (nSelNew != -1) SetSelection(nSelNew); + + InvalidateBestSize(); + return TRUE; } // end of wxNotebook::InsertPage @@ -696,20 +669,6 @@ void wxNotebook::OnSize( wxSizeEvent& rEvent ) { - int nPage; - int nCount = (int)m_pages.Count(); - - for (nPage = 0; nPage < nCount; nPage++) - { - if (m_nSelection == nPage) - m_pages[nPage]->Refresh(); - else - ::WinSetWindowPos(m_pages[nPage]->GetHWND() - ,NULLHANDLE - ,0,0,0,0 - ,SWP_HIDE - ); - } rEvent.Skip(); } // end of wxNotebook::OnSize @@ -729,7 +688,7 @@ void wxNotebook::OnSelChange ( for (nSel = 0; nSel < nPageCount; nSel++) { - if (ulOS2Sel == m_alPageId[nSel]) + if (ulOS2Sel == (ULONG)m_alPageId[nSel]) { bFound = TRUE; break; @@ -747,7 +706,7 @@ void wxNotebook::OnSelChange ( for (nSel = 0; nSel < nPageCount; nSel++) { - if (ulOS2Sel == m_alPageId[nSel]) + if (ulOS2Sel == (ULONG)m_alPageId[nSel]) { bFound = TRUE; break;