]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/nbkbase.cpp
don't crash on weird line endings like \r\r\n
[wxWidgets.git] / src / common / nbkbase.cpp
index 47011be7039af1a7933ccc82d9875f54d31ba8b1..ec391bb57febafa767cb241a8e00501c786189cd 100644 (file)
@@ -59,4 +59,26 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
     return sizeTotal;
 }
 
+// ----------------------------------------------------------------------------
+// events
+// ----------------------------------------------------------------------------
+
+bool wxNotebookBase::SendPageChangingEvent(int nPage)
+{
+    wxNotebookEvent 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)
+{
+    wxNotebookEvent 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