The Battle for Wesnoth  1.15.2+dev
tooltips.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project https://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 #pragma once
16 
17 #include <string>
18 #include "sdl/surface.hpp"
19 
20 struct SDL_Rect;
21 
22 namespace tooltips {
23 
24 struct manager
25 {
26  manager();
27  ~manager();
28 };
29 
30 void clear_tooltips();
31 void clear_tooltips(const SDL_Rect& rect);
32 int add_tooltip(const SDL_Rect& rect, const std::string& message, const std::string& action ="", bool use_markup = true, const surface& foreground = surface(nullptr));
33 bool update_tooltip(int id, const SDL_Rect& rect, const std::string& message,
34  const std::string& action, bool use_markup, const surface& foreground);
35 bool update_tooltip(int id, const SDL_Rect& rect, const std::string& message,
36  const std::string& action, bool use_markup);
37 void remove_tooltip(int id);
38 void process(int mousex, int mousey);
39 
40 // Check if we clicked on a tooltip having an action.
41 // If it is, then execute the action and return true
42 // (only possible action are opening help page for the moment)
43 bool click(int mousex, int mousey);
44 
45 }
void remove_tooltip(int id)
Definition: tooltips.cpp:169
void clear_tooltips()
Definition: tooltips.cpp:120
void process(int mousex, int mousey)
Definition: tooltips.cpp:193
bool click(int mousex, int mousey)
Definition: tooltips.cpp:211
tooltips.
bool update_tooltip(int id, const SDL_Rect &rect, const std::string &message, const std::string &action, bool use_markup)
Definition: tooltips.cpp:144
int add_tooltip(const SDL_Rect &rect, const std::string &message, const std::string &action, bool use_markup, const surface &foreground)
Definition: tooltips.cpp:175