ScummVM API documentation
dialogpanel.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 STARK_UI_DIALOG_PANEL_H
23 #define STARK_UI_DIALOG_PANEL_H
24 
25 #include "engines/stark/ui/window.h"
26 #include "engines/stark/gfx/color.h"
27 
28 #include "common/scummsys.h"
29 #include "common/str.h"
30 #include "common/str-array.h"
31 #include "common/array.h"
32 #include "common/rect.h"
33 
34 namespace Stark {
35 
36 class VisualImageXMG;
37 class VisualText;
38 class ClickText;
39 
40 namespace Resources {
41 class Speech;
42 }
43 
44 class DialogPanel : public Window {
45 public:
46  DialogPanel(Gfx::Driver *gfx, Cursor *cursor);
47  virtual ~DialogPanel();
48 
50  void reset();
51 
53  void onScreenChanged();
54 
56  void scrollUp();
57  void scrollDown();
58 
60  void focusNextOption();
61  void focusPrevOption();
62 
64  void selectFocusedOption();
65 
67  void selectOption(uint index);
68 
69 protected:
70  void onMouseMove(const Common::Point &pos) override;
71  void onClick(const Common::Point &pos) override;
72  void onRightClick(const Common::Point &pos) override;
73  void onGameLoop() override;
74  void onRender() override;
75 
76 private:
77  void updateSubtitleVisual();
78  void clearSubtitleVisual();
79  void updateDialogOptions();
80  void clearOptions();
81  void renderOptions();
82  void renderScrollArrows() const;
83 
84  void updateFirstVisibleOption();
85  void updateLastVisibleOption();
86 
87  VisualImageXMG *_passiveBackGroundImage;
88  VisualImageXMG *_activeBackGroundImage;
89  VisualImageXMG *_scrollUpArrowImage;
90  VisualImageXMG *_scrollDownArrowImage;
91  VisualImageXMG *_dialogOptionBullet;
92  VisualText *_subtitleVisual;
93 
94  bool _scrollUpArrowVisible;
95  bool _scrollDownArrowVisible;
96  Common::Rect _scrollUpArrowRect;
97  Common::Rect _scrollDownArrowRect;
98 
99  Resources::Speech *_currentSpeech;
100  void abortCurrentSpeech();
101 
102  uint32 _firstVisibleOption, _lastVisibleOption;
103  uint32 _focusedOption;
104  Common::Array<ClickText*> _options;
105  bool _acceptIdleMousePos;
106 
107  const Gfx::Color _aprilColor = Gfx::Color(0xFF, 0xC0, 0x00);
108  const Gfx::Color _otherColor = Gfx::Color(0xFF, 0x40, 0x40);
109  static const uint32 _optionsTop = 4;
110  static const uint32 _optionsLeft = 30;
111  static const uint32 _optionsHeight = 80;
112 };
113 
114 } // End of namespace Stark
115 
116 #endif // STARK_UI_DIALOG_PANEL_H
Definition: window.h:54
Definition: array.h:52
Definition: rect.h:144
Definition: driver.h:44
Definition: cursor.h:45
Definition: text.h:44
Definition: console.h:27
Definition: rect.h:45
Definition: color.h:30
Definition: dialogpanel.h:44
Definition: speech.h:48
Definition: image.h:45