ScummVM API documentation
gui_dialog.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_DIALOG_H
24#define M4_GUI_GUI_DIALOG_H
25
26#include "m4/m4_types.h"
27#include "m4/graphics/gr_buff.h"
28#include "m4/gui/gui.h"
29#include "m4/gui/gui_item.h"
30#include "m4/gui/gui_univ.h"
31
32namespace M4 {
33
34enum {
35 TS_GIVEN = 0, TS_JUST_LEFT, TS_JUST_RIGHT, TS_CENTRE
36};
37
38struct Dialog {
39 int32 w, h;
40 int32 num_items;
41 Item *itemList;
42 Item *listBottom;
43 Item *cancel_item, *return_item, *default_item;
44 GrBuff *dlgBuffer;
45
46 // General support methods
47 void destroy();
48 void configure(int32 defaultTag, int32 returnTag, int32 cancelTag);
49 void show();
50
51 // Add methods
52 bool addMessage(int32 x, int32 y, const char *prompt, int32 tag);
53 bool addButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
54
55 // Item Fields
56 Item *getItem(int32 tag);
57
58 // Text Fields
59 bool addTextField(int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
60};
61
62struct TextScrn {
63 int32 w, h;
64 int32 textColor;
65 int32 textColor_alt1;
66 int32 textColor_alt2;
67 int32 hiliteColor;
68 int32 hiliteColor_alt1;
69 int32 hiliteColor_alt2;
70 int32 luminance;
71 Font *myFont;
72 TextItem *myTextItems;
73 TextItem *hiliteItem;
74 GrBuff *textScrnBuffer;
75};
76
78 bool okButton = false;
79 //event handler vars
80 bool movingScreen = false;
81 Item *clickItem = nullptr;
82 Item *doubleClickItem = nullptr;
83 char listboxSearchStr[80] = { 0 };
84};
85
86bool gui_dialog_init();
87void gui_dialog_shutdown();
88
89//GENERAL DIALOG SUPPORT
90Dialog *DialogCreateAbsolute(int32 x1, int32 y1, int32 x2, int32 y2, uint32 scrnFlags);
91void vmng_Dialog_Destroy(Dialog *d); //used only by viewmgr.cpp **DO NOT USE
92void DialogDestroy(Dialog *d, M4Rect *r = nullptr);
93void Dialog_Refresh(Dialog *d);
94void Dialog_Refresh_All();
95void Dialog_Configure(Dialog *d, int32 defaultTag, int32 returnTag, int32 cancelTag);
96void Dialog_SetDefault(Dialog *d, int32 tag);
97bool Dialog_SetPressed(Dialog *d, int32 tag);
98
99//MESSAGE TYPE SUPPORT
100bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 tag);
101
102//BUTTON TYPE SUPPORT
103bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
104
105//LIST TYPE SUPPORT
106void Dialog_GetPrevListItem(Dialog *d);
107void Dialog_GetNextListItem(Dialog *d);
108
109//TEXTFIELD TYPE SUPPORT
110bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
111
112//GENERAL ITEM SUPPORT
113Item *Dialog_Get_Item(Dialog *d, int32 tag);
114void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, int32 tag);
115void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag);
116void Dialog_KeyMouseCollision();
117
118bool sizeofGUIelement_border(int16 el_type, int32 *w, int32 *h);
119bool sizeofGUIelement_interior(ButtonDrawRec *bdr, M4Rect *myRect);
120bool drawGUIelement(ButtonDrawRec *bdr, M4Rect *myRect);
121
122//----------------------------------------------------------------------------------------
123//TEXTSCRN STUFF...
124TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminance, uint32 scrnFlags,
125 int32 textColor, int32 hiliteColor,
126 int32 textColor_alt1 = 0, int32 hiliteColor_alt1 = 0,
127 int32 textColor_alt2 = 0, int32 hiliteColor_alt2 = 0);
128void vmng_TextScrn_Destroy(TextScrn *myTextScrn);
129void TextScrn_Destroy(TextScrn *myTextScrn);
130void TextScrn_Activate(TextScrn *myTextScrn);
131bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
132 int32 justification, const char *prompt, M4CALLBACK callback);
133bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
134 int32 justification, const char *prompt);
135
136} // End of namespace M4
137
138#endif
Definition: gr_buff.h:30
Definition: database.h:28
Definition: gui_univ.h:58
Definition: gui_dialog.h:77
Definition: gui_dialog.h:38
Definition: gr_font.h:30
Definition: gui_item.h:82
Definition: gui.h:52
Definition: gui_item.h:69
Definition: gui_dialog.h:62