]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/notebook.h
more extra semicolons removed (patch 1303724)
[wxWidgets.git] / include / wx / mac / carbon / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: notebook.h
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: Stefan Csomor
5 // Modified by:
6 // RCS-ID: $Id$
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_NOTEBOOK_H_
12 #define _WX_NOTEBOOK_H_
13
14 // ----------------------------------------------------------------------------
15 // headers
16 // ----------------------------------------------------------------------------
17 #include "wx/event.h"
18
19 // ----------------------------------------------------------------------------
20 // types
21 // ----------------------------------------------------------------------------
22
23 // fwd declarations
24 class WXDLLEXPORT wxImageList;
25 class WXDLLEXPORT wxWindow;
26
27 // ----------------------------------------------------------------------------
28 // wxNotebook
29 // ----------------------------------------------------------------------------
30
31 // @@@ this class should really derive from wxTabCtrl, but the interface is not
32 // exactly the same, so I can't do it right now and instead we reimplement
33 // part of wxTabCtrl here
34 class wxNotebook : public wxNotebookBase
35 {
36 public:
37 // ctors
38 // -----
39 // default for dynamic class
40 wxNotebook();
41 // the same arguments as for wxControl (@@@ any special styles?)
42 wxNotebook(wxWindow *parent,
43 wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 long style = 0,
47 const wxString& name = wxNotebookNameStr);
48 // Create() function
49 bool Create(wxWindow *parent,
50 wxWindowID id,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 long style = 0,
54 const wxString& name = wxNotebookNameStr);
55 // dtor
56 ~wxNotebook();
57
58 // accessors
59 // ---------
60 // set the currently selected page, return the index of the previously
61 // selected one (or -1 on error)
62 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
63 int SetSelection(size_t nPage);
64 // get the currently selected page
65 int GetSelection() const { return m_nSelection; }
66
67 // set/get the title of a page
68 bool SetPageText(size_t nPage, const wxString& strText);
69 wxString GetPageText(size_t nPage) const;
70
71 // sets/returns item's image index in the current image list
72 int GetPageImage(size_t nPage) const;
73 bool SetPageImage(size_t nPage, int nImage);
74
75 // control the appearance of the notebook pages
76 // set the size (the same for all pages)
77 virtual void SetPageSize(const wxSize& size);
78 // set the padding between tabs (in pixels)
79 virtual void SetPadding(const wxSize& padding);
80 // sets the size of the tabs (assumes all tabs are the same size)
81 virtual void SetTabSize(const wxSize& sz);
82
83 // calculate size for wxNotebookSizer
84 wxSize CalcSizeFromPage(const wxSize& sizePage) const;
85 wxRect GetPageRect() const ;
86 /*
87 // get number of pages in the dialog
88 int GetPageCount() const;
89
90 // cycle thru the tabs
91 void AdvanceSelection(bool bForward = true);
92
93
94 // currently it's always 1 because wxGTK doesn't support multi-row
95 // tab controls
96 int GetRowCount() const;
97 */
98 // operations
99 // ----------
100 // remove all pages
101 bool DeleteAllPages();
102 // the same as AddPage(), but adds it at the specified position
103 bool InsertPage(size_t nPage,
104 wxNotebookPage *pPage,
105 const wxString& strText,
106 bool bSelect = false,
107 int imageId = -1);
108 /*
109 // get the panel which represents the given page
110 wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
111 */
112 // callbacks
113 // ---------
114 void OnSize(wxSizeEvent& event);
115 void OnSelChange(wxNotebookEvent& event);
116 void OnSetFocus(wxFocusEvent& event);
117 void OnNavigationKey(wxNavigationKeyEvent& event);
118
119 // implementation
120 // --------------
121
122 #if wxUSE_CONSTRAINTS
123 virtual void SetConstraintSizes(bool recurse = true);
124 virtual bool DoPhase(int nPhase);
125
126 #endif
127
128 // base class virtuals
129 // -------------------
130 virtual void Command(wxCommandEvent& event);
131 protected:
132 virtual wxNotebookPage *DoRemovePage(size_t page) ;
133 virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
134 // common part of all ctors
135 void Init();
136
137 // helper functions
138 void ChangePage(int nOldSel, int nSel); // change pages
139 void MacSetupTabs();
140
141 // the icon indices
142 wxArrayInt m_images;
143
144 int m_nSelection; // the current selection (-1 if none)
145
146 DECLARE_DYNAMIC_CLASS(wxNotebook)
147 DECLARE_EVENT_TABLE()
148 };
149
150
151 #endif // _WX_NOTEBOOK_H_