Mana
Loading...
Searching...
No Matches
textpreview.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2006-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program 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 General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <guichan/color.hpp>
25#include <guichan/font.hpp>
26#include <guichan/widget.hpp>
27
31class TextPreview : public gcn::Widget
32{
33 public:
34 TextPreview(const std::string &text);
35
41 void setTextColor(const gcn::Color *color)
42 {
43 mTextColor = color;
44 }
45
51 void setFont(gcn::Font *font)
52 {
53 mFont = font;
54 }
55
61 void setShadow(bool shadow)
62 {
63 mShadow = shadow;
64 }
65
71 void setOutline(bool outline)
72 {
73 mOutline = outline;
74 }
75
81 void draw(gcn::Graphics *graphics) override;
82
83 private:
84 gcn::Font *mFont;
85 std::string mText;
86 const gcn::Color *mTextColor;
87 bool mShadow = false;
88 bool mOutline = false;
89};
Preview widget for particle colors, etc.
Definition textpreview.h:32
void setFont(gcn::Font *font)
Sets the font to render the text in.
Definition textpreview.h:51
void setOutline(bool outline)
Sets whether to use an outline while rendering.
Definition textpreview.h:71
const gcn::Color * mTextColor
Definition textpreview.h:86
gcn::Font * mFont
Definition textpreview.h:84
void draw(gcn::Graphics *graphics) override
Widget's draw method.
void setTextColor(const gcn::Color *color)
Sets the color the text is printed in.
Definition textpreview.h:41
std::string mText
Definition textpreview.h:85
void setShadow(bool shadow)
Sets whether to use a shadow while rendering.
Definition textpreview.h:61
Graphics * graphics
Definition client.cpp:104