diff options
author | v-rob <robinsonvincent89@gmail.com> | 2020-07-12 00:47:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-12 09:47:05 +0200 |
commit | e0499731a867c76005f7cd83ee18c1a9503da719 (patch) | |
tree | 31e145944ad335ecb84b41c0d0295d845bc2205e /src/gui/guiFormSpecMenu.h | |
parent | d80def5bbf58c9ddf1ab3d62e2e456b8dc824c98 (diff) | |
download | minetest-e0499731a867c76005f7cd83ee18c1a9503da719.tar.gz minetest-e0499731a867c76005f7cd83ee18c1a9503da719.tar.bz2 minetest-e0499731a867c76005f7cd83ee18c1a9503da719.zip |
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>]".
Diffstat (limited to 'src/gui/guiFormSpecMenu.h')
-rw-r--r-- | src/gui/guiFormSpecMenu.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/guiFormSpecMenu.h b/src/gui/guiFormSpecMenu.h index a91afd2f7..19026bd34 100644 --- a/src/gui/guiFormSpecMenu.h +++ b/src/gui/guiFormSpecMenu.h @@ -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(); |