mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:34:57 +00:00
LibGUI: Move GUI::FocusPolicy to its own header & add explainer comment
This commit is contained in:
parent
c1ba9c66b5
commit
d621534511
2 changed files with 29 additions and 9 deletions
28
Userland/Libraries/LibGUI/FocusPolicy.h
Normal file
28
Userland/Libraries/LibGUI/FocusPolicy.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/EnumBits.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
// FocusPolicy determines how GUI widgets gain focus.
|
||||
//
|
||||
// - NoFocus: The widget is not focusable.
|
||||
// - TabFocus: The widget can gain focus by cycling through focusable widgets with the Tab key.
|
||||
// - ClickFocus: The widget gains focus when clicked.
|
||||
// - StrongFocus: The widget can gain focus both via Tab, and by clicking on it.
|
||||
enum class FocusPolicy {
|
||||
NoFocus = 0,
|
||||
TabFocus = 0x1,
|
||||
ClickFocus = 0x2,
|
||||
StrongFocus = TabFocus | ClickFocus,
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(FocusPolicy)
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <LibCore/Object.h>
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibGUI/FocusPolicy.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Margins.h>
|
||||
#include <LibGfx/Color.h>
|
||||
|
@ -45,15 +46,6 @@ enum class VerticalDirection {
|
|||
Down
|
||||
};
|
||||
|
||||
enum class FocusPolicy {
|
||||
NoFocus = 0,
|
||||
TabFocus = 0x1,
|
||||
ClickFocus = 0x2,
|
||||
StrongFocus = TabFocus | ClickFocus,
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(FocusPolicy)
|
||||
|
||||
enum class AllowCallback {
|
||||
No,
|
||||
Yes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue