]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/classic/notebook.h
Partly reverted changes to Get(Current)Selection.
[wxWidgets.git] / include / wx / mac / classic / notebook.h
CommitLineData
52479aef
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
52479aef
SC
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_NOTEBOOK_H_
12#define _WX_NOTEBOOK_H_
13
52479aef
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
52479aef
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,
e211b7b1 40 wxWindowID id,
52479aef
SC
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = 0,
e211b7b1 44 const wxString& name = wxNotebookNameStr);
52479aef
SC
45 // Create() function
46 bool Create(wxWindow *parent,
e211b7b1 47 wxWindowID id,
52479aef
SC
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 long style = 0,
e211b7b1 51 const wxString& name = wxNotebookNameStr);
52479aef
SC
52 // dtor
53 ~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);
61 // get the currently selected page
62 int GetSelection() const { return m_nSelection; }
63
64 // set/get the title of a page
65 bool SetPageText(size_t nPage, const wxString& strText);
66 wxString GetPageText(size_t nPage) const;
67
68 // sets/returns item's image index in the current image list
69 int GetPageImage(size_t nPage) const;
70 bool SetPageImage(size_t nPage, int nImage);
71
72 // control the appearance of the notebook pages
73 // set the size (the same for all pages)
74 virtual void SetPageSize(const wxSize& size);
75 // set the padding between tabs (in pixels)
76 virtual void SetPadding(const wxSize& padding);
77 // sets the size of the tabs (assumes all tabs are the same size)
78 virtual void SetTabSize(const wxSize& sz);
e211b7b1 79
52479aef
SC
80 // calculate size for wxNotebookSizer
81 wxSize CalcSizeFromPage(const wxSize& sizePage) const;
82 wxRect GetPageRect() const ;
52479aef 83
52479aef
SC
84 // operations
85 // ----------
86 // remove all pages
87 bool DeleteAllPages();
88 // the same as AddPage(), but adds it at the specified position
89 bool InsertPage(size_t nPage,
90 wxNotebookPage *pPage,
91 const wxString& strText,
e211b7b1 92 bool bSelect = false,
52479aef 93 int imageId = -1);
27a1fd58 94
52479aef
SC
95 // callbacks
96 // ---------
97 void OnSize(wxSizeEvent& event);
98 void OnSelChange(wxNotebookEvent& event);
99 void OnSetFocus(wxFocusEvent& event);
100 void OnNavigationKey(wxNavigationKeyEvent& event);
e211b7b1 101 void OnMouse(wxMouseEvent &event);
52479aef
SC
102
103 // implementation
104 // --------------
105
106#if wxUSE_CONSTRAINTS
e211b7b1 107 virtual void SetConstraintSizes(bool recurse = true);
52479aef
SC
108 virtual bool DoPhase(int nPhase);
109
110#endif
111
112 // base class virtuals
113 // -------------------
114 virtual void Command(wxCommandEvent& event);
115protected:
116 virtual wxSize DoGetBestSize() const ;
117 virtual wxNotebookPage *DoRemovePage(size_t page) ;
118 virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
119 // common part of all ctors
120 void Init();
121
122 // helper functions
123 void ChangePage(int nOldSel, int nSel); // change pages
124 void MacSetupTabs();
125
126 // the icon indices
127 wxArrayInt m_images;
128
129 int m_nSelection; // the current selection (-1 if none)
130
131 DECLARE_DYNAMIC_CLASS(wxNotebook)
132 DECLARE_EVENT_TABLE()
133};
134
135
136#endif // _WX_NOTEBOOK_H_