]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed preview navigation as per ancient bug report
authorJulian Smart <julian@anthemion.co.uk>
Thu, 24 Jul 2003 10:07:43 +0000 (10:07 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 24 Jul 2003 10:07:43 +0000 (10:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/prntbase.h
src/common/prntbase.cpp

index 42e04bf85f49d4f04d28498170057e22f806ae08..067ba6e9a01d2ff3cc35cff734a1c697de55037b 100644 (file)
@@ -267,13 +267,14 @@ public:
     virtual wxPrintPreviewBase *GetPrintPreview() const
         { return m_printPreview; }
 
-    void OnPrint(wxCommandEvent& event);
     void OnWindowClose(wxCommandEvent& event);
     void OnNext();
     void OnPrevious();
     void OnFirst();
     void OnLast();
     void OnGoto();
+    void OnPrint();
+    void OnPrint(wxCommandEvent& WXUNUSED(event)) { OnPrint(); }
     void OnNextButton(wxCommandEvent & WXUNUSED(event)) { OnNext(); }
     void OnPreviousButton(wxCommandEvent & WXUNUSED(event)) { OnPrevious(); }
     void OnFirstButton(wxCommandEvent & WXUNUSED(event)) { OnFirst(); }
index 8b9498215496132d7c56932fef237bcbf0f77d2e..59a2bc634f28714acd997bd71c9930f1ed5ee848 100644 (file)
@@ -242,34 +242,42 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
 
 void wxPreviewCanvas::OnChar(wxKeyEvent &event)
 {
+    wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar();
     if (event.GetKeyCode() == WXK_ESCAPE)
     {
         ((wxPreviewFrame*) GetParent())->Close(TRUE);
         return;
+    }    
+    else if (event.GetKeyCode() == WXK_TAB)
+    {
+        controlBar->OnGoto();
+        return;
     }
-    
+    else if (event.GetKeyCode() == WXK_RETURN)
+    {
+        controlBar->OnPrint();
+        return;
+    }
+
     if (!event.ControlDown())
     {
         event.Skip();
         return;
     }
-
-    wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar();
-   switch(event.GetKeyCode())
-   {
-   case WXK_NEXT:
-      controlBar->OnNext(); break;
-   case WXK_PRIOR:
-      controlBar->OnPrevious(); break;
-   case WXK_HOME:
-      controlBar->OnFirst(); break;
-   case WXK_END:
-      controlBar->OnLast(); break;
-   case WXK_TAB:
-      controlBar->OnGoto(); break;
-   default:
-      event.Skip();
-   }
+    
+    switch(event.GetKeyCode())
+    {
+        case WXK_NEXT:
+            controlBar->OnNext(); break;
+        case WXK_PRIOR:
+            controlBar->OnPrevious(); break;
+        case WXK_HOME:
+            controlBar->OnFirst(); break;
+        case WXK_END:
+            controlBar->OnLast(); break;
+        default:
+            event.Skip();
+    }
 }
 
 /*
@@ -323,7 +331,7 @@ void wxPreviewControlBar::OnWindowClose(wxCommandEvent& WXUNUSED(event))
     frame->Close(TRUE);
 }
 
-void wxPreviewControlBar::OnPrint(wxCommandEvent& WXUNUSED(event))
+void wxPreviewControlBar::OnPrint(void)
 {
     wxPrintPreviewBase *preview = GetPrintPreview();
     preview->Print(TRUE);