Module Geyser.StyleSheet

Represents a stylesheet used for styling labels.

Based primarily off the work of Vadi on CSSMan CSSMan. This version extends it with recursive inheritance of properties, storing the target of the stylesheet (QLabel, QPlainTextEdit, etc), and parsing string stylesheets for them.
See also: Mudlet Manual

Info:

  • Author: guy,Vadi

Functions

Geyser.StyleSheet:get (property) Returns the value of a stylesheet property
Geyser.StyleSheet:getCSS (inherit) Returns the stylesheet as a string for use in set*StyleSheet functions.
Geyser.StyleSheet:getStyleTable (inherit) Returns the stylesheet as a table with the properties as keys which hold the value they've had set.
Geyser.StyleSheet:new (stylesheet, parent, target) Creates a new StyleSheet
Geyser.StyleSheet:parseCSS (stylesheet) Parses a text stylesheet into a property:value table
Geyser.StyleSheet:set (property, value) Sets the value of a stylesheet property
Geyser.StyleSheet:setCSS (css) Set the style for this StyleSheet using the text stylesheet.
Geyser.StyleSheet:setParent (parent) Allows you to set the parent for this stylesheet.
Geyser.StyleSheet:setStyleTable (styleTable) Allows you to set the styleTable directly with the properties as keys which hold the value to set for the property.
Geyser.StyleSheet:setTarget (target) Allows you to set a target for this stylesheet to effect, such as "QPlainTextEdit" etc.


Functions

Geyser.StyleSheet:get (property)
Returns the value of a stylesheet property

Parameters:

  • property the property to return the value of
Geyser.StyleSheet:getCSS (inherit)
Returns the stylesheet as a string for use in set*StyleSheet functions.

Parameters:

  • inherit Defaults to true. If true, returns table with properties inherited from its parent (if any). If false will only return the properties set in this StyleSheet

Returns:

    stylesheet as a string, suitable for passing in to set*StyleSheet() functions
Geyser.StyleSheet:getStyleTable (inherit)
Returns the stylesheet as a table with the properties as keys which hold the value they've had set. Inherits property:values for unset properties from its parent stylesheet, if set.

Parameters:

  • inherit Defaults to true. If true, returns table with properties inherited from its parent (if any). If false will only return the properties set in this StyleSheet

Returns:

    StyleSheet as a property:value table
Geyser.StyleSheet:new (stylesheet, parent, target)
Creates a new StyleSheet

Parameters:

  • stylesheet the stylesheet to start off with
  • parent if provided, this stylesheet will inherit values for keys it does not set from its parent
  • target if provided, will enclose the stylesheet in "category { stylesheet }". Will also extract this information from a stylesheet formatted in this way.
Geyser.StyleSheet:parseCSS (stylesheet)
Parses a text stylesheet into a property:value table

Parameters:

  • stylesheet the stylesheet(as a string) to parse

Returns:

    table of stylesheet properties with their values
Geyser.StyleSheet:set (property, value)
Sets the value of a stylesheet property

Parameters:

  • property the property to set the value for, as a string
  • value the value to set for the property, as a string
Geyser.StyleSheet:setCSS (css)
Set the style for this StyleSheet using the text stylesheet.

Parameters:

  • css the stylesheet to parse. If not provided will clear the style
Geyser.StyleSheet:setParent (parent)
Allows you to set the parent for this stylesheet. Any properties set in the parent will be used by this stylesheet unless it has a value set for that property itself.

Parameters:

  • parent a Geyser.StyleSheet to inherit from. If not provided, clears the parent.
Geyser.StyleSheet:setStyleTable (styleTable)
Allows you to set the styleTable directly with the properties as keys which hold the value to set for the property.

Parameters:

  • styleTable table with properties for keys and their values as the value. If not provided will clear the style.
Geyser.StyleSheet:setTarget (target)
Allows you to set a target for this stylesheet to effect, such as "QPlainTextEdit" etc.

Parameters:

  • target the target to apply this stylesheet to. if not provided will clear the target
generated by LDoc 1.5.0 Last updated 2024-04-26 00:56:21