| 1 | // Aseprite |
|---|---|
| 2 | // Copyright (C) 2001-2016 David Capello |
| 3 | // |
| 4 | // This program is distributed under the terms of |
| 5 | // the End-User License Agreement for Aseprite. |
| 6 | |
| 7 | #ifndef APP_UI_SELECT_ACCELERATOR_H_INCLUDED |
| 8 | #define APP_UI_SELECT_ACCELERATOR_H_INCLUDED |
| 9 | #pragma once |
| 10 | |
| 11 | #include "app/ui/key_context.h" |
| 12 | #include "ui/accelerator.h" |
| 13 | #include "ui/tooltips.h" |
| 14 | |
| 15 | #include "select_accelerator.xml.h" |
| 16 | |
| 17 | namespace app { |
| 18 | class KeyboardShortcuts; |
| 19 | |
| 20 | class SelectAccelerator : public app::gen::SelectAccelerator { |
| 21 | public: |
| 22 | SelectAccelerator(const ui::Accelerator& accelerator, |
| 23 | const KeyContext keyContext, |
| 24 | const KeyboardShortcuts& currentKeys); |
| 25 | |
| 26 | bool isOK() const { return m_ok; } |
| 27 | bool isModified() const { return m_modified; } |
| 28 | const ui::Accelerator& accel() const { return m_accel; } |
| 29 | |
| 30 | private: |
| 31 | void onModifierChange(ui::KeyModifiers modifier, ui::CheckBox* checkbox); |
| 32 | void onAccelChange(const ui::Accelerator* accel); |
| 33 | void onClear(); |
| 34 | void onOK(); |
| 35 | void onCancel(); |
| 36 | void updateModifiers(); |
| 37 | void updateAssignedTo(); |
| 38 | |
| 39 | class KeyField; |
| 40 | |
| 41 | ui::TooltipManager m_tooltipManager; |
| 42 | KeyField* m_keyField; |
| 43 | KeyContext m_keyContext; |
| 44 | const KeyboardShortcuts& m_currentKeys; |
| 45 | ui::Accelerator m_origAccel; |
| 46 | ui::Accelerator m_accel; |
| 47 | bool m_ok; |
| 48 | bool m_modified; |
| 49 | }; |
| 50 | |
| 51 | } // namespace app |
| 52 | |
| 53 | #endif |
| 54 |