+
+
Module widget_core
+
A collection of Widget classes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+ w.temperature_color(temperature, low, high)
+
+ -
+ Generate a temperature based color.
+ Colors are chosen based on float offset in a pre-defined color gradient.
+
+
+
Parameters:
+
+ - temperature
+ number
+ current temperature (or any other type of numeric value)
+
+ - low
+ number
+ threshold for lowest temperature / coolest color
+
+ - high
+ number
+ threshold for highest temperature / hottest color
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+ default_text_color
+
+ -
+ Text color used by widgets if no other is specified.
+
+
+
Fields:
+
+ - default_text_color
+ {number,number,number,number}
+
+
+
+
+
+
+
+
+
+ -
+
+ default_graph_color
+
+ -
+ Color used to draw some widgets if no other is specified.
+
+
+
Fields:
+
+ - default_graph_color
+ {number,number,number,number}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+ default_font_family
+
+ -
+ Font used by widgets if no other is specified.
+
+
+
+ - default_font_family
+ string
+
+
+
+
+
+
+
+
+
+ -
+
+ default_font_size
+
+ -
+ Font size used by widgets if no other is specified.
+
+
+
+ - default_font_size
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Root widget wrapper
+ Takes care of managing layout reflows and background caching.
+
+
+ -
+
+ Renderer:init(args)
+
+ -
+
+
+
+
Parameters:
+
+ - args table of options
+
+ - root
+ Widget
+ The Widget subclass that should be rendered,
+ usually a Rows widget
+
+ - width
+ int
+ Width of the surface that should be covered
+
+ - height
+ int
+ Height of the surface that should be covered
+
+
+
+
+
+
+
+
+
+ -
+
+ Renderer:layout()
+
+ -
+ Layout all Widgets and cache their backgrounds.
+ Call this once to create the initial layout.
+ Will be called again automatically each time the layout changes.
+
+
+
+
+
+
+
+
+ -
+
+ Renderer:update(update_count)
+
+ -
+ Update all Widgets
+
+
+
Parameters:
+
+ - update_count
+ int
+ Conky's $updates
+
+
+
+
+
+
+
+
+ -
+
+ Renderer:render(cr)
+
+ -
+ Render to the given context
+
+
+
Parameters:
+
+
+
+
+
+
+
+
+
+
+
+ Base Widget class.
+
+
+ -
+
+ Widget.width
+
+ -
+ Set a width if the Widget should have a fixed width.
+ Omit (=nil) if width should be adjusted dynamically.
+
+
+
+
+
+
+
+
+ -
+
+ Widget.height
+
+ -
+ Set a height if the Widget should have a fixed height.
+ Omit (=nil) if height should be adjusted dynamically.
+
+
+
+
+
+
+
+
+ -
+
+ Widget:layout(width, height)
+
+ -
+ Called at least once to inform the widget of the width and height
+ it may occupy.
+
+
+
Parameters:
+
+ - width
+ int
+
+
+ - height
+ int
+
+
+
+
+
+
+
+
+
+ -
+
+ Widget:render_background(cr)
+
+ -
+ Called at least once to allow the widget to draw static content.
+
+
+
Parameters:
+
+ - cr
+ cairo_t
+ Cairo context for background rendering
+ (to be cached by the Renderer)
+
+
+
+
+
+
+
+
+ -
+
+ Widget:update(update_count)
+
+ -
+ Called before each call to Widget:render.
+ If this function returns a true-ish value, a reflow will be triggered.
+ Since this involves calls to all widgets' :layout functions,
+ reflows should be used sparingly.
+
+
+
Parameters:
+
+ - update_count
+ int
+ Conky's $updates
+
+
+
+ Returns:
+
+
+ optional bool
+ true(-ish) if a layout reflow should be triggered, causing
+ all Widget:layout and Widget:render_background methods
+ to be called again
+
+
+
+
+
+
+ -
+
+ Widget:render(cr)
+
+ -
+ Called once per update to do draw dynamic content.
+
+
+
Parameters:
+
+
+
+
+
+
+
+
+
+
+
+ Basic collection of widgets.
+ Rows are drawn in a vertical stack starting at the top of the drawble
+ surface.
+
+
+ -
+
+ Rows:init(widgets)
+
+ -
+
+
+
+
Parameters:
+
+
+
+
+
+
+
+
+
+
+
+ Display Widgets side by side
+
+
+ -
+
+ Columns:init(widgets)
+
+ -
+
+
+
+
Parameters:
+
+
+
+
+
+
+
+
+
+
+
+ Leave space between widgets.
+ If either height or width is not specified, the available space
+ inside a Rows or Columns widget will be distributed evenly between Fillers
+ with no fixed height/width.
+ A Filler may contain one other Widget which will have its dimensions
+ restricted to those of the Filler.
+
+
+ -
+
+ Filler:init(args)
+
+ -
+
+
+
+
Parameters:
+
+ - args table of options
+
+ - width
+ optional int
+
+
+ - height
+ optional int
+
+
+ - widget
+ optional Widget
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Draw a static border and/or background around/behind another widget.
+
+
+ -
+
+ Frame:init(widget, args)
+
+ -
+
+
+
+
Parameters:
+
+ - widget
+ Widget
+ Widget to be wrapped
+
+ - args table of options
+
+ - padding
+ number or {number,...}
+ Leave some space around the inside
+ of the frame.
+ - number: same padding all around.
+ - table of two numbers: {top & bottom, left & right}
+ - table of three numbers: {top, left & right, bottom}
+ - table of four numbers: {top, right, bottom, left}
+
+ - margin
+ number or {number,...}
+ Like padding but outside the border.
+
+ - background_color
+ optional {number,number,number,number}
+
+
+ - border_color
+ optional {number,number,number,number}
+
+ (default transparent)
+
+ - border_width
+ optional number
+ border line width
+ (default 0)
+
+ - border_sides
+ optional {string,...}
+ any combination of
+ "top", "right", "bottom" and/or "left"
+ (default: all sides)
+
+
+
+
+
+
+
+
+
+
+
+
+