]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/carbon/notebook.h
DEBUGREPORT
[wxWidgets.git] / include / wx / mac / carbon / notebook.h
... / ...
CommitLineData
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#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15#pragma interface "notebook.h"
16#endif
17
18// ----------------------------------------------------------------------------
19// headers
20// ----------------------------------------------------------------------------
21#include "wx/event.h"
22
23// ----------------------------------------------------------------------------
24// types
25// ----------------------------------------------------------------------------
26
27// fwd declarations
28class WXDLLEXPORT wxImageList;
29class WXDLLEXPORT wxWindow;
30
31// ----------------------------------------------------------------------------
32// wxNotebook
33// ----------------------------------------------------------------------------
34
35// @@@ this class should really derive from wxTabCtrl, but the interface is not
36// exactly the same, so I can't do it right now and instead we reimplement
37// part of wxTabCtrl here
38class wxNotebook : public wxNotebookBase
39{
40public:
41 // ctors
42 // -----
43 // default for dynamic class
44 wxNotebook();
45 // the same arguments as for wxControl (@@@ any special styles?)
46 wxNotebook(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 // Create() function
53 bool Create(wxWindow *parent,
54 wxWindowID id,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = 0,
58 const wxString& name = wxNotebookNameStr);
59 // dtor
60 ~wxNotebook();
61
62 // accessors
63 // ---------
64 // set the currently selected page, return the index of the previously
65 // selected one (or -1 on error)
66 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
67 int SetSelection(size_t nPage);
68 // get the currently selected page
69 int GetSelection() const { return m_nSelection; }
70
71 // set/get the title of a page
72 bool SetPageText(size_t nPage, const wxString& strText);
73 wxString GetPageText(size_t nPage) const;
74
75 // sets/returns item's image index in the current image list
76 int GetPageImage(size_t nPage) const;
77 bool SetPageImage(size_t nPage, int nImage);
78
79 // control the appearance of the notebook pages
80 // set the size (the same for all pages)
81 virtual void SetPageSize(const wxSize& size);
82 // set the padding between tabs (in pixels)
83 virtual void SetPadding(const wxSize& padding);
84 // sets the size of the tabs (assumes all tabs are the same size)
85 virtual void SetTabSize(const wxSize& sz);
86
87 // calculate size for wxNotebookSizer
88 wxSize CalcSizeFromPage(const wxSize& sizePage) const;
89 wxRect GetPageRect() const ;
90/*
91 // get number of pages in the dialog
92 int GetPageCount() const;
93
94 // cycle thru the tabs
95 void AdvanceSelection(bool bForward = true);
96
97
98 // currently it's always 1 because wxGTK doesn't support multi-row
99 // tab controls
100 int GetRowCount() const;
101*/
102 // operations
103 // ----------
104 // remove all pages
105 bool DeleteAllPages();
106 // the same as AddPage(), but adds it at the specified position
107 bool InsertPage(size_t nPage,
108 wxNotebookPage *pPage,
109 const wxString& strText,
110 bool bSelect = false,
111 int imageId = -1);
112/*
113 // get the panel which represents the given page
114 wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
115*/
116 // callbacks
117 // ---------
118 void OnSize(wxSizeEvent& event);
119 void OnSelChange(wxNotebookEvent& event);
120 void OnSetFocus(wxFocusEvent& event);
121 void OnNavigationKey(wxNavigationKeyEvent& event);
122
123 // implementation
124 // --------------
125
126#if wxUSE_CONSTRAINTS
127 virtual void SetConstraintSizes(bool recurse = true);
128 virtual bool DoPhase(int nPhase);
129
130#endif
131
132 // base class virtuals
133 // -------------------
134 virtual void Command(wxCommandEvent& event);
135protected:
136 virtual wxNotebookPage *DoRemovePage(size_t page) ;
137 virtual wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
138 // common part of all ctors
139 void Init();
140
141 // helper functions
142 void ChangePage(int nOldSel, int nSel); // change pages
143 void MacSetupTabs();
144
145 // the icon indices
146 wxArrayInt m_images;
147
148 int m_nSelection; // the current selection (-1 if none)
149
150 DECLARE_DYNAMIC_CLASS(wxNotebook)
151 DECLARE_EVENT_TABLE()
152};
153
154
155#endif // _WX_NOTEBOOK_H_