]>
Commit | Line | Data |
---|---|---|
6762286d | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/osx/notebook.h |
6762286d SC |
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 WXDLLIMPEXP_FWD_CORE wxImageList; | |
25 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
26 | ||
27 | // ---------------------------------------------------------------------------- | |
28 | // wxNotebook | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
31 | class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase | |
32 | { | |
33 | public: | |
34 | // ctors | |
35 | // ----- | |
36 | // default for dynamic class | |
681be2ef | 37 | wxNotebook() { } |
6762286d SC |
38 | // the same arguments as for wxControl (@@@ any special styles?) |
39 | wxNotebook(wxWindow *parent, | |
40 | wxWindowID id, | |
41 | const wxPoint& pos = wxDefaultPosition, | |
42 | const wxSize& size = wxDefaultSize, | |
43 | long style = 0, | |
af0b2063 | 44 | const wxString& name = wxNotebookNameStr) |
681be2ef | 45 | { Create( parent, id, pos, size, style, name ); } |
6762286d SC |
46 | // Create() function |
47 | bool Create(wxWindow *parent, | |
48 | wxWindowID id, | |
49 | const wxPoint& pos = wxDefaultPosition, | |
50 | const wxSize& size = wxDefaultSize, | |
51 | long style = 0, | |
52 | const wxString& name = wxNotebookNameStr); | |
53 | // dtor | |
54 | virtual ~wxNotebook(); | |
55 | ||
56 | // accessors | |
57 | // --------- | |
58 | // set the currently selected page, return the index of the previously | |
7e837615 | 59 | // selected one (or wxNOT_FOUND on error) |
6762286d SC |
60 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events |
61 | int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); } | |
6762286d SC |
62 | |
63 | // changes selected page without sending events | |
64 | int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); } | |
65 | ||
66 | // set/get the title of a page | |
67 | bool SetPageText(size_t nPage, const wxString& strText); | |
68 | wxString GetPageText(size_t nPage) const; | |
69 | ||
70 | // sets/returns item's image index in the current image list | |
71 | int GetPageImage(size_t nPage) const; | |
72 | bool SetPageImage(size_t nPage, int nImage); | |
73 | ||
74 | // control the appearance of the notebook pages | |
75 | // set the size (the same for all pages) | |
76 | virtual void SetPageSize(const wxSize& size); | |
77 | // set the padding between tabs (in pixels) | |
78 | virtual void SetPadding(const wxSize& padding); | |
79 | // sets the size of the tabs (assumes all tabs are the same size) | |
80 | virtual void SetTabSize(const wxSize& sz); | |
81 | ||
82 | // hit test | |
83 | virtual int HitTest(const wxPoint& pt, long *flags = NULL) const; | |
03647350 | 84 | |
6762286d SC |
85 | // calculate size for wxNotebookSizer |
86 | wxSize CalcSizeFromPage(const wxSize& sizePage) const; | |
87 | wxRect GetPageRect() const ; | |
88 | ||
89 | // operations | |
90 | // ---------- | |
91 | // remove all pages | |
92 | bool DeleteAllPages(); | |
93 | // the same as AddPage(), but adds it at the specified position | |
94 | bool InsertPage(size_t nPage, | |
95 | wxNotebookPage *pPage, | |
96 | const wxString& strText, | |
97 | bool bSelect = false, | |
1871b9fa | 98 | int imageId = NO_IMAGE); |
6762286d SC |
99 | |
100 | // callbacks | |
101 | // --------- | |
102 | void OnSize(wxSizeEvent& event); | |
103 | void OnSelChange(wxBookCtrlEvent& event); | |
104 | void OnSetFocus(wxFocusEvent& event); | |
105 | void OnNavigationKey(wxNavigationKeyEvent& event); | |
106 | ||
107 | // implementation | |
108 | // -------------- | |
109 | ||
110 | #if wxUSE_CONSTRAINTS | |
111 | virtual void SetConstraintSizes(bool recurse = true); | |
112 | virtual bool DoPhase(int nPhase); | |
113 | ||
5c6eb3a8 | 114 | #endif |
6762286d SC |
115 | |
116 | // base class virtuals | |
117 | // ------------------- | |
118 | virtual void Command(wxCommandEvent& event); | |
119 | // osx specific event handling common for all osx-ports | |
03647350 | 120 | |
12b5f4b4 | 121 | virtual bool OSXHandleClicked( double timestampsec ); |
6762286d SC |
122 | |
123 | protected: | |
124 | virtual wxNotebookPage *DoRemovePage(size_t page) ; | |
125 | // common part of all ctors | |
126 | void Init(); | |
127 | ||
128 | // helper functions | |
129 | void ChangePage(int nOldSel, int nSel); // change pages | |
130 | void MacSetupTabs(); | |
131 | ||
132 | int DoSetSelection(size_t nPage, int flags = 0); | |
133 | ||
134 | // the icon indices | |
135 | wxArrayInt m_images; | |
136 | ||
6762286d SC |
137 | DECLARE_DYNAMIC_CLASS(wxNotebook) |
138 | DECLARE_EVENT_TABLE() | |
139 | }; | |
140 | ||
141 | ||
142 | #endif // _WX_NOTEBOOK_H_ |