ScummVM API documentation
widget_base.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 SHERLOCK_TATTOO_WIDGET_BASE_H
23 #define SHERLOCK_TATTOO_WIDGET_BASE_H
24 
25 #include "common/scummsys.h"
26 #include "common/rect.h"
27 #include "common/str-array.h"
28 #include "sherlock/surface.h"
29 
30 namespace Sherlock {
31 
32 class SherlockEngine;
33 class ImageFile;
34 
35 namespace Tattoo {
36 
37 class WidgetBase {
38 private:
39  uint32 _dialogTimer;
40 protected:
41  SherlockEngine *_vm;
42  Common::Rect _bounds;
43  Common::Rect _oldBounds;
44  Surface _surface;
45  bool _outsideMenu;
46  bool _scroll;
47 
51  Common::String splitLines(const Common::String &str, Common::StringArray &lines, int maxWidth, uint maxLines);
52 
56  void restrictToScreen();
57 
61  void makeInfoArea(Surface &s);
62 
66  void makeInfoArea();
67 
71  void drawDialogRect(const Common::Rect &r, bool raised = true);
72 
76  virtual Common::Rect getScrollBarBounds() const;
77 
81  void drawScrollBar(int index, int pageSize, int count);
82 
86  void handleScrollbarEvents(int index, int pageSize, int count);
87 
91  void handleScrolling(int &scrollIndex, int pageSize, int max);
92 
96  void close();
97 
101  virtual void drawBackground();
102 public:
104  virtual ~WidgetBase() {}
105 
109  bool active() const;
110 
114  virtual void erase();
115 
119  virtual void draw();
120 
124  void checkTabbingKeys(int numOptions);
125 
129  virtual void summonWindow();
130 
134  virtual void banishWindow();
135 
139  virtual void handleEvents() {}
140 };
141 
142 } // End of namespace Tattoo
143 
144 } // End of namespace Sherlock
145 
146 #endif
Definition: surface.h:118
Definition: str.h:59
void drawDialogRect(const Common::Rect &r, bool raised=true)
Definition: animation.h:29
Definition: rect.h:144
void handleScrollbarEvents(int index, int pageSize, int count)
Definition: sherlock.h:76
virtual Common::Rect getScrollBarBounds() const
void checkTabbingKeys(int numOptions)
void handleScrolling(int &scrollIndex, int pageSize, int max)
void drawScrollBar(int index, int pageSize, int count)
virtual void handleEvents()
Definition: widget_base.h:139
Common::String splitLines(const Common::String &str, Common::StringArray &lines, int maxWidth, uint maxLines)
Definition: widget_base.h:37