use a single wxBookCtrlEvent class for all wxBookCtrlBase-derived controls (#9667)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-08-01 13:46:46 +00:00
parent 10f41d50ff
commit 3e97a90518
37 changed files with 184 additions and 366 deletions

View File

@ -26,7 +26,7 @@
WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
class WXDLLIMPEXP_FWD_CORE wxImageList;
class WXDLLIMPEXP_FWD_CORE wxBookCtrlBaseEvent;
class WXDLLIMPEXP_FWD_CORE wxBookCtrlEvent;
// ----------------------------------------------------------------------------
// constants
@ -260,12 +260,12 @@ protected:
{ 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!")); }
@ -341,13 +341,13 @@ private:
};
// ----------------------------------------------------------------------------
// 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)
{
@ -355,13 +355,15 @@ public:
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; }
@ -373,29 +375,35 @@ public:
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

View File

@ -97,8 +97,8 @@ protected:
GetChoiceCtrl()->Select(newsel);
}
wxBookCtrlBaseEvent* CreatePageChangingEvent() const;
void MakeChangedEvent(wxBookCtrlBaseEvent &event);
wxBookCtrlEvent* CreatePageChangingEvent() const;
void MakeChangedEvent(wxBookCtrlEvent &event);
// event handlers
void OnChoiceSelected(wxCommandEvent& event);
@ -118,36 +118,16 @@ private:
// 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

View File

@ -237,7 +237,7 @@ public:
protected:
void PageChanged(int OldSelection, int newSelection);
void OnPageChanged(wxNotebookEvent& event);
void OnPageChanged(wxBookCtrlEvent& event);
void OnSize(wxSizeEvent& event);
private:

View File

@ -115,7 +115,7 @@ public:
// ---------
void OnSize(wxSizeEvent& event);
void OnInternalIdle();
void OnSelChange(wxNotebookEvent& event);
void OnSelChange(wxBookCtrlEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);

View File

@ -44,10 +44,6 @@ public:
// 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);

View File

@ -94,8 +94,8 @@ protected:
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;
@ -124,36 +124,16 @@ private:
// 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

View File

@ -225,7 +225,7 @@ public:
void OnScroll(wxScrollEvent& event);
// Implementation
void OnPageChanged(wxNotebookEvent& event);
void OnPageChanged(wxBookCtrlEvent& event);
int FindPage(const wxNotebookPage* page);

View File

@ -150,7 +150,7 @@ public:
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
void OnSelChange(wxNotebookEvent& event);
void OnSelChange(wxBookCtrlEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// base class virtuals

View File

@ -118,39 +118,19 @@ protected:
// 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

View File

@ -155,7 +155,7 @@ public:
// ---------
//
void OnSize(wxSizeEvent& rEvent);
void OnSelChange(wxNotebookEvent& rEvent);
void OnSelChange(wxBookCtrlEvent& rEvent);
void OnSetFocus(wxFocusEvent& rEvent);
void OnNavigationKey(wxNavigationKeyEvent& rEvent);

View File

@ -101,7 +101,7 @@ public:
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
void OnSelChange(wxNotebookEvent& event);
void OnSelChange(wxBookCtrlEvent& event);
void OnSetFocus(wxFocusEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);

View File

@ -145,7 +145,7 @@ public:
// callbacks
// ---------
void OnSize(wxSizeEvent& event);
void OnSelChange(wxNotebookEvent& event);
void OnSelChange(wxBookCtrlEvent& event);
void OnNavigationKey(wxNavigationKeyEvent& event);
// base class virtuals

View File

@ -111,8 +111,8 @@ protected:
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;
@ -135,36 +135,17 @@ private:
// 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 is obsolete and defined for compatibility only
typedef wxBookCtrlEvent wxToolbookEvent;
typedef wxBookCtrlEventFunction wxToolbookEventFunction;
#define wxToolbookEventHandler(func) wxBookCtrlEventHandler(func)
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&);
#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

View File

@ -233,47 +233,28 @@ private:
// 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 is obsolete and defined for compatibility only
typedef wxBookCtrlEvent wxTreebookEvent;
typedef wxBookCtrlEventFunction wxTreebookEventFunction;
#define wxTreebookEventHandler(func) wxBookCtrlEventHandler(func)
wxTreebookEvent(const wxTreebookEvent& event)
: wxBookCtrlBaseEvent(event)
{
}
virtual wxEvent *Clone() const { return new wxTreebookEvent(*this); }
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

View File

