From cb4844bf649cd3a55e0f461c6278c44c102c97b3 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Tue, 7 Jun 2022 22:44:13 +0200 Subject: LibGUI: Add VerticalDirection::operator! This allows to invert the direction of a VerticalDirection. --- Userland/Libraries/LibGUI/Widget.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Userland/Libraries/LibGUI/Widget.h') diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index 830007fa8e..f856f137b6 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -52,6 +52,13 @@ enum class VerticalDirection { Down }; +constexpr VerticalDirection operator!(VerticalDirection const& other) +{ + if (other == VerticalDirection::Up) + return VerticalDirection::Down; + return VerticalDirection::Up; +} + constexpr VerticalDirection key_code_to_vertical_direction(KeyCode const& key) { if (key == Key_Up) -- cgit v1.2.3