]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/notebook.h
added selecting-while-dragging
[wxWidgets.git] / include / wx / msw / notebook.h
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
39 class WXDLLEXPORT wxNotebook : public wxNotebookBase
40 {
41 public:
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 // Windows only: attempts to get colour for UX theme page background
100 wxColour GetThemeBackgroundColour();
101
102 // operations
103 // ----------
104 // remove all pages
105 bool DeleteAllPages();
106 // inserts a new page to the notebook (it will be deleted ny the notebook,
107 // don't delete it yourself). If bSelect, this page becomes active.
108 bool InsertPage(int nPage,
109 wxNotebookPage *pPage,
110 const wxString& strText,
111 bool bSelect = FALSE,
112 int imageId = -1);
113
114 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
115 // style.
116 void SetTabSize(const wxSize& sz);
117
118 // Windows only: attempts to apply the UX theme page background to this page
119 void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
120
121 // Hit test
122 int HitTest(const wxPoint& pt, long& flags);
123 // calculate the size of the notebook from the size of its page
124 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
125
126 // callbacks
127 // ---------
128 void OnSize(wxSizeEvent& event);
129 void OnSelChange(wxNotebookEvent& event);
130 void OnSetFocus(wxFocusEvent& event);
131 void OnNavigationKey(wxNavigationKeyEvent& event);
132
133 // base class virtuals
134 // -------------------
135
136 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
137 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
138 WXWORD pos, WXHWND control);
139
140 #if wxUSE_CONSTRAINTS
141 virtual void SetConstraintSizes(bool recurse = TRUE);
142 virtual bool DoPhase(int nPhase);
143 #endif // wxUSE_CONSTRAINTS
144
145 protected:
146 // common part of all ctors
147 void Init();
148
149 // translate wxWin styles to the Windows ones
150 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
151
152 // remove one page from the notebook, without deleting
153 virtual wxNotebookPage *DoRemovePage(int nPage);
154
155 // set the size of the given page to fit in the notebook
156 void AdjustPageSize(wxNotebookPage *page);
157
158
159 // the current selection (-1 if none)
160 int m_nSelection;
161
162
163 DECLARE_DYNAMIC_CLASS(wxNotebook)
164 DECLARE_EVENT_TABLE()
165 };
166
167 #endif // wxUSE_NOTEBOOK
168
169 #endif // _NOTEBOOK_H