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:
142
src/qt/tglbtn.cpp
Normal file
142
src/qt/tglbtn.cpp
Normal file
@@ -0,0 +1,142 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/qt/tglbtn.cpp
|
||||
// Author: Peter Most, Mariano Reingart
|
||||
// Copyright: (c) 2010 wxWidgets dev team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/tglbtn.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/qt/private/converter.h"
|
||||
#include "wx/qt/private/winevent.h"
|
||||
|
||||
class wxQtToggleButton : public wxQtEventSignalHandler< QPushButton, wxAnyButton >
|
||||
{
|
||||
|
||||
public:
|
||||
wxQtToggleButton( wxWindow *parent, wxAnyButton *handler);
|
||||
|
||||
private:
|
||||
void clicked( bool checked );
|
||||
};
|
||||
|
||||
wxQtToggleButton::wxQtToggleButton(wxWindow *parent, wxAnyButton *handler)
|
||||
: wxQtEventSignalHandler< QPushButton, wxAnyButton >( parent, handler )
|
||||
{
|
||||
setCheckable( true );
|
||||
connect(this, &QPushButton::clicked, this, &wxQtToggleButton::clicked);
|
||||
}
|
||||
|
||||
void wxQtToggleButton::clicked( bool checked )
|
||||
{
|
||||
wxAnyButton *handler = GetHandler();
|
||||
if ( handler )
|
||||
{
|
||||
// for toggle buttons, send the checked state in the wx event:
|
||||
wxCommandEvent event( wxEVT_TOGGLEBUTTON, handler->GetId() );
|
||||
event.SetInt( checked );
|
||||
EmitEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent );
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( wxBitmapToggleButton, wxToggleButtonBase )
|
||||
|
||||
wxBitmapToggleButton::wxBitmapToggleButton()
|
||||
{
|
||||
}
|
||||
|
||||
wxBitmapToggleButton::wxBitmapToggleButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& 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 wxBitmapToggleButton::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
// this button is toggleable and has a bitmap label:
|
||||
QtSetBitmap( label );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
void wxBitmapToggleButton::SetValue(bool state)
|
||||
{
|
||||
m_qtPushButton->setChecked( state );
|
||||
}
|
||||
|
||||
bool wxBitmapToggleButton::GetValue() const
|
||||
{
|
||||
return m_qtPushButton->isChecked();
|
||||
}
|
||||
|
||||
QPushButton *wxBitmapToggleButton::GetHandle() const
|
||||
{
|
||||
return m_qtPushButton;
|
||||
}
|
||||
|
||||
//##############################################################################
|
||||
|
||||
wxToggleButton::wxToggleButton()
|
||||
{
|
||||
}
|
||||
|
||||
wxToggleButton::wxToggleButton(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 wxToggleButton::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size, long style,
|
||||
const wxValidator& validator,
|
||||
const wxString& name)
|
||||
{
|
||||
// create a checkable push button
|
||||
m_qtPushButton = new wxQtToggleButton( parent, this );
|
||||
|
||||
// this button is toggleable and has a text label
|
||||
SetLabel( wxIsStockID( id ) ? wxGetStockLabel( id ) : label );
|
||||
|
||||
return QtCreateControl( parent, id, pos, size, style, validator, name );
|
||||
}
|
||||
|
||||
void wxToggleButton::SetValue(bool state)
|
||||
{
|
||||
m_qtPushButton->setChecked( state );
|
||||
}
|
||||
|
||||
bool wxToggleButton::GetValue() const
|
||||
{
|
||||
return m_qtPushButton->isChecked();
|
||||
}
|
||||
|
||||
QPushButton *wxToggleButton::GetHandle() const
|
||||
{
|
||||
return m_qtPushButton;
|
||||
}
|
Reference in New Issue
Block a user