ScummVM API documentation
textbox.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 NANCY_UI_TEXTBOX_H
23 #define NANCY_UI_TEXTBOX_H
24 
25 #include "engines/nancy/misc/hypertext.h"
26 #include "engines/nancy/renderobject.h"
27 
28 namespace Nancy {
29 
30 class NancyEngine;
31 class Scene;
32 struct NancyInput;
33 
34 namespace UI {
35 
36 class Scrollbar;
37 
38 class Textbox : public RenderObject, public Misc::HypertextParser {
39 public:
40  Textbox();
41  virtual ~Textbox();
42 
43  void init() override;
44  void registerGraphics() override;
45  void updateGraphics() override;
46  void handleInput(NancyInput &input);
47 
48  void drawTextbox();
49  void clear() override;
50 
51  void addTextLine(const Common::String &text, uint32 autoClearTime = 0);
52  void setOverrideFont(const uint fontID);
53 
54  // Nancy 10+ open/full mode. When `open` is true the textbox extends
55  // down to cover the taskbar buttons; `timeoutMs` schedules an automatic
56  // return to closed mode Passing 0 disables the auto-close (the caller is
57  // then responsible for closing). No-op for pre-Nancy 10 games.
58  void setFullMode(bool open, uint32 timeoutMs = 15000);
59  bool isFullMode() const { return _isFullMode; }
60 
61 private:
62  enum DisplayMode {
63  kModeClosed = 0,
64  kModeOpen = 1
65  };
66 
67  uint16 getInnerHeight() const;
68  void onScrollbarMove();
69  void applyDisplayMode();
70 
71  RenderObject _highlightRObj;
72  Scrollbar *_scrollbar;
73 
74  float _scrollbarPos;
75 
76  uint32 _autoClearTime;
77  int _fontIDOverride;
78 
79  // Nancy 10+ open/closed strip geometry. `_closedRect` is the small
80  // taskbar-clipped strip; `_openRect` is the full bsum textbox area
81  // (extends through the taskbar zone).
82  bool _isFullMode;
83  uint32 _fullModeCloseTime;
84  Common::Rect _closedRect;
85  Common::Rect _openRect;
86 };
87 
88 } // End of namespace UI
89 } // End of namespace Nancy
90 
91 #endif // NANCY_UI_TEXTBOX_H
Definition: str.h:59
Definition: rect.h:524
Definition: scrollbar.h:33
Definition: textbox.h:38
Definition: input.h:41
Definition: soundequalizerpuzzle.h:27
Definition: hypertext.h:32
Definition: renderobject.h:36
Definition: actionmanager.h:32