From a8568eb969a7aa500a8e4de35ec2f1fb6a8e886e Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 24 Jul 2016 22:06:11 -0400 Subject: [PATCH] doc: Add examples for vertical and labelled progressbar --- lib/wibox/widget/progressbar.lua | 9 +++++++ .../wibox/widget/progressbar/text.lua | 25 +++++++++++++++++++ .../wibox/widget/progressbar/vertical.lua | 18 +++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 tests/examples/wibox/widget/progressbar/text.lua create mode 100644 tests/examples/wibox/widget/progressbar/vertical.lua diff --git a/lib/wibox/widget/progressbar.lua b/lib/wibox/widget/progressbar.lua index 568777a5..ef4e0729 100644 --- a/lib/wibox/widget/progressbar.lua +++ b/lib/wibox/widget/progressbar.lua @@ -1,11 +1,20 @@ --------------------------------------------------------------------------- --- A progressbar widget. -- +-- To add text on top of the progressbar, a `wibox.layout.stack` can be used: +-- +--@DOC_wibox_widget_progressbar_text_EXAMPLE@ +-- +-- To display the progressbar vertically, use a `wibox.container.rotate` widget: +-- +--@DOC_wibox_widget_progressbar_vertical_EXAMPLE@ +-- -- 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 -- @release @AWESOME_VERSION@ diff --git a/tests/examples/wibox/widget/progressbar/text.lua b/tests/examples/wibox/widget/progressbar/text.lua new file mode 100644 index 00000000..f502939e --- /dev/null +++ b/tests/examples/wibox/widget/progressbar/text.lua @@ -0,0 +1,25 @@ +local parent = ... --DOC_NO_USAGE --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE +local beautiful = require("beautiful") --DOC_HIDE + +parent:add( --DOC_HIDE + + wibox.widget { + { + max_value = 1, + value = 0.5, + forced_height = 20, + forced_width = 100, + paddings = 1, + border_width = 1, + border_color = beautiful.border_color, + widget = wibox.widget.progressbar, + }, + { + text = "50%", + widget = wibox.widget.textbox, + }, + layout = wibox.layout.stack + } + +) --DOC_HIDE diff --git a/tests/examples/wibox/widget/progressbar/vertical.lua b/tests/examples/wibox/widget/progressbar/vertical.lua new file mode 100644 index 00000000..eb0d060f --- /dev/null +++ b/tests/examples/wibox/widget/progressbar/vertical.lua @@ -0,0 +1,18 @@ +local parent = ... --DOC_NO_USAGE --DOC_HIDE +local wibox = require("wibox") --DOC_HIDE + +parent:add( --DOC_HIDE + + wibox.widget { + { + max_value = 1, + value = 0.33, + widget = wibox.widget.progressbar, + }, + forced_height = 100, + forced_width = 20, + direction = "east", + layout = wibox.container.rotate, + } + +) --DOC_HIDE