ScummVM API documentation
Tooltip.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GUI_TOOLTIP_H
23 #define GUI_TOOLTIP_H
24 
25 #include "common/keyboard.h"
26 #include "common/str-array.h"
27 #include "gui/dialog.h"
28 
29 namespace GUI {
30 
31 class Widget;
32 
33 class Tooltip : public Dialog {
34 private:
35  Dialog *_parent;
36 
37 public:
38  Tooltip();
39 
40  void setup(Dialog *parent, Widget *widget, int x, int y);
41 
42  void drawDialog(DrawLayer layerToDraw) override;
43 
44  void receivedFocus(int x = -1, int y = -1) override {}
45 protected:
46  void handleMouseDown(int x, int y, int button, int clickCount) override {
47  close();
48  _parent->handleMouseDown(x + (getAbsX() - _parent->getAbsX()), y + (getAbsY() - _parent->getAbsY()), button, clickCount);
49  }
50  void handleMouseUp(int x, int y, int button, int clickCount) override {
51  close();
52  _parent->handleMouseUp(x + (getAbsX() - _parent->getAbsX()), y + (getAbsY() - _parent->getAbsY()), button, clickCount);
53  }
54  void handleMouseWheel(int x, int y, int direction) override {
55  close();
56  _parent->handleMouseWheel(x + (getAbsX() - _parent->getAbsX()), y + (getAbsX() - _parent->getAbsX()), direction);
57  }
58  void handleKeyDown(Common::KeyState state) override {
59  close();
60  _parent->handleKeyDown(state);
61  }
62  void handleKeyUp(Common::KeyState state) override {
63  close();
64  _parent->handleKeyUp(state);
65  }
66  void handleMouseMoved(int x, int y, int button) override {
67  close();
68  }
69 
70  int _maxWidth;
71  int _xdelta, _ydelta;
72  int _xpadding, _ypadding;
73 
74  Common::U32StringArray _wrappedLines;
75 };
76 
77 } // End of namespace GUI
78 
79 #endif // GUI_TOOLTIP_H
Definition: system.h:46
void drawDialog(DrawLayer layerToDraw) override
Definition: Tooltip.h:33
Definition: dialog.h:49
Definition: widget.h:101
Definition: keyboard.h:294