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:
87
src/qt/spinbutt.cpp
Normal file
87
src/qt/spinbutt.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/qt/spinbutt.cpp
|
||||
// Author: Peter Most
|
||||
// Copyright: (c) Peter Most
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/spinbutt.h"
|
||||
#include "wx/qt/private/winevent.h"
|
||||
|
||||
|
||||
class wxQtSpinButton : public wxQtEventSignalHandler< QSpinBox, wxSpinButton >
|
||||
{
|
||||
public:
|
||||
wxQtSpinButton( wxWindow *parent, wxSpinButton *handler );
|
||||
|
||||
private:
|
||||
void valueChanged(int value);
|
||||
};
|
||||
|
||||
wxQtSpinButton::wxQtSpinButton( wxWindow *parent, wxSpinButton *handler )
|
||||
: wxQtEventSignalHandler< QSpinBox, wxSpinButton >( parent, handler )
|
||||
{
|
||||
connect(this, static_cast<void (QSpinBox::*)(int index)>(&QSpinBox::valueChanged),
|
||||
this, &wxQtSpinButton::valueChanged);
|
||||
}
|
||||
|
||||
void wxQtSpinButton::valueChanged(int value)
|
||||
{
|
||||
wxSpinButton *handler = GetHandler();
|
||||
if ( handler )
|
||||
{
|
||||
wxCommandEvent event( wxEVT_SPIN, handler->GetId() );
|
||||
event.SetInt( value );
|
||||
EmitEvent( event );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxSpinButton::wxSpinButton()
|
||||
{
|
||||
}
|
||||
|
||||
wxSpinButton::wxSpinButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Create( parent, id, pos, size, style, name );
|
||||
}
|
||||
|
||||
bool wxSpinButton::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_qtSpinBox = new wxQtSpinButton( parent, this );
|
||||
|
||||
// Modify the size so that the text field is not visible.
|
||||
// TODO: Find out the width of the buttons i.e. take the style into account (QStyleOptionSpinBox).
|
||||
wxSize newSize( size );
|
||||
newSize.SetWidth( 18 );
|
||||
|
||||
return QtCreateControl( parent, id, pos, newSize, style, wxDefaultValidator, name );
|
||||
}
|
||||
|
||||
int wxSpinButton::GetValue() const
|
||||
{
|
||||
return m_qtSpinBox->value();
|
||||
}
|
||||
|
||||
void wxSpinButton::SetValue(int val)
|
||||
{
|
||||
m_qtSpinBox->setValue( val );
|
||||
}
|
||||
|
||||
QSpinBox *wxSpinButton::GetHandle() const
|
||||
{
|
||||
return m_qtSpinBox;
|
||||
}
|
Reference in New Issue
Block a user