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:
58
include/wx/qt/private/converter.h
Normal file
58
include/wx/qt/private/converter.h
Normal file
@@ -0,0 +1,58 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/converter.h
|
||||
// Purpose: Converter utility classes and functions
|
||||
// Author: Peter Most, Kolya Kosenko
|
||||
// Created: 02/28/10
|
||||
// Copyright: (c) Peter Most
|
||||
// (c) 2010 Kolya Kosenko
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_QT_CONVERTER_H_
|
||||
#define _WX_QT_CONVERTER_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include <QtCore/Qt>
|
||||
|
||||
// Rely on overloading and let the compiler pick the correct version, which makes
|
||||
// them easier to use then to write wxQtConvertQtRectToWxRect() or wxQtConvertWxRectToQtRect()
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxPoint;
|
||||
class QPoint;
|
||||
wxPoint wxQtConvertPoint( const QPoint &point );
|
||||
QPoint wxQtConvertPoint( const wxPoint &point );
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxRect;
|
||||
class QRect;
|
||||
wxRect wxQtConvertRect( const QRect &rect );
|
||||
QRect wxQtConvertRect( const wxRect &rect );
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxString;
|
||||
class QString;
|
||||
wxString wxQtConvertString( const QString &str );
|
||||
QString wxQtConvertString( const wxString &str );
|
||||
|
||||
#if wxUSE_DATETIME
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxDateTime;
|
||||
class QDate;
|
||||
|
||||
wxDateTime wxQtConvertDate(const QDate& date);
|
||||
QDate wxQtConvertDate(const wxDateTime& date);
|
||||
|
||||
#endif // wxUSE_DATETIME
|
||||
|
||||
class WXDLLIMPEXP_FWD_BASE wxSize;
|
||||
class QSize;
|
||||
wxSize wxQtConvertSize( const QSize &size );
|
||||
QSize wxQtConvertSize( const wxSize &size );
|
||||
|
||||
Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation );
|
||||
wxOrientation wxQtConvertOrientation( Qt::Orientation );
|
||||
|
||||
wxKeyCode wxQtConvertKeyCode( int key, const Qt::KeyboardModifiers modifiers );
|
||||
void wxQtFillKeyboardModifiers( Qt::KeyboardModifiers modifiers, wxKeyboardState *state );
|
||||
int wxQtConvertKeyCode( int keyCode, int modifiers, Qt::KeyboardModifiers &qtmodifiers );
|
||||
|
||||
#endif // _WX_QT_CONVERTER_H_
|
||||
|
30
include/wx/qt/private/utils.h
Normal file
30
include/wx/qt/private/utils.h
Normal file
@@ -0,0 +1,30 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/qt/utils.h
|
||||
// Purpose: utility classes and/or functions
|
||||
// Author: Peter Most, Javier Torres
|
||||
// Created: 15/05/10
|
||||
// Copyright: (c) Peter Most, Javier Torres
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_QT_UTILS_H_
|
||||
#define _WX_QT_UTILS_H_
|
||||
|
||||
#include "wx/mousestate.h"
|
||||
#include <QtCore/Qt>
|
||||
|
||||
void wxQtFillMouseButtons( Qt::MouseButtons buttons, wxMouseState *state );
|
||||
|
||||
void wxMissingImplementation( const char fileName[], unsigned lineNumber,
|
||||
const char feature[] );
|
||||
|
||||
#define wxMISSING_IMPLEMENTATION( feature )\
|
||||
wxMissingImplementation( __FILE__, __LINE__, feature )
|
||||
|
||||
#define wxMISSING_FUNCTION() \
|
||||
wxMISSING_IMPLEMENTATION( __WXFUNCTION__ )
|
||||
|
||||
// global function handle Qt objects destruction (just for debugging now)
|
||||
void wxQtHandleDestroyedSignal(QObject *qobj = 0);
|
||||
|
||||
#endif // _WX_QT_UTILS_H_
|
332
include/wx/qt/private/winevent.h
Normal file
332
include/wx/qt/private/winevent.h
Normal file
@@ -0,0 +1,332 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/wx/qt/winevent_qt.h
|
||||
// Purpose: QWidget to wxWindow event handler
|
||||
// Author: Javier Torres, Peter Most
|
||||
// Modified by:
|
||||
// Created: 21.06.10
|
||||
// Copyright: (c) Javier Torres
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_QT_EVENTSIGNALFORWARDER_H_
|
||||
#define _WX_QT_EVENTSIGNALFORWARDER_H_
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/qt/private/converter.h"
|
||||
#include "wx/qt/private/utils.h"
|
||||
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QPaintEvent>
|
||||
|
||||
template< typename Handler >
|
||||
class wxQtSignalHandler
|
||||
{
|
||||
protected:
|
||||
wxQtSignalHandler( Handler *handler )
|
||||
{
|
||||
m_handler = handler;
|
||||
}
|
||||
|
||||
void EmitEvent( wxEvent &event ) const
|
||||
{
|
||||
wxWindow *handler = GetHandler();
|
||||
event.SetEventObject( handler );
|
||||
handler->HandleWindowEvent( event );
|
||||
}
|
||||
|
||||
virtual Handler *GetHandler() const
|
||||
{
|
||||
return m_handler;
|
||||
}
|
||||
|
||||
private:
|
||||
Handler *m_handler;
|
||||
};
|
||||
|
||||
template < typename Widget, typename Handler >
|
||||
class wxQtEventSignalHandler : public Widget, public wxQtSignalHandler< Handler >
|
||||
{
|
||||
public:
|
||||
wxQtEventSignalHandler( wxWindow *parent, Handler *handler )
|
||||
: Widget( parent != NULL ? parent->GetHandle() : NULL )
|
||||
, wxQtSignalHandler< Handler >( handler )
|
||||
{
|
||||
// Set immediatelly as it is used to check if wxWindow is alive
|
||||
wxWindow::QtStoreWindowPointer( this, handler );
|
||||
|
||||
// Handle QWidget destruction signal AFTER it gets deleted
|
||||
QObject::connect( this, &QObject::destroyed, this,
|
||||
&wxQtEventSignalHandler::HandleDestroyedSignal );
|
||||
|
||||
}
|
||||
|
||||
void HandleDestroyedSignal()
|
||||
{
|
||||
wxQtHandleDestroyedSignal(this);
|
||||
}
|
||||
|
||||
virtual Handler *GetHandler() const
|
||||
{
|
||||
// Only process the signal / event if the wxWindow is not destroyed
|
||||
if ( !wxWindow::QtRetrieveWindowPointer( this ) )
|
||||
{
|
||||
wxLogDebug( wxT("%s win pointer is NULL (wxWindow is deleted)!"),
|
||||
Widget::staticMetaObject.className()
|
||||
);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return wxQtSignalHandler< Handler >::GetHandler();
|
||||
}
|
||||
|
||||
protected:
|
||||
/* Not implemented here: wxHelpEvent, wxIdleEvent wxJoystickEvent,
|
||||
* wxMouseCaptureLostEvent, wxMouseCaptureChangedEvent,
|
||||
* wxPowerEvent, wxScrollWinEvent, wxSysColourChangedEvent */
|
||||
|
||||
//wxActivateEvent
|
||||
virtual void changeEvent ( QEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::changeEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleChangeEvent(this, event) )
|
||||
Widget::changeEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxCloseEvent
|
||||
virtual void closeEvent ( QCloseEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::closeEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleCloseEvent(this, event) )
|
||||
Widget::closeEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxContextMenuEvent
|
||||
virtual void contextMenuEvent ( QContextMenuEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::contextMenuEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleContextMenuEvent(this, event) )
|
||||
Widget::contextMenuEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxDropFilesEvent
|
||||
//virtual void dropEvent ( QDropEvent * event ) { }
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void enterEvent ( QEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::enterEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleEnterEvent(this, event) )
|
||||
Widget::enterEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxFocusEvent.
|
||||
virtual void focusInEvent ( QFocusEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::focusInEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleFocusEvent(this, event) )
|
||||
Widget::focusInEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxFocusEvent.
|
||||
virtual void focusOutEvent ( QFocusEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::focusOutEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleFocusEvent(this, event) )
|
||||
Widget::focusOutEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxShowEvent
|
||||
virtual void hideEvent ( QHideEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::hideEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleShowEvent(this, event) )
|
||||
Widget::hideEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxKeyEvent
|
||||
virtual void keyPressEvent ( QKeyEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::keyPressEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleKeyEvent(this, event) )
|
||||
Widget::keyPressEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxKeyEvent
|
||||
virtual void keyReleaseEvent ( QKeyEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::keyReleaseEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleKeyEvent(this, event) )
|
||||
Widget::keyReleaseEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void leaveEvent ( QEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::leaveEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleEnterEvent(this, event) )
|
||||
Widget::leaveEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void mouseDoubleClickEvent ( QMouseEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::mouseDoubleClickEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
|
||||
Widget::mouseDoubleClickEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void mouseMoveEvent ( QMouseEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::mouseMoveEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
|
||||
Widget::mouseMoveEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void mousePressEvent ( QMouseEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::mousePressEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
|
||||
Widget::mousePressEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void mouseReleaseEvent ( QMouseEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::mouseReleaseEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
|
||||
Widget::mouseReleaseEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMoveEvent
|
||||
virtual void moveEvent ( QMoveEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::moveEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleMoveEvent(this, event) )
|
||||
Widget::moveEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxEraseEvent then wxPaintEvent
|
||||
virtual void paintEvent ( QPaintEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::paintEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandlePaintEvent(this, event) )
|
||||
Widget::paintEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxSizeEvent
|
||||
virtual void resizeEvent ( QResizeEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::resizeEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleResizeEvent(this, event) )
|
||||
Widget::resizeEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxShowEvent
|
||||
virtual void showEvent ( QShowEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::showEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleShowEvent(this, event) )
|
||||
Widget::showEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
//wxMouseEvent
|
||||
virtual void wheelEvent ( QWheelEvent * event )
|
||||
{
|
||||
if ( !this->GetHandler() )
|
||||
wxLogDebug( wxT("%s::wheelEvent for invalid handler!"),
|
||||
Widget::staticMetaObject.className() );
|
||||
else if ( !this->GetHandler()->QtHandleWheelEvent(this, event) )
|
||||
Widget::wheelEvent(event);
|
||||
else
|
||||
event->accept();
|
||||
}
|
||||
|
||||
/* Unused Qt events
|
||||
virtual void actionEvent ( QActionEvent * event ) { }
|
||||
virtual void dragEnterEvent ( QDragEnterEvent * event ) { }
|
||||
virtual void dragLeaveEvent ( QDragLeaveEvent * event ) { }
|
||||
virtual void dragMoveEvent ( QDragMoveEvent * event ) { }
|
||||
virtual void inputMethodEvent ( QInputMethodEvent * event ) { }
|
||||
virtual bool macEvent ( EventHandlerCallRef caller, EventRef event ) { }
|
||||
virtual bool qwsEvent ( QWSEvent * event ) { }
|
||||
virtual void tabletEvent ( QTabletEvent * event ) { }
|
||||
virtual bool winEvent ( MSG * message, long * result ) { }
|
||||
virtual bool x11Event ( XEvent * event ) { } */
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user