summaryrefslogtreecommitdiff
path: root/src/gui/guiFormSpecMenu.h
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-11-20 19:39:10 +0100
committerGitHub <noreply@github.com>2019-11-20 19:39:10 +0100
commitb50a166bb05c4ebe1bf757190f4045d57a0d5f20 (patch)
treeed6190d1fd837f26bb25bb5c246e2c8e3f4303f9 /src/gui/guiFormSpecMenu.h
parent60bff1e6cbf56e9a248bc4b0928dfc716cf04131 (diff)
downloadminetest-b50a166bb05c4ebe1bf757190f4045d57a0d5f20.tar.gz
minetest-b50a166bb05c4ebe1bf757190f4045d57a0d5f20.tar.bz2
minetest-b50a166bb05c4ebe1bf757190f4045d57a0d5f20.zip
Formspec: Fix priorities for version < 3 (#9121)
* Formspec: Fix priorities for version < 3 1) Introduce 'priority' to 'FieldSpec' 2) Sort elements based on 'priority' 3) Assign 'name' to the Item Image Button's image to show tooltips again
Diffstat (limited to 'src/gui/guiFormSpecMenu.h')
-rw-r--r--src/gui/guiFormSpecMenu.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/guiFormSpecMenu.h b/src/gui/guiFormSpecMenu.h
index f15bba35a..5be639fa5 100644
--- a/src/gui/guiFormSpecMenu.h
+++ b/src/gui/guiFormSpecMenu.h
@@ -143,24 +143,27 @@ class GUIFormSpecMenu : public GUIModalMenu
FieldSpec() = default;
FieldSpec(const std::string &name, const std::wstring &label,
- const std::wstring &default_text, int id) :
+ const std::wstring &default_text, s32 id, int priority = 0) :
fname(name),
flabel(label),
fdefault(unescape_enriched(translate_string(default_text))),
fid(id),
send(false),
ftype(f_Unknown),
- is_exit(false)
+ is_exit(false),
+ priority(priority)
{
}
std::string fname;
std::wstring flabel;
std::wstring fdefault;
- int fid;
+ s32 fid;
bool send;
FormspecFieldType ftype;
bool is_exit;
+ // Draw priority for formspec version < 3
+ int priority;
core::rect<s32> rect;
};
@@ -309,7 +312,7 @@ protected:
}
std::wstring getLabelByID(s32 id);
std::string getNameByID(s32 id);
- FormspecFieldType getTypeByID(s32 id);
+ const FieldSpec *getSpecByID(s32 id);
v2s32 getElementBasePos(const std::vector<std::string> *v_pos);
v2s32 getRealCoordinateBasePos(const std::vector<std::string> &v_pos);
v2s32 getRealCoordinateGeometry(const std::vector<std::string> &v_geom);