diff --git a/lib/wibox/container/rotate.lua b/lib/wibox/container/rotate.lua index 5b0d9d324..9e166f58b 100644 --- a/lib/wibox/container/rotate.lua +++ b/lib/wibox/container/rotate.lua @@ -1,4 +1,6 @@ --------------------------------------------------------------------------- +-- A container rotating the conained widget by 90 degrees. +-- -- @author Uli Schlachter -- @copyright 2010 Uli Schlachter -- @release @AWESOME_VERSION@ @@ -85,8 +87,16 @@ function rotate:reset() self:set_widget(nil) end ---- Set the direction of this rotating layout. Valid values are "north", "east", --- "south" and "west". On an invalid value, this function will throw an error. +--- Set the direction of this rotating container. +-- Valid values are: +-- +-- * *north* +-- * *east* +-- * *south* +-- * *north* +-- +--@DOC_wibox_container_rotate_angle_EXAMPLE@ +-- @tparam string dir The direction function rotate:set_direction(dir) local allowed = { north = true, diff --git a/tests/examples/wibox/container/rotate/angle.lua b/tests/examples/wibox/container/rotate/angle.lua new file mode 100644 index 000000000..4fc8a0630 --- /dev/null +++ b/tests/examples/wibox/container/rotate/angle.lua @@ -0,0 +1,66 @@ +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 function create_arrow(text) --DOC_HIDE + return { --DOC_HIDE + { --DOC_HIDE + { --DOC_HIDE + text = text, --DOC_HIDE + align = "center", --DOC_HIDE + valign = "center", --DOC_HIDE + widget = wibox.widget.textbox, --DOC_HIDE + }, --DOC_HIDE + shape = gears.shape.arrow, --DOC_HIDE + bg = beautiful.bg_normal, --DOC_HIDE + shape_border_color = beautiful.border_color, --DOC_HIDE + shape_border_width = beautiful.border_width, --DOC_HIDE + widget = wibox.container.background --DOC_HIDE + }, --DOC_HIDE + strategy = 'exact', --DOC_HIDE + width = 70, --DOC_HIDE + height = 70, --DOC_HIDE + widget = wibox.container.constraint --DOC_HIDE + } --DOC_HIDE +end --DOC_HIDE + +local normal = create_arrow("Normal") + +local north = wibox.container { + create_arrow("North"), + + direction = "north", + widget = wibox.container.rotate +} + +local south = wibox.container { + create_arrow("South"), + + direction = "south", + widget = wibox.container.rotate +} + +local east = wibox.container { + create_arrow("East"), + + direction = "east", + widget = wibox.container.rotate +} + +local west = wibox.container { + create_arrow("West"), + + direction = "west", + widget = wibox.container.rotate +} + +parent : setup { --DOC_HIDE + normal, --DOC_HIDE + north, --DOC_HIDE + south, --DOC_HIDE + east, --DOC_HIDE + west, --DOC_HIDE + spacing = 10, --DOC_HIDE + layout = wibox.layout.fixed.horizontal --DOC_HIDE +} --DOC_HIDE