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