mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Tooltips rework.
Separate element for tooltips. Delayed showing, use global color or given ones.
This commit is contained in:
parent
d1ee708db2
commit
27538ecef5
3 changed files with 124 additions and 48 deletions
|
@ -159,7 +159,6 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
send = false;
|
||||
ftype = f_Unknown;
|
||||
is_exit = false;
|
||||
tooltip="";
|
||||
}
|
||||
std::wstring fname;
|
||||
std::wstring flabel;
|
||||
|
@ -169,7 +168,6 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
FormspecFieldType ftype;
|
||||
bool is_exit;
|
||||
core::rect<s32> rect;
|
||||
std::string tooltip;
|
||||
};
|
||||
|
||||
struct BoxDrawSpec {
|
||||
|
@ -184,6 +182,22 @@ class GUIFormSpecMenu : public GUIModalMenu
|
|||
irr::video::SColor color;
|
||||
};
|
||||
|
||||
struct TooltipSpec {
|
||||
TooltipSpec()
|
||||
{
|
||||
}
|
||||
TooltipSpec(std::string a_tooltip, irr::video::SColor a_bgcolor,
|
||||
irr::video::SColor a_color):
|
||||
tooltip(a_tooltip),
|
||||
bgcolor(a_bgcolor),
|
||||
color(a_color)
|
||||
{
|
||||
}
|
||||
std::string tooltip;
|
||||
irr::video::SColor bgcolor;
|
||||
irr::video::SColor color;
|
||||
};
|
||||
|
||||
public:
|
||||
GUIFormSpecMenu(irr::IrrlichtDevice* dev,
|
||||
gui::IGUIElement* parent, s32 id,
|
||||
|
@ -286,7 +300,8 @@ protected:
|
|||
std::vector<FieldSpec> m_fields;
|
||||
std::vector<std::pair<FieldSpec,GUITable*> > m_tables;
|
||||
std::vector<std::pair<FieldSpec,gui::IGUICheckBox*> > m_checkboxes;
|
||||
|
||||
std::map<std::wstring, TooltipSpec> m_tooltips;
|
||||
|
||||
ItemSpec *m_selected_item;
|
||||
u32 m_selected_amount;
|
||||
bool m_selected_dragging;
|
||||
|
@ -300,6 +315,10 @@ protected:
|
|||
v2s32 m_pointer;
|
||||
gui::IGUIStaticText *m_tooltip_element;
|
||||
|
||||
s32 m_hoovered_time;
|
||||
s32 m_old_tooltip_id;
|
||||
std::string m_old_tooltip;
|
||||
|
||||
bool m_allowclose;
|
||||
bool m_lock;
|
||||
v2u32 m_lockscreensize;
|
||||
|
@ -311,6 +330,9 @@ protected:
|
|||
video::SColor m_slotbg_n;
|
||||
video::SColor m_slotbg_h;
|
||||
video::SColor m_slotbordercolor;
|
||||
video::SColor m_default_tooltip_bgcolor;
|
||||
video::SColor m_default_tooltip_color;
|
||||
|
||||
private:
|
||||
IFormSource *m_form_src;
|
||||
TextDest *m_text_dst;
|
||||
|
@ -366,6 +388,7 @@ private:
|
|||
void parseBox(parserData* data,std::string element);
|
||||
void parseBackgroundColor(parserData* data,std::string element);
|
||||
void parseListColors(parserData* data,std::string element);
|
||||
void parseTooltip(parserData* data,std::string element);
|
||||
|
||||
/**
|
||||
* check if event is part of a double click
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue