neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_text_widget.hpp
Go to the documentation of this file.
1// i_text_widget.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2021 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19#pragma once
20
21#include <neogfx/neogfx.hpp>
22#include "i_widget.hpp"
23
24namespace neogfx
25{
27 {
30 };
31
33 {
34 None = 0x00,
35 HideOnEmpty = 0x01,
37 CutOff = 0x04,
38 UseEllipsis = 0x08
39 };
40
42 {
43 return static_cast<text_widget_flags>(static_cast<uint32_t>(aLhs) | static_cast<uint32_t>(aRhs));
44 }
45
47 {
48 return static_cast<text_widget_flags>(static_cast<uint32_t>(aLhs) & static_cast<uint32_t>(aRhs));
49 }
50
52 {
53 return static_cast<text_widget_flags>(~static_cast<uint32_t>(aLhs));
54 }
55
56 class i_text_widget : public i_widget
57 {
58 public:
59 declare_event(text_changed)
60 declare_event(text_geometry_changed)
61 public:
62 virtual i_string const& text() const = 0;
63 virtual void set_text(i_string const& aText) = 0;
64 virtual void set_size_hint(const size_hint& aSizeHint) = 0;
65 virtual bool multi_line() const = 0;
66 virtual text_widget_flags flags() const = 0;
67 virtual void set_flags(text_widget_flags aFlags) = 0;
68 virtual neogfx::alignment alignment() const = 0;
69 virtual void set_alignment(neogfx::alignment aAlignment, bool aUpdateLayout = true) = 0;
70 virtual bool has_text_color() const = 0;
71 virtual color text_color() const = 0;
72 virtual void set_text_color(const optional_color& aTextColor) = 0;
73 virtual bool has_text_format() const = 0;
74 virtual neogfx::text_format text_format() const = 0;
75 virtual void set_text_format(const optional_text_format& aTextAppearance) = 0;
76 };
77}
virtual void set_flags(text_widget_flags aFlags)=0
virtual bool multi_line() const =0
virtual text_widget_flags flags() const =0
virtual neogfx::alignment alignment() const =0
virtual bool has_text_format() const =0
virtual declare_event(text_changed) declare_event(text_geometry_changed) public void set_text(i_string const &aText)=0
virtual color text_color() const =0
virtual void set_size_hint(const size_hint &aSizeHint)=0
virtual void set_alignment(neogfx::alignment aAlignment, bool aUpdateLayout=true)=0
virtual void set_text_color(const optional_color &aTextColor)=0
virtual void set_text_format(const optional_text_format &aTextAppearance)=0
virtual bool has_text_color() const =0
virtual neogfx::text_format text_format() const =0
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:60
audio_channel operator~(audio_channel lhs)
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
Definition i_style.hpp:55
#define declare_event(declName,...)
Definition i_event.hpp:305