Implement readonly dcscreen for wxQT, thanks @seandpagnier

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mariano Reingart 2014-09-29 04:16:57 +00:00
parent fa98a771e3
commit 0435721b3e
2 changed files with 24 additions and 5 deletions

View File

@ -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_

View File

@ -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 <QtWidgets>
#include <QPixmap>
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);
}