File: gui_item.h

package info (click to toggle)
scummvm 2.9.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 450,268 kB
  • sloc: cpp: 4,297,604; asm: 28,322; python: 12,901; sh: 11,219; java: 8,477; xml: 7,843; perl: 2,633; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (160 lines) | stat: -rw-r--r-- 4,699 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef M4_GUI_GUI_ITEM_H
#define M4_GUI_GUI_ITEM_H

#include "m4/m4_types.h"
#include "m4/graphics/gr_font.h"

namespace M4 {

#define ITEM_NORMAL     0x00000
#define ITEM_PRESSED    0x00001

#define ITEM_DEFAULT    0x00001
#define ITEM_RETURN     0x00002

#define SU_PRESSED      0x0100
#define SD_PRESSED      0x0200
#define PU_PRESSED      0x0400
#define PD_PRESSED      0x0800
#define THUMB_PRESSED   0x1000
#define BOX_PRESSED     0x2000
#define AREA_PRESSED    0x3f00

#define NO_SCROLL       0x0000
#define SCROLLABLE      0x0001
#define PAGEABLE        0x0002

#define FILL_INTERIOR 1	// a flag for use by DrawTile
#define BORDER 0

enum ItemType {
	MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
};

enum {
	LIST_BY_TAG = 0,
	LIST_ALPH,
	LIST_SEQUN
};

struct ListItem {
	char   prompt[80];
	int32  tag;
	struct ListItem *next;
	struct ListItem *prev;
};

struct TextItem {
	TextItem *next;
	int32 justification;
	int32 x;
	int32 y;
	int32 w;
	int32 h;
	int32 tag;
	int32 type;
	char *prompt;
	M4CALLBACK	callback;
};

struct Item {
	Item *next;
	Item *prev;
	M4CALLBACK callback;
	ItemType type;
	int32 status;
	Font *myFont;
	char *prompt;
	char *aux;
	char *aux2;
	int32 promptMax;
	int32 myListCount;
	int32 viewIndex;
	int32 thumbY;
	ListItem *myList;
	ListItem *currItem;
	ListItem *viewTop;
	ListItem *viewBottom;
	int32 listView;
	int32 x, y, w, h;
	int32 tag;
};

struct Item_Globals {
	char *origPrompt = nullptr;
	char *undoPrompt = nullptr;
	char *undoAux = nullptr;
	char *undoAux2 = nullptr;
	Item *currTextField = nullptr;

	int32 buttonWidth = 0;
	int32 buttonHeight = 0;

	char clipBoard[100] = { 0 };
};

bool InitItems(void);
Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb);
void Item_destroy(Item *myItem);
void Item_empty_list(Item *myItem);
Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *prompt, int32 tag,
	ItemType type, M4CALLBACK cb, int32 promptMax);
Item *ItemFind(Item *itemList, int32 tag);
bool Item_SetViewBottom(Item *i);
bool ListItemExists(Item *myItem, char *prompt, int32 listTag);
bool ListItemAdd(Item *myItem, char *prompt, int32 listTag, int32 addMode, ListItem *changedItem);
bool ListItemDelete(Item *myItem, ListItem *myListItem, int32 listTag);
bool ListItemChange(Item *myItem, ListItem *myListItem, int32 listTag,
	char *newPrompt, int32 newTag, int32 changeMode);
void ViewCurrListItem(Item *myItem);
ListItem *ListItemFind(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset);
bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType);
bool ResetDefaultListBox(Item *myItem);
bool Item_change_prompt(Item *myItem, const char *newPrompt);
void Item_ClearOrigPrompt(void);
Item *Item_RestoreTextField(void);
Item *Item_CheckTextField(void);
void Item_SaveTextField(Item *myItem);
void SetTextBlockBegin(Item *myItem, int32 relXPos);
void SetTextBlockEnd(Item *myItem, int32 relXPos);
bool Item_TextEdit(Item *myItem, int32 parm1);
bool GetNextListItem(Item *myItem);
bool GetNextPageList(Item *myItem);
bool GetPrevListItem(Item *myItem);
bool GetPrevPageList(Item *myItem);
bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType);
void Item_format(Item *i);
Item *Item_set_default(Item *itemList, Item *currDefault, int32 tag);
Item *Item_set_pressed(Item *itemList, Item *myItem, int32 tag);
Item *Item_set_unpressed(Item *itemList, Item *myItem, int32 tag);
Item *Item_set_cancel(Item *itemList, int32 tag);
Item *Item_set_next_default(Item *currDefault, Item *itemList);
Item *Item_set_prev_default(Item *currDefault, Item *listBottom);

} // End of namespace M4

#endif