]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/notebook.h
added WXDLLIMPEXP_FWD_FOO macros in addition to WXDLLIMPEXP_FOO for use with forward...
[wxWidgets.git] / include / wx / palmos / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/notebook.h
3 // Purpose: notebook interface (a.k.a. property sheet)
4 // Author: William Osborne - minimal working wxPalmOS port
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 wxUSE_NOTEBOOK
16
17 // ----------------------------------------------------------------------------
18 // headers
19 // ----------------------------------------------------------------------------
20
21 #include "wx/control.h"
22
23 // ----------------------------------------------------------------------------
24 // wxNotebook
25 // ----------------------------------------------------------------------------
26
27 class WXDLLEXPORT wxNotebookPageInfo : public wxObject
28 {
29 public :
30 wxNotebookPageInfo() { m_page = NULL ; m_imageId = -1 ; m_selected = false ; }
31 virtual ~wxNotebookPageInfo() { }
32
33 void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId )
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; }
39 private :
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
49 WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
50
51 class WXDLLEXPORT wxNotebook : public wxNotebookBase
52 {
53 public:
54 // ctors
55 // -----
56
57 // default for dynamic class
58 wxNotebook();
59
60 // the same arguments as for wxControl (@@@ any special styles?)
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
68 // Create() function
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
79 // get number of pages in the dialog
80 virtual size_t GetPageCount() const;
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
85 int SetSelection(size_t nPage);
86
87 // get the currently selected page
88 int GetSelection() const { return m_nSelection; }
89
90 // changes the selected page without sending events
91 int ChangeSelection(size_t nPage);
92
93 // set/get the title of a page
94 bool SetPageText(size_t nPage, const wxString& strText);
95 wxString GetPageText(size_t nPage) const;
96
97 // image list stuff: each page may have an image associated with it. All
98 // the images belong to an image list, so you have to
99 // 1) create an image list
100 // 2) associate it with the notebook
101 // 3) set for each page it's image
102 // associate image list with a control
103 void SetImageList(wxImageList* imageList);
104
105 // sets/returns item's image index in the current image list
106 int GetPageImage(size_t nPage) const;
107 bool SetPageImage(size_t nPage, int nImage);
108
109 // currently it's always 1 because wxGTK doesn't support multi-row
110 // tab controls
111 int GetRowCount() const;
112
113 // control the appearance of the notebook pages
114 // set the size (the same for all pages)
115 void SetPageSize(const wxSize& size);
116 // set the padding between tabs (in pixels)
117 void SetPadding(const wxSize& padding);
118
119 // operations
120 // ----------
121 // remove all pages
122 bool DeleteAllPages();
123
124 // inserts a new page to the notebook (it will be deleted ny the notebook,
125 // don't delete it yourself). If bSelect, this page becomes active.
126 bool InsertPage(size_t nPage,
127 wxNotebookPage *pPage,
128 const wxString& strText,
129 bool bSelect = false,
130 int imageId = -1);
131
132 void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
133 const wxNotebookPageInfoList& GetPageInfos() const ;
134
135 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
136 // style.
137 void SetTabSize(const wxSize& sz);
138
139 // hit test
140 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
141
142 // calculate the size of the notebook from the size of its page
143 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
144
145 // callbacks
146 // ---------
147 void OnSize(wxSizeEvent& event);
148 void OnSelChange(wxNotebookEvent& event);
149 void OnNavigationKey(wxNavigationKeyEvent& event);
150
151 // base class virtuals
152 // -------------------
153
154 #if wxUSE_CONSTRAINTS
155 virtual void SetConstraintSizes(bool recurse = true);
156 virtual bool DoPhase(int nPhase);
157 #endif // wxUSE_CONSTRAINTS
158
159 protected:
160 // common part of all ctors
161 void Init();
162
163 // remove one page from the notebook, without deleting
164 virtual wxNotebookPage *DoRemovePage(size_t nPage);
165
166 // set the size of the given page to fit in the notebook
167 void AdjustPageSize(wxNotebookPage *page);
168
169 // the current selection (-1 if none)
170 int m_nSelection;
171
172 wxNotebookPageInfoList m_pageInfos ;
173
174
175 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
176 DECLARE_EVENT_TABLE()
177 };
178
179 #endif // wxUSE_NOTEBOOK
180
181 #endif // _NOTEBOOK_H