@ -22,3 +22,65 @@ public:
};
/**
@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);
};

View File

@ -36,7 +36,7 @@
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.

View File

@ -2385,7 +2385,7 @@ public:
@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
@ -2394,7 +2394,7 @@ public:
@library{wxcore}
@category{events}
@see wxNotebookEvent
@see wxBookCtrlEvent
*/
class wxNotifyEvent : public wxCommandEvent
{

View File

@ -1,88 +1,21 @@
/////////////////////////////////////////////////////////////////////////////
// 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.
@ -109,8 +42,8 @@ public:
@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
{
@ -190,7 +123,7 @@ public:
/**
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.
*/
@ -256,10 +189,9 @@ public:
/**
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;
@ -327,9 +259,9 @@ public:
/**
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.

View File

@ -1,71 +1,11 @@
/////////////////////////////////////////////////////////////////////////////
// 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
@ -81,7 +21,7 @@ public:
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.
@ -100,7 +40,7 @@ public:
@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
@ -230,7 +170,7 @@ public:
@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;

View File

@ -125,11 +125,10 @@ WX_DECLARE_GET_OBJC_CLASS(WXCTabViewImageItem,NSTabViewItem)
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
@ -315,7 +314,7 @@ int wxNotebook::GetSelection() const
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);
@ -323,7 +322,7 @@ void wxNotebook::CocoaDelegate_tabView_didSelectTabViewItem(WX_NSTabViewItem tab
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();

View File

@ -455,7 +455,7 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags)
if ( n != (size_t)oldSel )
{
wxBookCtrlBaseEvent *event = CreatePageChangingEvent();
wxBookCtrlEvent *event = CreatePageChangingEvent();
bool allowed = false;
if ( flags & SetSelection_SendEvent )
@ -493,5 +493,6 @@ int wxBookCtrlBase::DoSetSelection(size_t n, int flags)
return oldSel;
}
IMPLEMENT_DYNAMIC_CLASS(wxBookCtrlEvent, wxNotifyEvent)
#endif // wxUSE_BOOKCTRL

View File

@ -65,7 +65,7 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
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);
@ -74,7 +74,7 @@ bool wxNotebookBase::SendPageChangingEvent(int nPage)
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);

View File

@ -48,7 +48,6 @@
// ----------------------------------------------------------------------------
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();
@ -205,12 +204,12 @@ int wxChoicebook::GetSelection() const
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);
}

View File

@ -54,7 +54,6 @@
// ----------------------------------------------------------------------------
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();
@ -370,12 +369,12 @@ int wxListbook::GetSelection() const
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);
}

View File

@ -775,7 +775,7 @@ void wxGenericMDIClientWindow::PageChanged(int OldSelection, int newSelection)
}
}
void wxGenericMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
void wxGenericMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event)
{
PageChanged(event.GetOldSelection(), event.GetSelection());

View File

@ -62,7 +62,6 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// ============================================================================
// implementation
@ -545,7 +544,7 @@ bool wxNotebook::RefreshLayout(bool force)
return true;
}
void wxNotebook::OnSelChange(wxNotebookEvent& event)
void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
@ -713,7 +712,7 @@ void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
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).
@ -736,7 +735,7 @@ bool wxNotebookTabView::OnTabPreActivate(int activateId, int deactivateId)
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).

View File

@ -44,7 +44,6 @@
// ----------------------------------------------------------------------------
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();
@ -247,12 +246,12 @@ int wxToolbook::GetSelection() const
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);
}

View File

@ -46,7 +46,6 @@
// ----------------------------------------------------------------------------
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();
@ -579,7 +578,7 @@ int wxTreebook::DoSetSelection(size_t pagePos, int flags)
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;
@ -717,7 +716,7 @@ void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event)
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);

View File

@ -675,10 +675,4 @@ wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
}
//-----------------------------------------------------------------------------
// wxNotebookEvent
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
#endif

View File

@ -112,7 +112,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
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;
}
@ -126,7 +126,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
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;
@ -865,10 +865,4 @@ wxNotebook::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
return GetDefaultAttributesFromGTKWidget(gtk_notebook_new);
}
//-----------------------------------------------------------------------------
// wxNotebookEvent
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
#endif

View File

@ -682,7 +682,7 @@ void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
event.Skip();
}
void wxMDIClientWindow::OnPageChanged(wxNotebookEvent& event)
void wxMDIClientWindow::OnPageChanged(wxBookCtrlEvent& event)
{
// Notify child that it has been activated
if (event.GetOldSelection() != -1)

View File

@ -187,8 +187,8 @@ template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theLis
}
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
@ -216,7 +216,6 @@ wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text ,
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
#endif
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
@ -1091,7 +1090,7 @@ void wxNotebook::OnSize(wxSizeEvent& event)
event.Skip();
}
void wxNotebook::OnSelChange(wxNotebookEvent& event)
void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
@ -1423,7 +1422,7 @@ bool wxNotebook::MSWOnScroll(int orientation, WXWORD nSBCode,
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 ) {

View File

@ -64,7 +64,6 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
@ -216,7 +215,7 @@ int wxNotebook::SetSelection( size_t nPage )
if (nPage != (size_t)m_nSelection)
{
wxNotebookEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
wxBookCtrlEvent vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
,m_windowId
);
@ -683,7 +682,7 @@ void wxNotebook::OnSize(
} // end of wxNotebook::OnSize
void wxNotebook::OnSelChange (
wxNotebookEvent& rEvent
wxBookCtrlEvent& rEvent
)
{
//

View File

@ -2548,7 +2548,7 @@ MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg,
(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

View File

@ -43,7 +43,6 @@ BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// common part of all ctors
@ -458,7 +457,7 @@ void wxNotebook::OnSize(wxSizeEvent& event)
event.Skip();
}
void wxNotebook::OnSelChange(wxNotebookEvent& event)
void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
@ -593,7 +592,7 @@ wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR
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 );
@ -601,7 +600,7 @@ wxInt32 wxNotebook::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTR
if ( changing.IsAllowed() )
{
wxNotebookEvent event(
wxBookCtrlEvent event(
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
newSel, m_nSelection );
event.SetEventObject( this );

View File

@ -98,8 +98,8 @@ template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theLis
}
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
@ -127,7 +127,6 @@ wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text ,
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
#endif
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
@ -288,7 +287,7 @@ void wxNotebook::OnSize(wxSizeEvent& event)
{
}
void wxNotebook::OnSelChange(wxNotebookEvent& event)
void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
}

View File

@ -115,7 +115,6 @@ END_EVENT_TABLE()
// ============================================================================
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
// ----------------------------------------------------------------------------
// wxNotebook creation