]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/notebook.h
wxFrameNameStr was already delivered by #include one line earlier.
[wxWidgets.git] / include / wx / palmos / notebook.h
CommitLineData
ffecfa5a 1/////////////////////////////////////////////////////////////////////////////
e1d63b79 2// Name: wx/palmos/notebook.h
630ad6c6 3// Purpose: notebook interface (a.k.a. property sheet)
e1d63b79 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e1d63b79 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _NOTEBOOK_H
13#define _NOTEBOOK_H
14
ffecfa5a
JS
15#if wxUSE_NOTEBOOK
16
17// ----------------------------------------------------------------------------
18// headers
19// ----------------------------------------------------------------------------
20
21#include "wx/control.h"
22
23// ----------------------------------------------------------------------------
24// wxNotebook
25// ----------------------------------------------------------------------------
26
27class WXDLLEXPORT wxNotebookPageInfo : public wxObject
28{
29public :
30 wxNotebookPageInfo() { m_page = NULL ; m_imageId = -1 ; m_selected = false ; }
31 virtual ~wxNotebookPageInfo() { }
32
630ad6c6 33 void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId )
ffecfa5a
JS
34 { m_page = page ; m_text = text ; m_selected = selected ; m_imageId = imageId ; }
35 wxNotebookPage* GetPage() const { return m_page ; }
36 wxString GetText() const { return m_text ; }
37 bool GetSelected() const { return m_selected ; }
38 int GetImageId() const { return m_imageId; }
39private :
40 wxNotebookPage *m_page ;
41 wxString m_text ;
42 bool m_selected ;
43 int m_imageId ;
44
45 DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) ;
46} ;
47
48
49WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
50
51class WXDLLEXPORT wxNotebook : public wxNotebookBase
52{
53public:
630ad6c6
WS
54 // ctors
55 // -----
56
ffecfa5a 57 // default for dynamic class
630ad6c6
WS
58 wxNotebook();
59
ffecfa5a 60 // the same arguments as for wxControl (@@@ any special styles?)
630ad6c6
WS
61 wxNotebook(wxWindow *parent,
62 wxWindowID id,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = 0,
66 const wxString& name = wxNotebookNameStr);
67
ffecfa5a 68 // Create() function
630ad6c6
WS
69 bool Create(wxWindow *parent,
70 wxWindowID id,
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
73 long style = 0,
74 const wxString& name = wxNotebookNameStr);
75
76 // accessors
77 // ---------
78
ffecfa5a 79 // get number of pages in the dialog
630ad6c6 80 virtual size_t GetPageCount() const;
ffecfa5a
JS
81
82 // set the currently selected page, return the index of the previously
83 // selected one (or -1 on error)
84 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
630ad6c6
WS
85 int SetSelection(size_t nPage);
86
ffecfa5a 87 // get the currently selected page
630ad6c6 88 int GetSelection() const { return m_nSelection; }
ffecfa5a
JS
89
90 // set/get the title of a page
630ad6c6
WS
91 bool SetPageText(size_t nPage, const wxString& strText);
92 wxString GetPageText(size_t nPage) const;
93
94 // image list stuff: each page may have an image associated with it. All
95 // the images belong to an image list, so you have to
96 // 1) create an image list
97 // 2) associate it with the notebook
98 // 3) set for each page it's image
ffecfa5a 99 // associate image list with a control
630ad6c6 100 void SetImageList(wxImageList* imageList);
ffecfa5a
JS
101
102 // sets/returns item's image index in the current image list
630ad6c6
WS
103 int GetPageImage(size_t nPage) const;
104 bool SetPageImage(size_t nPage, int nImage);
ffecfa5a
JS
105
106 // currently it's always 1 because wxGTK doesn't support multi-row
107 // tab controls
630ad6c6 108 int GetRowCount() const;
ffecfa5a 109
630ad6c6 110 // control the appearance of the notebook pages
ffecfa5a 111 // set the size (the same for all pages)
630ad6c6 112 void SetPageSize(const wxSize& size);
ffecfa5a 113 // set the padding between tabs (in pixels)
630ad6c6 114 void SetPadding(const wxSize& padding);
ffecfa5a 115
630ad6c6
WS
116 // operations
117 // ----------
ffecfa5a 118 // remove all pages
630ad6c6 119 bool DeleteAllPages();
ffecfa5a
JS
120
121 // inserts a new page to the notebook (it will be deleted ny the notebook,
122 // don't delete it yourself). If bSelect, this page becomes active.
630ad6c6
WS
123 bool InsertPage(size_t nPage,
124 wxNotebookPage *pPage,
125 const wxString& strText,
126 bool bSelect = false,
127 int imageId = -1);
ffecfa5a 128
630ad6c6
WS
129 void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
130 const wxNotebookPageInfoList& GetPageInfos() const ;
ffecfa5a
JS
131
132 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
133 // style.
630ad6c6 134 void SetTabSize(const wxSize& sz);
ffecfa5a
JS
135
136 // hit test
630ad6c6 137 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
ffecfa5a
JS
138
139 // calculate the size of the notebook from the size of its page
630ad6c6 140 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
ffecfa5a 141
630ad6c6
WS
142 // callbacks
143 // ---------
144 void OnSize(wxSizeEvent& event);
145 void OnSelChange(wxNotebookEvent& event);
146 void OnNavigationKey(wxNavigationKeyEvent& event);
ffecfa5a 147
630ad6c6
WS
148 // base class virtuals
149 // -------------------
ffecfa5a
JS
150
151#if wxUSE_CONSTRAINTS
630ad6c6
WS
152 virtual void SetConstraintSizes(bool recurse = true);
153 virtual bool DoPhase(int nPhase);
ffecfa5a
JS
154#endif // wxUSE_CONSTRAINTS
155
156protected:
630ad6c6
WS
157 // common part of all ctors
158 void Init();
ffecfa5a 159
630ad6c6
WS
160 // remove one page from the notebook, without deleting
161 virtual wxNotebookPage *DoRemovePage(size_t nPage);
ffecfa5a 162
630ad6c6
WS
163 // set the size of the given page to fit in the notebook
164 void AdjustPageSize(wxNotebookPage *page);
ffecfa5a 165
630ad6c6
WS
166 // the current selection (-1 if none)
167 int m_nSelection;
ffecfa5a 168
630ad6c6 169 wxNotebookPageInfoList m_pageInfos ;
ffecfa5a
JS
170
171
630ad6c6
WS
172 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
173 DECLARE_EVENT_TABLE()
ffecfa5a
JS
174};
175
176#endif // wxUSE_NOTEBOOK
177
178#endif // _NOTEBOOK_H