Merge wxQT branch into the trunk.

This merges in the latest sources from GSoC 2014 wxQt project with just a few
minor corrections, mostly undoing wrong changes to common files in that branch
(results of a previous bad merge?) and getting rid of whitespace-only changes.
Also remove debug logging from wxGrid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-08-24 01:50:11 +00:00
parent d513d3e2f0
commit df13791078
381 changed files with 24333 additions and 938 deletions

130
src/qt/dcclient.cpp Normal file
View File

@@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/dcclient.cpp
// Author: Peter Most, Javier Torres
// Copyright: (c) Peter Most, Javier Torres
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/dcclient.h"
#include "wx/log.h"
#include "wx/qt/dcclient.h"
#include <QtGui/QPicture>
//##############################################################################
wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
: wxQtDCImpl( owner )
{
m_window = NULL;
m_ok = false;
m_qtPainter = new QPainter();
}
wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *win )
: wxQtDCImpl( owner )
{
m_window = win;
m_qtPainter = m_window->QtGetPainter();
// if we're not inside a Paint event, painter will invalid
m_ok = m_qtPainter != NULL;
}
wxWindowDCImpl::~wxWindowDCImpl()
{
if ( m_ok )
{
m_ok = false;
}
if ( m_window )
{
// do not destroy as it is owned by the window
m_qtPainter = NULL;
}
}
//##############################################################################
wxClientDCImpl::wxClientDCImpl( wxDC *owner )
: wxWindowDCImpl( owner )
{
m_window = NULL;
}
wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *win )
: wxWindowDCImpl( owner )
{
m_window = win;
QPicture *pic = win->QtGetPicture();
m_ok = m_qtPainter->begin( pic );
QtPreparePainter();
}
wxClientDCImpl::~wxClientDCImpl()
{
/* Paint to a QPicture that will then be painted in the next
* paint event of that window (a paint event will be generated
* when this wxClientDC is done). */
if ( m_ok )
{
m_qtPainter->end();
m_ok = false;
QPicture *pict = m_window->QtGetPicture();
if ( m_window != NULL )
{
// get the inner widget in scroll areas:
QWidget *widget;
if ( m_window->QtGetScrollBarsContainer() )
{
widget = m_window->QtGetScrollBarsContainer()->viewport();
} else {
widget = m_window->GetHandle();
}
// force paint event if there is something to replay and
// if not currently inside a paint event (to avoid recursion)
QRect rect = pict->boundingRect();
if ( !pict->isNull() && !widget->paintingActive() && !rect.isEmpty() )
{
// only force the update of the rect affected by the DC
widget->repaint( rect );
wxLogDebug( wxT("wxClientDC Repainting %s (%d %d %d %d)"),
(const char*) m_window->GetName(),
rect.left(), rect.top(), rect.width(), rect.height());
}
else
{
// Not drawing anything, reset picture to avoid issues in handler
pict->setData( NULL, 0 );
}
// let destroy the m_qtPainter (see inherited classes destructors)
m_window = NULL;
}
}
}
//##############################################################################
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner )
: wxWindowDCImpl( owner )
{
if ( m_ok )
{
QtPreparePainter();
}
}
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *win )
: wxWindowDCImpl( owner, win )
{
if ( m_ok )
{
QtPreparePainter();
}
}