all repos — mgba @ 091e717133a10f785f02d1d4e880b8271fea8066

mGBA Game Boy Advance Emulator

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 <QPicture>
 6#include <QWidget>
 7
 8namespace QGBA {
 9
10class InputController;
11class KeyEditor;
12
13class GBAKeyEditor : public QWidget {
14Q_OBJECT
15
16public:
17	GBAKeyEditor(InputController* controller, int type, QWidget* parent = nullptr);
18
19public slots:
20	void setAll();
21
22protected:
23	virtual void resizeEvent(QResizeEvent*) override;
24	virtual void paintEvent(QPaintEvent*) override;
25
26private slots:
27	void setNext();
28	void save();
29
30private:
31	static const qreal DPAD_CENTER_X;
32	static const qreal DPAD_CENTER_Y;
33	static const qreal DPAD_WIDTH;
34	static const qreal DPAD_HEIGHT;
35
36	void setLocation(QWidget* widget, qreal x, qreal y);
37
38	QWidget* m_buttons;
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	uint32_t m_type;
53	InputController* m_controller;
54
55	QPicture m_background;
56};
57
58}
59
60#endif