ScummVM API documentation
gui_item.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef M4_GUI_GUI_ITEM_H
24#define M4_GUI_GUI_ITEM_H
25
26#include "m4/m4_types.h"
27#include "m4/graphics/gr_font.h"
28
29namespace M4 {
30
31#define ITEM_NORMAL 0x00000
32#define ITEM_PRESSED 0x00001
33
34#define ITEM_DEFAULT 0x00001
35#define ITEM_RETURN 0x00002
36
37#define SU_PRESSED 0x0100
38#define SD_PRESSED 0x0200
39#define PU_PRESSED 0x0400
40#define PD_PRESSED 0x0800
41#define THUMB_PRESSED 0x1000
42#define BOX_PRESSED 0x2000
43#define AREA_PRESSED 0x3f00
44
45#define NO_SCROLL 0x0000
46#define SCROLLABLE 0x0001
47#define PAGEABLE 0x0002
48
49#define FILL_INTERIOR 1 // a flag for use by DrawTile
50#define BORDER 0
51
52enum ItemType {
53 MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
54};
55
56enum {
57 LIST_BY_TAG = 0,
58 LIST_ALPH,
59 LIST_SEQUN
60};
61
62struct ListItem {
63 char prompt[80];
64 int32 tag;
65 struct ListItem *next;
66 struct ListItem *prev;
67};
68
69struct TextItem {
70 TextItem *next;
71 int32 justification;
72 int32 x;
73 int32 y;
74 int32 w;
75 int32 h;
76 int32 tag;
77 int32 type;
78 char *prompt;
79 M4CALLBACK callback;
80};
81
82struct Item {
83 Item *next;
84 Item *prev;
85 M4CALLBACK callback;
86 ItemType type;
87 int32 status;
88 Font *myFont;
89 char *prompt;
90 char *aux;
91 char *aux2;
92 int32 promptMax;
93 int32 myListCount;
94 int32 viewIndex;
95 int32 thumbY;
96 ListItem *myList;
97 ListItem *currItem;
98 ListItem *viewTop;
99 ListItem *viewBottom;
100 int32 listView;
101 int32 x, y, w, h;
102 int32 tag;
103};
104
106 char *origPrompt = nullptr;
107 char *undoPrompt = nullptr;
108 char *undoAux = nullptr;
109 char *undoAux2 = nullptr;
110 Item *currTextField = nullptr;
111
112 int32 buttonWidth = 0;
113 int32 buttonHeight = 0;
114
115 char clipBoard[100] = { 0 };
116};
117
118Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb);
119void Item_destroy(Item *myItem);
120Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *prompt, int32 tag,
121 ItemType type, M4CALLBACK cb, int32 promptMax);
122Item *ItemFind(Item *itemList, int32 tag);
123bool Item_SetViewBottom(Item *i);
124void ViewCurrListItem(Item *myItem);
125ListItem *ListItemFind(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
126bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
127bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset);
128bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType);
129bool ResetDefaultListBox(Item *myItem);
130bool Item_change_prompt(Item *myItem, const char *newPrompt);
131void Item_ClearOrigPrompt();
132Item *Item_RestoreTextField();
133Item *Item_CheckTextField();
134void Item_SaveTextField(Item *myItem);
135void SetTextBlockBegin(Item *myItem, int32 relXPos);
136void SetTextBlockEnd(Item *myItem, int32 relXPos);
137bool Item_TextEdit(Item *myItem, int32 parm1);
138bool GetNextListItem(Item *myItem);
139bool GetNextPageList(Item *myItem);
140bool GetPrevListItem(Item *myItem);
141bool GetPrevPageList(Item *myItem);
142bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType);
143void Item_format(Item *i);
144Item *Item_set_default(Item *itemList, Item *currDefault, int32 tag);
145Item *Item_set_pressed(Item *itemList, Item *myItem, int32 tag);
146Item *Item_set_unpressed(Item *itemList, Item *myItem, int32 tag);
147Item *Item_set_cancel(Item *itemList, int32 tag);
148Item *Item_set_next_default(Item *currDefault, Item *itemList);
149Item *Item_set_prev_default(Item *currDefault, Item *listBottom);
150
151} // End of namespace M4
152
153#endif
Definition: database.h:28
Definition: m4_types.h:54
Definition: gr_font.h:30
Definition: gui_item.h:105
Definition: gui_item.h:82
Definition: gui_item.h:62
Definition: gui_item.h:69