serenity/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.h
Sam Atkins c6099eca5c KeyboardSettings: Add text area to test the currently selected keymap
Right now, this is a bit of a hack. We can't set a keymap to only apply
to the test area, so we set the system keymap instead, while also
keeping track of the "real" current keymap. Whenever the settings are
applied, we update what that "real" keymap is, and when we exit, we
revert to that keymap.

Basically, it behaves as you would expect, apart from it also affecting
other applications you are typing in while the KeyboardSettings window
is open with a different keymap selected.
2021-11-20 21:05:20 +00:00

34 lines
870 B
C++

/*
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Button.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/SettingsWindow.h>
#include <LibGUI/TextEditor.h>
class KeyboardSettingsWidget final : public GUI::SettingsWindow::Tab {
C_OBJECT(KeyboardSettingsWidget)
public:
virtual ~KeyboardSettingsWidget() override;
virtual void apply_settings() override;
private:
KeyboardSettingsWidget();
void set_keymap(String const& keymap_filename);
String m_current_applied_keymap;
Vector<String> m_character_map_files;
RefPtr<GUI::ComboBox> m_character_map_file_combo;
RefPtr<GUI::TextEditor> m_test_typing_area;
RefPtr<GUI::Button> m_clear_test_typing_area_button;
RefPtr<GUI::CheckBox> m_num_lock_checkbox;
};