progressbar: Remove vertical/width/height code
The deprecation message should be enough. This doesn't remove the functionalities themselves.
This commit is contained in:
parent
e28b79944f
commit
e5d4c188f1
|
@ -1,6 +1,10 @@
|
|||
---------------------------------------------------------------------------
|
||||
--- A progressbar widget.
|
||||
--
|
||||
-- By default, this widget will take all the available size. To prevent this,
|
||||
-- a `wibox.container.constraint` widget or the `forced_width`/`forced_height`
|
||||
-- properties have to be used.
|
||||
--
|
||||
--@DOC_wibox_widget_defaults_progressbar_EXAMPLE@
|
||||
-- @author Julien Danjou <julien@danjou.info>
|
||||
-- @copyright 2009 Julien Danjou
|
||||
|
@ -34,8 +38,8 @@ local progressbar = { mt = {} }
|
|||
-- @property background_color
|
||||
-- @tparam gears.color color The progressbar background color.
|
||||
|
||||
--- Set the progressbar to draw vertically. Default is false.
|
||||
--
|
||||
--- Set the progressbar to draw vertically.
|
||||
-- This doesn't do anything anymore, use a `wibox.container.rotate` widget.
|
||||
-- @deprecated set_vertical
|
||||
-- @tparam boolean vertical
|
||||
|
||||
|
@ -68,10 +72,9 @@ local progressbar = { mt = {} }
|
|||
--- The progressbar border color.
|
||||
-- @beautiful beautiful.progressbar_border_color
|
||||
|
||||
local properties = { "width", "height", "border_color",
|
||||
"color", "background_color",
|
||||
"vertical", "value", "max_value",
|
||||
"ticks", "ticks_gap", "ticks_size" }
|
||||
local properties = { "border_color", "color" , "background_color",
|
||||
"value" , "max_value", "ticks",
|
||||
"ticks_gap" , "ticks_size" }
|
||||
|
||||
function progressbar.draw(pbar, _, cr, width, height)
|
||||
local ticks_gap = pbar._private.ticks_gap or 1
|
||||
|
@ -107,31 +110,6 @@ function progressbar.draw(pbar, _, cr, width, height)
|
|||
cr:fill()
|
||||
|
||||
-- Cover the part that is not set with a rectangle
|
||||
if pbar._private.vertical then
|
||||
local rel_height = over_drawn_height * (1 - value)
|
||||
cr:rectangle(border_width,
|
||||
border_width,
|
||||
over_drawn_width,
|
||||
rel_height)
|
||||
cr:set_source(color(pbar._private.background_color or beautiful.progressbar_bg or "#000000aa"))
|
||||
cr:fill()
|
||||
|
||||
-- Place smaller pieces over the gradient if ticks are enabled
|
||||
if pbar._private.ticks then
|
||||
for i=0, height / (ticks_size+ticks_gap)-border_width do
|
||||
local rel_offset = over_drawn_height / 1 - (ticks_size+ticks_gap) * i
|
||||
|
||||
if rel_offset >= rel_height then
|
||||
cr:rectangle(border_width,
|
||||
rel_offset,
|
||||
over_drawn_width,
|
||||
ticks_gap)
|
||||
end
|
||||
end
|
||||
cr:set_source(color(pbar._private.background_color or beautiful.progressbar_bg or "#000000aa"))
|
||||
cr:fill()
|
||||
end
|
||||
else
|
||||
local rel_x = over_drawn_width * value
|
||||
cr:rectangle(border_width + rel_x,
|
||||
border_width,
|
||||
|
@ -155,10 +133,9 @@ function progressbar.draw(pbar, _, cr, width, height)
|
|||
cr:fill()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function progressbar.fit(pbar)
|
||||
return pbar._private.width, pbar._private.height
|
||||
function progressbar:fit(_, width, height)
|
||||
return width, height
|
||||
end
|
||||
|
||||
--- Set the progressbar value.
|
||||
|
@ -172,27 +149,21 @@ function progressbar:set_value(value)
|
|||
end
|
||||
|
||||
--- Set the progressbar height.
|
||||
-- This method is deprecated.
|
||||
-- This method is deprecated, it no longer do anything.
|
||||
-- Use a `wibox.container.constraint` widget or `forced_height`.
|
||||
-- @param height The height to set.
|
||||
-- @deprecated set_height
|
||||
function progressbar:set_height(height) --luacheck: no unused_args
|
||||
util.deprecate("Use a `wibox.container.constraint` widget or forced_height")
|
||||
self._private.height = height
|
||||
self:emit_signal("widget::layout_changed")
|
||||
return self
|
||||
end
|
||||
|
||||
--- Set the progressbar width.
|
||||
-- This method is deprecated.
|
||||
-- This method is deprecated, it no longer do anything.
|
||||
-- Use a `wibox.container.constraint` widget or `forced_width`.
|
||||
-- @param width The width to set.
|
||||
-- @deprecated set_width
|
||||
function progressbar:set_width(width) --luacheck: no unused_args
|
||||
util.deprecate("Use a `wibox.container.constraint` widget or forced_width")
|
||||
self._private.width = width
|
||||
self:emit_signal("widget::layout_changed")
|
||||
return self
|
||||
end
|
||||
|
||||
-- Build properties function
|
||||
|
@ -206,10 +177,8 @@ for _, prop in ipairs(properties) do
|
|||
end
|
||||
end
|
||||
|
||||
local set_vertical = progressbar.set_vertical
|
||||
function progressbar:set_vertical(value) --luacheck: no unused_args
|
||||
util.deprecate("Use a `wibox.container.rotate` widget")
|
||||
set_vertical(self, value)
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue