ac1f07982a8da544064dbf45b7fa3954f86fad15
[supertux.git] / src / supertux / info_box_line.hpp
1 //  SuperTux
2 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
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 <http://www.gnu.org/licenses/>.
16
17 #ifndef HEADER_SUPERTUX_SUPERTUX_INFO_BOX_LINE_HPP
18 #define HEADER_SUPERTUX_SUPERTUX_INFO_BOX_LINE_HPP
19
20 #include <string>
21 #include <vector>
22
23 #include "video/color.hpp"
24
25 class DrawingContext;
26 class Font;
27 class Rect;
28 class Surface;
29
30 /**
31  * Helper class for InfoBox: Represents a line of text
32  */
33 class InfoBoxLine
34 {
35 public:
36   enum LineType { NORMAL, NORMAL_LEFT, SMALL, HEADING, REFERENCE, IMAGE};
37
38   InfoBoxLine(char format_char, const std::string& text);
39   ~InfoBoxLine();
40
41   void draw(DrawingContext& context, const Rect& bbox, int layer);
42   float get_height();
43
44   static const std::vector<InfoBoxLine*> split(const std::string& text, float width);
45
46 private:
47   InfoBoxLine::LineType lineType;
48   Font* font;
49   Color color;
50   std::string text;
51   Surface* image;
52
53 private:
54   InfoBoxLine(const InfoBoxLine&);
55   InfoBoxLine& operator=(const InfoBoxLine&);
56 };
57
58 #endif
59
60 /* EOF */