summaryrefslogtreecommitdiff
path: root/lib/nes/app/graphics/text-attributes.hh
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-02 20:59:36 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-02 20:59:36 +0100
commit4fe67b36e3bbe6ea5505ed7233c245be9374f0ce (patch)
treef5cfe88f252ee2e9830162a1673441a704e6ea37 /lib/nes/app/graphics/text-attributes.hh
parent8062afc25e895cb49e76f6e26e51a7d4a1ad2df2 (diff)
refactor selection
Diffstat (limited to 'lib/nes/app/graphics/text-attributes.hh')
-rw-r--r--lib/nes/app/graphics/text-attributes.hh39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/nes/app/graphics/text-attributes.hh b/lib/nes/app/graphics/text-attributes.hh
new file mode 100644
index 0000000..6c82311
--- /dev/null
+++ b/lib/nes/app/graphics/text-attributes.hh
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "nes/common/types.hh"
+
+namespace nes::app
+{
+ enum class ellipsize_mode
+ {
+ clip,
+ start,
+ middle,
+ end,
+ };
+
+ enum class text_alignment
+ {
+ left,
+ center,
+ right,
+ };
+
+ class text_attributes
+ {
+ u32 max_width_{ 32 };
+ ellipsize_mode ellipsize_mode_{ ellipsize_mode::clip };
+ text_alignment alignment_{ text_alignment::left };
+
+ public:
+ explicit text_attributes() = default;
+
+ auto get_max_width() const -> u32 { return max_width_; }
+ auto get_ellipsize_mode() const -> ellipsize_mode { return ellipsize_mode_; }
+ auto get_alignment() const -> text_alignment { return alignment_; }
+
+ auto set_max_width(u32 const v) -> text_attributes& { max_width_ = v; return *this; }
+ auto set_ellipsize_mode(ellipsize_mode const v) -> text_attributes& { ellipsize_mode_ = v; return *this; }
+ auto set_alignment(text_alignment const v) -> text_attributes& { alignment_ = v; return *this; }
+ };
+} // namespace nes::app \ No newline at end of file