///////////////////////////////////////////////////////////////////////////////
-// Name: notebook.cpp
-// Purpose: implementation of wxNotebook
+// Name: src/generic/notebook.cpp
+// Purpose: generic implementation of wxNotebook
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// headers
// ----------------------------------------------------------------------------
-#ifndef __PALMOS__
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "notebook.h"
+#ifdef __BORLANDC__
+ #pragma hdrstop
#endif
-#ifdef __VMS
-#pragma message disable unscomzer
-#endif
+#if wxUSE_NOTEBOOK
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
+#include "wx/notebook.h"
-#ifdef __BORLANDC__
-#pragma hdrstop
+#ifndef WX_PRECOMP
+ #include "wx/string.h"
+ #include "wx/log.h"
#endif
-#include "wx/string.h"
-#include "wx/log.h"
#include "wx/settings.h"
#include "wx/generic/imaglist.h"
-#include "wx/notebook.h"
#include "wx/dcclient.h"
#include "wx/generic/tabg.h"
// ----------------------------------------------------------------------------
// check that the page index is valid
-#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
+#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
// ----------------------------------------------------------------------------
// event table
{
DECLARE_DYNAMIC_CLASS(wxNotebookTabView)
public:
- wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR);
- ~wxNotebookTabView(void);
+ wxNotebookTabView(wxNotebook* notebook, long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR);
+ ~wxNotebookTabView(void);
- // Called when a tab is activated
- virtual void OnTabActivate(int activateId, int deactivateId);
- // Allows vetoing
- virtual bool OnTabPreActivate(int activateId, int deactivateId);
+ // Called when a tab is activated
+ virtual void OnTabActivate(int activateId, int deactivateId);
+ // Allows vetoing
+ virtual bool OnTabPreActivate(int activateId, int deactivateId);
protected:
- wxNotebook* m_notebook;
+ wxNotebook* m_notebook;
};
// ----------------------------------------------------------------------------
return wxEmptyString;
}
-int wxNotebook::GetPageImage(size_t nPage) const
+int wxNotebook::GetPageImage(size_t WXUNUSED_UNLESS_DEBUG(nPage)) const
{
wxASSERT( IS_VALID_PAGE(nPage) );
return 0;
}
-bool wxNotebook::SetPageImage(size_t nPage, int nImage)
+bool wxNotebook::SetPageImage(size_t WXUNUSED_UNLESS_DEBUG(nPage),
+ int WXUNUSED(nImage))
{
wxASSERT( IS_VALID_PAGE(nPage) );
}
// set the size (the same for all pages)
-void wxNotebook::SetPageSize(const wxSize& size)
+void wxNotebook::SetPageSize(const wxSize& WXUNUSED(size))
{
// TODO
}
// set the padding between tabs (in pixels)
-void wxNotebook::SetPadding(const wxSize& padding)
+void wxNotebook::SetPadding(const wxSize& WXUNUSED(padding))
{
// TODO
}
// set the size of the tabs for wxNB_FIXEDWIDTH controls
-void wxNotebook::SetTabSize(const wxSize& sz)
+void wxNotebook::SetTabSize(const wxSize& WXUNUSED(sz))
{
// TODO
}
if (m_pages.GetCount() == 0)
{
- m_nSelection = -1;
- m_tabView->SetTabSelection(-1, false);
+ m_nSelection = -1;
+ m_tabView->SetTabSelection(-1, false);
}
else if (m_nSelection > -1)
{
- m_nSelection = -1;
+ m_nSelection = -1;
- m_tabView->SetTabSelection((int) (long) GetPage(0), false);
+ m_tabView->SetTabSelection((int) (long) GetPage(0), false);
- if (m_nSelection != 0)
- ChangePage(-1, 0);
+ if (m_nSelection != 0)
+ ChangePage(-1, 0);
}
RefreshLayout(false);
// remove one page from the notebook
wxWindow* wxNotebook::DoRemovePage(size_t nPage)
{
- wxCHECK( IS_VALID_PAGE(nPage), false );
+ wxCHECK( IS_VALID_PAGE(nPage), NULL );
m_pages[nPage]->Show(false);
// m_pages[nPage]->Lower();
wxNotebookPage *pPage,
const wxString& strText,
bool bSelect,
- int imageId)
+ int WXUNUSED(imageId))
{
wxASSERT( pPage != NULL );
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), false );
m_tabView->Draw(dc);
}
+wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
+{
+ // MBN: since the total tab height is really a function of the
+ // width, this should really call
+ // GetTotalTabHeightPretendingWidthIs(), but the current
+ // implementation will suffice, provided the wxNotebook has been
+ // created with a sensible initial width.
+ return wxSize( sizePage.x + 12,
+ sizePage.y + m_tabView->GetTotalTabHeight() + 6 + 4 );
+}
+
wxRect wxNotebook::GetAvailableClientSize()
{
int cw, ch;
return retval;
}
-#endif // __PALMOS__
+#endif // wxUSE_NOTEBOOK