ScummVM API documentation
notebookpopup.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_NOTEBOOKPOPUP_H
23
#define NANCY_UI_NOTEBOOKPOPUP_H
24
25
#include "engines/nancy/renderobject.h"
26
#include "engines/nancy/misc/hypertext.h"
27
28
namespace
Nancy
{
29
30
struct
NancyInput;
31
struct
UINB;
32
33
namespace
UI
{
34
35
// Nancy 10+ notebook popup. Driven by the UINB chunk: overlay image + two
36
// tab buttons.
37
class
NotebookPopup
:
public
RenderObject
,
public
Misc::HypertextParser
{
38
public
:
39
NotebookPopup
();
40
~
NotebookPopup
()
override
=
default
;
41
42
void
init()
override
;
43
void
registerGraphics()
override
;
44
void
handleInput(
NancyInput
&input);
45
46
void
open();
47
void
close();
48
void
toggle() {
if
(_isVisible) close();
else
open(); }
49
50
// Re-render the active tab's text content into the text rect.
51
// Called automatically on open() and on tab switch; Scene also
52
// invokes it after a ModifyListEntry AR runs while the popup is open.
53
void
refreshContent();
54
55
private
:
56
static
const
uint kNumTabs = 2;
57
58
enum
WidgetState {
59
kStatePressed = 0,
60
kStateHover = 1,
61
kStateIdle = 2,
62
kStateDisabled = 3
63
};
64
65
void
drawBackground();
66
void
drawTabs();
67
void
drawTab(uint index,
bool
drawHover =
false
);
68
void
drawContent();
69
// Paint foreground widgets (close button, scrollbar) on top of the
70
// already-drawn background + content layers.
71
void
drawForeground();
72
void
drawCloseButton(WidgetState state);
73
void
drawScrollbar(WidgetState state);
74
75
// Returns the on-popup-surface bounding rect of the slider thumb at
76
// the current scroll position (in popup-local coords).
77
Common::Rect
computeThumbRect()
const
;
78
79
// Convert a chunk-space destRect into popup-local coordinates.
80
Common::Rect
toPopupLocal(
const
Common::Rect
&chunkRect,
bool
useGameFrame)
const
;
81
Common::Point
popupLocalMouse(
const
Common::Point
&screenMouse)
const
;
82
83
// Populate HypertextParser's text-line list with the active tab's
84
// entries.
85
void
buildTextLines();
86
87
const
UINB
*_uinbData;
88
89
Graphics::ManagedSurface
_overlayImage;
// popup background image
90
Graphics::ManagedSurface
_closeButtonImage;
// header.secondaryButton.primaryImageName
91
92
bool
_closeButtonHovered =
false
;
93
bool
_tabHovered =
false
;
94
int
_activeTab;
// 0..1, matching UINB::tabs index
95
96
// Scrollbar state. Driven by header.slider.
97
float
_scrollPos = 0.0f;
// [0, 1]: 0 = top, 1 = bottom
98
bool
_scrollbarDragging =
false
;
99
bool
_scrollbarHovered =
false
;
100
int
_scrollbarGrabOffset = 0;
101
102
// journalEntries HashMap keys: _surfaceID = 3 holds task entries,
103
// _surfaceID = 4 holds journal entries.
104
enum
NotebookTab {
105
kNotebookTabTasks = 3,
106
kNotebookTabJournal = 4
107
};
108
};
109
110
}
// End of namespace UI
111
}
// End of namespace Nancy
112
113
#endif // NANCY_UI_NOTEBOOKPOPUP_H
Graphics::ManagedSurface
Definition:
managed_surface.h:51
Common::Rect
Definition:
rect.h:524
Nancy::NancyInput
Definition:
input.h:41
UI
Definition:
soundequalizerpuzzle.h:27
Nancy::Misc::HypertextParser
Definition:
hypertext.h:32
Nancy::RenderObject
Definition:
renderobject.h:36
Common::Point
Definition:
rect.h:144
Nancy::UI::NotebookPopup
Definition:
notebookpopup.h:37
Nancy
Definition:
actionmanager.h:32
Nancy::UINB
Definition:
enginedata.h:718
engines
nancy
ui
notebookpopup.h
Generated on Sat Jun 27 2026 09:14:39 for ScummVM API documentation by
1.8.13