From 549d68dcc526680d428faf04f516f3339b49c912 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Jul 2016 22:35:58 -0400 Subject: [PATCH] doc: Add more progressbar shape examples --- lib/wibox/widget/progressbar.lua | 6 +++++ .../wibox/widget/progressbar/bar_shape.lua | 27 +++++++++++++++++++ .../wibox/widget/progressbar/shape.lua | 24 +++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 tests/examples/wibox/widget/progressbar/bar_shape.lua create mode 100644 tests/examples/wibox/widget/progressbar/shape.lua diff --git a/lib/wibox/widget/progressbar.lua b/lib/wibox/widget/progressbar.lua index f7f9d314a..833656aec 100644 --- a/lib/wibox/widget/progressbar.lua +++ b/lib/wibox/widget/progressbar.lua @@ -61,11 +61,17 @@ local progressbar = { mt = {} } -- @tparam gears.color color The progressbar background color. --- The progressbar inner shape. +-- +--@DOC_wibox_widget_progressbar_bar_shape_EXAMPLE@ +-- -- @property bar_shape -- @tparam[opt=gears.shape.rectangle] gears.shape shape -- @see gears.shape --- The progressbar shape. +-- +--@DOC_wibox_widget_progressbar_shape_EXAMPLE@ +-- -- @property shape -- @tparam[opt=gears.shape.rectangle] gears.shape shape -- @see gears.shape diff --git a/tests/examples/wibox/widget/progressbar/bar_shape.lua b/tests/examples/wibox/widget/progressbar/bar_shape.lua new file mode 100644 index 000000000..8b6ba991d --- /dev/null +++ b/tests/examples/wibox/widget/progressbar/bar_shape.lua @@ -0,0 +1,27 @@ +local parent = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local gears = {shape = require("gears.shape") } --DOC_HIDE +local beautiful = require("beautiful") --DOC_HIDE + + +local l = wibox.layout { --DOC_HIDE + forced_height = 120, --DOC_HIDE + forced_width = 100, --DOC_HIDE + layout = wibox.layout.flex.vertical --DOC_HIDE +} --DOC_HIDE + +for _, shape in ipairs {"rounded_bar", "octogon", "hexagon", "powerline" } do + l:add(wibox.widget { + value = 0.33, + bar_shape = gears.shape[shape], + bar_border_color = beautiful.border_color, + bar_border_width = 1, + border_width = 2, + border_color = beautiful.border_color, + margins = 5, --DOC_HIDE + paddings = 1, + widget = wibox.widget.progressbar, + }) +end + +parent:add(l) --DOC_HIDE diff --git a/tests/examples/wibox/widget/progressbar/shape.lua b/tests/examples/wibox/widget/progressbar/shape.lua new file mode 100644 index 000000000..596034297 --- /dev/null +++ b/tests/examples/wibox/widget/progressbar/shape.lua @@ -0,0 +1,24 @@ +local parent = ... --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local gears = {shape = require("gears.shape") } --DOC_HIDE +local beautiful = require("beautiful") --DOC_HIDE + + +local l = wibox.layout { --DOC_HIDE + forced_height = 100, --DOC_HIDE + forced_width = 100, --DOC_HIDE + layout = wibox.layout.flex.vertical --DOC_HIDE +} --DOC_HIDE + +for _, shape in ipairs {"rounded_bar", "octogon", "hexagon", "powerline" } do + l:add(wibox.widget { + value = 0.33, + shape = gears.shape[shape], + border_width = 2, + border_color = beautiful.border_color, + margins = 5, --DOC_HIDE + widget = wibox.widget.progressbar, + }) +end + +parent:add(l) --DOC_HIDE