]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/notebook.h
Moved print dialog data conversion code
[wxWidgets.git] / include / wx / msw / notebook.h
CommitLineData
b5f2afe5
VZ
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$
371a5b4e 7// Copyright: (c) Julian Smart
65571936 8// Licence: wxWindows licence
b5f2afe5
VZ
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _NOTEBOOK_H
12#define _NOTEBOOK_H
13
12028905 14#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
b5f2afe5
VZ
15 #pragma interface "notebook.h"
16#endif
17
1e6feb95
VZ
18#if wxUSE_NOTEBOOK
19
b5f2afe5
VZ
20// ----------------------------------------------------------------------------
21// headers
22// ----------------------------------------------------------------------------
74b31181 23
7c0ea335 24#include "wx/control.h"
b5f2afe5 25
b5f2afe5
VZ
26// ----------------------------------------------------------------------------
27// wxNotebook
28// ----------------------------------------------------------------------------
29
8acd402f
SC
30class WXDLLEXPORT wxNotebookPageInfo : public wxObject
31{
32public :
33 wxNotebookPageInfo() { m_page = NULL ; m_imageId = -1 ; m_selected = false ; }
34 virtual ~wxNotebookPageInfo() { }
35
078cf5cb 36 void Create( wxNotebookPage *page , const wxString &text , bool selected , int imageId )
8acd402f
SC
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; }
42private :
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
91c9dbdc 52WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
8acd402f 53
1e6feb95 54class WXDLLEXPORT wxNotebook : public wxNotebookBase
b5f2afe5
VZ
55{
56public:
57 // ctors
58 // -----
59 // default for dynamic class
60 wxNotebook();
61 // the same arguments as for wxControl (@@@ any special styles?)
62 wxNotebook(wxWindow *parent,
35eca07c 63 wxWindowID id,
b5f2afe5
VZ
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
debe6624 66 long style = 0,
2b5f62a0 67 const wxString& name = wxNOTEBOOK_NAME);
b5f2afe5
VZ
68 // Create() function
69 bool Create(wxWindow *parent,
35eca07c 70 wxWindowID id,
b5f2afe5
VZ
71 const wxPoint& pos = wxDefaultPosition,
72 const wxSize& size = wxDefaultSize,
debe6624 73 long style = 0,
2b5f62a0 74 const wxString& name = wxNOTEBOOK_NAME);
b5f2afe5
VZ
75
76 // accessors
77 // ---------
78 // get number of pages in the dialog
8d34bf5c 79 virtual size_t GetPageCount() const;
b5f2afe5
VZ
80
81 // set the currently selected page, return the index of the previously
82 // selected one (or -1 on error)
83 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
15aad3b9 84 int SetSelection(size_t nPage);
b5f2afe5
VZ
85 // get the currently selected page
86 int GetSelection() const { return m_nSelection; }
87
88 // set/get the title of a page
15aad3b9
VZ
89 bool SetPageText(size_t nPage, const wxString& strText);
90 wxString GetPageText(size_t nPage) const;
b5f2afe5
VZ
91
92 // image list stuff: each page may have an image associated with it. All
93 // the images belong to an image list, so you have to
94 // 1) create an image list
95 // 2) associate it with the notebook
96 // 3) set for each page it's image
97 // associate image list with a control
98 void SetImageList(wxImageList* imageList);
b5f2afe5
VZ
99
100 // sets/returns item's image index in the current image list
15aad3b9
VZ
101 int GetPageImage(size_t nPage) const;
102 bool SetPageImage(size_t nPage, int nImage);
b5f2afe5 103
b5f2afe5
VZ
104 // currently it's always 1 because wxGTK doesn't support multi-row
105 // tab controls
106 int GetRowCount() const;
107
108 // control the appearance of the notebook pages
109 // set the size (the same for all pages)
110 void SetPageSize(const wxSize& size);
111 // set the padding between tabs (in pixels)
112 void SetPadding(const wxSize& padding);
113
85b43fbf
JS
114 // Windows only: attempts to get colour for UX theme page background
115 wxColour GetThemeBackgroundColour();
116
b5f2afe5
VZ
117 // operations
118 // ----------
b5f2afe5
VZ
119 // remove all pages
120 bool DeleteAllPages();
e450aa69 121
efa14cf2 122 // inserts a new page to the notebook (it will be deleted ny the notebook,
b5f2afe5 123 // don't delete it yourself). If bSelect, this page becomes active.
15aad3b9 124 bool InsertPage(size_t nPage,
b5f2afe5
VZ
125 wxNotebookPage *pPage,
126 const wxString& strText,
078cf5cb 127 bool bSelect = false,
8a33ea62 128 int imageId = -1);
b5f2afe5 129
8acd402f
SC
130 void AddPageInfo( wxNotebookPageInfo* info ) { AddPage( info->GetPage() , info->GetText() , info->GetSelected() , info->GetImageId() ) ; }
131 const wxNotebookPageInfoList& GetPageInfos() const ;
132
58a8ab88
JS
133 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
134 // style.
135 void SetTabSize(const wxSize& sz);
136
85b43fbf
JS
137 // Windows only: attempts to apply the UX theme page background to this page
138 void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
17816c2e 139
e450aa69
VZ
140 // hit test
141 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
142
143 // calculate the size of the notebook from the size of its page
2ce7af35
JS
144 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
145
b5f2afe5
VZ
146 // callbacks
147 // ---------
9026ad85 148 void OnSize(wxSizeEvent& event);
b5f2afe5 149 void OnSelChange(wxNotebookEvent& event);
8a33ea62 150 void OnNavigationKey(wxNavigationKeyEvent& event);
35eca07c 151
b5f2afe5
VZ
152 // base class virtuals
153 // -------------------
0b481c72 154
a23fd0e1 155 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
0df3fbd7
VZ
156 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
157 WXWORD pos, WXHWND control);
b8bdaa7c 158 virtual bool MSWTranslateMessage(WXMSG *wxmsg);
0b481c72
VZ
159
160#if wxUSE_CONSTRAINTS
078cf5cb 161 virtual void SetConstraintSizes(bool recurse = true);
5475b960 162 virtual bool DoPhase(int nPhase);
0b481c72 163#endif // wxUSE_CONSTRAINTS
b5f2afe5
VZ
164
165protected:
166 // common part of all ctors
167 void Init();
168
0df3fbd7
VZ
169 // translate wxWin styles to the Windows ones
170 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
171
1e6feb95 172 // remove one page from the notebook, without deleting
15aad3b9 173 virtual wxNotebookPage *DoRemovePage(size_t nPage);
1e6feb95 174
2015f2b3
VZ
175 // set the size of the given page to fit in the notebook
176 void AdjustPageSize(wxNotebookPage *page);
177
ffafd8a5
DS
178 // override WndProc.
179#if wxUSE_UXTHEME
c140b7e7 180 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
ffafd8a5 181#endif
2015f2b3 182
2b5f62a0
VZ
183 // the current selection (-1 if none)
184 int m_nSelection;
b5f2afe5 185
8acd402f
SC
186 wxNotebookPageInfoList m_pageInfos ;
187
2015f2b3 188
fc7a2a60 189 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
b5f2afe5
VZ
190 DECLARE_EVENT_TABLE()
191};
192
1e6feb95
VZ
193#endif // wxUSE_NOTEBOOK
194
b5f2afe5 195#endif // _NOTEBOOK_H