mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
LibGUI: Use AK_ENUM_BITWISE_OPERATORS for the FocusPolicy enum
This commit is contained in:
parent
5f6ab77352
commit
bac0dd5e3d
3 changed files with 6 additions and 3 deletions
|
@ -389,7 +389,7 @@ void Widget::handle_mouseup_event(MouseEvent& event)
|
|||
|
||||
void Widget::handle_mousedown_event(MouseEvent& event)
|
||||
{
|
||||
if (((unsigned)focus_policy() & (unsigned)FocusPolicy::ClickFocus))
|
||||
if (has_flag(focus_policy(), FocusPolicy::ClickFocus))
|
||||
set_focus(true, FocusSource::Mouse);
|
||||
mousedown_event(event);
|
||||
if (event.button() == MouseButton::Right) {
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/EnumBits.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Object.h>
|
||||
|
@ -80,6 +81,8 @@ enum class FocusPolicy {
|
|||
StrongFocus = TabFocus | ClickFocus,
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(FocusPolicy)
|
||||
|
||||
class Widget : public Core::Object {
|
||||
C_OBJECT(Widget)
|
||||
public:
|
||||
|
|
|
@ -831,10 +831,10 @@ Vector<Widget*> Window::focusable_widgets(FocusSource source) const
|
|||
bool widget_accepts_focus = false;
|
||||
switch (source) {
|
||||
case FocusSource::Keyboard:
|
||||
widget_accepts_focus = ((unsigned)widget.focus_policy() & (unsigned)FocusPolicy::TabFocus);
|
||||
widget_accepts_focus = has_flag(widget.focus_policy(), FocusPolicy::TabFocus);
|
||||
break;
|
||||
case FocusSource::Mouse:
|
||||
widget_accepts_focus = ((unsigned)widget.focus_policy() & (unsigned)FocusPolicy::ClickFocus);
|
||||
widget_accepts_focus = has_flag(widget.focus_policy(), FocusPolicy::ClickFocus);
|
||||
break;
|
||||
case FocusSource::Programmatic:
|
||||
widget_accepts_focus = widget.focus_policy() != FocusPolicy::NoFocus;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue