The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
tooltips.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2003 - 2025
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
19#include "sdl/rect.hpp"
20
21#include <string>
22
23namespace tooltips {
24
26{
27public:
28 manager();
29 ~manager();
30 // TLD interface
31 virtual void layout() override;
32 virtual bool expose(const rect& region) override;
33 virtual rect screen_location() override;
34};
35
36void clear_tooltips();
37void clear_tooltips(const rect& rect);
38int add_tooltip(const rect& rect, const std::string& message, const std::string& action ="");
39bool update_tooltip(int id, const rect& rect, const std::string& message);
40void remove_tooltip(int id);
41void process(int mousex, int mousey);
42
43// Check if we clicked on a tooltip having an action.
44// If it is, then execute the action and return true
45// (only possible action are opening help page for the moment)
46bool click(int mousex, int mousey);
47
48}
A top-level drawable item (TLD), such as a window.
virtual bool expose(const rect &region) override
Draw the portion of the drawable intersecting region to the screen.
Definition tooltips.cpp:211
virtual void layout() override
Finalize the size and position of the drawable and its children, and invalidate any regions requiring...
Definition tooltips.cpp:197
virtual rect screen_location() override
The location of the TLD on the screen, in drawing coordinates.
Definition tooltips.cpp:225
tooltips.
Definition tooltips.cpp:181
int add_tooltip(const rect &origin, const std::string &message, const std::string &action)
Definition tooltips.cpp:293
bool click(int mousex, int mousey)
Definition tooltips.cpp:350
void clear_tooltips()
Definition tooltips.cpp:235
void remove_tooltip(int id)
Definition tooltips.cpp:283
void process(int mousex, int mousey)
Definition tooltips.cpp:334
bool update_tooltip(int id, const rect &origin, const std::string &message)
Definition tooltips.cpp:261
Contains the SDL_Rect helper code.
An abstract description of a rectangle with integer coordinates.
Definition rect.hpp:49