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