Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
guiFormSpecMenu.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include <optional>
8#include <utility>
9#include <stack>
10#include <unordered_set>
11
13#include "irr_ptr.h"
14#include "inventory.h"
15#include "inventorymanager.h"
16#include "modalMenu.h"
17#include "guiInventoryList.h"
18#include "guiScrollBar.h"
19#include "guiTable.h"
20#include "util/string.h"
22#include "StyleSpec.h"
23#include <ICursorControl.h> // gui::ECURSOR_ICON
24#include <IGUIStaticText.h>
25
28class Client;
30class ISoundManager;
32
46
52
65
67{
68 virtual ~TextDest() = default;
69
70 // This is deprecated I guess? -celeron55
71 virtual void gotText(const std::wstring &text) {}
72 virtual void gotText(const StringMap &fields) = 0;
73
74 std::string m_formname;
75};
76
78{
79public:
80 virtual ~IFormSource() = default;
81 virtual const std::string &getForm() const = 0;
82 // Fill in variables in field text
83 virtual std::string resolveText(const std::string &str) { return str; }
84};
85
87{
89 {
90 ListRingSpec() = default;
91
92 ListRingSpec(const InventoryLocation &a_inventoryloc,
93 const std::string &a_listname):
94 inventoryloc(a_inventoryloc),
95 listname(a_listname)
96 {
97 }
98
100 std::string listname;
101 };
102
104 {
105 FieldSpec() = default;
106
107 FieldSpec(const std::string &name, const std::wstring &label,
108 const std::wstring &default_text, s32 id, int priority = 0,
109 gui::ECURSOR_ICON cursor_icon = ECI_NORMAL) :
110 fname(name),
111 flabel(label),
113 fid(id),
114 send(false),
116 is_exit(false),
118 fcursor_icon(cursor_icon)
119 {
120 }
121
122 std::string fname;
123 std::wstring flabel;
124 std::wstring fdefault;
125 std::string url;
126 s32 fid;
127 bool send;
130 // Draw priority for formspec version < 3
132 core::rect<s32> rect;
133 gui::ECURSOR_ICON fcursor_icon;
134 std::string sound;
135 };
136
138 {
139 TooltipSpec() = default;
140 TooltipSpec(const std::wstring &a_tooltip, irr::video::SColor a_bgcolor,
141 irr::video::SColor a_color):
142 tooltip(translate_string(a_tooltip)),
143 bgcolor(a_bgcolor),
144 color(a_color)
145 {
146 }
147
148 std::wstring tooltip;
149 irr::video::SColor bgcolor;
150 irr::video::SColor color;
151 };
152
153public:
155 gui::IGUIElement* parent, s32 id,
156 IMenuManager *menumgr,
157 Client *client,
158 gui::IGUIEnvironment *guienv,
160 ISoundManager *sound_manager,
161 IFormSource* fs_src,
162 TextDest* txt_dst,
163 const std::string &formspecPrepend,
164 bool remap_dbl_click = true);
165
167
168 static void create(GUIFormSpecMenu *&cur_formspec, Client *client,
169 gui::IGUIEnvironment *guienv, JoystickController *joystick, IFormSource *fs_src,
170 TextDest *txt_dest, const std::string &formspecPrepend,
171 ISoundManager *sound_manager);
172
173 void setFormSpec(const std::string &formspec_string,
174 const InventoryLocation &current_inventory_location)
175 {
176 m_formspec_string = formspec_string;
177 m_current_inventory_location = current_inventory_location;
178 m_is_form_regenerated = false;
180 }
181
186
187 void setFormspecPrepend(const std::string &formspecPrepend)
188 {
189 m_formspec_prepend = formspecPrepend;
190 }
191
192 // form_src is deleted by this GUIFormSpecMenu
194 {
195 delete m_form_src;
196 m_form_src = form_src;
197 }
198
199 // text_dst is deleted by this GUIFormSpecMenu
200 void setTextDest(TextDest *text_dst)
201 {
202 delete m_text_dst;
203 m_text_dst = text_dst;
204 }
205
206 void allowClose(bool value)
207 {
208 m_allowclose = value;
209 }
210
211 void setDebugView(bool value)
212 {
213 m_show_debug = value;
214 }
215
216 void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0))
217 {
218 m_lock = lock;
219 m_lockscreensize = basescreensize;
220 }
221
222 void removeTooltip();
223 void setInitialFocus();
224
225 void setFocus(const std::string &elementname)
226 {
227 m_focused_element = elementname;
228 }
229
231 {
232 return m_client;
233 }
234
236 {
237 return m_selected_item;
238 }
239
241 {
242 return m_selected_amount;
243 }
244
246 {
248 }
249
250 void addHoveredItemTooltip(const std::string &name)
251 {
252 m_hovered_item_tooltips.emplace_back(name);
253 }
254
255 /*
256 Remove and re-add (or reposition) stuff
257 */
258 void regenerateGui(v2u32 screensize);
259
261 void drawSelectedItem();
262 void drawMenu();
263 void updateSelectedItem();
265
266 s16 getNextInventoryRing(const InventoryLocation &inventoryloc, const std::string &listname);
267
269 bool preprocessEvent(const SEvent& event);
270 bool OnEvent(const SEvent& event);
272 bool pausesGame() { return doPause; }
273
274 GUITable* getTable(const std::string &tablename);
275 std::vector<std::string>* getDropDownValues(const std::string &name);
276
277 // This will only return a meaningful value if called after drawMenu().
278 core::rect<s32> getAbsoluteRect();
279
280#ifdef __ANDROID__
281 void getAndroidUIInput();
282#endif
283
284 // Returns the fixed formspec coordinate size for the given parameters.
285 static double getFixedImgsize(double screen_dpi, double gui_scaling);
286 // Returns the preferred non-fixed formspec coordinate size for the given parameters.
287 static double getImgsize(v2u32 avail_screensize, double screen_dpi, double gui_scaling);
288
289protected:
291 {
292 return padding + offset + AbsoluteRect.UpperLeftCorner;
293 }
294 std::wstring getLabelByID(s32 id);
295 std::string getNameByID(s32 id);
296 const FieldSpec *getSpecByID(s32 id);
297 v2s32 getElementBasePos(const std::vector<std::string> *v_pos);
298 v2s32 getRealCoordinateBasePos(const std::vector<std::string> &v_pos);
299 v2s32 getRealCoordinateGeometry(const std::vector<std::string> &v_geom);
300 bool precheckElement(const std::string &name, const std::string &element,
301 size_t args_min, size_t args_max, std::vector<std::string> &parts);
302
303 std::unordered_map<std::string, std::vector<StyleSpec>> theme_by_type;
304 std::unordered_map<std::string, std::vector<StyleSpec>> theme_by_name;
305 std::unordered_set<std::string> property_warned;
306
307 StyleSpec getDefaultStyleForElement(const std::string &type,
308 const std::string &name="", const std::string &parent_type="");
309 std::array<StyleSpec, StyleSpec::NUM_STATES> getStyleForElement(const std::string &type,
310 const std::string &name="", const std::string &parent_type="");
311
317 std::stack<v2f32> container_stack;
318
323
324 std::string m_formspec_string;
327
328 // Default true because we can't control regeneration on resizing, but
329 // we can control cases when the formspec is shown intentionally.
331
332 std::vector<GUIInventoryList *> m_inventorylists;
333 std::vector<ListRingSpec> m_inventory_rings;
334 std::unordered_map<std::string, bool> field_enter_after_edit;
335 std::unordered_map<std::string, bool> field_close_on_enter;
336 std::unordered_map<std::string, bool> m_dropdown_index_event;
337 std::vector<FieldSpec> m_fields;
338 std::vector<std::pair<FieldSpec, GUITable *>> m_tables;
339 std::vector<std::pair<FieldSpec, gui::IGUICheckBox *>> m_checkboxes;
340 std::map<std::string, TooltipSpec> m_tooltips;
341 std::vector<std::pair<gui::IGUIElement *, TooltipSpec>> m_tooltip_rects;
342 std::vector<std::pair<FieldSpec, GUIScrollBar *>> m_scrollbars;
343 std::vector<std::pair<FieldSpec, std::vector<std::string>>> m_dropdowns;
344 std::vector<gui::IGUIElement *> m_clickthrough_elements;
345 std::vector<std::pair<std::string, GUIScrollContainer *>> m_scroll_containers;
346
353
356 std::vector<std::pair<GUIInventoryList::ItemSpec, ItemStack>> m_left_drag_stacks;
357 bool m_left_dragging = false;
358
359 gui::IGUIStaticText *m_tooltip_element = nullptr;
360
365
366 bool m_allowclose = true;
367 bool m_lock = false;
369
372 video::SColor m_bgcolor;
373 video::SColor m_fullscreen_bgcolor;
376
377private:
380 std::string m_last_formname;
382 std::optional<std::string> m_focused_element = std::nullopt;
384 bool m_show_debug = false;
385
386 struct parserData {
395 core::rect<s32> rect;
400 gui::IGUIElement *current_parent = nullptr;
401 irr_ptr<gui::IGUIElement> background_parent;
402
404
405 struct {
406 s32 max = 1000;
407 s32 min = 0;
408 s32 small_step = 10;
409 s32 large_step = 100;
410 s32 thumb_size = 1;
413
414 // used to restore table selection/scroll/treeview state
415 std::unordered_map<std::string, GUITable::DynamicData> table_dyndata;
416 std::string type;
417 };
418
419 static const std::unordered_map<std::string, std::function<void(GUIFormSpecMenu*, GUIFormSpecMenu::parserData *data, const std::string &description)>> element_parsers;
420
422 bool key_up;
426 };
427
430 std::vector<std::string> m_hovered_item_tooltips;
431
432 void removeAll();
433
434 void parseElement(parserData* data, const std::string &element);
435
436 void parseSize(parserData* data, const std::string &element);
437 void parseContainer(parserData* data, const std::string &element);
438 void parseContainerEnd(parserData* data, const std::string &element);
439 void parseScrollContainer(parserData *data, const std::string &element);
440 void parseScrollContainerEnd(parserData *data, const std::string &element);
441 void parseList(parserData* data, const std::string &element);
442 void parseListRing(parserData* data, const std::string &element);
443 void parseCheckbox(parserData* data, const std::string &element);
444 void parseImage(parserData* data, const std::string &element);
445 void parseAnimatedImage(parserData *data, const std::string &element);
446 void parseItemImage(parserData* data, const std::string &element);
447 void parseButton(parserData* data, const std::string &element);
448 void parseBackground(parserData* data, const std::string &element);
449 void parseTableOptions(parserData* data, const std::string &element);
450 void parseTableColumns(parserData* data, const std::string &element);
451 void parseTable(parserData* data, const std::string &element);
452 void parseTextList(parserData* data, const std::string &element);
453 void parseDropDown(parserData* data, const std::string &element);
454 void parseFieldEnterAfterEdit(parserData *data, const std::string &element);
455 void parseFieldCloseOnEnter(parserData *data, const std::string &element);
456 void parsePwdField(parserData* data, const std::string &element);
457 void parseField(parserData* data, const std::string &element);
458 void createTextField(parserData *data, FieldSpec &spec,
459 core::rect<s32> &rect, bool is_multiline);
460 void parseSimpleField(parserData* data,std::vector<std::string> &parts);
461 void parseTextArea(parserData* data,std::vector<std::string>& parts,
462 const std::string &type);
463 void parseHyperText(parserData *data, const std::string &element);
464 void parseLabel(parserData* data, const std::string &element);
465 void parseVertLabel(parserData* data, const std::string &element);
466 void parseImageButton(parserData* data, const std::string &element);
467 void parseItemImageButton(parserData* data, const std::string &element);
468 void parseTabHeader(parserData* data, const std::string &element);
469 void parseBox(parserData* data, const std::string &element);
470 void parseBackgroundColor(parserData* data, const std::string &element);
471 void parseListColors(parserData* data, const std::string &element);
472 void parseTooltip(parserData* data, const std::string &element);
473 bool parseVersionDirect(const std::string &data);
474 bool parseSizeDirect(parserData* data, const std::string &element);
475 void parseRealCoordinates(parserData* data, const std::string &element);
476 void parseScrollBar(parserData* data, const std::string &element);
477 void parseScrollBarOptions(parserData *data, const std::string &element);
478 bool parsePositionDirect(parserData *data, const std::string &element);
479 void parsePosition(parserData *data, const std::string &element);
480 bool parseAnchorDirect(parserData *data, const std::string &element);
481 void parseAnchor(parserData *data, const std::string &element);
482 bool parsePaddingDirect(parserData *data, const std::string &element);
483 void parsePadding(parserData *data, const std::string &element);
484 void parseStyle(parserData *data, const std::string &element);
485 void parseSetFocus(parserData *, const std::string &element);
486 void parseModel(parserData *data, const std::string &element);
487
488 bool parseMiddleRect(const std::string &value, core::rect<s32> *parsed_rect);
489
490 void tryClose();
491
492 void showTooltip(const std::wstring &text, const irr::video::SColor &color,
493 const irr::video::SColor &bgcolor);
494
500 void legacySortElements(std::list<IGUIElement *>::iterator from);
501
503 gui::IGUIFont *m_font = nullptr;
504
505 // used by getAbsoluteRect
507
508 // Determines the size (in pixels) of formspec coordinate units.
509 double calculateImgsize(const parserData &data);
510};
511
513{
514public:
515 FormspecFormSource(const std::string &formspec):
516 m_formspec(formspec)
517 {
518 }
519
521
522 void setForm(const std::string &formspec)
523 {
524 m_formspec = formspec;
525 }
526
527 const std::string &getForm() const
528 {
529 return m_formspec;
530 }
531
532 std::string m_formspec;
533};
Definition client.h:105
Definition guiFormSpecMenu.h:513
const std::string & getForm() const
Definition guiFormSpecMenu.h:527
FormspecFormSource(const std::string &formspec)
Definition guiFormSpecMenu.h:515
void setForm(const std::string &formspec)
Definition guiFormSpecMenu.h:522
~FormspecFormSource()=default
std::string m_formspec
Definition guiFormSpecMenu.h:532
Definition guiFormSpecMenu.h:87
std::unordered_set< std::string > property_warned
Definition guiFormSpecMenu.h:305
int m_btn_height
Definition guiFormSpecMenu.h:502
ItemStack m_selected_swap
Definition guiFormSpecMenu.h:350
std::string current_field_enter_pending
Definition guiFormSpecMenu.h:429
fs_key_pending current_keys_pending
Definition guiFormSpecMenu.h:428
void legacySortElements(std::list< IGUIElement * >::iterator from)
In formspec version < 2 the elements were not ordered properly.
Definition guiFormSpecMenu.cpp:3292
ItemStack verifySelectedItem()
Definition guiFormSpecMenu.cpp:3709
void parseHyperText(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1705
void parseTableColumns(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1159
void tryClose()
Definition guiFormSpecMenu.cpp:3991
void parseImage(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:768
void parseDropDown(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1327
std::array< StyleSpec, StyleSpec::NUM_STATES > getStyleForElement(const std::string &type, const std::string &name="", const std::string &parent_type="")
Definition guiFormSpecMenu.cpp:4976
std::string m_formspec_string
Definition guiFormSpecMenu.h:324
Client * m_client
Definition guiFormSpecMenu.h:322
ISimpleTextureSource * m_tsrc
Definition guiFormSpecMenu.h:320
s16 getNextInventoryRing(const InventoryLocation &inventoryloc, const std::string &listname)
Definition guiFormSpecMenu.cpp:3746
bool doTooltipAppendItemname() const
Definition guiFormSpecMenu.h:245
void parseSize(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:289
double calculateImgsize(const parserData &data)
Definition guiFormSpecMenu.cpp:5040
ButtonEventType m_held_mouse_button
Definition guiFormSpecMenu.h:351
core::rect< s32 > getAbsoluteRect()
Definition guiFormSpecMenu.cpp:250
u16 m_left_drag_amount
Definition guiFormSpecMenu.h:354
v2u32 m_lockscreensize
Definition guiFormSpecMenu.h:368
void drawSelectedItem()
Definition guiFormSpecMenu.cpp:3397
bool preprocessEvent(const SEvent &event)
Definition guiFormSpecMenu.cpp:3903
void regenerateGui(v2u32 screensize)
Definition guiFormSpecMenu.cpp:2937
void parseScrollBar(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:642
void setTextDest(TextDest *text_dst)
Definition guiFormSpecMenu.h:200
StyleSpec getDefaultStyleForElement(const std::string &type, const std::string &name="", const std::string &parent_type="")
Definition guiFormSpecMenu.cpp:4971
std::string m_formspec_prepend
Definition guiFormSpecMenu.h:325
void parseModel(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2740
video::SColor m_default_tooltip_bgcolor
Definition guiFormSpecMenu.h:374
void parseList(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:439
bool m_selected_dragging
Definition guiFormSpecMenu.h:349
void parseContainer(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:315
void parseSetFocus(parserData *, const std::string &element)
Definition guiFormSpecMenu.cpp:2726
std::unordered_map< std::string, bool > m_dropdown_index_event
Definition guiFormSpecMenu.h:336
void createTextField(parserData *data, FieldSpec &spec, core::rect< s32 > &rect, bool is_multiline)
Definition guiFormSpecMenu.cpp:1509
~GUIFormSpecMenu()
Definition guiFormSpecMenu.cpp:114
TextDest * m_text_dst
Definition guiFormSpecMenu.h:379
bool m_bgnonfullscreen
Definition guiFormSpecMenu.h:370
std::vector< std::pair< FieldSpec, gui::IGUICheckBox * > > m_checkboxes
Definition guiFormSpecMenu.h:339
void parseRealCoordinates(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:637
v2s32 getBasePos() const
Definition guiFormSpecMenu.h:290
void acceptInput(FormspecQuitMode quitmode=quit_mode_no)
Definition guiFormSpecMenu.cpp:3765
video::SColor m_fullscreen_bgcolor
Definition guiFormSpecMenu.h:373
void parseTextList(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1251
void parseStyle(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2583
static void create(GUIFormSpecMenu *&cur_formspec, Client *client, gui::IGUIEnvironment *guienv, JoystickController *joystick, IFormSource *fs_src, TextDest *txt_dest, const std::string &formspecPrepend, ISoundManager *sound_manager)
Definition guiFormSpecMenu.cpp:123
bool parsePositionDirect(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2464
JoystickController * m_joystick
Definition guiFormSpecMenu.h:383
gui::IGUIFont * m_font
Definition guiFormSpecMenu.h:503
void parseBackground(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1072
u64 m_hovered_time
Definition guiFormSpecMenu.h:363
void parseFieldEnterAfterEdit(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1408
std::wstring getLabelByID(s32 id)
get label of element by id
Definition guiFormSpecMenu.cpp:4962
void parseTableOptions(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1147
std::unordered_map< std::string, bool > field_close_on_enter
Definition guiFormSpecMenu.h:335
ItemStack m_left_drag_stack
Definition guiFormSpecMenu.h:355
std::vector< std::pair< FieldSpec, GUIScrollBar * > > m_scrollbars
Definition guiFormSpecMenu.h:342
void parseTextArea(parserData *data, std::vector< std::string > &parts, const std::string &type)
Definition guiFormSpecMenu.cpp:1625
void parseFieldCloseOnEnter(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1417
void setFormSource(IFormSource *form_src)
Definition guiFormSpecMenu.h:193
std::vector< FieldSpec > m_fields
Definition guiFormSpecMenu.h:337
bool OnEvent(const SEvent &event)
Definition guiFormSpecMenu.cpp:4002
bool parseAnchorDirect(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2503
std::unordered_map< std::string, std::vector< StyleSpec > > theme_by_type
Definition guiFormSpecMenu.h:303
void parseLabel(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1758
bool m_show_debug
Definition guiFormSpecMenu.h:384
void parseItemImage(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:926
ISoundManager * m_sound_manager
Definition guiFormSpecMenu.h:321
bool pausesGame()
Definition guiFormSpecMenu.h:272
static const std::unordered_map< std::string, std::function< void(GUIFormSpecMenu *, GUIFormSpecMenu::parserData *data, const std::string &description)> > element_parsers
Definition guiFormSpecMenu.h:2858
gui::IGUIStaticText * m_tooltip_element
Definition guiFormSpecMenu.h:359
void parseBackgroundColor(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2264
void parseTooltip(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2343
std::string getNameByID(s32 id)
get name of element by element id
Definition guiFormSpecMenu.cpp:4938
void parseScrollBarOptions(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:715
void parsePadding(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2564
bool m_shift_move_after_craft
Definition guiFormSpecMenu.h:352
v2f32 pos_offset
Definition guiFormSpecMenu.h:316
void parsePosition(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2485
GUITable * getTable(const std::string &tablename)
Definition guiFormSpecMenu.cpp:231
void setDebugView(bool value)
Definition guiFormSpecMenu.h:211
std::vector< GUIInventoryList * > m_inventorylists
Definition guiFormSpecMenu.h:332
GUIInventoryList::ItemSpec getItemAtPos(v2s32 p) const
Definition guiFormSpecMenu.cpp:3385
GUIFormSpecMenu(JoystickController *joystick, gui::IGUIElement *parent, s32 id, IMenuManager *menumgr, Client *client, gui::IGUIEnvironment *guienv, ISimpleTextureSource *tsrc, ISoundManager *sound_manager, IFormSource *fs_src, TextDest *txt_dst, const std::string &formspecPrepend, bool remap_dbl_click=true)
Definition guiFormSpecMenu.cpp:90
bool m_bgfullscreen
Definition guiFormSpecMenu.h:371
void parsePwdField(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1426
void updateSelectedItem()
Definition guiFormSpecMenu.cpp:3630
v2s32 getRealCoordinateBasePos(const std::vector< std::string > &v_pos)
Definition guiFormSpecMenu.cpp:267
void lockSize(bool lock, v2u32 basescreensize=v2u32(0, 0))
Definition guiFormSpecMenu.h:216
void parseAnimatedImage(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:860
v2s32 imgsize
Definition guiFormSpecMenu.h:314
std::vector< std::pair< gui::IGUIElement *, TooltipSpec > > m_tooltip_rects
Definition guiFormSpecMenu.h:341
const InventoryLocation & getFormspecLocation()
Definition guiFormSpecMenu.h:182
u64 m_tooltip_show_delay
Definition guiFormSpecMenu.h:361
bool doPause
Definition guiFormSpecMenu.h:271
InventoryLocation m_current_inventory_location
Definition guiFormSpecMenu.h:326
bool m_tooltip_append_itemname
Definition guiFormSpecMenu.h:362
void parseTabHeader(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2015
bool m_is_form_regenerated
Definition guiFormSpecMenu.h:330
void removeAll()
Definition guiFormSpecMenu.cpp:2835
void setInitialFocus()
Definition guiFormSpecMenu.cpp:170
void setFocus(const std::string &elementname)
Definition guiFormSpecMenu.h:225
void parseVertLabel(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1847
void removeTooltip()
Definition guiFormSpecMenu.cpp:161
std::vector< std::pair< std::string, GUIScrollContainer * > > m_scroll_containers
Definition guiFormSpecMenu.h:345
bool parsePaddingDirect(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2543
std::optional< std::string > m_focused_element
Definition guiFormSpecMenu.h:382
InventoryManager * m_invmgr
Definition guiFormSpecMenu.h:319
void parseScrollContainer(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:341
static double getFixedImgsize(double screen_dpi, double gui_scaling)
Definition guiFormSpecMenu.cpp:5016
s32 m_tabheader_upper_edge
Definition guiFormSpecMenu.h:506
bool parseMiddleRect(const std::string &value, core::rect< s32 > *parsed_rect)
Definition guiFormSpecMenu.cpp:1043
std::vector< std::string > * getDropDownValues(const std::string &name)
Definition guiFormSpecMenu.cpp:240
void parseTable(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1179
bool m_left_dragging
Definition guiFormSpecMenu.h:357
s32 m_old_tooltip_id
Definition guiFormSpecMenu.h:364
std::vector< std::pair< FieldSpec, GUITable * > > m_tables
Definition guiFormSpecMenu.h:338
v2f32 spacing
Definition guiFormSpecMenu.h:313
const GUIInventoryList::ItemSpec * getSelectedItem() const
Definition guiFormSpecMenu.h:235
void parseAnchor(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2524
v2s32 getRealCoordinateGeometry(const std::vector< std::string > &v_geom)
Definition guiFormSpecMenu.cpp:273
static double getImgsize(v2u32 avail_screensize, double screen_dpi, double gui_scaling)
Definition guiFormSpecMenu.cpp:5028
v2s32 padding
Definition guiFormSpecMenu.h:312
void parseItemImageButton(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2130
void parseElement(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2906
std::vector< ListRingSpec > m_inventory_rings
Definition guiFormSpecMenu.h:333
bool parseSizeDirect(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2440
bool parseVersionDirect(const std::string &data)
Definition guiFormSpecMenu.cpp:2416
v2s32 offset
Definition guiFormSpecMenu.h:315
void setFormSpec(const std::string &formspec_string, const InventoryLocation &current_inventory_location)
Definition guiFormSpecMenu.h:173
bool m_lock
Definition guiFormSpecMenu.h:367
void parseListRing(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:527
void allowClose(bool value)
Definition guiFormSpecMenu.h:206
void parseField(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1690
GUIInventoryList::ItemSpec * m_selected_item
Definition guiFormSpecMenu.h:347
void parseContainerEnd(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:331
std::vector< std::pair< GUIInventoryList::ItemSpec, ItemStack > > m_left_drag_stacks
Definition guiFormSpecMenu.h:356
void parseSimpleField(parserData *data, std::vector< std::string > &parts)
Definition guiFormSpecMenu.cpp:1581
void addHoveredItemTooltip(const std::string &name)
Definition guiFormSpecMenu.h:250
bool precheckElement(const std::string &name, const std::string &element, size_t args_min, size_t args_max, std::vector< std::string > &parts)
Definition guiFormSpecMenu.cpp:278
std::map< std::string, TooltipSpec > m_tooltips
Definition guiFormSpecMenu.h:340
std::vector< gui::IGUIElement * > m_clickthrough_elements
Definition guiFormSpecMenu.h:344
video::SColor m_bgcolor
Definition guiFormSpecMenu.h:372
v2s32 getElementBasePos(const std::vector< std::string > *v_pos)
Definition guiFormSpecMenu.cpp:257
void parseListColors(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2301
bool m_allowclose
Definition guiFormSpecMenu.h:366
u16 m_selected_amount
Definition guiFormSpecMenu.h:348
void parseScrollContainerEnd(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:415
u16 m_formspec_version
Definition guiFormSpecMenu.h:381
IFormSource * m_form_src
Definition guiFormSpecMenu.h:378
void parseButton(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:974
const FieldSpec * getSpecByID(s32 id)
Definition guiFormSpecMenu.cpp:4948
void parseCheckbox(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:562
u16 getSelectedAmount() const
Definition guiFormSpecMenu.h:240
std::unordered_map< std::string, bool > field_enter_after_edit
Definition guiFormSpecMenu.h:334
std::string m_last_formname
Definition guiFormSpecMenu.h:380
void setFormspecPrepend(const std::string &formspecPrepend)
Definition guiFormSpecMenu.h:187
std::vector< std::string > m_hovered_item_tooltips
Definition guiFormSpecMenu.h:430
video::SColor m_default_tooltip_color
Definition guiFormSpecMenu.h:375
Client * getClient() const
Definition guiFormSpecMenu.h:230
std::stack< v2f32 > container_stack
Definition guiFormSpecMenu.h:317
void parseImageButton(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:1925
std::unordered_map< std::string, std::vector< StyleSpec > > theme_by_name
Definition guiFormSpecMenu.h:304
void showTooltip(const std::wstring &text, const irr::video::SColor &color, const irr::video::SColor &bgcolor)
Definition guiFormSpecMenu.cpp:3585
std::vector< std::pair< FieldSpec, std::vector< std::string > > > m_dropdowns
Definition guiFormSpecMenu.h:343
void drawMenu()
Definition guiFormSpecMenu.cpp:3423
void parseBox(parserData *data, const std::string &element)
Definition guiFormSpecMenu.cpp:2205
Definition modalMenu.h:36
v2u32 m_screensize_old
Definition modalMenu.h:67
ArrowVisibility
Definition guiScrollBar.h:31
@ DEFAULT
Definition guiScrollBar.h:34
Definition guiScrollContainer.h:12
Definition guiTable.h:31
std::vector< Option > TableOptions
Definition guiTable.h:63
std::vector< TableColumn > TableColumns
Definition guiTable.h:73
Definition guiFormSpecMenu.h:78
virtual std::string resolveText(const std::string &str)
Definition guiFormSpecMenu.h:83
virtual const std::string & getForm() const =0
virtual ~IFormSource()=default
Definition modalMenu.h:25
Definition texturesource.h:25
Definition sound.h:46
Definition inventorymanager.h:96
Definition joystick_controller.h:87
Definition StyleSpec.h:18
gui::IGUIEnvironment * guienv
Definition clientlauncher.cpp:34
FormspecFieldType
Definition guiFormSpecMenu.h:33
@ f_Box
Definition guiFormSpecMenu.h:40
@ f_CheckBox
Definition guiFormSpecMenu.h:37
@ f_Table
Definition guiFormSpecMenu.h:35
@ f_ScrollBar
Definition guiFormSpecMenu.h:39
@ f_ItemImage
Definition guiFormSpecMenu.h:41
@ f_Unknown
Definition guiFormSpecMenu.h:44
@ f_DropDown
Definition guiFormSpecMenu.h:38
@ f_TabHeader
Definition guiFormSpecMenu.h:36
@ f_AnimatedImage
Definition guiFormSpecMenu.h:43
@ f_Button
Definition guiFormSpecMenu.h:34
@ f_HyperText
Definition guiFormSpecMenu.h:42
FormspecQuitMode
Definition guiFormSpecMenu.h:47
@ quit_mode_cancel
Definition guiFormSpecMenu.h:50
@ quit_mode_accept
Definition guiFormSpecMenu.h:49
@ quit_mode_no
Definition guiFormSpecMenu.h:48
ButtonEventType
Definition guiFormSpecMenu.h:54
@ BET_RIGHT
Definition guiFormSpecMenu.h:56
@ BET_DOWN
Definition guiFormSpecMenu.h:61
@ BET_MIDDLE
Definition guiFormSpecMenu.h:57
@ BET_WHEEL_UP
Definition guiFormSpecMenu.h:58
@ BET_OTHER
Definition guiFormSpecMenu.h:63
@ BET_UP
Definition guiFormSpecMenu.h:60
@ BET_LEFT
Definition guiFormSpecMenu.h:55
@ BET_WHEEL_DOWN
Definition guiFormSpecMenu.h:59
@ BET_MOVE
Definition guiFormSpecMenu.h:62
core::vector2d< f32 > v2f32
Definition irr_v2d.h:15
core::vector2d< s32 > v2s32
Definition irr_v2d.h:13
core::vector2d< f32 > v2f
Definition irr_v2d.h:11
core::vector2d< u32 > v2u32
Definition irr_v2d.h:14
Definition activeobjectmgr.cpp:11
static void translate_string(std::wstring_view s, Translations *translations, const std::wstring &textdomain, size_t &i, std::wstring &res, bool use_plural, unsigned long int number)
Definition string.cpp:700
std::unordered_map< std::string, std::string > StringMap
Definition string.h:65
std::basic_string< T > unescape_enriched(const std::basic_string< T > &s)
Remove all escape sequences in s.
Definition string.h:581
Definition guiFormSpecMenu.h:104
bool send
Definition guiFormSpecMenu.h:127
FieldSpec(const std::string &name, const std::wstring &label, const std::wstring &default_text, s32 id, int priority=0, gui::ECURSOR_ICON cursor_icon=ECI_NORMAL)
Definition guiFormSpecMenu.h:107
FormspecFieldType ftype
Definition guiFormSpecMenu.h:128
bool is_exit
Definition guiFormSpecMenu.h:129
std::string sound
Definition guiFormSpecMenu.h:134
std::string url
Definition guiFormSpecMenu.h:125
std::wstring fdefault
Definition guiFormSpecMenu.h:124
std::string fname
Definition guiFormSpecMenu.h:122
s32 fid
Definition guiFormSpecMenu.h:126
core::rect< s32 > rect
Definition guiFormSpecMenu.h:132
std::wstring flabel
Definition guiFormSpecMenu.h:123
gui::ECURSOR_ICON fcursor_icon
Definition guiFormSpecMenu.h:133
int priority
Definition guiFormSpecMenu.h:131
Definition guiFormSpecMenu.h:89
ListRingSpec(const InventoryLocation &a_inventoryloc, const std::string &a_listname)
Definition guiFormSpecMenu.h:92
InventoryLocation inventoryloc
Definition guiFormSpecMenu.h:99
std::string listname
Definition guiFormSpecMenu.h:100
Definition guiFormSpecMenu.h:138
std::wstring tooltip
Definition guiFormSpecMenu.h:148
irr::video::SColor bgcolor
Definition guiFormSpecMenu.h:149
TooltipSpec(const std::wstring &a_tooltip, irr::video::SColor a_bgcolor, irr::video::SColor a_color)
Definition guiFormSpecMenu.h:140
irr::video::SColor color
Definition guiFormSpecMenu.h:150
Definition guiFormSpecMenu.h:421
bool key_escape
Definition guiFormSpecMenu.h:425
bool key_down
Definition guiFormSpecMenu.h:423
bool key_up
Definition guiFormSpecMenu.h:422
bool key_enter
Definition guiFormSpecMenu.h:424
Definition guiFormSpecMenu.h:386
v2f invsize
Definition guiFormSpecMenu.h:390
GUITable::TableColumns table_columns
Definition guiFormSpecMenu.h:399
gui::IGUIElement * current_parent
Definition guiFormSpecMenu.h:400
v2s32 basepos
Definition guiFormSpecMenu.h:396
v2u32 screensize
Definition guiFormSpecMenu.h:397
v2f32 anchor
Definition guiFormSpecMenu.h:393
GUITable::TableOptions table_options
Definition guiFormSpecMenu.h:398
bool real_coordinates
Definition guiFormSpecMenu.h:388
s32 thumb_size
Definition guiFormSpecMenu.h:410
s32 max
Definition guiFormSpecMenu.h:406
v2s32 size
Definition guiFormSpecMenu.h:391
std::string type
Definition guiFormSpecMenu.h:416
v2f32 offset
Definition guiFormSpecMenu.h:392
GUIScrollBar::ArrowVisibility arrow_visiblity
Definition guiFormSpecMenu.h:411
bool explicit_size
Definition guiFormSpecMenu.h:387
s32 small_step
Definition guiFormSpecMenu.h:408
s32 min
Definition guiFormSpecMenu.h:407
struct GUIFormSpecMenu::parserData::@17 scrollbar_options
v2f32 padding
Definition guiFormSpecMenu.h:394
u8 simple_field_count
Definition guiFormSpecMenu.h:389
GUIInventoryList::Options inventorylist_options
Definition guiFormSpecMenu.h:403
core::rect< s32 > rect
Definition guiFormSpecMenu.h:395
irr_ptr< gui::IGUIElement > background_parent
Definition guiFormSpecMenu.h:401
std::unordered_map< std::string, GUITable::DynamicData > table_dyndata
Definition guiFormSpecMenu.h:415
s32 large_step
Definition guiFormSpecMenu.h:409
Definition guiInventoryList.h:17
Definition guiInventoryList.h:46
Definition inventorymanager.h:18
Definition inventory.h:19
Definition guiFormSpecMenu.h:67
virtual void gotText(const std::wstring &text)
Definition guiFormSpecMenu.h:71
virtual void gotText(const StringMap &fields)=0
virtual ~TextDest()=default
std::string m_formname
Definition guiFormSpecMenu.h:74
static std::string p(std::string path)
Definition test_filesys.cpp:53