diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action.dm index 507090fdb4e..ee081baaa0e 100644 --- a/code/_onclick/hud/action.dm +++ b/code/_onclick/hud/action.dm @@ -185,6 +185,15 @@ overlays += img return + +/obj/screen/movable/action_button/MouseEntered(location,control,params) + openToolTip(usr,params,title = name,content = desc) + + +/obj/screen/movable/action_button/MouseExited() + closeToolTip(usr) + + //This is the proc used to update all the action buttons. Properly defined in /mob/living/ /mob/proc/update_action_buttons() return diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 7063b2fb8f9..c9217c164f7 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -44,3 +44,8 @@ // Used by html_interface module. var/hi_last_pos + + //datum that controls the displaying and hiding of tooltips + var/datum/tooltip/tooltips + + diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 61f1c05baa8..389d88f7ba7 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -206,6 +206,12 @@ var/next_external_rsc = 0 if (config && config.autoconvert_notes) convert_notes_sql(ckey) + + //This is down here because of the browse() calls in tooltip/New() + if(!tooltips) + tooltips = new /datum/tooltip(src) + + ////////////// //DISCONNECT// ////////////// diff --git a/code/modules/tooltip/tooltip.dm b/code/modules/tooltip/tooltip.dm index e17d91092d1..718e98856b9 100644 --- a/code/modules/tooltip/tooltip.dm +++ b/code/modules/tooltip/tooltip.dm @@ -26,6 +26,7 @@ Customization: Notes: - You may have noticed 90% of the work is done via javascript on the client. Gotta save those cycles man. - This is entirely untested in any other codebase besides goonstation so I have no idea if it will port nicely. Good luck! + - After testing and discussion (Wire, Remie, MrPerson, AnturK) ToolTips are ok and work for /tg/station13 */ @@ -62,12 +63,6 @@ Notes: //Send stuff to the tooltip src.owner << output(list2params(list(src.control, params, src.owner.view, "[title][content]", theme)), "[src.control]:tooltip.update") - //DEBUG - world << "SHOW() DEBUG" - world << "Tooltip Owner View: [src.owner.view]" - world << "Params: [params]" - - //If a hide() was hit while we were showing, run hide() again to avoid stuck tooltips src.showing = 0 if (src.queueHide) @@ -89,22 +84,30 @@ Notes: -/client/var/datum/tooltip/tooltip -/client/New() - ..() - tooltip = new /datum/tooltip(src) +/* TG SPECIFIC CODE */ -/obj/screen/movable/action_button/MouseEntered(location,control,params) - usr.client.tooltip.show(params,title = name, content = desc) +//Open a tooltip for user, at a location based on params +//Theme is a CSS class in tooltip.html, by default this wrapper chooses a CSS class based on the user's UI_style (Midnight, Plasmafire, Retro) +//Includes sanity.checks +/proc/openToolTip(mob/user = null,params = null,title = "",content = "",theme = "") + if(istype(user)) + if(user.client && user.client.tooltips) + if(!theme && user.client.prefs && user.client.prefs.UI_style) + theme = lowertext(user.client.prefs.UI_style) + if(!theme) + theme = "default" + user.client.tooltips.show(params,title,content,theme) + + +//Arbitrarily close a user's tooltip +//Includes sanity checks. +/proc/closeToolTip(mob/user) + if(istype(user)) + if(user.client && user.client.tooltips) + user.client.tooltips.hide() -/obj/screen/movable/action_button/MouseExited() - usr.client.tooltip.hide() -/mob/MouseEntered(location,control,params) - usr.client.tooltip.show(params,title = name, content = desc) -/mob/MouseExited() - usr.client.tooltip.hide() \ No newline at end of file diff --git a/code/modules/tooltip/tooltip.html b/code/modules/tooltip/tooltip.html index c43193a21e9..b5df51603f0 100644 --- a/code/modules/tooltip/tooltip.html +++ b/code/modules/tooltip/tooltip.html @@ -50,6 +50,21 @@ .colo-pod .wrap {border-color: #256fb9;} .colo-pod .content {border-color: #000000; background-color: #000000;} + + + /* TG: Themes */ + /* ScreenUI */ + .midnight .wrap {border-color: #2B2B33;} + .midnight .content {color: #6087A0; border-color: #2B2B33; background-color: #36363C;} + + .plasmafire .wrap {border-color: #21213D;} + .plasmafire .content {color: #FFA800 ; border-color: #21213D; background-color:#1D1D36;} + + .retro .wrap {border-color: #005E00;} + .retro .content {color: #003366; border-color: #005E00; background-color: #00BD00;} + + +