1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/nbkbase.cpp
3 // Purpose: common wxNotebook methods
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 Vadim Zeitlin
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
32 #include "wx/notebook.h"
34 // ============================================================================
36 // ============================================================================
38 wxDEFINE_EVENT( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, wxBookCtrlEvent
);
39 wxDEFINE_EVENT( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, wxBookCtrlEvent
);
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 wxSize
wxNotebookBase::CalcSizeFromPage(const wxSize
& sizePage
) const
47 // this is, of course, totally bogus -- but we must do something by
48 // default because not all ports implement this
49 wxSize sizeTotal
= sizePage
;
51 if ( HasFlag(wxBK_LEFT
) || HasFlag(wxBK_RIGHT
) )
56 else // tabs on top/bottom side
65 // ----------------------------------------------------------------------------
67 // ----------------------------------------------------------------------------
69 bool wxNotebookBase::SendPageChangingEvent(int nPage
)
71 wxBookCtrlEvent
event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, GetId());
72 event
.SetSelection(nPage
);
73 event
.SetOldSelection(GetSelection());
74 event
.SetEventObject(this);
75 return !GetEventHandler()->ProcessEvent(event
) || event
.IsAllowed();
78 void wxNotebookBase::SendPageChangedEvent(int nPageOld
, int nPageNew
)
80 wxBookCtrlEvent
event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, GetId());
81 event
.SetSelection(nPageNew
== -1 ? GetSelection() : nPageNew
);
82 event
.SetOldSelection(nPageOld
);
83 event
.SetEventObject(this);
84 GetEventHandler()->ProcessEvent(event
);
87 #endif // wxUSE_NOTEBOOK