UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_abstractscrollable.h
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License
11
as published by the Free Software Foundation; either version 2
12
of the License, or (at your option) any later version.
13
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24
*/
25
26
#pragma once
27
28
#include "
../../../shared/mathlib.h
"
29
#include "
ui_node_abstractnode.h
"
30
31
struct
uiBehaviour_t
;
32
struct
uiAction_s;
33
struct
uiNode_t
;
34
35
class
uiAbstractScrollableNode
:
public
uiLocatedNode
{
36
public
:
38
void
initNode
(
uiNode_t
* node)
override
;
39
43
bool
isSizeChange
(
uiNode_t
* node);
44
bool
scrollY
(
uiNode_t
* node,
int
offset
);
45
bool
setScrollY
(
uiNode_t
* node,
int
viewPos,
int
viewSize,
int
fullSize);
46
47
void
pageUp
(
uiNode_t
* node);
48
void
pageDown
(
uiNode_t
* node);
49
void
moveUp
(
uiNode_t
* node);
50
void
moveDown
(
uiNode_t
* node);
51
void
moveHome
(
uiNode_t
* node);
52
void
moveEnd
(
uiNode_t
* node);
53
};
54
58
struct
uiScroll_t
{
59
int
viewPos
;
60
int
viewSize
;
61
int
fullSize
;
62
63
bool
set
(
int
viewPos
,
int
viewSize
,
int
fullSize
);
64
bool
move
(
int
viewPos
);
70
bool
moveDelta
(
int
deltaPos) {
71
return
move
(this->viewPos + deltaPos);
72
}
73
};
74
75
typedef
struct
{
76
vec2_t
cacheSize
;
77
79
uiScroll_t
scrollX
;
80
uiScroll_t
scrollY
;
81
82
struct
uiAction_s*
onViewChange
;
83
LUA_EVENT
lua_onViewChange
;
84
85
}
abstractScrollableExtraData_t
;
86
87
void
UI_RegisterAbstractScrollableNode
(
uiBehaviour_t
* behaviour);
uiAbstractScrollableNode
Definition
ui_node_abstractscrollable.h:35
uiAbstractScrollableNode::moveEnd
void moveEnd(uiNode_t *node)
Definition
ui_node_abstractscrollable.cpp:179
uiAbstractScrollableNode::scrollY
bool scrollY(uiNode_t *node, int offset)
Scroll the Y scroll with a relative position, and call event if need.
Definition
ui_node_abstractscrollable.cpp:229
uiAbstractScrollableNode::moveUp
void moveUp(uiNode_t *node)
Definition
ui_node_abstractscrollable.cpp:170
uiAbstractScrollableNode::initNode
void initNode(uiNode_t *node) override
Definition
ui_node_abstractscrollable.cpp:130
uiAbstractScrollableNode::setScrollY
bool setScrollY(uiNode_t *node, int viewPos, int viewSize, int fullSize)
Set the Y scroll to a position, and call event if need.
Definition
ui_node_abstractscrollable.cpp:143
uiAbstractScrollableNode::isSizeChange
bool isSizeChange(uiNode_t *node)
return true if the node size change and update the cache
Definition
ui_node_abstractscrollable.cpp:47
uiAbstractScrollableNode::pageDown
void pageDown(uiNode_t *node)
Definition
ui_node_abstractscrollable.cpp:167
uiAbstractScrollableNode::moveHome
void moveHome(uiNode_t *node)
Definition
ui_node_abstractscrollable.cpp:176
uiAbstractScrollableNode::moveDown
void moveDown(uiNode_t *node)
Definition
ui_node_abstractscrollable.cpp:173
uiAbstractScrollableNode::pageUp
void pageUp(uiNode_t *node)
Definition
ui_node_abstractscrollable.cpp:163
uiLocatedNode
Definition
ui_node_abstractnode.h:68
offset
voidpf uLong offset
Definition
ioapi.h:45
mathlib.h
LUA_EVENT
int LUA_EVENT
holds a reference to a lua event handler
Definition
scripts_lua.h:49
abstractScrollableExtraData_t
Definition
ui_node_abstractscrollable.h:75
abstractScrollableExtraData_t::scrollY
uiScroll_t scrollY
Definition
ui_node_abstractscrollable.h:80
abstractScrollableExtraData_t::lua_onViewChange
LUA_EVENT lua_onViewChange
Definition
ui_node_abstractscrollable.h:83
abstractScrollableExtraData_t::scrollX
uiScroll_t scrollX
Definition
ui_node_abstractscrollable.h:79
abstractScrollableExtraData_t::cacheSize
vec2_t cacheSize
Definition
ui_node_abstractscrollable.h:76
abstractScrollableExtraData_t::onViewChange
struct uiAction_s * onViewChange
Definition
ui_node_abstractscrollable.h:82
uiBehaviour_t
node behaviour, how a node work
Definition
ui_behaviour.h:39
uiNode_t
Atomic structure used to define most of the UI.
Definition
ui_nodes.h:80
uiScroll_t
Scroll representation.
Definition
ui_node_abstractscrollable.h:58
uiScroll_t::move
bool move(int viewPos)
Fix a new position.
Definition
ui_node_abstractscrollable.cpp:63
uiScroll_t::viewPos
int viewPos
Definition
ui_node_abstractscrollable.h:59
uiScroll_t::fullSize
int fullSize
Definition
ui_node_abstractscrollable.h:61
uiScroll_t::set
bool set(int viewPos, int viewSize, int fullSize)
Set the scroll to a position.
Definition
ui_node_abstractscrollable.cpp:87
uiScroll_t::moveDelta
bool moveDelta(int deltaPos)
Move the position with a delta position.
Definition
ui_node_abstractscrollable.h:70
uiScroll_t::viewSize
int viewSize
Definition
ui_node_abstractscrollable.h:60
vec2_t
vec_t vec2_t[2]
Definition
ufotypes.h:38
ui_node_abstractnode.h
UI_RegisterAbstractScrollableNode
void UI_RegisterAbstractScrollableNode(uiBehaviour_t *behaviour)
Definition
ui_node_abstractscrollable.cpp:235
src
client
ui
node
ui_node_abstractscrollable.h
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.16.1