#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
// wxNotebook accessors
// ----------------------------------------------------------------------------
-int wxNotebook::GetPageCount() const
+size_t wxNotebook::GetPageCount() const
{
- int nPageInternal = m_pages.Count();
- int nPageAPI = (int)::WinSendMsg(GetHWND(), BKM_QUERYPAGECOUNT, (MPARAM)0, (MPARAM)BKA_END);
-
//
// Consistency check
//
} // 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
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])
} // 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])
} // end of wxNotebook::SetPageText
wxString wxNotebook::GetPageText (
- int nPage
+ size_t nPage
) const
{
BOOKTEXT vBookText;
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
,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."));
}
,MPFROMLONG((ULONG)m_alPageId[nPage])
,MPFROMP(&vBookText)
));
- if (ulRc == BOOKERR_INVALID_PARAMETERS || ulRc == 0L)
+ if (ulRc == (ULONG)BOOKERR_INVALID_PARAMETERS || ulRc == 0L)
{
return wxEmptyString;
}
} // 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") );
} // 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];
-
return (bool)::WinSendMsg( GetHWND()
,BKM_SETTABBITMAP
,MPFROMLONG((ULONG)m_alPageId[nPage])
} // 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
// ----------------------------------------------------------------------------
// Remove one page from the notebook, without deleting
//
wxNotebookPage* wxNotebook::DoRemovePage (
- int nPage
+ size_t nPage
)
{
wxNotebookPage* pPageRemoved = wxNotebookBase::DoRemovePage(nPage);
if (!pPageRemoved)
return NULL;
-
- ULONG ulPageId = (ULONG)m_alPageId[nPage];
-
::WinSendMsg( GetHWND()
,BKM_DELETEPAGE
,MPFROMLONG((ULONG)m_alPageId[nPage])
//
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
// Same as AddPage() but does it at given position
//
bool wxNotebook::InsertPage (
- int nPage
+ size_t nPage
, wxNotebookPage* pPage
, const wxString& rsStrText
, bool bSelect
// 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
vDC.GetTextExtent(rsStrText, &nTextX, &nTextY);
nTextY *= 2;
- nTextX *= 1.3;
+ nTextX = (wxCoord)(nTextX * 1.3);
if (nTextX > m_nTabSize)
{
m_nTabSize = nTextX;
for (nSel = 0; nSel < nPageCount; nSel++)
{
- if (ulOS2Sel == m_alPageId[nSel])
+ if (ulOS2Sel == (ULONG)m_alPageId[nSel])
{
bFound = TRUE;
break;
for (nSel = 0; nSel < nPageCount; nSel++)
{
- if (ulOS2Sel == m_alPageId[nSel])
+ if (ulOS2Sel == (ULONG)m_alPageId[nSel])
{
bFound = TRUE;
break;