KeyboardMapperWidget.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2020, Hüseyin Aslıtürk <asliturk@hotmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "KeyButton.h"
  8. #include <LibGUI/Button.h>
  9. #include <LibKeyboard/CharacterMapData.h>
  10. class KeyboardMapperWidget final : public GUI::Widget {
  11. C_OBJECT(KeyboardMapperWidget)
  12. public:
  13. virtual ~KeyboardMapperWidget() override;
  14. void create_frame();
  15. void load_from_file(const String);
  16. void load_from_system();
  17. void save();
  18. void save_to_file(StringView);
  19. protected:
  20. virtual void keydown_event(GUI::KeyEvent&) override;
  21. virtual void keyup_event(GUI::KeyEvent&) override;
  22. void set_current_map(const String);
  23. void update_window_title();
  24. private:
  25. KeyboardMapperWidget();
  26. Vector<KeyButton*> m_keys;
  27. RefPtr<GUI::Widget> m_map_group;
  28. void add_map_radio_button(const StringView map_name, const StringView button_text);
  29. u32* map_from_name(const StringView map_name);
  30. String m_filename;
  31. Keyboard::CharacterMapData m_character_map;
  32. String m_current_map_name;
  33. bool m_modified { false };
  34. };