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 
29 namespace 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 
52 enum ItemType {
53  MESSAGE, PICTURE, BUTTON, LISTBOX, TEXTFIELD, REPEAT_BUTTON, DIALOGBOX
54 };
55 
56 enum {
57  LIST_BY_TAG = 0,
58  LIST_ALPH,
59  LIST_SEQUN
60 };
61 
62 struct ListItem {
63  char prompt[80];
64  int32 tag;
65  struct ListItem *next;
66  struct ListItem *prev;
67 };
68 
69 struct 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 
82 struct 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 
105 struct Item_Globals {
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 
118 bool InitItems(void);
119 Item *Item_create(Item *parent, enum ItemType type, int32 tag, M4CALLBACK cb);
120 void Item_destroy(Item *myItem);
121 void Item_empty_list(Item *myItem);
122 Item *ItemAdd(Item *itemList, int32 x, int32 y, int32 w, int32 h, const char *prompt, int32 tag,
123  ItemType type, M4CALLBACK cb, int32 promptMax);
124 Item *ItemFind(Item *itemList, int32 tag);
125 bool Item_SetViewBottom(Item *i);
126 bool ListItemExists(Item *myItem, char *prompt, int32 listTag);
127 bool ListItemAdd(Item *myItem, char *prompt, int32 listTag, int32 addMode, ListItem *changedItem);
128 bool ListItemDelete(Item *myItem, ListItem *myListItem, int32 listTag);
129 bool ListItemChange(Item *myItem, ListItem *myListItem, int32 listTag,
130  char *newPrompt, int32 newTag, int32 changeMode);
131 void ViewCurrListItem(Item *myItem);
132 ListItem *ListItemFind(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
133 bool ListItemSearch(Item *myItem, int32 searchMode, char *searchStr, int32 parm1);
134 bool DoubleClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset);
135 bool ClickOnListBox(Item *myItem, int32 xOffset, int32 yOffset, int32 scrollType);
136 bool ResetDefaultListBox(Item *myItem);
137 bool Item_change_prompt(Item *myItem, const char *newPrompt);
138 void Item_ClearOrigPrompt(void);
139 Item *Item_RestoreTextField(void);
140 Item *Item_CheckTextField(void);
141 void Item_SaveTextField(Item *myItem);
142 void SetTextBlockBegin(Item *myItem, int32 relXPos);
143 void SetTextBlockEnd(Item *myItem, int32 relXPos);
144 bool Item_TextEdit(Item *myItem, int32 parm1);
145 bool GetNextListItem(Item *myItem);
146 bool GetNextPageList(Item *myItem);
147 bool GetPrevListItem(Item *myItem);
148 bool GetPrevPageList(Item *myItem);
149 bool Item_show(Item *i, void *bdrDialog, Buffer *scrBuf, int32 itemType);
150 void Item_format(Item *i);
151 Item *Item_set_default(Item *itemList, Item *currDefault, int32 tag);
152 Item *Item_set_pressed(Item *itemList, Item *myItem, int32 tag);
153 Item *Item_set_unpressed(Item *itemList, Item *myItem, int32 tag);
154 Item *Item_set_cancel(Item *itemList, int32 tag);
155 Item *Item_set_next_default(Item *currDefault, Item *itemList);
156 Item *Item_set_prev_default(Item *currDefault, Item *listBottom);
157 
158 } // End of namespace M4
159 
160 #endif
Definition: gr_font.h:30
Definition: gui_item.h:62
Definition: gui_item.h:69
Definition: gui_item.h:82
Definition: m4_types.h:67
Definition: database.h:28
Definition: gui_item.h:105