The Battle for Wesnoth  1.17.0-dev
tooltips.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2021
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include <string>
19 #include "sdl/surface.hpp"
20 
21 struct SDL_Rect;
22 
23 namespace tooltips {
24 
25 struct manager
26 {
27  manager();
28  ~manager();
29 };
30 
31 void clear_tooltips();
32 void clear_tooltips(const SDL_Rect& rect);
33 int add_tooltip(const SDL_Rect& rect, const std::string& message, const std::string& action ="", bool use_markup = true, const surface& foreground = surface(nullptr));
34 bool update_tooltip(int id, const SDL_Rect& rect, const std::string& message,
35  const std::string& action, bool use_markup, const surface& foreground);
36 bool update_tooltip(int id, const SDL_Rect& rect, const std::string& message,
37  const std::string& action, bool use_markup);
38 void remove_tooltip(int id);
39 void process(int mousex, int mousey);
40 
41 // Check if we clicked on a tooltip having an action.
42 // If it is, then execute the action and return true
43 // (only possible action are opening help page for the moment)
44 bool click(int mousex, int mousey);
45 
46 }
void remove_tooltip(int id)
Definition: tooltips.cpp:170
void clear_tooltips()
Definition: tooltips.cpp:121
void process(int mousex, int mousey)
Definition: tooltips.cpp:194
bool click(int mousex, int mousey)
Definition: tooltips.cpp:212
tooltips.
bool update_tooltip(int id, const SDL_Rect &rect, const std::string &message, const std::string &action, bool use_markup)
Definition: tooltips.cpp:145
int add_tooltip(const SDL_Rect &rect, const std::string &message, const std::string &action, bool use_markup, const surface &foreground)
Definition: tooltips.cpp:176