------------------------------------------------- -- @author Gregor Best , Lukas Hrazky -- @copyright 2009 Gregor Best, Lukas Hrazky -- @release @AWESOME_VERSION@ ------------------------------------------------- local setmetatable = setmetatable local require = require local type = type --- Widget layouts module("awful.widget.layout") -- the table that really contains the margins. local margin_table = setmetatable({}, {__mode = 'k'}) -- empty margin table - used every time there is no margin for something local empty_margin = setmetatable({}, {__index = function() return 0 end}) --- Margins of widgets and layout tables. -- In this table you can set the margin you want the layout to use when positionning -- your widgets or tables with widgets. The key is the widget or the table to set -- margin for, value is either a number (setting the same margin to all four sides) or -- a table with one or more of the following keys: --

left, right, top, bottom

-- For example, if you want to put a 10 pixel free space on the left of a widget, add this: --

-- awful.widget.layout.margins[mywidget] = { left = 10 } --

-- @name margins -- @class table margins = setmetatable({}, { __index = function(t, i) return margin_table[i] or empty_margin end, __newindex = function(t, i, v) if type(v) == "number" then margin_table[i] = setmetatable({}, {__index = function() return v end}) elseif type(v) == "table" then margin_table[i] = setmetatable(v, {__index = function() return 0 end}) end end }) -- A table used to index geometry properties. Returns the name with which it is indexed. -- It is used in horizontal layouts, where it returns "x" when indexed by "x", etc. regular_index = setmetatable({}, {__index = function(t, i) return i end}) -- A table used to index geometry properties. Returns the name opposite to the one -- with which it is indexed. It is used in vertical layouts, where it returns "y" -- when indexed by "x", etc. switched_index = { x = "y", y = "x", width = "height", height = "width", top = "left", bottom = "right", left = "top", right = "bottom" } -- set the default layout function local horizontal = require("awful.widget.layout.horizontal") default = horizontal.leftright require("awful.widget.layout.vertical") --- Places the widgets in a grid. -- It recognizes the following attributes in the encompassing table: --

cell_width: Either a table containing column widths or -- a number (width for all columns). In case its a number, col_count is mandatory.
-- cell_height: Either a table containing row heights or -- a number (height for all rows). In case its a number, row_count is mandatory.
-- col_count: In case cell_width is a number, sets the number of columns.
-- row_count: In case cell_height is a number, sets the number of rows.
-- col_gap: Gap between columns in pixels. (optional)
-- row_gap: Gap between rows in pixels. (optional)
-- resize: Boolean indicating whether widgets should be resized to the size of the cell. -- (optional)

-- @param bounds The geometry of the bounds for the layout. -- @param widgets The table of the widgets to layout. When layout function is placed in -- a table, it is the table that is passed as this argument. -- @param screen The screen of the wibox. -- @return A table of geometries of all the widgets. -- @name grid -- @class function grid = require("awful.widget.layout.grid").grid -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80