Files
wxWidgets/src/qt/gauge.cpp
Sean D'Epagnier 35bc8f449b Improve build and widget storage
There are no longer any qt headers included in wx/qt headers.
Applications do not need to link with qt librarys anymore, only wxqt libraries.
wxWindow and derived widgets only contain one pointer to their qtwidget, no longer
  carrying both base and derived pointers in parallel as was before.
2017-11-06 02:05:40 +01:00

93 lines
2.2 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/gauge.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/gauge.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/winevent.h"
#include <QtWidgets/QProgressBar>
class wxQtProgressBar : public wxQtEventSignalHandler< QProgressBar, wxGauge >
{
public:
wxQtProgressBar( wxWindow *parent, wxGauge *handler );
private:
void valueChanged(int value);
};
wxQtProgressBar::wxQtProgressBar( wxWindow *parent, wxGauge *handler )
: wxQtEventSignalHandler< QProgressBar, wxGauge >( parent, handler )
{
}
wxGauge::wxGauge()
{
}
wxGauge::wxGauge(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name)
{
Create( parent, id, range, pos, size, style, validator, name );
}
bool wxGauge::Create(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos,
const wxSize& size,
long style,
const wxValidator& validator,
const wxString& name)
{
m_qtProgressBar = new wxQtProgressBar( parent, this);
m_qtProgressBar->setOrientation( wxQtConvertOrientation( style, wxGA_HORIZONTAL ));
m_qtProgressBar->setRange( 0, range );
m_qtProgressBar->setTextVisible( style & wxGA_TEXT );
return QtCreateControl( parent, id, pos, size, style, validator, name );
}
QWidget *wxGauge::GetHandle() const
{
return m_qtProgressBar;
}
// set/get the control range and value
void wxGauge::SetRange(int range)
{
// note that in wx minimun range is fixed at 0
m_qtProgressBar->setMaximum(range);
}
int wxGauge::GetRange() const
{
return m_qtProgressBar->maximum();
}
void wxGauge::SetValue(int pos)
{
m_qtProgressBar->setValue(pos);
}
int wxGauge::GetValue() const
{
return m_qtProgressBar->value();
}