diff options
Diffstat (limited to 'src/guiFormSpecMenu.h')
-rw-r--r-- | src/guiFormSpecMenu.h | 87 |
1 files changed, 73 insertions, 14 deletions
diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 2ba47f7ff..ef230c81c 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -29,6 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "modalMenu.h" #include "guiTable.h" #include "network/networkprotocol.h" +#include "util/string.h" class IGameDef; class InventoryManager; @@ -139,25 +140,53 @@ class GUIFormSpecMenu : public GUIModalMenu struct ImageDrawSpec { - ImageDrawSpec() + ImageDrawSpec(): + parent_button(NULL) { } ImageDrawSpec(const std::string &a_name, - v2s32 a_pos, v2s32 a_geom): + const std::string &a_item_name, + gui::IGUIButton *a_parent_button, + const v2s32 &a_pos, const v2s32 &a_geom): name(a_name), + item_name(a_item_name), + parent_button(a_parent_button), pos(a_pos), - geom(a_geom) + geom(a_geom), + scale(true) + { + } + ImageDrawSpec(const std::string &a_name, + const std::string &a_item_name, + const v2s32 &a_pos, const v2s32 &a_geom): + name(a_name), + item_name(a_item_name), + parent_button(NULL), + pos(a_pos), + geom(a_geom), + scale(true) { - scale = true; } ImageDrawSpec(const std::string &a_name, - v2s32 a_pos): + const v2s32 &a_pos, const v2s32 &a_geom): name(a_name), - pos(a_pos) + parent_button(NULL), + pos(a_pos), + geom(a_geom), + scale(true) + { + } + ImageDrawSpec(const std::string &a_name, + const v2s32 &a_pos): + name(a_name), + parent_button(NULL), + pos(a_pos), + scale(false) { - scale = false; } std::string name; + std::string item_name; + gui::IGUIButton *parent_button; v2s32 pos; v2s32 geom; bool scale; @@ -169,12 +198,12 @@ class GUIFormSpecMenu : public GUIModalMenu { } FieldSpec(const std::string &name, const std::wstring &label, - const std::wstring &fdeflt, int id) : + const std::wstring &default_text, int id) : fname(name), - flabel(label), - fdefault(fdeflt), fid(id) { + flabel = unescape_enriched(label); + fdefault = unescape_enriched(default_text); send = false; ftype = f_Unknown; is_exit = false; @@ -207,16 +236,41 @@ class GUIFormSpecMenu : public GUIModalMenu } TooltipSpec(std::string a_tooltip, irr::video::SColor a_bgcolor, irr::video::SColor a_color): - tooltip(a_tooltip), bgcolor(a_bgcolor), color(a_color) { + tooltip = unescape_enriched(utf8_to_wide(a_tooltip)); } - std::string tooltip; + std::wstring tooltip; irr::video::SColor bgcolor; irr::video::SColor color; }; + struct StaticTextSpec { + StaticTextSpec(): + parent_button(NULL) + { + } + StaticTextSpec(const std::wstring &a_text, + const core::rect<s32> &a_rect): + rect(a_rect), + parent_button(NULL) + { + text = unescape_enriched(a_text); + } + StaticTextSpec(const std::wstring &a_text, + const core::rect<s32> &a_rect, + gui::IGUIButton *a_parent_button): + rect(a_rect), + parent_button(a_parent_button) + { + text = unescape_enriched(a_text); + } + std::wstring text; + core::rect<s32> rect; + gui::IGUIButton *parent_button; + }; + public: GUIFormSpecMenu(irr::IrrlichtDevice* dev, gui::IGUIElement* parent, s32 id, @@ -282,7 +336,7 @@ public: void regenerateGui(v2u32 screensize); ItemSpec getItemAtPos(v2s32 p) const; - void drawList(const ListDrawSpec &s, int phase); + void drawList(const ListDrawSpec &s, int phase, bool &item_hovered); void drawSelectedItem(); void drawMenu(); void updateSelectedItem(); @@ -295,6 +349,7 @@ public: bool pausesGame() { return doPause; } GUITable* getTable(const std::string &tablename); + std::vector<std::string>* getDropDownValues(const std::string &name); #ifdef __ANDROID__ bool getAndroidUIInput(); @@ -328,12 +383,16 @@ protected: std::vector<ImageDrawSpec> m_itemimages; std::vector<BoxDrawSpec> m_boxes; std::vector<FieldSpec> m_fields; + std::vector<StaticTextSpec> m_static_texts; std::vector<std::pair<FieldSpec,GUITable*> > m_tables; std::vector<std::pair<FieldSpec,gui::IGUICheckBox*> > m_checkboxes; std::map<std::string, TooltipSpec> m_tooltips; std::vector<std::pair<FieldSpec,gui::IGUIScrollBar*> > m_scrollbars; + std::vector<std::pair<FieldSpec, std::vector<std::string> > > m_dropdowns; ItemSpec *m_selected_item; + f32 m_timer1; + f32 m_timer2; u32 m_selected_amount; bool m_selected_dragging; @@ -350,7 +409,7 @@ protected: u32 m_tooltip_show_delay; s32 m_hovered_time; s32 m_old_tooltip_id; - std::string m_old_tooltip; + std::wstring m_old_tooltip; bool m_rmouse_auto_place; |