diff --git a/include/wx/defs.h b/include/wx/defs.h index 86ec8bcd1b..5482b48848 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1173,8 +1173,12 @@ enum wxBorder */ #define wxTC_RIGHTJUSTIFY 0x0010 #define wxTC_FIXEDWIDTH 0x0020 -#define wxTC_OWNERDRAW 0x0040 +#define wxTC_TOP 0x0000 // default +#define wxTC_LEFT 0x0020 +#define wxTC_RIGHT 0x0040 +#define wxTC_BOTTOM 0x0080 #define wxTC_MULTILINE wxNB_MULTILINE +#define wxTC_OWNERDRAW 0x0200 // wxToolBar style flags #define wxTB_HORIZONTAL wxHORIZONTAL // == 0x0004 diff --git a/include/wx/msw/tabctrl.h b/include/wx/msw/tabctrl.h index e97a957a28..014ea3167b 100644 --- a/include/wx/msw/tabctrl.h +++ b/include/wx/msw/tabctrl.h @@ -126,12 +126,30 @@ protected: DECLARE_EVENT_TABLE() }; -class WXDLLEXPORT wxTabEvent: public wxNotifyEvent +class WXDLLEXPORT wxTabEvent : public wxNotifyEvent { - DECLARE_DYNAMIC_CLASS(wxTabEvent) +public: + wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0, + int nSel = -1, int nOldSel = -1) + : wxNotifyEvent(commandType, id) + { + m_nSel = nSel; + m_nOldSel = nOldSel; + } - public: - wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0); + // accessors + // the currently selected page (-1 if none) + int GetSelection() const { return m_nSel; } + void SetSelection(int nSel) { m_nSel = nSel; } + // the page that was selected before the change (-1 if none) + int GetOldSelection() const { return m_nOldSel; } + void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; } + +private: + int m_nSel, // currently selected page + m_nOldSel; // previously selected page + + DECLARE_DYNAMIC_CLASS(wxTabEvent) }; typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&); diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp index d5fc8ed130..c2553f2f2f 100644 --- a/src/msw/tabctrl.cpp +++ b/src/msw/tabctrl.cpp @@ -45,6 +45,7 @@ #include "wx/msw/imaglist.h" IMPLEMENT_DYNAMIC_CLASS(wxTabCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_TAB_SEL_CHANGING) @@ -158,6 +159,7 @@ bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) event.SetEventObject( this ); event.SetEventType(eventType); event.SetInt(idCtrl) ; + event.SetSelection(idCtrl); return ProcessEvent(event); } @@ -439,14 +441,5 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height) } #endif -// Tab event -IMPLEMENT_DYNAMIC_CLASS(wxTabEvent, wxNotifyEvent) - -wxTabEvent::wxTabEvent(wxEventType commandType, int id): - wxNotifyEvent(commandType, id) -{ -} - - #endif // __WIN95__