]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/notebook.h
fd9333b16ce078d20b7a2761cf0eb0ea2eab081a
[wxWidgets.git] / include / wx / palmos / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/notebook.h
3 // Purpose: notebook interface (a.k.a. property sheet)
4 // Author: William Osborne
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id:
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
37 void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId )
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:
58 // ctors
59 // -----
60
61 // default for dynamic class
62 wxNotebook();
63
64 // the same arguments as for wxControl (@@@ any special styles?)
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
72 // Create() function
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
83 // get number of pages in the dialog
84 virtual size_t GetPageCount() const;
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
89 int SetSelection(size_t nPage);
90
91 // get the currently selected page
92 int GetSelection() const { return m_nSelection; }
93
94 // set/get the title of a page
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
103 // associate image list with a control
104 void SetImageList(wxImageList* imageList);
105
106 // sets/returns item's image index in the current image list
107 int GetPageImage(size_t nPage) const;
108 bool SetPageImage(size_t nPage, int nImage);
109
110 // currently it's always 1 because wxGTK doesn't support multi-row
111 // tab controls
112 int GetRowCount() const;
113
114 // control the appearance of the notebook pages
115 // set the size (the same for all pages)
116 void SetPageSize(const wxSize& size);
117 // set the padding between tabs (in pixels)
118 void SetPadding(const wxSize& padding);
119
120 // operations
121 // ----------
122 // remove all pages
123 bool DeleteAllPages();
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.
127 bool InsertPage(size_t nPage,
128 wxNotebookPage *pPage,
129 const wxString& strText,
130 bool bSelect = false,
131 int imageId = -1);
132
133 void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
134 const wxNotebookPageInfoList& GetPageInfos() const ;
135
136 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
137 // style.
138 void SetTabSize(const wxSize& sz);
139
140 // hit test
141 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
142
143 // calculate the size of the notebook from the size of its page
144 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
145
146 // callbacks
147 // ---------
148 void OnSize(wxSizeEvent& event);
149 void OnSelChange(wxNotebookEvent& event);
150 void OnNavigationKey(wxNavigationKeyEvent& event);
151
152 // base class virtuals
153 // -------------------
154
155 #if wxUSE_CONSTRAINTS
156 virtual void SetConstraintSizes(bool recurse = true);
157 virtual bool DoPhase(int nPhase);
158 #endif // wxUSE_CONSTRAINTS
159
160 protected:
161 // common part of all ctors
162 void Init();
163
164 // remove one page from the notebook, without deleting
165 virtual wxNotebookPage *DoRemovePage(size_t nPage);
166
167 // set the size of the given page to fit in the notebook
168 void AdjustPageSize(wxNotebookPage *page);
169
170 // the current selection (-1 if none)
171 int m_nSelection;
172
173 wxNotebookPageInfoList m_pageInfos ;
174
175
176 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
177 DECLARE_EVENT_TABLE()
178 };
179
180 #endif // wxUSE_NOTEBOOK
181
182 #endif // _NOTEBOOK_H