]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/nbkbase.cpp
Corrected IMPLEMENT_CLASS/BEGIN_EVENT_TABLE base class
[wxWidgets.git] / src / common / nbkbase.cpp
index 8746f2729db8f75a096077252a41fcfe8d46863a..e12ba34a90e6ef3113754e2875741975e0478588 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "notebookbase.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // implementation
 // ============================================================================
 
-wxNotebookBase::wxNotebookBase()
-{
-}
-
-wxNotebookBase::wxNotebookBase(wxWindow *parent,
-                               wxWindowID id,
-                               const wxPoint& pos,
-                               const wxSize& size,
-                               long style,
-                               const wxString& name)
-                               : wxBookCtrl(parent, id, pos, size, style, name)
-{
-}
+wxDEFINE_EVENT( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
+wxDEFINE_EVENT( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
 
 // ----------------------------------------------------------------------------
 // geometry
@@ -63,7 +48,7 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
     // default because not all ports implement this
     wxSize sizeTotal = sizePage;
 
-    if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
+    if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) )
     {
         sizeTotal.x += 90;
         sizeTotal.y += 10;
@@ -77,5 +62,26 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
     return sizeTotal;
 }
 
-#endif // wxUSE_NOTEBOOK
+// ----------------------------------------------------------------------------
+// events
+// ----------------------------------------------------------------------------
+
+bool wxNotebookBase::SendPageChangingEvent(int nPage)
+{
+    wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId());
+    event.SetSelection(nPage);
+    event.SetOldSelection(GetSelection());
+    event.SetEventObject(this);
+    return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();
+}
 
+void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew)
+{
+    wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId());
+    event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew);
+    event.SetOldSelection(nPageOld);
+    event.SetEventObject(this);
+    GetEventHandler()->ProcessEvent(event);
+}
+
+#endif // wxUSE_NOTEBOOK