mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Allow FormSpec elements to be focused with set_focus
(#9353)
This allows you to specify a FormSpec element to set the focus of with "set_focus[<name>;<always set>]".
This commit is contained in:
parent
d80def5bbf
commit
e0499731a8
3 changed files with 102 additions and 39 deletions
|
@ -168,6 +168,7 @@ public:
|
|||
{
|
||||
m_formspec_string = formspec_string;
|
||||
m_current_inventory_location = current_inventory_location;
|
||||
m_is_form_regenerated = false;
|
||||
regenerateGui(m_screensize_old);
|
||||
}
|
||||
|
||||
|
@ -299,6 +300,10 @@ protected:
|
|||
std::string m_formspec_prepend;
|
||||
InventoryLocation m_current_inventory_location;
|
||||
|
||||
// Default true because we can't control regeneration on resizing, but
|
||||
// we can control cases when the formspec is shown intentionally.
|
||||
bool m_is_form_regenerated = true;
|
||||
|
||||
std::vector<GUIInventoryList *> m_inventorylists;
|
||||
std::vector<ListRingSpec> m_inventory_rings;
|
||||
std::vector<gui::IGUIElement *> m_backgrounds;
|
||||
|
@ -339,10 +344,10 @@ protected:
|
|||
video::SColor m_default_tooltip_bgcolor;
|
||||
video::SColor m_default_tooltip_color;
|
||||
|
||||
|
||||
private:
|
||||
IFormSource *m_form_src;
|
||||
TextDest *m_text_dst;
|
||||
std::string m_last_formname;
|
||||
u16 m_formspec_version = 1;
|
||||
std::string m_focused_element = "";
|
||||
JoystickController *m_joystick;
|
||||
|
@ -359,7 +364,6 @@ private:
|
|||
core::rect<s32> rect;
|
||||
v2s32 basepos;
|
||||
v2u32 screensize;
|
||||
std::string focused_fieldname;
|
||||
GUITable::TableOptions table_options;
|
||||
GUITable::TableColumns table_columns;
|
||||
gui::IGUIElement *current_parent = nullptr;
|
||||
|
@ -439,6 +443,7 @@ private:
|
|||
bool parseAnchorDirect(parserData *data, const std::string &element);
|
||||
void parseAnchor(parserData *data, const std::string &element);
|
||||
bool parseStyle(parserData *data, const std::string &element, bool style_type);
|
||||
void parseSetFocus(const std::string &element);
|
||||
|
||||
void tryClose();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue