The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
label.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2004 - 2016 by Philippe Plantier <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #ifndef LABEL_HPP_INCLUDED
16 #define LABEL_HPP_INCLUDED
17 
18 #include "font.hpp"
19 #include "widget.hpp"
20 #include <string>
21 #include "sdl/image.hpp"
22 
23 namespace gui {
24 
25 class label : public widget
26 {
27 public:
29  const SDL_Color& color=font::NORMAL_COLOR, const bool auto_join=true);
30  const std::string& set_text(const std::string& text);
31  const std::string& get_text() const;
32 
33  const SDL_Color& set_color(const SDL_Color& color);
34  const SDL_Color& get_color() const;
35 
36  virtual void draw_contents();
37 private:
38  void update_label_size();
39 #ifdef SDL_GPU
40  void render_text();
41 
42  sdl::timage text_image_;
43 #endif
45  int size_;
46  SDL_Color color_;
47 };
48 
49 }
50 
51 #endif
52 
const SDL_Color & set_color(const SDL_Color &color)
Definition: label.cpp:55
const std::string & set_text(const std::string &text)
Definition: label.cpp:35
Definition: video.hpp:58
static surface render_text(const std::string &text, int fontsize, const SDL_Color &color, int style, bool use_markup)
Definition: font.cpp:813
label(CVideo &video, const std::string &text, int size=font::SIZE_NORMAL, const SDL_Color &color=font::NORMAL_COLOR, const bool auto_join=true)
Definition: label.cpp:26
CVideo & video() const
Definition: widget.hpp:83
General purpose widgets.
void update_label_size()
Definition: label.cpp:81
const SDL_Color & get_color() const
Definition: label.cpp:65
const SDL_Color NORMAL_COLOR
Definition: font.cpp:564
const int SIZE_NORMAL
Definition: font.hpp:58
GLuint color
Definition: glew.h:5801
const std::string & get_text() const
Definition: label.cpp:50
int size_
Definition: label.hpp:45
SDL_Color color_
Definition: label.hpp:46
Contains a wrapper class for the GPU_Image class.
virtual void draw_contents()
Definition: label.cpp:70
GLsizeiptr size
Definition: glew.h:1649
std::string text_
Definition: label.hpp:44
GLsizei const GLcharARB ** string
Definition: glew.h:4503