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

127
src/qt/checkbox.cpp Normal file
View File

@@ -0,0 +1,127 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/checkbox.cpp
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2009 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#include "wx/checkbox.h"
#include "wx/qt/private/utils.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
class wxQtCheckBox : public wxQtEventSignalHandler< QCheckBox, wxCheckBox >
{
public:
wxQtCheckBox( wxWindow *parent, wxCheckBox *handler );
private:
void clicked( bool checked );
};
wxQtCheckBox::wxQtCheckBox( wxWindow *parent, wxCheckBox *handler )
: wxQtEventSignalHandler< QCheckBox, wxCheckBox >( parent, handler )
{
connect(this, &QCheckBox::clicked, this, &wxQtCheckBox::clicked);
}
void wxQtCheckBox::clicked( bool checked )
{
wxCheckBox *handler = GetHandler();
if ( handler )
{
wxCommandEvent event( wxEVT_CHECKBOX, handler->GetId() );
if (!handler->Is3rdStateAllowedForUser() &&
checkState() == Qt::PartiallyChecked)
setCheckState(Qt::Checked);
event.SetInt( checked );
EmitEvent( event );
}
}
wxCheckBox::wxCheckBox()
{
}
wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator,
const wxString& name )
{
Create( parent, id, label, pos, size, style, validator, name );
}
bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator,
const wxString& name )
{
m_qtCheckBox = new wxQtCheckBox( parent, this );
m_qtCheckBox->setText( wxQtConvertString( label ) );
// Do the initialization here as WXValidateStyle may fail in unit tests
bool ok = QtCreateControl( parent, id, pos, size, style, validator, name );
WXValidateStyle(&style);
if ( style & wxCHK_2STATE )
m_qtCheckBox->setTristate( false );
else if ( style & wxCHK_3STATE )
m_qtCheckBox->setTristate( true );
if ( style & wxALIGN_RIGHT )
m_qtCheckBox->setLayoutDirection( Qt::RightToLeft );
return ok;
}
void wxCheckBox::SetValue(bool value)
{
m_qtCheckBox->setChecked( value );
}
bool wxCheckBox::GetValue() const
{
return m_qtCheckBox->isChecked();
}
void wxCheckBox::DoSet3StateValue(wxCheckBoxState state)
{
switch (state)
{
case wxCHK_UNCHECKED:
m_qtCheckBox->setCheckState(Qt::Unchecked);
break;
case wxCHK_CHECKED:
m_qtCheckBox->setCheckState(Qt::Checked);
break;
case wxCHK_UNDETERMINED:
m_qtCheckBox->setCheckState(Qt::PartiallyChecked);
break;
}
}
wxCheckBoxState wxCheckBox::DoGet3StateValue() const
{
switch (m_qtCheckBox->checkState())
{
case Qt::Unchecked:
return wxCHK_UNCHECKED;
case Qt::Checked:
return wxCHK_CHECKED;
case Qt::PartiallyChecked:
return wxCHK_UNDETERMINED;
}
}
QCheckBox *wxCheckBox::GetHandle() const
{
return m_qtCheckBox;
}