I wanted a set of function to make and use vertical gauges the same way the current one makes horizontal gauges, so I started writing one. What I have does some of what the Gauge functions do, but I haven't figured out how to do the rest. Here's what I have so far:
createVGauge() - makes the same output as createGauge(), only with a vertical gauge instead of horizontal. Don't know if it will need to be changed to make everything else work.
setVGauge() - would work just like setGauge() if I knew how to get the dimensions of a previously created label. Does such a thing exist?
Also need to figure out how to make moveWindow() handle this correctly.
here's the code of what I got. Looking for help finishing this up, since I suspect that what I've got isn't going to work without significant changes, even ignoring what still needs to be added.
function createVGauge(name, height, width, posX, posY, color1, color2, color3)
local bglabel = name .. "Bg"
local fglabel = name .. "Fg"
local r = tonumber(color1) or color_table[color1][1]
local g = tonumber(color2) or color_table[color1][2]
local b = tonumber(color3) or color_table[color1][3]
createLabel(bglabel, posX, posY, width, height,1)
setBackgroundColor(bglabel, r, g, b, 100)
createLabel(fglabel, posX, posY, width, height,1)
setBackgroundColor(fglabel, r, g, b, 255)
end
function setVGauge(name, current, max)
local bglabel = name .. "Bg"
local fglabel = name .. "Fg"
local ratio = current / max
local height = getWindowSize(bglabel)[2] * ratio
local width = getWindowSize(bglabel)[1]
resizeWindow(fglabel, width, height)
end