Symphony Of Empires
tooltip.hpp
Go to the documentation of this file.
1 // Symphony of Empires
2 // Copyright (C) 2021, Symphony of Empires contributors
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 //
17 // ----------------------------------------------------------------------------
18 // Name:
19 // eng3d/ui/tooltip.hpp
20 //
21 // Abstract:
22 // Tooltip widget emulates a Window (but it's not actually one!) for
23 // displaying tooltips on the screen.
24 // ----------------------------------------------------------------------------
25 
26 #pragma once
27 
28 #include <vector>
29 #include <string>
30 #include <memory>
31 
32 #include "eng3d/ui/widget.hpp"
33 
34 namespace UI {
38  class Tooltip: public UI::Widget {
39  void init(UI::Widget* parent, size_t w, size_t h);
40  public:
41  Tooltip(UI::Widget* parant = nullptr);
42  Tooltip(UI::Widget* parent, const std::string& text);
43  Tooltip(UI::Widget* parent, unsigned w, unsigned h);
44  virtual ~Tooltip() {}
45  void set_pos(int x, int y, int width, int height, int screen_width, int screen_height);
46  void set_text(const std::string& text);
47  };
48 }
Tooltip widget, used entirely for hovering purpouses, don't use any other widget for hovering unless ...
Definition: tooltip.hpp:38
void set_pos(int x, int y, int width, int height, int screen_width, int screen_height)
Definition: tooltip.cpp:72
Tooltip(UI::Widget *parant=nullptr)
Definition: tooltip.cpp:34
virtual ~Tooltip()
Definition: tooltip.hpp:44
void set_text(const std::string &text)
Generates text for the widget and overrides the current text texture.
Definition: tooltip.cpp:89
The master widget all the other widgets inherit from, do not use directly instead use one of the many...
Definition: widget.hpp:176
size_t width
Definition: widget.hpp:325
size_t height
Definition: widget.hpp:325
UI::Widget * parent
Definition: widget.hpp:314