Symphony Of Empires
text.hpp
Go to the documentation of this file.
1 // Symphony of Empires
2 // Copyright (C) 2021, Symphony of Empires contributors
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 //
17 // ----------------------------------------------------------------------------
18 // Name:
19 // eng3d/ui/text.cpp
20 //
21 // Abstract:
22 // An extended version of Label that supports multiline text.
23 // ----------------------------------------------------------------------------
24 
25 #pragma once
26 
27 #include <vector>
28 #include <string>
29 #include <memory>
30 
31 #include "eng3d/ui/widget.hpp"
32 
33 namespace UI {
34  class Context;
35  class Label;
36 
41  class Text: public Widget {
42  public:
43  Text(int x, int y, unsigned w, unsigned h, UI::Widget* parent);
44  Text(int x, int y, const std::string& text, UI::Widget* parent);
45  virtual ~Text() {}
46  virtual void on_render(Context& ctx, Eng3D::Rect viewport);
47  virtual void set_text(const std::string& text);
48 
49  int min_height = 0;
51  bool auto_adjust = true;
52  };
53 }
The UI context that handles all the ui widgets.
Definition: ui.hpp:63
Multiline textbox that allows more descriptive paragraphs than the Label widget.
Definition: text.hpp:41
virtual ~Text()
Definition: text.hpp:45
virtual void on_render(Context &ctx, Eng3D::Rect viewport)
Definition: text.cpp:52
virtual void set_text(const std::string &text)
Generates text for the widget and overrides the current text texture.
Definition: text.cpp:56
Text(int x, int y, unsigned w, unsigned h, UI::Widget *parent)
Definition: text.cpp:30
int min_height
Definition: text.hpp:49
bool auto_adjust
Whetever to auto adjust the widget depending on the text.
Definition: text.hpp:51
The master widget all the other widgets inherit from, do not use directly instead use one of the many...
Definition: widget.hpp:176
UI::Widget * parent
Definition: widget.hpp:314