libAlgAudio  v1.99-440-g08538e5-dirty
The development library for AlgAudio framework.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UITextArea.hpp
Go to the documentation of this file.
1 #ifndef UITEXTAREA_HPP
2 #define UITEXTAREA_HPP
3 /*
4 This file is part of AlgAudio.
5 
6 AlgAudio, Copyright (C) 2015 CeTA - Audiovisual Technology Center
7 
8 AlgAudio is free software: you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as
10 published by the Free Software Foundation, either version 3 of the
11 License, or (at your option) any later version.
12 
13 AlgAudio is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with AlgAudio. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include <vector>
22 #include "UIWidget.hpp"
23 
24 namespace AlgAudio{
25 
26 class UITextArea : public UIWidget{
27 public:
28  static std::shared_ptr<UITextArea> Create(std::weak_ptr<Window> parent_window, Color c_fg, Color c_bg = Color(0,0,0));
29  void Clear();
30  void Push(std::string);
31  void PushLine(std::string);
32  void SetBottomAligned(bool b){
33  bottom_alligned = b;
34  }
35  virtual void CustomDraw(DrawContext& c) override;
36  std::string GetAllText();
37 private:
38  UITextArea(std::weak_ptr<Window> parent_window, Color c_fg, Color c_bg = Color(0,0,0));
39  std::vector<std::string> text;
40  std::vector<std::shared_ptr<SDLTextTexture>> textures;
41  bool bottom_alligned = false;
42  Color c_fg, c_bg;
43 };
44 
45 } // namespace AlgAudio
46 
47 #endif // UITEXTAREA_HPP
Definition: UIWidget.hpp:65
Definition: Color.hpp:28
void PushLine(std::string)
Definition: DrawContext.hpp:65
void Push(std::string)
std::string GetAllText()
Definition: Alertable.hpp:26
void SetBottomAligned(bool b)
Definition: UITextArea.hpp:32
static std::shared_ptr< UITextArea > Create(std::weak_ptr< Window > parent_window, Color c_fg, Color c_bg=Color(0, 0, 0))
virtual void CustomDraw(DrawContext &c) override
Definition: UITextArea.hpp:26