UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ui_node_abstractscrollable.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 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 
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;
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 {
81 
86 
int LUA_EVENT
holds a reference to a lua event handler
Definition: scripts_lua.h:49
void initNode(uiNode_t *node) override
bool setScrollY(uiNode_t *node, int viewPos, int viewSize, int fullSize)
Set the Y scroll to a position, and call event if need.
bool moveDelta(int deltaPos)
Move the position with a delta position.
bool set(int viewPos, int viewSize, int fullSize)
Set the scroll to a position.
bool isSizeChange(uiNode_t *node)
return true if the node size change and update the cache
void UI_RegisterAbstractScrollableNode(uiBehaviour_t *behaviour)
bool scrollY(uiNode_t *node, int offset)
Scroll the Y scroll with a relative position, and call event if need.
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
node behaviour, how a node work
Definition: ui_behaviour.h:39
Scroll representation.
vec_t vec2_t[2]
Definition: ufotypes.h:38
voidpf uLong offset
Definition: ioapi.h:45
Atomic element to store UI scripts The parser use this atom to translate script action into many tree...
Definition: ui_actions.h:144
bool move(int viewPos)
Fix a new position.