src/platform/qt/GBAKeyEditor.h (view raw)
1#ifndef QGBA_GBA_KEY_EDITOR
2#define QGBA_GBA_KEY_EDITOR
3
4#include <QList>
5#include <QPixmap>
6#include <QWidget>
7
8class QPushButton;
9
10namespace QGBA {
11
12class InputController;
13class KeyEditor;
14
15class GBAKeyEditor : public QWidget {
16Q_OBJECT
17
18public:
19 GBAKeyEditor(InputController* controller, int type, QWidget* parent = nullptr);
20
21public slots:
22 void setAll();
23
24protected:
25 virtual void resizeEvent(QResizeEvent*) override;
26 virtual void paintEvent(QPaintEvent*) override;
27
28private:
29 static const qreal DPAD_CENTER_X;
30 static const qreal DPAD_CENTER_Y;
31 static const qreal DPAD_WIDTH;
32 static const qreal DPAD_HEIGHT;
33
34 void setNext();
35
36 void setLocation(QWidget* widget, qreal x, qreal y);
37
38 QPushButton* m_setAll;
39 KeyEditor* m_keyDU;
40 KeyEditor* m_keyDD;
41 KeyEditor* m_keyDL;
42 KeyEditor* m_keyDR;
43 KeyEditor* m_keySelect;
44 KeyEditor* m_keyStart;
45 KeyEditor* m_keyA;
46 KeyEditor* m_keyB;
47 KeyEditor* m_keyL;
48 KeyEditor* m_keyR;
49 QList<KeyEditor*> m_keyOrder;
50 QList<KeyEditor*>::iterator m_currentKey;
51
52 InputController* m_controller;
53
54 QPixmap m_background;
55};
56
57}
58
59#endif