2004-10-19 09:40:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-01-18 16:14:27 -05:00
|
|
|
// Name: wx/palmos/notebook.h
|
2005-01-13 15:30:21 -05:00
|
|
|
// Purpose: notebook interface (a.k.a. property sheet)
|
2005-01-18 16:14:27 -05:00
|
|
|
// Author: William Osborne - minimal working wxPalmOS port
|
2004-10-19 09:40:30 -04:00
|
|
|
// Modified by:
|
|
|
|
// Created: 10/13/04
|
2005-01-18 16:14:27 -05:00
|
|
|
// RCS-ID: $Id$
|
2004-10-19 09:40:30 -04:00
|
|
|
// Copyright: (c) William Osborne
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _NOTEBOOK_H
|
|
|
|
#define _NOTEBOOK_H
|
|
|
|
|
|
|
|
#if wxUSE_NOTEBOOK
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "wx/control.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxNotebook
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxNotebookPageInfo : public wxObject
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
|
|
|
public :
|
|
|
|
wxNotebookPageInfo() { m_page = NULL ; m_imageId = -1 ; m_selected = false ; }
|
|
|
|
virtual ~wxNotebookPageInfo() { }
|
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId )
|
2004-10-19 09:40:30 -04:00
|
|
|
{ m_page = page ; m_text = text ; m_selected = selected ; m_imageId = imageId ; }
|
|
|
|
wxNotebookPage* GetPage() const { return m_page ; }
|
|
|
|
wxString GetText() const { return m_text ; }
|
|
|
|
bool GetSelected() const { return m_selected ; }
|
|
|
|
int GetImageId() const { return m_imageId; }
|
|
|
|
private :
|
|
|
|
wxNotebookPage *m_page ;
|
|
|
|
wxString m_text ;
|
|
|
|
bool m_selected ;
|
|
|
|
int m_imageId ;
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) ;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
|
2004-10-19 09:40:30 -04:00
|
|
|
{
|
|
|
|
public:
|
2005-01-13 15:30:21 -05:00
|
|
|
// ctors
|
|
|
|
// -----
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// default for dynamic class
|
2005-01-13 15:30:21 -05:00
|
|
|
wxNotebook();
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// the same arguments as for wxControl (@@@ any special styles?)
|
2005-01-13 15:30:21 -05:00
|
|
|
wxNotebook(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxNotebookNameStr);
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// Create() function
|
2005-01-13 15:30:21 -05:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxString& name = wxNotebookNameStr);
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// ---------
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// get number of pages in the dialog
|
2005-01-13 15:30:21 -05:00
|
|
|
virtual size_t GetPageCount() const;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// 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
|
2005-01-13 15:30:21 -05:00
|
|
|
int SetSelection(size_t nPage);
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// get the currently selected page
|
2005-01-13 15:30:21 -05:00
|
|
|
int GetSelection() const { return m_nSelection; }
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2006-10-08 13:37:23 -04:00
|
|
|
// changes the selected page without sending events
|
|
|
|
int ChangeSelection(size_t nPage);
|
|
|
|
|
2004-10-19 09:40:30 -04:00
|
|
|
// set/get the title of a page
|
2005-01-13 15:30:21 -05:00
|
|
|
bool SetPageText(size_t nPage, const wxString& strText);
|
|
|
|
wxString GetPageText(size_t 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
|
2004-10-19 09:40:30 -04:00
|
|
|
// associate image list with a control
|
2005-01-13 15:30:21 -05:00
|
|
|
void SetImageList(wxImageList* imageList);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// sets/returns item's image index in the current image list
|
2005-01-13 15:30:21 -05:00
|
|
|
int GetPageImage(size_t nPage) const;
|
|
|
|
bool SetPageImage(size_t nPage, int nImage);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// currently it's always 1 because wxGTK doesn't support multi-row
|
|
|
|
// tab controls
|
2005-01-13 15:30:21 -05:00
|
|
|
int GetRowCount() const;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// control the appearance of the notebook pages
|
2004-10-19 09:40:30 -04:00
|
|
|
// set the size (the same for all pages)
|
2005-01-13 15:30:21 -05:00
|
|
|
void SetPageSize(const wxSize& size);
|
2004-10-19 09:40:30 -04:00
|
|
|
// set the padding between tabs (in pixels)
|
2005-01-13 15:30:21 -05:00
|
|
|
void SetPadding(const wxSize& padding);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// operations
|
|
|
|
// ----------
|
2004-10-19 09:40:30 -04:00
|
|
|
// remove all pages
|
2005-01-13 15:30:21 -05:00
|
|
|
bool DeleteAllPages();
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// inserts a new page to the notebook (it will be deleted ny the notebook,
|
|
|
|
// don't delete it yourself). If bSelect, this page becomes active.
|
2005-01-13 15:30:21 -05:00
|
|
|
bool InsertPage(size_t nPage,
|
|
|
|
wxNotebookPage *pPage,
|
|
|
|
const wxString& strText,
|
|
|
|
bool bSelect = false,
|
|
|
|
int imageId = -1);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
|
|
|
|
const wxNotebookPageInfoList& GetPageInfos() const ;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
|
|
|
|
// style.
|
2005-01-13 15:30:21 -05:00
|
|
|
void SetTabSize(const wxSize& sz);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// hit test
|
2005-01-13 15:30:21 -05:00
|
|
|
virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
// calculate the size of the notebook from the size of its page
|
2005-01-13 15:30:21 -05:00
|
|
|
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// callbacks
|
|
|
|
// ---------
|
|
|
|
void OnSize(wxSizeEvent& event);
|
2008-08-01 09:46:46 -04:00
|
|
|
void OnSelChange(wxBookCtrlEvent& event);
|
2005-01-13 15:30:21 -05:00
|
|
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// base class virtuals
|
|
|
|
// -------------------
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
#if wxUSE_CONSTRAINTS
|
2005-01-13 15:30:21 -05:00
|
|
|
virtual void SetConstraintSizes(bool recurse = true);
|
|
|
|
virtual bool DoPhase(int nPhase);
|
2004-10-19 09:40:30 -04:00
|
|
|
#endif // wxUSE_CONSTRAINTS
|
|
|
|
|
|
|
|
protected:
|
2005-01-13 15:30:21 -05:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// remove one page from the notebook, without deleting
|
|
|
|
virtual wxNotebookPage *DoRemovePage(size_t nPage);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// set the size of the given page to fit in the notebook
|
|
|
|
void AdjustPageSize(wxNotebookPage *page);
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
// the current selection (-1 if none)
|
|
|
|
int m_nSelection;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
wxNotebookPageInfoList m_pageInfos ;
|
2004-10-19 09:40:30 -04:00
|
|
|
|
|
|
|
|
2005-01-13 15:30:21 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
|
|
|
|
DECLARE_EVENT_TABLE()
|
2004-10-19 09:40:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_NOTEBOOK
|
|
|
|
|
|
|
|
#endif // _NOTEBOOK_H
|