Class wibox.layout.ratio

A layout filling all the available space.

Each widget is assigned a ratio (percentage) of the total space. Multiple methods are available to ajust this ratio.

Usage:

    local w = wibox.widget {
        generic_widget( 'first'  ),
        generic_widget( 'second' ),
        generic_widget( 'third'  ),
        layout  = wibox.layout.ratio.horizontal
    }
    w:ajust_ratio(2, 0.44, 0.33, 0.22)

Info:

  • Copyright: 2016 Emmanuel Lepage Vallee
  • Author: Emmanuel Lepage Vallee

Functions

ratio:inc_ratio (index, increment) Increase the ratio of "widget" If the increment produce an invalid ratio (not between 0 and 1), the method do nothing.
ratio:inc_widget_ratio (widget, increment) Increment the ratio of the first instance of widget If the increment produce an invalid ratio (not between 0 and 1), the method do nothing.
ratio:set_ratio (index, percent) Set the ratio of the widget at position index
ratio:get_ratio (index) Get the ratio at index.
ratio:set_widget_ratio (widget, percent) Set the ratio of widget to percent.
ratio:ajust_ratio (index, before, itself, after) Update all widgets to match a set of a ratio.
ratio:ajust_widget_ratio (widget, before, itself, after) Update all widgets to match a set of a ratio
ratio:add (...) Add some widgets to the given fixed layout **Signal:** widget::added The argument are the widgets
ratio:remove (index) Remove a widget from the layout **Signal:** widget::removed The arguments are the widget and the index
ratio:insert (index, widget) Insert a new widget in the layout at position index **Signal:** widget::inserted The arguments are the widget and the index
ratio.horizontal (...) Returns a new horizontal ratio layout.
ratio.vertical (...) Returns a new vertical ratio layout.


Functions

ratio:inc_ratio (index, increment)
Increase the ratio of "widget" If the increment produce an invalid ratio (not between 0 and 1), the method do nothing.
  • index number The widget index to change
  • increment number An floating point value between -1 and 1 where the end result is within 0 and 1
ratio:inc_widget_ratio (widget, increment)
Increment the ratio of the first instance of widget If the increment produce an invalid ratio (not between 0 and 1), the method do nothing.
  • widget The widget to ajust
  • increment number An floating point value between -1 and 1 where the end result is within 0 and 1
ratio:set_ratio (index, percent)
Set the ratio of the widget at position index
  • index number The index of the widget to change
  • percent number An floating point value between 0 and 1
ratio:get_ratio (index)
Get the ratio at index.
  • index number The widget index to query

Returns:

    number The index (between 0 and 1)
ratio:set_widget_ratio (widget, percent)
Set the ratio of widget to percent.
  • widget widget The widget to ajust.
  • percent number A floating point value between 0 and 1.
ratio:ajust_ratio (index, before, itself, after)
Update all widgets to match a set of a ratio. The sum of before, itself and after must be 1 or nothing will be done
  • index number The index of the widget to change
  • before number The sum of the ratio before the widget
  • itself number The ratio for "widget"
  • after number The sum of the ratio after the widget
ratio:ajust_widget_ratio (widget, before, itself, after)
Update all widgets to match a set of a ratio
  • widget The widget to ajust
  • before number The sum of the ratio before the widget
  • itself number The ratio for "widget"
  • after number The sum of the ratio after the widget
ratio:add (...)
Add some widgets to the given fixed layout **Signal:** widget::added The argument are the widgets
  • ... widget Widgets that should be added (must at least be one)
ratio:remove (index)
Remove a widget from the layout **Signal:** widget::removed The arguments are the widget and the index
  • index number The widget index to remove

Returns:

    boolean index If the operation is successful
ratio:insert (index, widget)
Insert a new widget in the layout at position index **Signal:** widget::inserted The arguments are the widget and the index
  • index number The position
  • widget The widget
ratio.horizontal (...)
Returns a new horizontal ratio layout. A ratio layout shares the available space equally among all widgets. Widgets can be added via :add(widget).
  • ... widget Widgets that should be added to the layout.
ratio.vertical (...)
Returns a new vertical ratio layout. A ratio layout shares the available space equally among all widgets. Widgets can be added via :add(widget).
  • ... widget Widgets that should be added to the layout.
generated by LDoc 1.4.2