arch/arm64: Support FEAT_CCIDX
[coreboot2.git] / util / coreboot-configurator / src / application / ToggleSwitch.h
blob191dc5ef96ceb8d6067ebd2dbb84db1267c8dc20
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #pragma once
5 #include <QCheckBox>
6 #include <QFile>
7 #include <QObject>
8 #include <QSvgRenderer>
12 * The ToggleSwitch class represents Toggle Switch widget based on QCheckBox and toggles svg with colorscheme support
14 class ToggleSwitch : public QCheckBox {
15 Q_OBJECT
16 public:
17 explicit ToggleSwitch(QWidget* parent = nullptr);
19 private:
20 QSvgRenderer m_svgr;
22 static const QByteArray s_toggleOnSvgContent;
23 static const QByteArray s_toggleOffSvgContent;
24 static const int s_colorPosInToggleOn;
26 QByteArray m_toggleOnSvgContentColored;
28 /* QWidget interface */
29 protected:
30 void paintEvent(QPaintEvent *event) override;
32 /* QAbstractButton interface */
33 protected:
34 bool hitButton(const QPoint &pos) const override
36 /* needs to be clickable on */
37 return rect().contains(pos);