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