qskinny/examples/mycontrols/MyToggleButton.h

51 lines
1.3 KiB
C
Raw Normal View History

2019-02-26 21:52:02 +01:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
2021-08-04 10:11:12 +02:00
#pragma once
2019-02-26 21:52:02 +01:00
#include <QskAbstractButton.h>
class QskGraphic;
class QskTextOptions;
class MyToggleButton : public QskAbstractButton
{
Q_OBJECT
using Inherited = QskAbstractButton;
public:
2021-12-27 18:47:46 +01:00
QSK_SUBCONTROLS( Panel, Cursor, CheckedPanel, CheckedText, CheckedGraphic,
UncheckedPanel, UncheckedText, UncheckedGraphic )
2019-02-26 21:52:02 +01:00
MyToggleButton( QQuickItem* parent = nullptr );
~MyToggleButton() override;
bool isCheckable() const override final;
2021-12-27 18:47:46 +01:00
void setText( bool isChecked, const QString& );
QString text( bool isChecked ) const;
2019-02-26 21:52:02 +01:00
2021-12-27 18:47:46 +01:00
void setIcon( bool isChecked, const QString& icon );
QString icon( bool isChecked ) const;
2019-02-26 21:52:02 +01:00
void setTextOptions( const QskTextOptions& );
QskTextOptions textOptions() const;
2021-12-27 18:47:46 +01:00
QskGraphic graphic( bool isChecked ) const;
2019-02-26 21:52:02 +01:00
void setInverted( bool );
bool isInverted() const;
Q_SIGNALS:
void invertedChanged( bool );
protected:
2019-12-15 13:34:07 +01:00
void updateResources() override;
2019-02-26 21:52:02 +01:00
private:
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};