]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/cocoa/notebook.h | |
3 | // Purpose: wxNotebook class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2004/04/08 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2004 David Elliott | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COCOA_NOTEBOOK_H__ | |
13 | #define _WX_COCOA_NOTEBOOK_H__ | |
14 | ||
15 | #include "wx/cocoa/NSTabView.h" | |
16 | ||
17 | // ======================================================================== | |
18 | // wxNotebook | |
19 | // ======================================================================== | |
20 | class WXDLLEXPORT wxNotebook: public wxNotebookBase, protected wxCocoaNSTabView | |
21 | { | |
22 | DECLARE_DYNAMIC_CLASS(wxNotebook) | |
23 | DECLARE_EVENT_TABLE() | |
24 | WX_DECLARE_COCOA_OWNER(NSTabView,NSView,NSView) | |
25 | // ------------------------------------------------------------------------ | |
26 | // initialization | |
27 | // ------------------------------------------------------------------------ | |
28 | public: | |
29 | wxNotebook() { } | |
30 | wxNotebook(wxWindow *parent, wxWindowID winid, | |
31 | const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, | |
33 | long style = 0, | |
34 | const wxString& name = wxNotebookNameStr) | |
35 | { | |
36 | Create(parent, winid, pos, size, style, name); | |
37 | } | |
38 | ||
39 | bool Create(wxWindow *parent, wxWindowID winid, | |
40 | const wxPoint& pos = wxDefaultPosition, | |
41 | const wxSize& size = wxDefaultSize, | |
42 | long style = 0, | |
43 | const wxString& name = wxNotebookNameStr); | |
44 | virtual ~wxNotebook(); | |
45 | ||
46 | // ------------------------------------------------------------------------ | |
47 | // Cocoa callbacks | |
48 | // ------------------------------------------------------------------------ | |
49 | protected: | |
50 | // Notebooks cannot be enabled/disabled | |
51 | virtual void CocoaSetEnabled(bool WXUNUSED(enable)) { } | |
52 | virtual void CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabviewItem); | |
53 | virtual bool CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabviewItem); | |
54 | // ------------------------------------------------------------------------ | |
55 | // Implementation | |
56 | // ------------------------------------------------------------------------ | |
57 | public: | |
58 | // set the currently selected page, return the index of the previously | |
59 | // selected one (or -1 on error) | |
60 | int SetSelection(size_t nPage); | |
61 | // get the currently selected page | |
62 | int GetSelection() const; | |
63 | ||
64 | // changes selected page without sending events | |
65 | int ChangeSelection(size_t nPage); | |
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 | // set the size (the same for all pages) | |
76 | void SetPageSize(const wxSize& size); | |
77 | ||
78 | // SetPadding and SetTabSize aren't possible to implement | |
79 | void SetPadding(const wxSize& padding); | |
80 | void SetTabSize(const wxSize& sz); | |
81 | ||
82 | //----------------------- | |
83 | // adding/removing pages | |
84 | ||
85 | // remove one page from the notebook, without deleting | |
86 | virtual wxNotebookPage *DoRemovePage(size_t nPage); | |
87 | ||
88 | // remove one page from the notebook | |
89 | bool DeletePage(size_t nPage); | |
90 | // remove all pages | |
91 | bool DeleteAllPages(); | |
92 | ||
93 | // adds a new page to the notebook (it will be deleted ny the notebook, | |
94 | // don't delete it yourself). If bSelect, this page becomes active. | |
95 | // the same as AddPage(), but adds it at the specified position | |
96 | bool InsertPage( size_t position, | |
97 | wxNotebookPage *win, | |
98 | const wxString& strText, | |
99 | bool bSelect = false, | |
100 | int imageId = -1 ); | |
101 | ||
102 | protected: | |
103 | }; | |
104 | ||
105 | #endif //ndef _WX_COCOA_NOTEBOOK_H__ |