]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/notebook.h
Applied patch [ 743194 ] HitTest for wxNotebook
[wxWidgets.git] / include / wx / msw / notebook.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: msw/notebook.h
3// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4// Author: Robert Roebling
5// Modified by: Vadim Zeitlin for Windows version
6// RCS-ID: $Id$
7// Copyright: (c) Julian Smart
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _NOTEBOOK_H
12#define _NOTEBOOK_H
13
14#ifdef __GNUG__
15 #pragma interface "notebook.h"
16#endif
17
18#if wxUSE_NOTEBOOK
19
20// ----------------------------------------------------------------------------
21// headers
22// ----------------------------------------------------------------------------
23
24#include "wx/control.h"
25
26// ----------------------------------------------------------------------------
27// wxNotebook
28// ----------------------------------------------------------------------------
29
30/*
31 * Flags returned by HitTest
32 */
33
34#define wxNB_HITTEST_NOWHERE 1
35#define wxNB_HITTEST_ONICON 2
36#define wxNB_HITTEST_ONLABEL 4
37#define wxNB_HITTEST_ONITEM 6
38
39class WXDLLEXPORT wxNotebook : public wxNotebookBase
40{
41public:
42 // ctors
43 // -----
44 // default for dynamic class
45 wxNotebook();
46 // the same arguments as for wxControl (@@@ any special styles?)
47 wxNotebook(wxWindow *parent,
48 wxWindowID id,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = 0,
52 const wxString& name = wxNOTEBOOK_NAME);
53 // Create() function
54 bool Create(wxWindow *parent,
55 wxWindowID id,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 long style = 0,
59 const wxString& name = wxNOTEBOOK_NAME);
60
61 // accessors
62 // ---------
63 // get number of pages in the dialog
64 int GetPageCount() const;
65
66 // set the currently selected page, return the index of the previously
67 // selected one (or -1 on error)
68 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
69 int SetSelection(int nPage);
70 // get the currently selected page
71 int GetSelection() const { return m_nSelection; }
72
73 // set/get the title of a page
74 bool SetPageText(int nPage, const wxString& strText);
75 wxString GetPageText(int nPage) const;
76
77 // image list stuff: each page may have an image associated with it. All
78 // the images belong to an image list, so you have to
79 // 1) create an image list
80 // 2) associate it with the notebook
81 // 3) set for each page it's image
82 // associate image list with a control
83 void SetImageList(wxImageList* imageList);
84
85 // sets/returns item's image index in the current image list
86 int GetPageImage(int nPage) const;
87 bool SetPageImage(int nPage, int nImage);
88
89 // currently it's always 1 because wxGTK doesn't support multi-row
90 // tab controls
91 int GetRowCount() const;
92
93 // control the appearance of the notebook pages
94 // set the size (the same for all pages)
95 void SetPageSize(const wxSize& size);
96 // set the padding between tabs (in pixels)
97 void SetPadding(const wxSize& padding);
98
99 // operations
100 // ----------
101 // remove all pages
102 bool DeleteAllPages();
103 // inserts a new page to the notebook (it will be deleted ny the notebook,
104 // don't delete it yourself). If bSelect, this page becomes active.
105 bool InsertPage(int nPage,
106 wxNotebookPage *pPage,
107 const wxString& strText,
108 bool bSelect = FALSE,
109 int imageId = -1);
110
111 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
112 // style.
113 void SetTabSize(const wxSize& sz);
114
115
116 // Hit test
117 int HitTest(const wxPoint& pt, long& flags);
118 // calculate the size of the notebook from the size of its page
119 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
120
121 // callbacks
122 // ---------
123 void OnSize(wxSizeEvent& event);
124 void OnSelChange(wxNotebookEvent& event);
125 void OnSetFocus(wxFocusEvent& event);
126 void OnNavigationKey(wxNavigationKeyEvent& event);
127
128 // base class virtuals
129 // -------------------
130
131 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
132 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
133 WXWORD pos, WXHWND control);
134
135#if wxUSE_CONSTRAINTS
136 virtual void SetConstraintSizes(bool recurse = TRUE);
137 virtual bool DoPhase(int nPhase);
138#endif // wxUSE_CONSTRAINTS
139
140protected:
141 // common part of all ctors
142 void Init();
143
144 // translate wxWin styles to the Windows ones
145 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
146
147 // remove one page from the notebook, without deleting
148 virtual wxNotebookPage *DoRemovePage(int nPage);
149
150 // set the size of the given page to fit in the notebook
151 void AdjustPageSize(wxNotebookPage *page);
152
153
154 // the current selection (-1 if none)
155 int m_nSelection;
156
157
158 DECLARE_DYNAMIC_CLASS(wxNotebook)
159 DECLARE_EVENT_TABLE()
160};
161
162#endif // wxUSE_NOTEBOOK
163
164#endif // _NOTEBOOK_H