From 003634e049d599b8ed5ae3ba6b3250e9eb7741ca Mon Sep 17 00:00:00 2001 From: sapier Date: Fri, 30 May 2014 03:07:48 +0200 Subject: Add support for exiting formspecs by doubleclicking outside --- src/guiFormSpecMenu.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'src/guiFormSpecMenu.h') diff --git a/src/guiFormSpecMenu.h b/src/guiFormSpecMenu.h index 016eb0e7e..474f13cb1 100644 --- a/src/guiFormSpecMenu.h +++ b/src/guiFormSpecMenu.h @@ -143,7 +143,7 @@ class GUIFormSpecMenu : public GUIModalMenu v2s32 geom; bool scale; }; - + struct FieldSpec { FieldSpec() @@ -205,7 +205,7 @@ public: m_current_inventory_location = current_inventory_location; regenerateGui(m_screensize_old); } - + // form_src is deleted by this GUIFormSpecMenu void setFormSource(IFormSource *form_src) { @@ -240,7 +240,7 @@ public: Remove and re-add (or reposition) stuff */ void regenerateGui(v2u32 screensize); - + ItemSpec getItemAtPos(v2s32 p) const; void drawList(const ListDrawSpec &s, int phase); void drawSelectedItem(); @@ -269,7 +269,7 @@ protected: v2s32 spacing; v2s32 imgsize; v2s32 offset; - + irr::IrrlichtDevice* m_device; InventoryManager *m_invmgr; IGameDef *m_gamedef; @@ -290,7 +290,7 @@ protected: ItemSpec *m_selected_item; u32 m_selected_amount; bool m_selected_dragging; - + // WARNING: BLACK MAGIC // Used to guess and keep up with some special things the server can do. // If name is "", no guess exists. @@ -366,6 +366,20 @@ private: void parseBox(parserData* data,std::string element); void parseBackgroundColor(parserData* data,std::string element); void parseListColors(parserData* data,std::string element); + + /** + * check if event is part of a double click + * @param event event to evaluate + * @return true/false if a doubleclick was detected + */ + bool DoubleClickDetection(const SEvent event); + + struct clickpos + { + v2s32 pos; + s32 time; + }; + clickpos m_doubleclickdetect[2]; }; class FormspecFormSource: public IFormSource -- cgit v1.2.3