Quantcast

- Add back accidentily removed routine - Utils to add 'Right Side' menu option

urnati [11-21-21 - 11:26]
- Add back accidentily removed routine - Utils to add 'Right Side' menu option
Filename
TitanClassic/TitanClassicUtils.lua
diff --git a/TitanClassic/TitanClassicUtils.lua b/TitanClassic/TitanClassicUtils.lua
index 5859c41..f34582a 100644
--- a/TitanClassic/TitanClassicUtils.lua
+++ b/TitanClassic/TitanClassicUtils.lua
@@ -1064,6 +1064,29 @@ function TitanPanelRightClickMenu_ToggleColoredText(value)
 end

 --[[ API
+NAME: TitanPanelRightClickMenu_AddToggleRightSide
+DESC: Menu - add a toggle Right Side (localized) command at the given level in the form of a button. Titan will properly control the "DisplayOnRightSide"
+VAR: id - id of the plugin
+VAR: level - level to put the line
+OUT:  None
+--]]
+function TitanPanelRightClickMenu_AddToggleRightSide(id, level)
+    -- copy of TitanPanelRightClickMenu_AddToggleVar adding a remove button
+    local info = {};
+    info.text = L["TITAN_CLOCK_MENU_DISPLAY_ON_RIGHT_SIDE"];
+    info.value = {id, "DisplayOnRightSide"};
+    info.func = function()
+        local bar = TitanUtils_GetWhichBar(id)
+        TitanPanelRightClickMenu_ToggleVar({id, "DisplayOnRightSide"})
+        TitanPanel_RemoveButton(id);
+        TitanUtils_AddButtonOnBar(bar, id)
+    end
+    info.checked = TitanGetVar(id, "DisplayOnRightSide");
+    info.keepShownOnClick = 1;
+    L_UIDropDownMenu_AddButton(info, level);
+end
+
+--[[ API
 NAME: TitanPanelRightClickMenu_SetCustomBackdrop
 DESC: This will set the backdrop of the given button. This is used for custom created controls such as Clock offset or Volume sliders to give a consistent look.
 VAR: frame - the control frame of the plugin