Changeset 89284 in webkit
- Timestamp:
- Jun 20, 2011 1:22:33 PM (13 years ago)
- Location:
- trunk/Source/WebKit/wx
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/wx/ChangeLog
r89274 r89284 1 2011-06-20 Robin Dunn <robin@alldunn.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Make showing the dialog optional, and add handling for Javascript print() calls. 6 7 https://bugs.webkit.org/show_bug.cgi?id=63008 8 9 * WebFrame.cpp: 10 (kit): 11 (wxWebFrame::Print): 12 * WebFrame.h: 13 * WebKitSupport/ChromeClientWx.cpp: 14 (WebCore::ChromeClientWx::print): 15 * WebKitSupport/FrameLoaderClientWx.h: 16 (WebCore::FrameLoaderClientWx::webFrame): 17 (WebCore::FrameLoaderClientWx::webView): 18 * WebView.cpp: 19 (wxWebViewPrintFrameEvent::wxWebViewPrintFrameEvent): 20 * WebView.h: 21 * bindings/python/webview.i: 22 1 23 2011-06-20 Kevin Ollivier <kevino@theolliviers.com> 2 24 -
trunk/Source/WebKit/wx/WebFrame.cpp
r87745 r89284 33 33 #include "Frame.h" 34 34 #include "FrameLoader.h" 35 #include "FrameLoaderClientWx.h" 35 36 #include "FrameView.h" 36 37 #include "GraphicsContext.h" … … 175 176 }; 176 177 #endif 178 179 wxWebFrame* kit(WebCore::Frame* frame) 180 { 181 if (!frame) 182 return 0; 183 if (!frame->loader()) 184 return 0; 185 186 WebCore::FrameLoaderClientWx* loaderClient = dynamic_cast<WebCore::FrameLoaderClientWx*>(frame->loader()->client()); 187 if (loaderClient) 188 return loaderClient->webFrame(); 189 190 return 0; 191 } 177 192 178 193 wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameData* data) : … … 557 572 } 558 573 559 void wxWebFrame::Print( )574 void wxWebFrame::Print(bool showDialog) 560 575 { 561 576 #if wxCHECK_VERSION(2, 9, 1) … … 584 599 printdata.SetToPage(printout->GetPageCount()); 585 600 586 wxPrintDialog dialog(0, &printdata); 587 if (dialog.ShowModal() == wxID_OK) { 588 wxPrintDialogData data(dialog.GetPrintDialogData()); 589 printout->SetFirstPage(data.GetFromPage()); 590 printout->SetLastPage(data.GetToPage()); 591 wxPrinter printer(&data); 592 593 printer.Print(0, printout, false); 594 } 601 wxPrintDialogData data(printdata); 602 603 if (showDialog) { 604 wxPrintDialog dialog(0, &data); 605 if (dialog.ShowModal() == wxID_OK) { 606 data = dialog.GetPrintDialogData(); 607 printout->SetFirstPage(data.GetFromPage()); 608 printout->SetLastPage(data.GetToPage()); 609 } else 610 return; 611 } 612 613 wxPrinter printer(&data); 614 615 printer.Print(0, printout, false); 616 595 617 #else 596 618 wxFAIL_MSG(wxT("Printing is only supported in wxWidgets 2.9.1 and above.")); -
trunk/Source/WebKit/wx/WebFrame.h
r87745 r89284 116 116 void Stop(); 117 117 void Reload(); 118 void Print( );118 void Print(bool showDialog = true); 119 119 120 120 bool CanGoBack(); … … 181 181 }; 182 182 183 wxWebFrame* kit(WebCore::Frame*); 184 183 185 #endif // ifndef WXWEBFRAME_H -
trunk/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
r89274 r89284 416 416 } 417 417 418 void ChromeClientWx::print(Frame*) 419 { 420 notImplemented(); 418 void ChromeClientWx::print(Frame* frame) 419 { 420 wxWebFrame* webFrame = kit(frame); 421 if (webFrame) { 422 wxWebViewPrintFrameEvent event(m_webView); 423 event.SetWebFrame(webFrame); 424 if (!m_webView->GetEventHandler()->ProcessEvent(event)) 425 webFrame->Print(true); 426 } 421 427 } 422 428 -
trunk/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
r88628 r89284 56 56 FrameLoaderClientWx(); 57 57 ~FrameLoaderClientWx(); 58 59 wxWebFrame* webFrame() { return m_webFrame; } 58 60 void setFrame(wxWebFrame *frame); 61 wxWebView* webView() { return m_webView; } 59 62 void setWebView(wxWebView *webview); 60 63 -
trunk/Source/WebKit/wx/WebView.cpp
r86068 r89284 248 248 { 249 249 SetEventType(wxEVT_WEBVIEW_SELECTION_CHANGED); 250 SetEventObject(win); 251 if (win) 252 SetId(win->GetId()); 253 } 254 255 IMPLEMENT_DYNAMIC_CLASS(wxWebViewPrintFrameEvent, wxCommandEvent) 256 257 DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_PRINT_FRAME) 258 259 wxWebViewPrintFrameEvent::wxWebViewPrintFrameEvent(wxWindow* win) 260 { 261 SetEventType(wxEVT_WEBVIEW_PRINT_FRAME); 250 262 SetEventObject(win); 251 263 if (win) -
trunk/Source/WebKit/wx/WebView.h
r86068 r89284 546 546 }; 547 547 548 class WXDLLIMPEXP_WEBKIT wxWebViewPrintFrameEvent : public wxCommandEvent { 549 #ifndef SWIG 550 DECLARE_DYNAMIC_CLASS(wxWebViewPrintFrameEvent) 551 #endif 552 553 public: 554 wxWebViewPrintFrameEvent(wxWindow* win = 0); 555 wxEvent *Clone(void) const { return new wxWebViewPrintFrameEvent(*this); } 556 557 wxWebFrame* GetWebFrame() { return m_webFrame; } 558 void SetWebFrame(wxWebFrame* frame) { m_webFrame = frame; } 559 private: 560 wxWebFrame* m_webFrame; 561 }; 562 548 563 typedef void (wxEvtHandler::*wxWebViewLoadEventFunction)(wxWebViewLoadEvent&); 549 564 typedef void (wxEvtHandler::*wxWebViewBeforeLoadEventFunction)(wxWebViewBeforeLoadEvent&); … … 558 573 typedef void (wxEvtHandler::*wxWebViewContentsChangedFunction)(wxWebViewContentsChangedEvent&); 559 574 typedef void (wxEvtHandler::*wxWebViewSelectionChangedFunction)(wxWebViewSelectionChangedEvent&); 575 typedef void (wxEvtHandler::*wxWebViewPrintFrameFunction)(wxWebViewPrintFrameEvent&); 560 576 561 577 #define wxWebViewLoadEventHandler(func) \ … … 583 599 #define wxWebViewSelectionChangedEventHandler(func) \ 584 600 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewSelectionChangedEventFunction, &func) 585 601 #define wxWebViewPrintFrameEventHandler(func) \ 602 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewPrintFrameEventFunction, &func) 603 586 604 #ifndef SWIG 587 605 BEGIN_DECLARE_EVENT_TYPES() … … 598 616 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONTENTS_CHANGED, wxID_ANY) 599 617 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_SELECTION_CHANGED, wxID_ANY) 618 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_PRINT_FRAME, wxID_ANY) 600 619 END_DECLARE_EVENT_TYPES() 601 620 #endif … … 696 715 (wxWebViewSelectionChangedEventFunction) & func, \ 697 716 static_cast<wxObject*>(0)), 698 717 718 #define EVT_WEBVIEW_PRINT_FRAME(winid, func) \ 719 DECLARE_EVENT_TABLE_ENTRY(wxEVT_WEBVIEW_PRINT_FRAME, \ 720 winid, \ 721 wxID_ANY, \ 722 (wxObjectEventFunction) \ 723 (wxWebViewPrintFrameEventFunction) & func, \ 724 static_cast<wxObject*>(0)), 699 725 700 726 #endif // ifndef WXWEBVIEW_H -
trunk/Source/WebKit/wx/bindings/python/webview.i
r81135 r89284 171 171 %constant wxEventType wxEVT_WEBVIEW_CONTENTS_CHANGED; 172 172 %constant wxEventType wxEVT_WEBVIEW_SELECTION_CHANGED; 173 %constant wxEventType wxEVT_WEBVIEW_PRINT_FRAME; 173 174 174 175 %pythoncode { … … 181 182 EVT_WEBVIEW_CONTENTS_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_CONTENTS_CHANGED, 1 ) 182 183 EVT_WEBVIEW_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_SELECTION_CHANGED, 1 ) 184 EVT_WEBVIEW_PRINT_FRAME = wx.PyEventBinder( wxEVT_WEBVIEW_PRINT_FRAME, 1 ) 183 185 }
Note: See TracChangeset
for help on using the changeset viewer.