From 7dc4078a73beb3648c4622437c9e4131b260110e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 24 Apr 2019 23:46:19 +0200 Subject: [PATCH] SharedGraphics: Add is_right_text_alignment(TextAlignment) helper. This seems a tad bit more future-proof than manually checking all the valid right-side TextAlignment values in clients. --- SharedGraphics/TextAlignment.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SharedGraphics/TextAlignment.h b/SharedGraphics/TextAlignment.h index da7fa18021..9f77c67179 100644 --- a/SharedGraphics/TextAlignment.h +++ b/SharedGraphics/TextAlignment.h @@ -1,3 +1,13 @@ #pragma once enum class TextAlignment { TopLeft, CenterLeft, Center, CenterRight }; + +inline bool is_right_text_alignment(TextAlignment alignment) +{ + switch (alignment) { + case TextAlignment::CenterRight: + return true; + default: + return false; + } +}