]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/notebook.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / include / wx / osx / notebook.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/notebook.h
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: Stefan Csomor
5 // Modified by:
6 // Copyright: (c) Stefan Csomor
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_NOTEBOOK_H_
11 #define _WX_NOTEBOOK_H_
12
13 // ----------------------------------------------------------------------------
14 // headers
15 // ----------------------------------------------------------------------------
16 #include "wx/event.h"
17
18 // ----------------------------------------------------------------------------
19 // types
20 // ----------------------------------------------------------------------------
21
22 // fwd declarations
23 class WXDLLIMPEXP_FWD_CORE wxImageList;
24 class WXDLLIMPEXP_FWD_CORE wxWindow;
25
26 // ----------------------------------------------------------------------------
27 // wxNotebook
28 // ----------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
31 {
32 public:
33 // ctors
34 // -----
35 // default for dynamic class
36 wxNotebook() { }
37 // the same arguments as for wxControl (@@@ any special styles?)
38 wxNotebook(wxWindow *parent,
39 wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxString& name = wxNotebookNameStr)
44 { Create( parent, id, pos, size, style, name ); }
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 wxNOT_FOUND 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
62 // changes selected page without sending events
63 int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); }
64
65 // set/get the title of a page
66 bool SetPageText(size_t nPage, const wxString& strText);
67 wxString GetPageText(size_t nPage) const;
68
69 // sets/returns item's image index in the current image list
70 int GetPageImage(size_t nPage) const;
71 bool SetPageImage(size_t nPage, int nImage);
72
73 // control the appearance of the notebook pages
74 // set the size (the same for all pages)
75 virtual void SetPageSize(const wxSize& size);
76 // set the padding between tabs (in pixels)
77 virtual void SetPadding(const wxSize& padding);
78 // sets the size of the tabs (assumes all tabs are the same size)
79 virtual void SetTabSize(const wxSize& sz);
80
81 // hit test
82 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
83
84 // calculate size for wxNotebookSizer
85 wxSize CalcSizeFromPage(const wxSize& sizePage) const;
86 wxRect GetPageRect() const ;
87
88 // operations
89 // ----------
90 // remove all pages
91 bool DeleteAllPages();
92 // the same as AddPage(), but adds it at the specified position
93 bool InsertPage(size_t nPage,
94 wxNotebookPage *pPage,
95 const wxString& strText,
96 bool bSelect = false,
97 int imageId = NO_IMAGE);
98
99 // callbacks
100 // ---------
101 void OnSize(wxSizeEvent& event);
102 void OnSelChange(wxBookCtrlEvent& event);
103 void OnSetFocus(wxFocusEvent& event);
104 void OnNavigationKey(wxNavigationKeyEvent& event);
105
106 // implementation
107 // --------------
108
109 #if wxUSE_CONSTRAINTS
110 virtual void SetConstraintSizes(bool recurse = true);
111 virtual bool DoPhase(int nPhase);
112
113 #endif
114
115 // base class virtuals
116 // -------------------
117 virtual void Command(wxCommandEvent& event);
118 // osx specific event handling common for all osx-ports
119
120 virtual bool OSXHandleClicked( double timestampsec );
121
122 protected:
123 virtual wxNotebookPage *DoRemovePage(size_t page) ;
124 // common part of all ctors
125 void Init();
126
127 // helper functions
128 void ChangePage(int nOldSel, int nSel); // change pages
129 void MacSetupTabs();
130
131 int DoSetSelection(size_t nPage, int flags = 0);
132
133 // the icon indices
134 wxArrayInt m_images;
135
136 DECLARE_DYNAMIC_CLASS(wxNotebook)
137 DECLARE_EVENT_TABLE()
138 };
139
140
141 #endif // _WX_NOTEBOOK_H_