WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
class WXDLLIMPEXP_FWD_CORE wxImageList;
-class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent;
+class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent;
// ----------------------------------------------------------------------------
// constants
{ wxFAIL_MSG(wxT("Override this function!")); }
// create a new "page changing" event
- virtual wxBookCtrlBaseEvent* CreatePageChangingEvent() const
+ virtual wxBookCtrlEvent* CreatePageChangingEvent() const
{ wxFAIL_MSG(wxT("Override this function!")); return NULL; }
// modify the event created by CreatePageChangingEvent() to "page changed"
// event, usually by just calling SetEventType() on it
- virtual void MakeChangedEvent(wxBookCtrlBaseEvent& WXUNUSED(event))
+ virtual void MakeChangedEvent(wxBookCtrlEvent& WXUNUSED(event))
{ wxFAIL_MSG(wxT("Override this function!")); }
};
// ----------------------------------------------------------------------------
-// wxBookCtrlBaseEvent: page changing events generated by derived classes
+// wxBookCtrlEvent: page changing events generated by book classes
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxBookCtrlBaseEvent : public wxNotifyEvent
+class WXDLLIMPEXP_CORE wxBookCtrlEvent : public wxNotifyEvent
{
public:
- wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
+ wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = -1, int nOldSel = -1)
: wxNotifyEvent(commandType, winid)
{
m_nOldSel = nOldSel;
}
- wxBookCtrlBaseEvent(const wxBookCtrlBaseEvent& event)
+ wxBookCtrlEvent(const wxBookCtrlEvent& event)
: wxNotifyEvent(event)
{
m_nSel = event.m_nSel;
m_nOldSel = event.m_nOldSel;
}
+ virtual wxEvent *Clone() const { return new wxBookCtrlEvent(*this); }
+
// accessors
// the currently selected page (-1 if none)
int GetSelection() const { return m_nSel; }
private:
int m_nSel, // currently selected page
m_nOldSel; // previously selected page
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxBookCtrlEvent)
};
+typedef void (wxEvtHandler::*wxBookCtrlEventFunction)(wxBookCtrlEvent&);
+
+#define wxBookCtrlEventHandler(func) \
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxBookCtrlEventFunction, &func)
+
+// obsolete name, defined for compatibility only
+#define wxBookCtrlBaseEvent wxBookCtrlEvent
+
// make a default book control for given platform
#if wxUSE_NOTEBOOK
// dedicated to majority of desktops
#include "wx/notebook.h"
#define wxBookCtrl wxNotebook
- #define wxBookCtrlEvent wxNotebookEvent
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
- #define wxBookctrlEventHandler(func) wxNotebookEventHandler(func)
#else
// dedicated to Smartphones
#include "wx/choicebk.h"
#define wxBookCtrl wxChoicebook
- #define wxBookCtrlEvent wxChoicebookEvent
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
- #define wxBookctrlEventHandler(func) wxChoicebookEventHandler(func)
#endif
#if WXWIN_COMPATIBILITY_2_6
GetChoiceCtrl()->Select(newsel);
}
- wxBookCtrlBaseEvent* CreatePageChangingEvent() const;
- void MakeChangedEvent(wxBookCtrlBaseEvent &event);
+ wxBookCtrlEvent* CreatePageChangingEvent() const;
+ void MakeChangedEvent(wxBookCtrlEvent &event);
// event handlers
void OnChoiceSelected(wxCommandEvent& event);
// choicebook event class and related stuff
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxChoicebookEvent : public wxBookCtrlBaseEvent
-{
-public:
- wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
- int nSel = -1, int nOldSel = -1)
- : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
- {
- }
-
- wxChoicebookEvent(const wxChoicebookEvent& event)
- : wxBookCtrlBaseEvent(event)
- {
- }
-
- virtual wxEvent *Clone() const { return new wxChoicebookEvent(*this); }
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChoicebookEvent)
-};
-
-typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&);
-
-#define wxChoicebookEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChoicebookEventFunction, &func)
+// wxChoicebookEvent is obsolete and defined for compatibility only
+typedef wxBookCtrlEvent wxChoicebookEvent;
+typedef wxBookCtrlEventFunction wxChoicebookEventFunction;
+#define wxChoicebookEventHandler(func) wxBookCtrlEventHandler(func)
#define EVT_CHOICEBOOK_PAGE_CHANGED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxChoicebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_CHOICEBOOK_PAGE_CHANGING(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxChoicebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
#endif // wxUSE_CHOICEBOOK
protected:
void PageChanged(int OldSelection, int newSelection);
- void OnPageChanged(wxNotebookEvent& event);
+ void OnPageChanged(wxBookCtrlEvent& event);
void OnSize(wxSizeEvent& event);
private:
// ---------
void OnSize(wxSizeEvent& event);
void OnInternalIdle();
- void OnSelChange(wxNotebookEvent& event);
+ void OnSelChange(wxBookCtrlEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// implementation
// --------------
- // Since this wxButton doesn't derive from wxButtonBase (why?) we need
- // to override this here too...
- virtual bool ShouldInheritColours() const { return false; }
-
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
void UpdateSelectedPage(size_t newsel);
- wxBookCtrlBaseEvent* CreatePageChangingEvent() const;
- void MakeChangedEvent(wxBookCtrlBaseEvent &event);
+ wxBookCtrlEvent* CreatePageChangingEvent() const;
+ void MakeChangedEvent(wxBookCtrlEvent &event);
// get flags for different list control modes
long GetListCtrlIconViewFlags() const;
// listbook event class and related stuff
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxListbookEvent : public wxBookCtrlBaseEvent
-{
-public:
- wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
- int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
- : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
- {
- }
-
- wxListbookEvent(const wxListbookEvent& event)
- : wxBookCtrlBaseEvent(event)
- {
- }
-
- virtual wxEvent *Clone() const { return new wxListbookEvent(*this); }
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxListbookEvent)
-};
-
-typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&);
-
-#define wxListbookEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func)
+// wxListbookEvent is obsolete and defined for compatibility only
+typedef wxBookCtrlEvent wxListbookEvent;
+typedef wxBookCtrlEventFunction wxListbookEventFunction;
+#define wxListbookEventHandler(func) wxBookCtrlEventHandler(func)
#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
#endif // wxUSE_LISTBOOK
void OnScroll(wxScrollEvent& event);
// Implementation
- void OnPageChanged(wxNotebookEvent& event);
+ void OnPageChanged(wxBookCtrlEvent& event);
int FindPage(const wxNotebookPage* page);
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
- void OnSelChange(wxNotebookEvent& event);
+ void OnSelChange(wxBookCtrlEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// base class virtuals
// notebook event class and related stuff
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxNotebookEvent : public wxBookCtrlBaseEvent
-{
-public:
- wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
- int nSel = -1, int nOldSel = -1)
- : wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel)
- {
- }
-
- wxNotebookEvent(const wxNotebookEvent& event)
- : wxBookCtrlBaseEvent(event)
- {
- }
-
- virtual wxEvent *Clone() const { return new wxNotebookEvent(*this); }
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotebookEvent)
-};
+// wxNotebookEvent is obsolete and defined for compatibility only
+typedef wxBookCtrlEvent wxNotebookEvent;
+typedef wxBookCtrlEventFunction wxNotebookEventFunction;
+#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func)
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING;
-typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
-
-#define wxNotebookEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotebookEventFunction, &func)
-
#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxNotebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxNotebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
// ----------------------------------------------------------------------------
// wxNotebook class itself
// ---------
//
void OnSize(wxSizeEvent& rEvent);
- void OnSelChange(wxNotebookEvent& rEvent);
+ void OnSelChange(wxBookCtrlEvent& rEvent);
void OnSetFocus(wxFocusEvent& rEvent);
void OnNavigationKey(wxNavigationKeyEvent& rEvent);
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
- void OnSelChange(wxNotebookEvent& event);
+ void OnSelChange(wxBookCtrlEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
- void OnSelChange(wxNotebookEvent& event);
+ void OnSelChange(wxBookCtrlEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// base class virtuals
void UpdateSelectedPage(size_t newsel);
- wxBookCtrlBaseEvent* CreatePageChangingEvent() const;
- void MakeChangedEvent(wxBookCtrlBaseEvent &event);
+ wxBookCtrlEvent* CreatePageChangingEvent() const;
+ void MakeChangedEvent(wxBookCtrlEvent &event);
// the currently selected page or wxNOT_FOUND if none
int m_selection;
// listbook event class and related stuff
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxToolbookEvent : public wxBookCtrlBaseEvent
-{
-public:
- wxToolbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
- int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
- : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
- {
- }
-
- wxToolbookEvent(const wxToolbookEvent& event)
- : wxBookCtrlBaseEvent(event)
- {
- }
-
- virtual wxEvent *Clone() const { return new wxToolbookEvent(*this); }
-
-private:
- DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxToolbookEvent)
-};
-
-typedef void (wxEvtHandler::*wxToolbookEventFunction)(wxToolbookEvent&);
+// wxToolbookEvent is obsolete and defined for compatibility only
+typedef wxBookCtrlEvent wxToolbookEvent;
+typedef wxBookCtrlEventFunction wxToolbookEventFunction;
+#define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func)
-#define wxToolbookEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxToolbookEventFunction, &func)
#define EVT_TOOLBOOK_PAGE_CHANGED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxToolbookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_TOOLBOOK_PAGE_CHANGING(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxToolbookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
#endif // wxUSE_TOOLBOOK
// treebook event class and related stuff
// ----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxTreebookEvent : public wxBookCtrlBaseEvent
-{
-public:
- wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
- int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
- : wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
- {
- }
-
- wxTreebookEvent(const wxTreebookEvent& event)
- : wxBookCtrlBaseEvent(event)
- {
- }
-
- virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); }
+// wxTreebookEvent is obsolete and defined for compatibility only
+typedef wxBookCtrlEvent wxTreebookEvent;
+typedef wxBookCtrlEventFunction wxTreebookEventFunction;
+#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func)
-private:
- DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTreebookEvent)
-};
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED;
-typedef void (wxEvtHandler::*wxTreebookEventFunction)(wxTreebookEvent&);
-
-#define wxTreebookEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxTreebookEventFunction, &func)
-
#define EVT_TREEBOOK_PAGE_CHANGED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxTreebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
#define EVT_TREEBOOK_PAGE_CHANGING(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxTreebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
#define EVT_TREEBOOK_NODE_COLLAPSED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxTreebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED, winid, wxBookCtrlEventHandler(fn))
#define EVT_TREEBOOK_NODE_EXPANDED(winid, fn) \
- wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxTreebookEventHandler(fn))
+ wx__DECLARE_EVT1(wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED, winid, wxBookCtrlEventHandler(fn))
#endif // wxUSE_TREEBOOK
};
+
+/**
+ @class wxBookCtrlEvent
+
+ This class represents the events generated by book controls (wxNotebook,
+ wxListbook, wxChoicebook, wxTreebook).
+ The PAGE_CHANGING events are sent before the current page is changed.
+ It allows the program to examine the current page (which can be retrieved
+ with wxBookCtrlEvent::GetOldSelection) and to veto the page change by calling
+ wxNotifyEvent::Veto if, for example, the current values in the controls
+ of the old page are invalid.
+
+ The PAGE_CHANGED events are sent after the page has been changed and
+ the program cannot veto it any more, it just informs it about the page
+ change.
+
+ To summarize, if the program is interested in validating the page values
+ before allowing the user to change it, it should process the PAGE_CHANGING
+ event, otherwise PAGE_CHANGED is probably enough. In any case, it is
+ probably unnecessary to process both events at once.
+
+ @library{wxcore}
+ @category{events}
+
+ @see wxNotebook, wxListbook, wxChoicebook, wxTreebook
+*/
+
+class wxBookCtrlEvent : public wxNotifyEvent
+{
+public:
+ /**
+ Constructor (used internally by wxWidgets only).
+ */
+ wxBookCtrlEvent(wxEventType eventType = wxEVT_NULL, int id = 0,
+ int sel = wxNOT_FOUND, int oldSel = wxNOT_FOUND);
+
+ /**
+ Returns the page that was selected before the change, @c wxNOT_FOUND if
+ none was selected.
+ */
+ int GetOldSelection() const;
+
+ /**
+ Returns the currently selected page, or @c wxNOT_FOUND if none was
+ selected.
+ @note under Windows, GetSelection() will return the same value as
+ GetOldSelection() when called from @c EVT_NOTEBOOK_PAGE_CHANGING
+ handler and not the page which is going to be selected.
+ */
+ int GetSelection() const;
+
+ /**
+ Sets the id of the page selected before the change.
+ */
+ void SetOldSelection(int page);
+
+ /**
+ Sets the selection member variable.
+ */
+ void SetSelection(int page);
+};
+
Place labels below the page area.
@endStyleTable
- @beginEventTable{wxChoicebookEvent}
+ @beginEventTable{wxBookCtrlEvent}
@event{EVT_CHOICEBOOK_PAGE_CHANGED(id, func)}
The page selection was changed. Processes a
wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED event.
@class wxNotifyEvent
This class is not used by the event handlers by itself, but is a base class
- for other event classes (such as wxNotebookEvent).
+ for other event classes (such as wxBookCtrlEvent).
It (or an object of a derived class) is sent when the controls state is being
changed and allows the program to wxNotifyEvent::Veto() this change if it wants
@library{wxcore}
@category{events}
- @see wxNotebookEvent
+ @see wxBookCtrlEvent
*/
class wxNotifyEvent : public wxCommandEvent
{
/////////////////////////////////////////////////////////////////////////////
// Name: notebook.h
-// Purpose: interface of wxNotebookEvent
+// Purpose: interface of wxNotebook
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-/**
- @class wxNotebookEvent
-
- This class represents the events generated by a notebook control: currently,
- there are two of them. The PAGE_CHANGING event is sent before the current
- page is changed. It allows the program to examine the current page (which
- can be retrieved with
- wxNotebookEvent::GetOldSelection) and to veto the page
- change by calling wxNotifyEvent::Veto if, for example, the
- current values in the controls of the old page are invalid.
-
- The second event - PAGE_CHANGED - is sent after the page has been changed and
- the program cannot veto it any more, it just informs it about the page change.
-
- To summarize, if the program is interested in validating the page values
- before allowing the user to change it, it should process the PAGE_CHANGING
- event, otherwise PAGE_CHANGED is probably enough. In any case, it is probably
- unnecessary to process both events at once.
-
- @library{wxcore}
- @category{events}
-
- @see wxNotebook
-*/
-class wxNotebookEvent : public wxNotifyEvent
-{
-public:
- /**
- Constructor (used internally by wxWidgets only).
- */
- wxNotebookEvent(wxEventType eventType = wxEVT_NULL, int id = 0,
- int sel = -1,
- int oldSel = -1);
-
- /**
- Returns the page that was selected before the change, -1 if none was selected.
- */
- int GetOldSelection() const;
-
- /**
- Returns the currently selected page, or -1 if none was selected.
- @note under Windows, GetSelection() will return the same value as
- GetOldSelection() when called from
- @c EVT_NOTEBOOK_PAGE_CHANGING handler and not the page which is going to
- be selected. Also note that the values of selection and old selection returned
- for an event generated in response to a call to
- wxNotebook::SetSelection shouldn't be trusted
- as they are currently inconsistent under different platforms (but in this case
- you presumably don't need them anyhow as you already have the corresponding
- information).
- */
- int GetSelection() const;
-
- /**
- Sets the id of the page selected before the change.
- */
- void SetOldSelection(int page);
-
- /**
- Sets the selection member variable.
- */
- void SetSelection(int page);
-};
-
-
-
/**
@class wxNotebook
This class represents a notebook control, which manages multiple windows with
associated tabs.
- To use the class, create a wxNotebook object and call wxNotebook::AddPage or
- wxNotebook::InsertPage,
- passing a window to be used as the page. Do not explicitly delete the window
- for a page that is currently
- managed by wxNotebook.
+ To use the class, create a wxNotebook object and call wxNotebook::AddPage
+ or wxNotebook::InsertPage, passing a window to be used as the page. Do not
+ explicitly delete the window for a page that is currently managed by
+ wxNotebook.
@b wxNotebookPage is a typedef for wxWindow.
@library{wxcore}
@category{miscwnd}
- @see wxBookCtrl(), wxNotebookEvent, wxImageList,
- @ref page_samples_notebook "Notebook Sample"
+ @see wxBookCtrl, wxBookCtrlEvent, wxImageList,
+ @ref page_samples_notebook "Notebook Sample"
*/
class wxNotebook : public wxBookCtrl overview
{
/**
Changes the selection for the given page, returning the previous selection.
The call to this function does not generate the page changing events.
- This is the only difference with SetSelection(). See
+ This is the only difference with SetSelection(). See
@ref overview_eventhandling_prog "User Generated Events"
for more infomation.
*/
/**
Returns the currently selected page, or -1 if none was selected.
- Note that this method may return either the previously or newly selected page
- when called from the @c EVT_NOTEBOOK_PAGE_CHANGED handler depending on
- the platform and so
- wxNotebookEvent::GetSelection should be
+ Note that this method may return either the previously or newly
+ selected page when called from the @c EVT_NOTEBOOK_PAGE_CHANGED handler
+ depending on the platform and so wxBookCtrlEvent::GetSelection should be
used instead in this case.
*/
virtual int GetSelection() const;
/**
An event handler function, called when the page selection is changed.
- @see wxNotebookEvent
+ @see wxBookCtrlEvent
*/
- void OnSelChange(wxNotebookEvent& event);
+ void OnSelChange(wxBookCtrlEvent& event);
/**
Deletes the specified page, without deleting the associated window.
/////////////////////////////////////////////////////////////////////////////
// Name: treebook.h
-// Purpose: interface of wxTreebookEvent
+// Purpose: interface of wxTreebook
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
-/**
- @class wxTreebookEvent
-
- This class represents the events generated by a treebook control: currently,
- there are four of them. The EVT_TREEBOOK_PAGE_CHANGING() and
- EVT_TREEBOOK_PAGE_CHANGED() - have exactly the same behaviour as
- wxNotebookEvent.
-
- The other two EVT_TREEBOOK_NODE_COLLAPSED() and EVT_TREEBOOK_NODE_EXPANDED()
- are triggered when page node in the tree control is collapsed/expanded. The
- page index could be retreived by calling GetSelection().
-
- @beginEventTable{wxTreebookEvent}
- @event{EVT_TREEBOOK_PAGE_CHANGED(id, func)}
- The page selection was changed. Processes a @c
- wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event.
- @event{EVT_TREEBOOK_PAGE_CHANGING(id, func)}
- The page selection is about to be changed. Processes a @c
- wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING event. This event can be @ref
- wxNotifyEvent::Veto() "vetoed".
- @event{EVT_TREEBOOK_NODE_COLLAPSED(id, func)}
- The page node is going to be collapsed. Processes a @c
- wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED event.
- @event{EVT_TREEBOOK_NODE_EXPANDED(id, func)}
- The page node is going to be expanded. Processes a @c
- wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED event.
- @endEventTable
-
- @library{wxcore}
- @category{events}
-
- @see wxTreebook, wxNotebookEvent
-*/
-class wxTreebookEvent : public wxNotifyEvent
-{
-public:
- /**
- @see wxNotebookEvent
- */
- wxTreebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
- int nSel = wxNOT_FOUND,
- int nOldSel = wxNOT_FOUND);
-
- /**
- Returns the page that was selected before the change, @c wxNOT_FOUND if
- none was selected.
- */
- int GetOldSelection() const;
-
- /**
- Returns the currently selected page, or @c wxNOT_FOUND if none was
- selected.
-
- @see wxNotebookEvent::GetSelection()
- */
- int GetSelection() const;
-};
-
-
-
/**
@class wxTreebook
AddPage() and AddSubPage() to sequentially populate your tree by adding at
every step a page or a subpage to the end of the tree.
- @beginEventTable{wxTreebookEvent}
+ @beginEventTable{wxBookCtrlEvent}
@event{EVT_TREEBOOK_PAGE_CHANGED(id, func)}
The page selection was changed. Processes a @c
wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED event.
@library{wxcore}
@category{miscwnd}
- @see wxTreebookEvent, wxNotebook, wxTreeCtrl, wxImageList,
+ @see wxBookCtrl, wxBookCtrlEvent, wxNotebook, wxTreeCtrl, wxImageList,
@ref overview_bookctrl, @ref page_samples_notebook
*/
class wxTreebook : public wxBookCtrlBase
@note This method may return either the previously or newly selected
page when called from the EVT_TREEBOOK_PAGE_CHANGED() handler
- depending on the platform and so wxTreebookEvent::GetSelection()
+ depending on the platform and so wxBookCtrlEvent::GetSelection()
should be used instead in this case.
*/
int GetSelection() const;
WX_IMPLEMENT_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem)
// ========================================================================
-// wxNotebookEvent
+// wxBookCtrlEvent
// ========================================================================
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ========================================================================
// wxNotebook
void wxNotebook::CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tabViewItem)
{
// FIXME: oldSel probably == newSel
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(),
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId(),
[GetNSTabView() indexOfTabViewItem:tabViewItem], GetSelection());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
bool wxNotebook::CocoaDelegate_tabView_shouldSelectTabViewItem(WX_NSTabViewItem tabViewItem)
{
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(),
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId(),
[GetNSTabView() indexOfTabViewItem:tabViewItem], GetSelection());
event.SetEventObject(this);
return !HandleWindowEvent(event) || event.IsAllowed();
if ( n != (size_t)oldSel )
{
- wxBookCtrlBaseEvent *event = CreatePageChangingEvent();
+ wxBookCtrlEvent *event = CreatePageChangingEvent();
bool allowed = false;
if ( flags & SetSelection_SendEvent )
return oldSel;
}
+IMPLEMENT_DYNAMIC_CLASS(wxBookCtrlEvent, wxNotifyEvent)
#endif // wxUSE_BOOKCTRL
bool wxNotebookBase::SendPageChangingEvent(int nPage)
{
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId());
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId());
event.SetSelection(nPage);
event.SetOldSelection(GetSelection());
event.SetEventObject(this);
void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew)
{
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId());
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId());
event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew);
event.SetOldSelection(nPageOld);
event.SetEventObject(this);
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent)
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType();
return m_selection;
}
-wxBookCtrlBaseEvent* wxChoicebook::CreatePageChangingEvent() const
+wxBookCtrlEvent* wxChoicebook::CreatePageChangingEvent() const
{
- return new wxChoicebookEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId);
+ return new wxBookCtrlEvent(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, m_windowId);
}
-void wxChoicebook::MakeChangedEvent(wxBookCtrlBaseEvent &event)
+void wxChoicebook::MakeChangedEvent(wxBookCtrlEvent &event)
{
event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED);
}
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent)
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType();
return m_selection;
}
-wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const
+wxBookCtrlEvent* wxListbook::CreatePageChangingEvent() const
{
- return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId);
+ return new wxBookCtrlEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId);
}
-void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event)
+void wxListbook::MakeChangedEvent(wxBookCtrlEvent &event)
{
event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED);
}
}
}
-void wxGenericMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
+void wxGenericMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event)
{
PageChanged(event.GetOldSelection(), event.GetSelection());
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// ============================================================================
// implementation
return true;
}
-void wxNotebook::OnSelChange(wxNotebookEvent& event)
+void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
if (!m_notebook)
return;
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
if (m_notebook)
{
- wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId());
+ wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId());
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToolbook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxToolbookEvent, wxNotifyEvent)
const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED = wxNewEventType();
return m_selection;
}
-wxBookCtrlBaseEvent* wxToolbook::CreatePageChangingEvent() const
+wxBookCtrlEvent* wxToolbook::CreatePageChangingEvent() const
{
- return new wxToolbookEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId);
+ return new wxBookCtrlEvent(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGING, m_windowId);
}
-void wxToolbook::MakeChangedEvent(wxBookCtrlBaseEvent &event)
+void wxToolbook::MakeChangedEvent(wxBookCtrlEvent &event)
{
event.SetEventType(wxEVT_COMMAND_TOOLBOOK_PAGE_CHANGED);
}
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxTreebookEvent, wxNotifyEvent)
const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED = wxNewEventType();
wxASSERT_MSG( GetPageCount() == DoInternalGetPageCount(),
wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!"));
- wxTreebookEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId);
+ wxBookCtrlEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId);
const int oldSel = m_selection;
wxTreeCtrl *tree = GetTreeCtrl();
bool allowed = false;
int pagePos = DoInternalFindPageById(nodeId);
wxCHECK_RET( pagePos != wxNOT_FOUND, wxT("Internal problem in wxTreebook!..") );
- wxTreebookEvent ev(GetTreeCtrl()->IsExpanded(nodeId)
+ wxBookCtrlEvent ev(GetTreeCtrl()->IsExpanded(nodeId)
? wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED
: wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED,
m_windowId);
return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
}
-//-----------------------------------------------------------------------------
-// wxNotebookEvent
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
-
#endif
notebook->m_skipNextPageChangeEvent = false;
// make wxNotebook::GetSelection() return the correct (i.e. consistent
- // with wxNotebookEvent::GetSelection()) value even though the page is
+ // with wxBookCtrlEvent::GetSelection()) value even though the page is
// not really changed in GTK+
notebook->m_selection = page;
}
else // change allowed
{
// make wxNotebook::GetSelection() return the correct (i.e. consistent
- // with wxNotebookEvent::GetSelection()) value even though the page is
+ // with wxBookCtrlEvent::GetSelection()) value even though the page is
// not really changed in GTK+
notebook->m_selection = page;
return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
}
-//-----------------------------------------------------------------------------
-// wxNotebookEvent
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
-
#endif
event.Skip();
}
-void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
+void wxMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event)
{
// Notify child that it has been activated
if (event.GetOldSelection() != -1)
}
wxBEGIN_PROPERTIES_TABLE(wxNotebook)
- wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent )
- wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent )
+ wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxBookCtrlEvent )
+ wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxBookCtrlEvent )
wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
#endif
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
event.Skip();
}
-void wxNotebook::OnSelChange(wxNotebookEvent& event)
+void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
{
- wxNotebookEvent event(wxEVT_NULL, m_windowId);
+ wxBookCtrlEvent event(wxEVT_NULL, m_windowId);
NMHDR* hdr = (NMHDR *)lParam;
switch ( hdr->code ) {
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
if (nPage != (size_t)m_nSelection)
{
- wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
+ wxBookCtrlEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
,m_windowId
);
} // end of wxNotebook::OnSize
void wxNotebook::OnSelChange (
- wxNotebookEvent& rEvent
+ wxBookCtrlEvent& rEvent
)
{
//
(pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
{
wxWindowOS2* pWin = wxFindWinFromHandle(pPage->hwndBook);
- wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
+ wxBookCtrlEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
,(int)SHORT1FROMMP(wParam)
,(int)pPage->ulPageIdNew
,(int)pPage->ulPageIdCur
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// common part of all ctors
event.Skip();
}
-void wxNotebook::OnSelChange(wxNotebookEvent& event)
+void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
SInt32 newSel = m_peer->GetValue() - 1 ;
if ( newSel != m_nSelection )
{
- wxNotebookEvent changing(
+ wxBookCtrlEvent changing(
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
newSel , m_nSelection );
changing.SetEventObject( this );
if ( changing.IsAllowed() )
{
- wxNotebookEvent event(
+ wxBookCtrlEvent event(
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
newSel, m_nSelection );
event.SetEventObject( this );
}
wxBEGIN_PROPERTIES_TABLE(wxNotebook)
- wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent )
- wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent )
+ wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxBookCtrlEvent )
+ wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxBookCtrlEvent )
wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
#endif
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
{
}
-void wxNotebook::OnSelChange(wxNotebookEvent& event)
+void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
}
// ============================================================================
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// ----------------------------------------------------------------------------
// wxNotebook creation