]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/notebook.h
add IsOk() to all classes having Ok() method (patch 1570985)
[wxWidgets.git] / include / wx / mac / carbon / notebook.h
CommitLineData
8cf73271
SC
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
65571936 8// Licence: wxWindows licence
8cf73271
SC
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_NOTEBOOK_H_
12#define _WX_NOTEBOOK_H_
13
8cf73271
SC
14// ----------------------------------------------------------------------------
15// headers
16// ----------------------------------------------------------------------------
17#include "wx/event.h"
18
19// ----------------------------------------------------------------------------
20// types
21// ----------------------------------------------------------------------------
22
23// fwd declarations
24class WXDLLEXPORT wxImageList;
25class WXDLLEXPORT wxWindow;
26
27// ----------------------------------------------------------------------------
28// wxNotebook
29// ----------------------------------------------------------------------------
30
8cf73271
SC
31class wxNotebook : public wxNotebookBase
32{
33public:
34 // ctors
35 // -----
36 // default for dynamic class
37 wxNotebook();
38 // the same arguments as for wxControl (@@@ any special styles?)
39 wxNotebook(wxWindow *parent,
630ad6c6 40 wxWindowID id,
8cf73271
SC
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = 0,
630ad6c6 44 const wxString& name = wxNotebookNameStr);
8cf73271
SC
45 // Create() function
46 bool Create(wxWindow *parent,
630ad6c6 47 wxWindowID id,
8cf73271
SC
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = 0,
630ad6c6 51 const wxString& name = wxNotebookNameStr);
8cf73271 52 // dtor
d3c7fc99 53 virtual ~wxNotebook();
8cf73271
SC
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
1d6fcbcc 60 int SetSelection(size_t nPage) { return DoSetSelection(nPage, SetSelection_SendEvent); }
8cf73271
SC
61 // get the currently selected page
62 int GetSelection() const { return m_nSelection; }
63
1d6fcbcc
VZ
64 // changes selected page without sending events
65 int ChangeSelection(size_t nPage) { return DoSetSelection(nPage); }
66
8cf73271
SC
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);
630ad6c6 82
d0e7c7e5
SC
83 // hit test
84 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
85
86 // calculate size for wxNotebookSizer
8cf73271
SC
87 wxSize CalcSizeFromPage(const wxSize& sizePage) const;
88 wxRect GetPageRect() const ;
8cf73271 89
8cf73271
SC
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,
630ad6c6 98 bool bSelect = false,
8cf73271 99 int imageId = -1);
27a1fd58 100
8cf73271
SC
101 // callbacks
102 // ---------
103 void OnSize(wxSizeEvent& event);
104 void OnSelChange(wxNotebookEvent& event);
105 void OnSetFocus(wxFocusEvent& event);
106 void OnNavigationKey(wxNavigationKeyEvent& event);
8cf73271
SC
107
108 // implementation
109 // --------------
110
111#if wxUSE_CONSTRAINTS
630ad6c6 112 virtual void SetConstraintSizes(bool recurse = true);
8cf73271
SC
113 virtual bool DoPhase(int nPhase);
114
115#endif
116
117 // base class virtuals
118 // -------------------
119 virtual void Command(wxCommandEvent& event);
6f02a879
VZ
120 virtual wxInt32 MacControlHit(WXEVENTHANDLERREF handler, WXEVENTREF event);
121
8cf73271 122protected:
8cf73271 123 virtual wxNotebookPage *DoRemovePage(size_t page) ;
8cf73271
SC
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
1d6fcbcc
VZ
131 int DoSetSelection(size_t nPage, int flags = 0);
132
8cf73271
SC
133 // the icon indices
134 wxArrayInt m_images;
135
136 int m_nSelection; // the current selection (-1 if none)
137
138 DECLARE_DYNAMIC_CLASS(wxNotebook)
139 DECLARE_EVENT_TABLE()
140};
141
142
143#endif // _WX_NOTEBOOK_H_