]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/notebook.h
Moved wxToolBarSimple to deprecated library
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 class WXDLLEXPORT wxNotebookPageInfo : public wxObject
31 {
32 public :
33 wxNotebookPageInfo() { m_page = NULL ; m_imageId = -1 ; m_selected = false ; }
34 virtual ~wxNotebookPageInfo() { }
35
36 void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId )
37 { m_page = page ; m_text = text ; m_selected = selected ; m_imageId = imageId ; }
38 wxNotebookPage* GetPage() const { return m_page ; }
39 wxString GetText() const { return m_text ; }
40 bool GetSelected() const { return m_selected ; }
41 int GetImageId() const { return m_imageId; }
42 private :
43 wxNotebookPage *m_page ;
44 wxString m_text ;
45 bool m_selected ;
46 int m_imageId ;
47
48 DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo) ;
49 } ;
50
51
52 WX_DECLARE_LIST(wxNotebookPageInfo, wxNotebookPageInfoList);
53 // WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
54 // WX_DECLARE_LIST_3(wxNotebookPageInfo, wxNotebookPageInfo, wxNotebookPageInfoList, wxNotebookPageInfoListNode, class WXDLLEXPORT);
55
56 class WXDLLEXPORT wxNotebook : public wxNotebookBase
57 {
58 public:
59 // ctors
60 // -----
61 // default for dynamic class
62 wxNotebook();
63 // the same arguments as for wxControl (@@@ any special styles?)
64 wxNotebook(wxWindow *parent,
65 wxWindowID id,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = 0,
69 const wxString& name = wxNOTEBOOK_NAME);
70 // Create() function
71 bool Create(wxWindow *parent,
72 wxWindowID id,
73 const wxPoint& pos = wxDefaultPosition,
74 const wxSize& size = wxDefaultSize,
75 long style = 0,
76 const wxString& name = wxNOTEBOOK_NAME);
77
78 // accessors
79 // ---------
80 // get number of pages in the dialog
81 int GetPageCount() const;
82
83 // set the currently selected page, return the index of the previously
84 // selected one (or -1 on error)
85 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
86 int SetSelection(int nPage);
87 // get the currently selected page
88 int GetSelection() const { return m_nSelection; }
89
90 // set/get the title of a page
91 bool SetPageText(int nPage, const wxString& strText);
92 wxString GetPageText(int nPage) const;
93
94 // image list stuff: each page may have an image associated with it. All
95 // the images belong to an image list, so you have to
96 // 1) create an image list
97 // 2) associate it with the notebook
98 // 3) set for each page it's image
99 // associate image list with a control
100 void SetImageList(wxImageList* imageList);
101
102 // sets/returns item's image index in the current image list
103 int GetPageImage(int nPage) const;
104 bool SetPageImage(int nPage, int nImage);
105
106 // currently it's always 1 because wxGTK doesn't support multi-row
107 // tab controls
108 int GetRowCount() const;
109
110 // control the appearance of the notebook pages
111 // set the size (the same for all pages)
112 void SetPageSize(const wxSize& size);
113 // set the padding between tabs (in pixels)
114 void SetPadding(const wxSize& padding);
115
116 // Windows only: attempts to get colour for UX theme page background
117 wxColour GetThemeBackgroundColour();
118
119 // operations
120 // ----------
121 // remove all pages
122 bool DeleteAllPages();
123
124 // inserts a new page to the notebook (it will be deleted ny the notebook,
125 // don't delete it yourself). If bSelect, this page becomes active.
126 bool InsertPage(int nPage,
127 wxNotebookPage *pPage,
128 const wxString& strText,
129 bool bSelect = FALSE,
130 int imageId = -1);
131
132 void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
133 const wxNotebookPageInfoList& GetPageInfos() const ;
134
135 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
136 // style.
137 void SetTabSize(const wxSize& sz);
138
139 // Windows only: attempts to apply the UX theme page background to this page
140 void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
141
142 // hit test
143 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
144
145 // calculate the size of the notebook from the size of its page
146 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
147
148 // callbacks
149 // ---------
150 void OnSize(wxSizeEvent& event);
151 void OnSelChange(wxNotebookEvent& event);
152 void OnSetFocus(wxFocusEvent& event);
153 void OnNavigationKey(wxNavigationKeyEvent& event);
154
155 // base class virtuals
156 // -------------------
157
158 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
159 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
160 WXWORD pos, WXHWND control);
161
162 #if wxUSE_CONSTRAINTS
163 virtual void SetConstraintSizes(bool recurse = TRUE);
164 virtual bool DoPhase(int nPhase);
165 #endif // wxUSE_CONSTRAINTS
166
167 protected:
168 // common part of all ctors
169 void Init();
170
171 // translate wxWin styles to the Windows ones
172 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
173
174 // remove one page from the notebook, without deleting
175 virtual wxNotebookPage *DoRemovePage(int nPage);
176
177 // set the size of the given page to fit in the notebook
178 void AdjustPageSize(wxNotebookPage *page);
179
180 // override WndProc
181 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
182
183 // the current selection (-1 if none)
184 int m_nSelection;
185
186 wxNotebookPageInfoList m_pageInfos ;
187
188
189 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
190 DECLARE_EVENT_TABLE()
191 };
192
193 #endif // wxUSE_NOTEBOOK
194
195 #endif // _NOTEBOOK_H