]>
git.saurik.com Git - wxWidgets.git/blob - 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
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
15 #pragma interface "notebook.h"
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
24 #include "wx/control.h"
26 // ----------------------------------------------------------------------------
28 // ----------------------------------------------------------------------------
31 * Flags returned by HitTest
34 #define wxNB_HITTEST_NOWHERE 1
35 #define wxNB_HITTEST_ONICON 2
36 #define wxNB_HITTEST_ONLABEL 4
37 #define wxNB_HITTEST_ONITEM 6
39 class WXDLLEXPORT wxNotebook
: public wxNotebookBase
44 // default for dynamic class
46 // the same arguments as for wxControl (@@@ any special styles?)
47 wxNotebook(wxWindow
*parent
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
52 const wxString
& name
= wxNOTEBOOK_NAME
);
54 bool Create(wxWindow
*parent
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
59 const wxString
& name
= wxNOTEBOOK_NAME
);
63 // get number of pages in the dialog
64 int GetPageCount() const;
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
; }
73 // set/get the title of a page
74 bool SetPageText(int nPage
, const wxString
& strText
);
75 wxString
GetPageText(int nPage
) const;
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
);
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
);
89 // currently it's always 1 because wxGTK doesn't support multi-row
91 int GetRowCount() const;
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
);
99 // Windows only: attempts to get colour for UX theme page background
100 wxColour
GetThemeBackgroundColour();
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
,
114 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
116 void SetTabSize(const wxSize
& sz
);
118 // Windows only: attempts to apply the UX theme page background to this page
119 void ApplyThemeBackground(wxWindow
* window
, const wxColour
& colour
);
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;
128 void OnSize(wxSizeEvent
& event
);
129 void OnSelChange(wxNotebookEvent
& event
);
130 void OnSetFocus(wxFocusEvent
& event
);
131 void OnNavigationKey(wxNavigationKeyEvent
& event
);
133 // base class virtuals
134 // -------------------
136 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
137 virtual bool MSWOnScroll(int orientation
, WXWORD nSBCode
,
138 WXWORD pos
, WXHWND control
);
140 #if wxUSE_CONSTRAINTS
141 virtual void SetConstraintSizes(bool recurse
= TRUE
);
142 virtual bool DoPhase(int nPhase
);
143 #endif // wxUSE_CONSTRAINTS
146 // common part of all ctors
149 // translate wxWin styles to the Windows ones
150 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
152 // remove one page from the notebook, without deleting
153 virtual wxNotebookPage
*DoRemovePage(int nPage
);
155 // set the size of the given page to fit in the notebook
156 void AdjustPageSize(wxNotebookPage
*page
);
159 // the current selection (-1 if none)
163 DECLARE_DYNAMIC_CLASS(wxNotebook
)
164 DECLARE_EVENT_TABLE()
167 #endif // wxUSE_NOTEBOOK
169 #endif // _NOTEBOOK_H