1 #ifndef BTANKS_TOOLTIP_H_
2 #define BTANKS_TOOLTIP_H_
3 
4 /* Battle Tanks Game
5  * Copyright (C) 2006-2009 Battle Tanks team
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  */
21 
22 /*
23  * Additional rights can be granted beyond the GNU General Public License
24  * on the terms provided in the Exception. If you modify this file,
25  * you may extend this exception to your version of the file,
26  * but you are not obligated to do so. If you do not wish to provide this
27  * exception without modification, you must delete this exception statement
28  * from your version and license this file solely under the GPL without exception.
29 */
30 
31 #include "sdlx/surface.h"
32 #include <vector>
33 #include "box.h"
34 #include "control.h"
35 #include "export_btanks.h"
36 
37 class BTANKSAPI Tooltip : public Control {
38 public:
39 	const std::string area, message;
40 	Tooltip(const std::string &area, const std::string &message, const bool use_background, int w = 0);
41 	Tooltip(const std::string &area, const std::string &message, const std::string &text, const bool use_background, int w = 0);
42 	void render(sdlx::Surface &surface, const int x, const int y) const;
43 	void get_size(int &w, int &h) const;
getReadingTime()44 	const float getReadingTime() const { return _time; }
45 
46 protected:
47 	bool _use_background;
48 	Box _background;
49 	void init(const std::string &text, const bool use_background, const int w = 0);
50 
51 private:
52 	sdlx::Surface _surface;
53 	std::vector<int> _lines;
54 	float _time;
55 };
56 
57 #endif
58 
59