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:
109
src/qt/accel.cpp
Normal file
109
src/qt/accel.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/qt/accel.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/accel.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/qt/private/converter.h"
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAccelList: a list of wxAcceleratorEntries
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList);
|
||||
#include "wx/listimpl.cpp"
|
||||
WX_DEFINE_LIST(wxAccelList)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxAccelRefData: the data used by wxAcceleratorTable
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxAccelRefData : public wxObjectRefData
|
||||
{
|
||||
public:
|
||||
wxAccelRefData()
|
||||
{
|
||||
}
|
||||
|
||||
wxAccelRefData(const wxAccelRefData& data)
|
||||
: wxObjectRefData()
|
||||
{
|
||||
m_accels = data.m_accels;
|
||||
}
|
||||
|
||||
virtual ~wxAccelRefData()
|
||||
{
|
||||
WX_CLEAR_LIST(wxAccelList, m_accels);
|
||||
}
|
||||
|
||||
wxAccelList m_accels;
|
||||
};
|
||||
|
||||
// macro which can be used to access wxAccelRefData from wxAcceleratorTable
|
||||
#define M_ACCELDATA ((wxAccelRefData *)m_refData)
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( wxAcceleratorTable, wxObject )
|
||||
|
||||
QShortcut *ConvertAccelerator( wxAcceleratorEntry *e, QWidget *parent )
|
||||
{
|
||||
// TODO: Not all keys have the same string representation in wx and qt
|
||||
QShortcut *s = new QShortcut( wxQtConvertString( e->ToString() ), parent );
|
||||
|
||||
// Set a property to save wx Command to send when activated
|
||||
s->setProperty( "wxQt_Command", e->GetCommand() );
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
wxAcceleratorTable::wxAcceleratorTable()
|
||||
{
|
||||
}
|
||||
|
||||
wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[])
|
||||
{
|
||||
m_refData = new wxAccelRefData;
|
||||
|
||||
for ( int i = 0; i < n; i++ )
|
||||
{
|
||||
M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( entries[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
QList< QShortcut* > wxAcceleratorTable::ConvertShortcutTable( QWidget *parent ) const
|
||||
{
|
||||
QList< QShortcut* > qtList;
|
||||
|
||||
for ( wxAccelList::Node *node = M_ACCELDATA->m_accels.GetFirst(); node; node = node->GetNext() )
|
||||
{
|
||||
qtList << ConvertAccelerator( node->GetData(), parent );
|
||||
}
|
||||
|
||||
return qtList;
|
||||
}
|
||||
|
||||
wxObjectRefData *wxAcceleratorTable::CreateRefData() const
|
||||
{
|
||||
return new wxAccelRefData;
|
||||
}
|
||||
|
||||
wxObjectRefData *wxAcceleratorTable::CloneRefData(const wxObjectRefData *data) const
|
||||
{
|
||||
return new wxAccelRefData(*(wxAccelRefData *)data);
|
||||
}
|
||||
|
||||
bool wxAcceleratorTable::IsOk() const
|
||||
{
|
||||
return (m_refData != NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user