]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/notebook.h
Correctly initialize wxGtkPrintNativeData members.
[wxWidgets.git] / include / wx / osx / 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 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
37 wxNotebook();
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,
44 const wxString& name = wxNotebookNameStr);
45 // Create() function
46 bool Create(wxWindow *parent,
47 wxWindowID id,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = 0,
51 const wxString& name = wxNotebookNameStr);
52 // dtor
53 virtual ~wxNotebook();
54
55 // accessors
56 // ---------
57 // set the currently selected page, return the index of the previously
58 // selected one (or -1 on error)
59 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
60 int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
61 // get the currently selected page
62 int GetSelection() const { return m_nSelection; }
63
64 // changes selected page without sending events
65 int ChangeSelection(size_t nPage) { return DoSetSelection(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 // 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 // hit test
84 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
85
86 // calculate size for wxNotebookSizer
87 wxSize CalcSizeFromPage(const wxSize& sizePage) const;
88 wxRect GetPageRect() const ;
89
90 // operations
91 // ----------
92 // remove all pages
93 bool DeleteAllPages();
94 // the same as AddPage(), but adds it at the specified position
95 bool InsertPage(size_t nPage,
96 wxNotebookPage *pPage,
97 const wxString& strText,
98 bool bSelect = false,
99 int imageId = -1);
100
101 // callbacks
102 // ---------
103 void OnSize(wxSizeEvent& event);
104 void OnSelChange(wxBookCtrlEvent& event);
105 void OnSetFocus(wxFocusEvent& event);
106 void OnNavigationKey(wxNavigationKeyEvent& event);
107
108 // implementation
109 // --------------
110
111 #if wxUSE_CONSTRAINTS
112 virtual void SetConstraintSizes(bool recurse = true);
113 virtual bool DoPhase(int nPhase);
114
115 #endif
116
117 // base class virtuals
118 // -------------------
119 virtual void Command(wxCommandEvent& event);
120 // osx specific event handling common for all osx-ports
121
122 virtual bool OSXHandleClicked( double timestampsec );
123
124 protected:
125 virtual wxNotebookPage *DoRemovePage(size_t page) ;
126 // common part of all ctors
127 void Init();
128
129 // helper functions
130 void ChangePage(int nOldSel, int nSel); // change pages
131 void MacSetupTabs();
132
133 int DoSetSelection(size_t nPage, int flags = 0);
134
135 // the icon indices
136 wxArrayInt m_images;
137
138 int m_nSelection; // the current selection (-1 if none)
139
140 DECLARE_DYNAMIC_CLASS(wxNotebook)
141 DECLARE_EVENT_TABLE()
142 };
143
144
145 #endif // _WX_NOTEBOOK_H_