+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// Name: notebook.h
-// Purpose: wxNotebook class (a.k.a. property sheet, tabbed dialog)
-// Author: Julian Smart
-// Modified by:
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_NOTEBOOK_H_
-#define _WX_NOTEBOOK_H_
-
-#ifdef __GNUG__
-#pragma interface "notebook.h"
-#endif
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-#include "wx/dynarray.h"
-#include "wx/event.h"
-#include "wx/control.h"
-#include "wx/generic/tabg.h"
-
-// ----------------------------------------------------------------------------
-// types
-// ----------------------------------------------------------------------------
-
-// fwd declarations
-class WXDLLEXPORT wxImageList;
-class WXDLLEXPORT wxWindow;
-
-// array of notebook pages
-typedef wxWindow wxNotebookPage; // so far, any window can be a page
-WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayPages);
-
-// ----------------------------------------------------------------------------
-// notebook events
-// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxNotebookEvent : public wxCommandEvent
-{
-public:
- wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
- int nSel = -1, int nOldSel = -1)
- : wxCommandEvent(commandType, id) { m_nSel = nSel; m_nOldSel = nOldSel; }
-
- // accessors
- int GetSelection() const { return m_nSel; }
- int GetOldSelection() const { return m_nOldSel; }
-
- void SetSelection(int sel) { m_nSel = sel; }
- void SetOldSelection(int oldSel) { m_nOldSel = oldSel; }
-
-private:
- int m_nSel, // currently selected page
- m_nOldSel; // previously selected page
-
- DECLARE_DYNAMIC_CLASS(wxNotebookEvent)
-};
-
-// ----------------------------------------------------------------------------
-// wxNotebook
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxNotebook;
-
-// This reuses wxTabView to draw the tabs.
-class WXDLLEXPORT wxNotebookTabView: public wxTabView
-{
-DECLARE_DYNAMIC_CLASS(wxNotebookTabView)
-public:
- 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);
-
-protected:
- wxNotebook* m_notebook;
-};
-
-class wxNotebook : public wxControl
-{
-public:
- // ctors
- // -----
- // default for dynamic class
- wxNotebook();
- // the same arguments as for wxControl (@@@ any special styles?)
- wxNotebook(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = "notebook");
- // Create() function
- bool Create(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = 0,
- const wxString& name = "notebook");
- // dtor
- ~wxNotebook();
-
- // accessors
- // ---------
- // get number of pages in the dialog
- int GetPageCount() const;
-
- // Find the position of the wxNotebookPage, -1 if not found.
- int FindPagePosition(wxNotebookPage* page) const;
-
- // set the currently selected page, return the index of the previously
- // selected one (or -1 on error)
- // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
- int SetSelection(int nPage);
- // cycle thru the tabs
- void AdvanceSelection(bool bForward = TRUE);
- // get the currently selected page
- int GetSelection() const { return m_nSelection; }
-
- // set/get the title of a page
- bool SetPageText(int nPage, const wxString& strText);
- wxString GetPageText(int nPage) const;
-
- // image list stuff: each page may have an image associated with it. All
- // the images belong to an image list, so you have to
- // 1) create an image list
- // 2) associate it with the notebook
- // 3) set for each page it's image
- // associate image list with a control
- void SetImageList(wxImageList* imageList);
- // get pointer (may be NULL) to the associated image list
- wxImageList* GetImageList() const { return m_pImageList; }
-
- // sets/returns item's image index in the current image list
- int GetPageImage(int nPage) const;
- bool SetPageImage(int nPage, int nImage);
-
- // currently it's always 1 because wxGTK doesn't support multi-row
- // tab controls
- int GetRowCount() const;
-
- // control the appearance of the notebook pages
- // set the size (the same for all pages)
- void SetPageSize(const wxSize& size);
- // set the padding between tabs (in pixels)
- void SetPadding(const wxSize& padding);
-
- // operations
- // ----------
- // remove one page from the notebook, and delete the page.
- bool DeletePage(int nPage);
- bool DeletePage(wxNotebookPage* page);
- // remove one page from the notebook, without deleting the page.
- bool RemovePage(int nPage);
- bool RemovePage(wxNotebookPage* page);
- // remove all pages
- bool DeleteAllPages();
- // adds a new page to the notebook (it will be deleted ny the notebook,
- // don't delete it yourself). If bSelect, this page becomes active.
- bool AddPage(wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect = FALSE,
- int imageId = -1);
- // the same as AddPage(), but adds it at the specified position
- bool InsertPage(int nPage,
- wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect = FALSE,
- int imageId = -1);
- // get the panel which represents the given page
- wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
-
- // callbacks
- // ---------
- void OnSize(wxSizeEvent& event);
- void OnIdle(wxIdleEvent& event);
- void OnSelChange(wxNotebookEvent& event);
- void OnSetFocus(wxFocusEvent& event);
- void OnNavigationKey(wxNavigationKeyEvent& event);
-
- // base class virtuals
- // -------------------
- virtual void Command(wxCommandEvent& event);
- virtual void SetConstraintSizes(bool recurse = TRUE);
- virtual bool DoPhase(int nPhase);
-
-// Implementation
-
- // wxNotebook on Motif uses a generic wxTabView to implement itself.
- inline wxTabView *GetTabView() const { return m_tabView; }
- inline void SetTabView(wxTabView *v) { m_tabView = v; }
-
- void OnMouseEvent(wxMouseEvent& event);
- void OnPaint(wxPaintEvent& event);
-
- virtual void ChangeFont(bool keepOriginalSize = TRUE);
- virtual void ChangeBackgroundColour();
- virtual void ChangeForegroundColour();
- virtual wxRect GetAvailableClientSize();
-
- // Implementation: calculate the layout of the view rect
- // and resize the children if required
- bool RefreshLayout(bool force = TRUE);
-
-protected:
- // common part of all ctors
- void Init();
-
- // helper functions
- void ChangePage(int nOldSel, int nSel); // change pages
-
- wxImageList *m_pImageList; // we can have an associated image list
- wxArrayPages m_aPages; // array of pages
-
- int m_nSelection; // the current selection (-1 if none)
-
- wxTabView* m_tabView;
-
- DECLARE_DYNAMIC_CLASS(wxNotebook)
- DECLARE_EVENT_TABLE()
-};
-
-// ----------------------------------------------------------------------------
-// event macros
-// ----------------------------------------------------------------------------
-typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
-
-#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
- { \
- wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
- id, \
- -1, \
- (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
- NULL \
- },
-
-#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
- { \
- wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \ \
- id, \
- -1, \
- (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
- NULL \
- },
-
-#endif // _WX_NOTEBOOK_H_
+++ /dev/null
-///////////////////////////////////////////////////////////////////////////////
-// Name: notebook.cpp
-// Purpose: implementation of wxNotebook
-// Author: Julian Smart
-// Modified by:
-// Created: 17/09/98
-// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
-///////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-#ifdef __GNUG__
-#pragma implementation "notebook.h"
-#endif
-
-#include <wx/string.h>
-#include <wx/log.h>
-#include <wx/imaglist.h>
-#include <wx/notebook.h>
-#include <wx/dcclient.h>
-
-#include <Xm/Xm.h>
-#include <wx/motif/private.h>
-
-// ----------------------------------------------------------------------------
-// macros
-// ----------------------------------------------------------------------------
-
-// check that the page index is valid
-#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
-
-// ----------------------------------------------------------------------------
-// event table
-// ----------------------------------------------------------------------------
-
-#if !USE_SHARED_LIBRARIES
-BEGIN_EVENT_TABLE(wxNotebook, wxControl)
- EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
- EVT_SIZE(wxNotebook::OnSize)
- EVT_PAINT(wxNotebook::OnPaint)
- EVT_MOUSE_EVENTS(wxNotebook::OnMouseEvent)
- EVT_SET_FOCUS(wxNotebook::OnSetFocus)
- EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
- EVT_IDLE(wxNotebook::OnIdle)
-END_EVENT_TABLE()
-
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
-#endif
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// wxNotebook construction
-// ----------------------------------------------------------------------------
-
-// common part of all ctors
-void wxNotebook::Init()
-{
- m_tabView = (wxNotebookTabView*) NULL;
- m_pImageList = NULL;
- m_nSelection = -1;
-}
-
-// default for dynamic class
-wxNotebook::wxNotebook()
-{
- Init();
-}
-
-// the same arguments as for wxControl
-wxNotebook::wxNotebook(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- long style,
- const wxString& name)
-{
- Init();
-
- Create(parent, id, pos, size, style, name);
-}
-
-// Create() function
-bool wxNotebook::Create(wxWindow *parent,
- wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- long style,
- const wxString& name)
-{
- // base init
- SetName(name);
-
- m_windowId = id == -1 ? NewControlId() : id;
-
- // It's like a normal window...
- if (!wxWindow::Create(parent, id, pos, size, style, name))
- return FALSE;
-
- SetTabView(new wxNotebookTabView(this));
-
- return TRUE;
-}
-
-// dtor
-wxNotebook::~wxNotebook()
-{
- delete m_tabView;
-}
-
-// ----------------------------------------------------------------------------
-// wxNotebook accessors
-// ----------------------------------------------------------------------------
-int wxNotebook::GetPageCount() const
-{
- return m_aPages.Count();
-}
-
-int wxNotebook::GetRowCount() const
-{
- // TODO
- return 0;
-}
-
-int wxNotebook::SetSelection(int nPage)
-{
- if (nPage == -1)
- return 0;
-
- wxASSERT( IS_VALID_PAGE(nPage) );
-
- wxNotebookPage* pPage = GetPage(nPage);
-
- m_tabView->SetTabSelection((int) (long) pPage);
-
- // TODO
- return 0;
-}
-
-void wxNotebook::AdvanceSelection(bool bForward)
-{
- int nSel = GetSelection();
- int nMax = GetPageCount() - 1;
- if ( bForward )
- SetSelection(nSel == nMax ? 0 : nSel + 1);
- else
- SetSelection(nSel == 0 ? nMax : nSel - 1);
-}
-
-bool wxNotebook::SetPageText(int nPage, const wxString& strText)
-{
- wxASSERT( IS_VALID_PAGE(nPage) );
-
- wxNotebookPage* page = GetPage(nPage);
- if (page)
- {
- m_tabView->SetTabText((int) (long) page, strText);
- Refresh();
- return TRUE;
- }
-
- return FALSE;
-}
-
-wxString wxNotebook::GetPageText(int nPage) const
-{
- wxASSERT( IS_VALID_PAGE(nPage) );
-
- wxNotebookPage* page = ((wxNotebook*)this)->GetPage(nPage);
- if (page)
- return m_tabView->GetTabText((int) (long) page);
- else
- return wxEmptyString;
-}
-
-int wxNotebook::GetPageImage(int nPage) const
-{
- wxASSERT( IS_VALID_PAGE(nPage) );
-
- // TODO
- return 0;
-}
-
-bool wxNotebook::SetPageImage(int nPage, int nImage)
-{
- wxASSERT( IS_VALID_PAGE(nPage) );
-
- // TODO
- return FALSE;
-}
-
-void wxNotebook::SetImageList(wxImageList* imageList)
-{
- m_pImageList = imageList;
- // TODO
-}
-
-// ----------------------------------------------------------------------------
-// wxNotebook operations
-// ----------------------------------------------------------------------------
-
-// remove one page from the notebook and delete it
-bool wxNotebook::DeletePage(int nPage)
-{
- wxCHECK( IS_VALID_PAGE(nPage), FALSE );
-
- if (m_nSelection != -1)
- {
- m_aPages[m_nSelection]->Show(FALSE);
- m_aPages[m_nSelection]->Lower();
- }
-
- wxNotebookPage* pPage = GetPage(nPage);
- m_tabView->RemoveTab((int) (long) pPage);
-
- delete m_aPages[nPage];
- m_aPages.Remove(nPage);
-
- if (m_aPages.GetCount() == 0)
- {
- m_nSelection = -1;
- m_tabView->SetTabSelection(-1, FALSE);
- }
- else if (m_nSelection > -1)
- {
- m_nSelection = -1;
- m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
- if (m_nSelection != 0)
- ChangePage(-1, 0);
- }
-
- RefreshLayout(FALSE);
-
- return TRUE;
-}
-
-bool wxNotebook::DeletePage(wxNotebookPage* page)
-{
- int pagePos = FindPagePosition(page);
- if (pagePos > -1)
- return DeletePage(pagePos);
- else
- return FALSE;
-}
-
-// remove one page from the notebook
-bool wxNotebook::RemovePage(int nPage)
-{
- wxCHECK( IS_VALID_PAGE(nPage), FALSE );
-
- m_aPages[nPage]->Show(FALSE);
- // m_aPages[nPage]->Lower();
-
- wxNotebookPage* pPage = GetPage(nPage);
- m_tabView->RemoveTab((int) (long) pPage);
-
- m_aPages.Remove(nPage);
-
- if (m_aPages.GetCount() == 0)
- {
- m_nSelection = -1;
- m_tabView->SetTabSelection(-1, TRUE);
- }
- else if (m_nSelection > -1)
- {
- // Only change the selection if the page we
- // deleted was the selection.
- if (nPage == m_nSelection)
- {
- m_nSelection = -1;
- // Select the first tab. Generates a ChangePage.
- m_tabView->SetTabSelection((int) (long) GetPage(0), TRUE);
- }
- else
- {
- // We must adjust which tab we think is selected.
- // If greater than the page we deleted, it must be moved down
- // a notch.
- if (m_nSelection > nPage)
- m_nSelection -- ;
- }
- }
-
- RefreshLayout(FALSE);
-
- return TRUE;
-}
-
-bool wxNotebook::RemovePage(wxNotebookPage* page)
-{
- int pagePos = FindPagePosition(page);
- if (pagePos > -1)
- return RemovePage(pagePos);
- else
- return FALSE;
-}
-
-// Find the position of the wxNotebookPage, -1 if not found.
-int wxNotebook::FindPagePosition(wxNotebookPage* page) const
-{
- int nPageCount = GetPageCount();
- int nPage;
- for ( nPage = 0; nPage < nPageCount; nPage++ )
- if (m_aPages[nPage] == page)
- return nPage;
- return -1;
-}
-
-// remove all pages
-bool wxNotebook::DeleteAllPages()
-{
- m_tabView->ClearTabs(TRUE);
-
- int nPageCount = GetPageCount();
- int nPage;
- for ( nPage = 0; nPage < nPageCount; nPage++ )
- delete m_aPages[nPage];
-
- m_aPages.Clear();
-
- return TRUE;
-}
-
-// add a page to the notebook
-bool wxNotebook::AddPage(wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect,
- int imageId)
-{
- return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
-}
-
-// same as AddPage() but does it at given position
-bool wxNotebook::InsertPage(int nPage,
- wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect,
- int imageId)
-{
- wxASSERT( pPage != NULL );
- wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
-
- m_tabView->AddTab((int) (long) pPage, strText);
- if (!bSelect)
- pPage->Show(FALSE);
-
- // save the pointer to the page
- m_aPages.Insert(pPage, nPage);
-
- if (bSelect)
- {
- // This will cause ChangePage to be called, via OnSelPage
- m_tabView->SetTabSelection((int) (long) pPage, TRUE);
- }
-
- // some page must be selected: either this one or the first one if there is
- // still no selection
- if ( m_nSelection == -1 )
- ChangePage(-1, 0);
-
- RefreshLayout(FALSE);
-
- return TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// wxNotebook callbacks
-// ----------------------------------------------------------------------------
-
-// @@@ OnSize() is used for setting the font when it's called for the first
-// time because doing it in ::Create() doesn't work (for unknown reasons)
-void wxNotebook::OnSize(wxSizeEvent& event)
-{
- static bool s_bFirstTime = TRUE;
- if ( s_bFirstTime ) {
- // TODO: any first-time-size processing.
- s_bFirstTime = FALSE;
- }
-
- RefreshLayout();
-
- // Processing continues to next OnSize
- event.Skip();
-}
-
-// This was supposed to cure the non-display of the notebook
-// until the user resizes the window.
-// What's going on?
-void wxNotebook::OnIdle(wxIdleEvent& event)
-{
- static bool s_bFirstTime = TRUE;
- if ( s_bFirstTime ) {
- /*
- wxSize sz(GetSize());
- sz.x ++;
- SetSize(sz);
- sz.x --;
- SetSize(sz);
- */
-
- /*
- wxSize sz(GetSize());
- wxSizeEvent sizeEvent(sz, GetId());
- sizeEvent.SetEventObject(this);
- GetEventHandler()->ProcessEvent(sizeEvent);
- Refresh();
- */
- s_bFirstTime = FALSE;
- }
- event.Skip();
-}
-
-// Implementation: calculate the layout of the view rect
-// and resize the children if required
-bool wxNotebook::RefreshLayout(bool force)
-{
- if (m_tabView)
- {
- wxRect oldRect = m_tabView->GetViewRect();
-
- int cw, ch;
- GetClientSize(& cw, & ch);
-
- int tabHeight = m_tabView->GetTotalTabHeight();
- wxRect rect;
- rect.x = 4;
- rect.y = tabHeight + 4;
- rect.width = cw - 8;
- rect.height = ch - 4 - rect.y ;
-
- m_tabView->SetViewRect(rect);
-
- m_tabView->Layout();
-
- // Need to do it a 2nd time to get the tab height with
- // the new view width, since changing the view width changes the
- // tab layout.
- tabHeight = m_tabView->GetTotalTabHeight();
- rect.x = 4;
- rect.y = tabHeight + 4;
- rect.width = cw - 8;
- rect.height = ch - 4 - rect.y ;
-
- m_tabView->SetViewRect(rect);
-
- m_tabView->Layout();
-
- if (!force && (rect == oldRect))
- return FALSE;
-
- // fit the notebook page to the tab control's display area
-
- unsigned int nCount = m_aPages.Count();
- for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
- wxNotebookPage *pPage = m_aPages[nPage];
- if (pPage->IsShown())
- {
- wxRect clientRect = GetAvailableClientSize();
- pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
- if ( pPage->GetAutoLayout() )
- pPage->Layout();
- }
- }
- Refresh();
- }
- return TRUE;
-}
-
-void wxNotebook::OnSelChange(wxNotebookEvent& event)
-{
- // is it our tab control?
- if ( event.GetEventObject() == this )
- {
- if (event.GetSelection() != m_nSelection)
- ChangePage(event.GetOldSelection(), event.GetSelection());
- }
-
- // we want to give others a chance to process this message as well
- event.Skip();
-}
-
-void wxNotebook::OnSetFocus(wxFocusEvent& event)
-{
- // set focus to the currently selected page if any
- if ( m_nSelection != -1 )
- m_aPages[m_nSelection]->SetFocus();
-
- event.Skip();
-}
-
-void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
-{
- if ( event.IsWindowChange() ) {
- // change pages
- AdvanceSelection(event.GetDirection());
- }
- else {
- // pass to the parent
- if ( GetParent() ) {
- event.SetCurrentFocus(this);
- GetParent()->ProcessEvent(event);
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// wxNotebook base class virtuals
-// ----------------------------------------------------------------------------
-
-// override these 2 functions to do nothing: everything is done in OnSize
-
-void wxNotebook::SetConstraintSizes(bool /* recurse */)
-{
- // don't set the sizes of the pages - their correct size is not yet known
- wxControl::SetConstraintSizes(FALSE);
-}
-
-bool wxNotebook::DoPhase(int /* nPhase */)
-{
- return TRUE;
-}
-
-void wxNotebook::Command(wxCommandEvent& event)
-{
- wxFAIL_MSG("wxNotebook::Command not implemented");
-}
-
-// ----------------------------------------------------------------------------
-// wxNotebook helper functions
-// ----------------------------------------------------------------------------
-
-// hide the currently active panel and show the new one
-void wxNotebook::ChangePage(int nOldSel, int nSel)
-{
- // cout << "ChangePage: " << nOldSel << ", " << nSel << "\n";
- wxASSERT( nOldSel != nSel ); // impossible
-
- if ( nOldSel != -1 ) {
- m_aPages[nOldSel]->Show(FALSE);
- m_aPages[nOldSel]->Lower();
- }
-
- wxNotebookPage *pPage = m_aPages[nSel];
-
- wxRect clientRect = GetAvailableClientSize();
- pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
-
- pPage->Show(TRUE);
- pPage->Raise();
- pPage->SetFocus();
-
- Refresh();
-
- m_nSelection = nSel;
-}
-
-void wxNotebook::ChangeFont(bool keepOriginalSize)
-{
- wxWindow::ChangeFont(keepOriginalSize);
-}
-
-void wxNotebook::ChangeBackgroundColour()
-{
- wxWindow::ChangeBackgroundColour();
-}
-
-void wxNotebook::ChangeForegroundColour()
-{
- wxWindow::ChangeForegroundColour();
-}
-
-void wxNotebook::OnMouseEvent(wxMouseEvent& event)
-{
- if (m_tabView)
- m_tabView->OnEvent(event);
-}
-
-void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event) )
-{
- wxPaintDC dc(this);
- if (m_tabView)
- m_tabView->Draw(dc);
-}
-
-wxRect wxNotebook::GetAvailableClientSize()
-{
- int cw, ch;
- GetClientSize(& cw, & ch);
-
- int tabHeight = m_tabView->GetTotalTabHeight();
-
- // TODO: these margins should be configurable.
- wxRect rect;
- rect.x = 6;
- rect.y = tabHeight + 6;
- rect.width = cw - 12;
- rect.height = ch - 4 - rect.y ;
-
- return rect;
-}
-
-/*
- * wxNotebookTabView
- */
-
-IMPLEMENT_CLASS(wxNotebookTabView, wxTabView)
-
-wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style): wxTabView(style)
-{
- m_notebook = notebook;
-
- m_notebook->SetTabView(this);
-
- SetWindow(m_notebook);
-}
-
-wxNotebookTabView::~wxNotebookTabView(void)
-{
-}
-
-// Called when a tab is activated
-void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
-{
- if (!m_notebook)
- return;
-
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
-
- // Translate from wxTabView's ids (which aren't position-dependent)
- // to wxNotebook's (which are).
- wxNotebookPage* pActive = (wxNotebookPage*) activateId;
- wxNotebookPage* pDeactive = (wxNotebookPage*) deactivateId;
-
- int activatePos = m_notebook->FindPagePosition(pActive);
- int deactivatePos = m_notebook->FindPagePosition(pDeactive);
-
- event.SetEventObject(m_notebook);
- event.SetSelection(activatePos);
- event.SetOldSelection(deactivatePos);
- m_notebook->GetEventHandler()->ProcessEvent(event);
-}
-
-