]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/notebook.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
7 // Copyright: (c) AUTHOR
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_NOTEBOOK_H_
12 #define _WX_NOTEBOOK_H_
15 #pragma interface "notebook.h"
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
21 #include "wx/dynarray.h"
23 #include "wx/control.h"
25 // ----------------------------------------------------------------------------
27 // ----------------------------------------------------------------------------
30 class WXDLLEXPORT wxImageList
;
31 class WXDLLEXPORT wxWindow
;
33 // array of notebook pages
34 typedef wxWindow wxNotebookPage
; // so far, any window can be a page
35 WX_DEFINE_ARRAY(wxNotebookPage
*, wxArrayPages
);
37 // ----------------------------------------------------------------------------
39 // ----------------------------------------------------------------------------
41 // @@@ this class should really derive from wxTabCtrl, but the interface is not
42 // exactly the same, so I can't do it right now and instead we reimplement
43 // part of wxTabCtrl here
44 class wxNotebook
: public wxControl
49 // default for dynamic class
51 // the same arguments as for wxControl (@@@ any special styles?)
52 wxNotebook(wxWindow
*parent
,
54 const wxPoint
& pos
= wxDefaultPosition
,
55 const wxSize
& size
= wxDefaultSize
,
57 const wxString
& name
= "notebook");
59 bool Create(wxWindow
*parent
,
61 const wxPoint
& pos
= wxDefaultPosition
,
62 const wxSize
& size
= wxDefaultSize
,
64 const wxString
& name
= "notebook");
70 // get number of pages in the dialog
71 int GetPageCount() const;
73 // set the currently selected page, return the index of the previously
74 // selected one (or -1 on error)
75 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
76 int SetSelection(int nPage
);
77 // cycle thru the tabs
78 void AdvanceSelection(bool bForward
= TRUE
);
79 // get the currently selected page
80 int GetSelection() const { return m_nSelection
; }
82 // set/get the title of a page
83 bool SetPageText(int nPage
, const wxString
& strText
);
84 wxString
GetPageText(int nPage
) const;
86 // image list stuff: each page may have an image associated with it. All
87 // the images belong to an image list, so you have to
88 // 1) create an image list
89 // 2) associate it with the notebook
90 // 3) set for each page it's image
91 // associate image list with a control
92 void SetImageList(wxImageList
* imageList
);
93 // get pointer (may be NULL) to the associated image list
94 wxImageList
* GetImageList() const { return m_pImageList
; }
96 // sets/returns item's image index in the current image list
97 int GetPageImage(int nPage
) const;
98 bool SetPageImage(int nPage
, int nImage
);
100 // currently it's always 1 because wxGTK doesn't support multi-row
102 int GetRowCount() const;
104 // control the appearance of the notebook pages
105 // set the size (the same for all pages)
106 void SetPageSize(const wxSize
& size
);
107 // set the padding between tabs (in pixels)
108 void SetPadding(const wxSize
& padding
);
112 // remove one page from the notebook
113 bool DeletePage(int nPage
);
114 // remove one page from the notebook, without deleting
115 bool RemovePage(int nPage
);
117 bool DeleteAllPages();
118 // adds a new page to the notebook (it will be deleted ny the notebook,
119 // don't delete it yourself). If bSelect, this page becomes active.
120 bool AddPage(wxNotebookPage
*pPage
,
121 const wxString
& strText
,
122 bool bSelect
= FALSE
,
124 // the same as AddPage(), but adds it at the specified position
125 bool InsertPage(int nPage
,
126 wxNotebookPage
*pPage
,
127 const wxString
& strText
,
128 bool bSelect
= FALSE
,
130 // get the panel which represents the given page
131 wxNotebookPage
*GetPage(int nPage
) { return m_aPages
[nPage
]; }
135 void OnSize(wxSizeEvent
& event
);
136 void OnSelChange(wxNotebookEvent
& event
);
137 void OnSetFocus(wxFocusEvent
& event
);
138 void OnNavigationKey(wxNavigationKeyEvent
& event
);
140 // base class virtuals
141 // -------------------
142 virtual void Command(wxCommandEvent
& event
);
143 virtual void SetConstraintSizes(bool recurse
= TRUE
);
144 virtual bool DoPhase(int nPhase
);
147 virtual void MacHandleControlClick( ControlHandle control
, SInt16 controlpart
) ;
148 // common part of all ctors
152 void ChangePage(int nOldSel
, int nSel
); // change pages
154 wxImageList
*m_pImageList
; // we can have an associated image list
155 wxArrayPages m_aPages
; // array of pages
157 int m_nSelection
; // the current selection (-1 if none)
159 DECLARE_DYNAMIC_CLASS(wxNotebook
)
160 DECLARE_EVENT_TABLE()
164 #endif // _WX_NOTEBOOK_H_