From 0435721b3efa974ecf4cb26041b0213ead0cf69e Mon Sep 17 00:00:00 2001 From: Mariano Reingart Date: Mon, 29 Sep 2014 04:16:57 +0000 Subject: [PATCH] Implement readonly dcscreen for wxQT, thanks @seandpagnier git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/qt/dcscreen.h | 10 +++++++--- src/qt/dcscreen.cpp | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/wx/qt/dcscreen.h b/include/wx/qt/dcscreen.h index 8143f215a1..5289cc53fb 100644 --- a/include/wx/qt/dcscreen.h +++ b/include/wx/qt/dcscreen.h @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // Name: wx/qt/dcscreen.h -// Author: Peter Most -// Copyright: (c) Peter Most +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -15,9 +15,13 @@ class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl public: wxScreenDCImpl( wxScreenDC *owner ); -protected: + ~wxScreenDCImpl(); + + virtual void DoGetSize(int *width, int *height) const wxOVERRIDE; private: + + DECLARE_ABSTRACT_CLASS(wxScreenDCImpl) }; #endif // _WX_QT_DCSCREEN_H_ diff --git a/src/qt/dcscreen.cpp b/src/qt/dcscreen.cpp index 4b1902ce9d..2336e0ce86 100644 --- a/src/qt/dcscreen.cpp +++ b/src/qt/dcscreen.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // Name: src/qt/dcscreen.cpp -// Author: Peter Most -// Copyright: (c) Peter Most +// Author: Sean D'Epagnier +// Copyright: (c) Sean D'Epagnier // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -11,8 +11,23 @@ #include "wx/dcscreen.h" #include "wx/qt/dcscreen.h" +#include +#include + +IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl) + wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) : wxWindowDCImpl( owner ) { + m_qtImage = new QImage(QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId()).toImage()); } +wxScreenDCImpl::~wxScreenDCImpl( ) +{ + delete m_qtImage; +} + +void wxScreenDCImpl::DoGetSize(int *width, int *height) const +{ + wxDisplaySize(width, height); +}