1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/notebook.h
3 // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4 // Author: William Osborne
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "notebook.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 #include "wx/control.h"
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLEXPORT wxNotebookPageInfo
: public wxObject
34 wxNotebookPageInfo() { m_page
= NULL
; m_imageId
= -1 ; m_selected
= false ; }
35 virtual ~wxNotebookPageInfo() { }
37 void Create( wxNotebookPage
*page
, const wxString
&text
, bool selected
, int imageId
)
38 { m_page
= page
; m_text
= text
; m_selected
= selected
; m_imageId
= imageId
; }
39 wxNotebookPage
* GetPage() const { return m_page
; }
40 wxString
GetText() const { return m_text
; }
41 bool GetSelected() const { return m_selected
; }
42 int GetImageId() const { return m_imageId
; }
44 wxNotebookPage
*m_page
;
49 DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo
) ;
53 WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo
, wxNotebookPageInfoList
);
55 class WXDLLEXPORT wxNotebook
: public wxNotebookBase
60 // default for dynamic class
62 // the same arguments as for wxControl (@@@ any special styles?)
63 wxNotebook(wxWindow
*parent
,
65 const wxPoint
& pos
= wxDefaultPosition
,
66 const wxSize
& size
= wxDefaultSize
,
68 const wxString
& name
= wxNOTEBOOK_NAME
);
70 bool Create(wxWindow
*parent
,
72 const wxPoint
& pos
= wxDefaultPosition
,
73 const wxSize
& size
= wxDefaultSize
,
75 const wxString
& name
= wxNOTEBOOK_NAME
);
79 // get number of pages in the dialog
80 virtual size_t GetPageCount() const;
82 // set the currently selected page, return the index of the previously
83 // selected one (or -1 on error)
84 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
85 int SetSelection(size_t nPage
);
86 // get the currently selected page
87 int GetSelection() const { return m_nSelection
; }
89 // set/get the title of a page
90 bool SetPageText(size_t nPage
, const wxString
& strText
);
91 wxString
GetPageText(size_t nPage
) const;
93 // image list stuff: each page may have an image associated with it. All
94 // the images belong to an image list, so you have to
95 // 1) create an image list
96 // 2) associate it with the notebook
97 // 3) set for each page it's image
98 // associate image list with a control
99 void SetImageList(wxImageList
* imageList
);
101 // sets/returns item's image index in the current image list
102 int GetPageImage(size_t nPage
) const;
103 bool SetPageImage(size_t nPage
, int nImage
);
105 // currently it's always 1 because wxGTK doesn't support multi-row
107 int GetRowCount() const;
109 // control the appearance of the notebook pages
110 // set the size (the same for all pages)
111 void SetPageSize(const wxSize
& size
);
112 // set the padding between tabs (in pixels)
113 void SetPadding(const wxSize
& padding
);
115 // Windows only: attempts to get colour for UX theme page background
116 wxColour
GetThemeBackgroundColour();
121 bool DeleteAllPages();
123 // inserts a new page to the notebook (it will be deleted ny the notebook,
124 // don't delete it yourself). If bSelect, this page becomes active.
125 bool InsertPage(size_t nPage
,
126 wxNotebookPage
*pPage
,
127 const wxString
& strText
,
128 bool bSelect
= FALSE
,
131 void AddPageInfo( wxNotebookPageInfo
* info
) { AddPage( info
->GetPage() , info
->GetText() , info
->GetSelected() , info
->GetImageId() ) ; }
132 const wxNotebookPageInfoList
& GetPageInfos() const ;
134 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
136 void SetTabSize(const wxSize
& sz
);
138 // Windows only: attempts to apply the UX theme page background to this page
139 void ApplyThemeBackground(wxWindow
* window
, const wxColour
& colour
);
142 virtual int HitTest(const wxPoint
& pt
, long *flags
= NULL
) const;
144 // calculate the size of the notebook from the size of its page
145 virtual wxSize
CalcSizeFromPage(const wxSize
& sizePage
) const;
149 void OnSize(wxSizeEvent
& event
);
150 void OnSelChange(wxNotebookEvent
& event
);
151 void OnNavigationKey(wxNavigationKeyEvent
& event
);
153 // base class virtuals
154 // -------------------
156 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
157 virtual bool MSWOnScroll(int orientation
, WXWORD nSBCode
,
158 WXWORD pos
, WXHWND control
);
159 virtual bool MSWTranslateMessage(WXMSG
*wxmsg
);
161 #if wxUSE_CONSTRAINTS
162 virtual void SetConstraintSizes(bool recurse
= TRUE
);
163 virtual bool DoPhase(int nPhase
);
164 #endif // wxUSE_CONSTRAINTS
167 // common part of all ctors
170 // translate wxWin styles to the Windows ones
171 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
173 // remove one page from the notebook, without deleting
174 virtual wxNotebookPage
*DoRemovePage(size_t nPage
);
176 // set the size of the given page to fit in the notebook
177 void AdjustPageSize(wxNotebookPage
*page
);
181 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
184 // the current selection (-1 if none)
187 wxNotebookPageInfoList m_pageInfos
;
190 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook
)
191 DECLARE_EVENT_TABLE()
194 #endif // wxUSE_NOTEBOOK
196 #endif // _NOTEBOOK_H