SDL Window Engine  20200905
swe_wingui.h
1 /***************************************************************************
2  * Copyright (C) 2017 by SWE team <sdl.window.engine@gmail.com> *
3  * *
4  * Part of the SWE: SDL Window Engine: *
5  * https://github.com/AndreyBarmaley/sdl-window-engine *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 3 of the License, or *
10  * (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 *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 
23 #ifndef _SWE_WINDOW_GUI_
24 #define _SWE_WINDOW_GUI_
25 
26 #include "swe_window.h"
27 
29 namespace SWE
30 {
31  class WindowToolTipArea : public Window
32  {
33  protected:
34  Texture tooltip;
35 
36  public:
38  WindowToolTipArea(const Size &, Window*);
39  WindowToolTipArea(const Point &, const Size &, Window*);
40 
41  void renderToolTip(const std::string &, const FontRender &, const Color & fn, const Color & bg, const Color & rt);
42  void renderToolTip(const StringList &, const FontRender &, const Color & fn, const Color & bg, const Color & rt);
43  void resetToolTip(void) { tooltip.reset(); }
44 
45  virtual void setToolTip(const std::string &);
46  virtual void setToolTip(const std::string &, int width);
47  virtual void setToolTip(const StringList &);
48 
49  const Texture & tooltipTexture(void) const;
50 
51  virtual u32 tooltipTimeout(void) const
52  {
53  return 400; // ms
54  }
55 
56  const char* className(void) const override { return "SWE::WindowToolTipArea"; }
57 #ifdef SWE_WITH_JSON
58  JsonObject toJson(void) const override
59  {
60  JsonObject res = Window::toJson();
61  res.addObject("tooltip", tooltip.toJson());
62  return res;
63  }
64 #endif
65  };
66 
67  /* WindowToolTipIcon */
69  {
70  protected:
71  Texture icon;
72 
73  public:
75  WindowToolTipIcon(const Point &, const Texture &, const std::string &, Window*);
76 
77  void setTexture(const Texture &);
78  void renderWindow(void) override;
79 
80  const char* className(void) const override { return "SWE::WindowToolTipIcon"; }
81 #ifdef SWE_WITH_JSON
82  JsonObject toJson(void) const override
83  {
84  JsonObject res = WindowToolTipArea::toJson();
85  res.addObject("icon", icon.toJson());
86  return res;
87  }
88 #endif
89  };
90 
91 } // SWE
92 #endif
Definition: swe_surface.h:154
пространство SWE.
Definition: swe_binarybuf.cpp:30
Definition: swe_wingui.h:31
класс точки с двумя координатами
Definition: swe_rect.h:72
класс цвета
Definition: swe_colors.h:65
базовый класс шрифта
Definition: swe_fontset.h:151
класс списка строк
Definition: swe_cstring.h:36
класс двухмерной размерности
Definition: swe_rect.h:36
Definition: swe_wingui.h:68
const char * className(void) const override
идентификацинная метка класса
Definition: swe_wingui.h:80
базовый класс графических объектов сцены DisplayScene.
Definition: swe_window.h:57
const char * className(void) const override
идентификацинная метка класса
Definition: swe_wingui.h:56