chunk
comment
-- "--"
comment_content "------------------------------------------------------------"...
comment
-- "--"
comment_content " A widget to display either plain or HTML text."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_wibox_widget_defaults_textbox_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @author Uli Schlachter"
comment
-- "--"
comment_content " @author dodo"
comment
-- "--"
comment_content " @copyright 2010, 2011 Uli Schlachter, dodo"
comment
-- "--"
comment_content " @widgetmod wibox.widget.textbox"
comment
-- "--"
comment_content " @supermodule wibox.widget.base"
comment
-- "--"
comment_content "------------------------------------------------------------"...
variable_declaration
local "local"
assignment_statement
variable_list
identifier "base"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "wibox.widget.base"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gdebug"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.debug"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "beautiful"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "beautiful"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "lgi"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "lgi"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "gtable"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
" "\""
string_content "gears.table"
" "\""
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "Pango"
= "="
expression_list
dot_index_expression
identifier "lgi"
. "."
identifier "Pango"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "PangoCairo"
= "="
expression_list
dot_index_expression
identifier "lgi"
. "."
identifier "PangoCairo"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "setmetatable"
= "="
expression_list
identifier "setmetatable"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "textbox"
= "="
expression_list
table_constructor
{ "{"
field
identifier "mt"
= "="
table_constructor
{ "{"
} "}"
} "}"
comment
-- "--"
comment_content "- The textbox font."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @beautiful beautiful.font"
comment
-- "--"
comment_content " @param string"
comment
-- "--"
comment_content "- Set the DPI of a Pango layout"
function_declaration (+79 nodes collapsed)
comment
-- "--"
comment_content "- Setup a pango layout for the given textbox and dpi"
function_declaration (+70 nodes collapsed)
comment
-- "--"
comment_content " Draw the given textbox on the given cairo context in the gi"...
function_declaration (+170 nodes collapsed)
function_declaration (+72 nodes collapsed)
comment
-- "--"
comment_content " Fit the given textbox"
function_declaration (+40 nodes collapsed)
comment
-- "--"
comment_content "- Get the preferred size of a textbox."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This returns the size that the textbox would use if infinit"...
comment
-- "--"
comment_content " available."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @method get_preferred_size"
comment
-- "--"
comment_content " @tparam integer|screen s The screen on which the textbox wi"...
comment
-- "--"
comment_content " @treturn number The preferred width."
comment
-- "--"
comment_content " @treturn number The preferred height."
function_declaration (+91 nodes collapsed)
comment
-- "--"
comment_content "- Get the preferred height of a textbox at a given width."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This returns the height that the textbox would use when it "...
comment
-- "--"
comment_content " given width."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @method get_height_for_width"
comment
-- "--"
comment_content " @tparam number width The available width."
comment
-- "--"
comment_content " @tparam integer|screen s The screen on which the textbox wi"...
comment
-- "--"
comment_content " @treturn number The needed height."
function_declaration (+95 nodes collapsed)
comment
-- "--"
comment_content "- Get the preferred size of a textbox."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This returns the size that the textbox would use if infinit"...
comment
-- "--"
comment_content " available."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @method get_preferred_size_at_dpi"
comment
-- "--"
comment_content " @tparam number dpi The DPI value to render at."
comment
-- "--"
comment_content " @treturn number The preferred width."
comment
-- "--"
comment_content " @treturn number The preferred height."
function_declaration (+80 nodes collapsed)
comment
-- "--"
comment_content "- Get the preferred height of a textbox at a given width."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This returns the height that the textbox would use when it "...
comment
-- "--"
comment_content " given width."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @method get_height_for_width_at_dpi"
comment
-- "--"
comment_content " @tparam number width The available width."
comment
-- "--"
comment_content " @tparam number dpi The DPI value to render at."
comment
-- "--"
comment_content " @treturn number The needed height."
function_declaration (+95 nodes collapsed)
comment
-- "--"
comment_content "- Set the text of the textbox.(with"
comment
-- "--"
comment_content " [Pango markup](https://docs.gtk.org/Pango/pango_markup.html"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam string text The text to set. This can contain pango"...
comment
-- "--"
comment_content " `<b>bold</b>`). You can use `gears.string.escape` to esca"...
comment
-- "--"
comment_content " parts of it."
comment
-- "--"
comment_content " @method set_markup_silently"
comment
-- "--"
comment_content " @treturn[1] boolean true"
comment
-- "--"
comment_content " @treturn[2] boolean false"
comment
-- "--"
comment_content " @treturn[2] string Error message explaining why the markup "...
function_declaration (+167 nodes collapsed)
comment
-- "--"
comment_content "- Set the HTML text of the textbox."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " The main difference between `text` and `markup` is that `ma"...
comment
-- "--"
comment_content " able to render a small subset of HTML tags. See the"
comment
-- "--"
comment_content " [Pango markup](https://docs.gtk.org/Pango/pango_markup.html"...
comment
-- "--"
comment_content " to see what is and isn't valid in this property."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_wibox_widget_textbox_markup1_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " The `wibox.widget.textbox` colors are usually set by wrappi"...
comment
-- "--"
comment_content " `wibox.container.background` widget, but can also be done u"...
comment
-- "--"
comment_content " markup:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_wibox_widget_textbox_markup2_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property markup"
comment
-- "--"
comment_content " @tparam string markup The text to set. This can contain pan"...
comment
-- "--"
comment_content " `<b>bold</b>`). You can use `gears.string.escape` to esca"...
comment
-- "--"
comment_content " parts of it."
comment
-- "--"
comment_content " @propemits true false"
comment
-- "--"
comment_content " @see text"
function_declaration (+77 nodes collapsed)
function_declaration (+21 nodes collapsed)
comment
-- "--"
comment_content "- Set a textbox plain text."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This property renders the text as-is, it does not interpret"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_wibox_widget_textbox_text1_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " One exception are the control characters, which are interpr"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_wibox_widget_textbox_text2_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property text"
comment
-- "--"
comment_content " @tparam string text The text to display. Pango markup is ig"...
comment
-- "--"
comment_content " as-is."
comment
-- "--"
comment_content " @propemits true false"
comment
-- "--"
comment_content " @see markup"
function_declaration (+127 nodes collapsed)
function_declaration (+24 nodes collapsed)
comment
-- "--"
comment_content "- Set the text ellipsize mode."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Valid values are:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `\"start\"`"
comment
-- "--"
comment_content " * `\"middle\"`"
comment
-- "--"
comment_content " * `\"end\"`"
comment
-- "--"
comment_content " * `\"none\"`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " See Pango for additional details:"
comment
-- "--"
comment_content " [Layout.set_ellipsize](https://docs.gtk.org/Pango/method.La"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_wibox_widget_textbox_ellipsize_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property ellipsize"
comment
-- "--"
comment_content " @tparam[opt=\"end\"] string mode The ellipsize mode."
comment
-- "--"
comment_content " @propemits true false"
function_declaration (+153 nodes collapsed)
comment
-- "--"
comment_content "- Set a textbox wrap mode."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Valid values are:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * **word**"
comment
-- "--"
comment_content " * **char**"
comment
-- "--"
comment_content " * **word_char**"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @DOC_wibox_widget_textbox_wrap1_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property wrap"
comment
-- "--"
comment_content " @tparam[opt=\"word_char\"] string mode Where to wrap? After \""...
comment
-- "--"
comment_content " @propemits true false"
function_declaration (+140 nodes collapsed)
comment
-- "--"
comment_content "- The vertical text alignment."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This aligns the text within the widget's bounds. In some si"...
comment
-- "--"
comment_content " differ from aligning the widget with `wibox.container.place"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Valid values are:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `\"top\"`"
comment
-- "--"
comment_content " * `\"center\"`"
comment
-- "--"
comment_content " * `\"bottom\"`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_wibox_widget_textbox_valign1_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property valign"
comment
-- "--"
comment_content " @tparam[opt=\"center\"] string mode The vertical alignment"
comment
-- "--"
comment_content " @propemits true false"
function_declaration (+113 nodes collapsed)
comment
-- "--"
comment_content "- The horizontal text alignment."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " This aligns the text within the widget's bounds. In some si"...
comment
-- "--"
comment_content " differ from aligning the widget with `wibox.container.place"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Valid values are:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " * `\"left\"`"
comment
-- "--"
comment_content " * `\"center\"`"
comment
-- "--"
comment_content " * `\"right\"`"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_wibox_widget_textbox_align1_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property align"
comment
-- "--"
comment_content " @tparam[opt=\"left\"] string mode The horizontal alignment"
comment
-- "--"
comment_content " @propemits true false"
function_declaration (+140 nodes collapsed)
comment
-- "--"
comment_content "- Set a textbox font."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " There is multiple valid font string representation. The mos"...
comment
-- "--"
comment_content " [XFT](https://wiki.archlinux.org/title/X_Logical_Font_Descr"...
comment
-- "--"
comment_content " is also possible to use the family name, followed by the fa"...
comment
-- "--"
comment_content " such as `Monospace Bold 10`. This script lists the fonts pr"...
comment
-- "--"
comment_content " on your system:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " #!/usr/bin/env lua"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " local lgi = require(\"lgi\")"
comment
-- "--"
comment_content " local pangocairo = lgi.PangoCairo"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " local font_map = pangocairo.font_map_get_default()"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " for k, v in pairs(font_map:list_families()) do"
comment
-- "--"
comment_content " print(v:get_name(), \"monospace?: \"..tostring(v:is_mo"...
comment
-- "--"
comment_content " for k2, v2 in ipairs(v:list_faces()) do"
comment
-- "--"
comment_content " print(\" \".. v2:get_face_name())"
comment
-- "--"
comment_content " end"
comment
-- "--"
comment_content " end"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Save this script somewhere on your system, `chmod +x` it an"...
comment
-- "--"
comment_content " will list something like:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Sans monospace?: false"
comment
-- "--"
comment_content " Regular"
comment
-- "--"
comment_content " Bold"
comment
-- "--"
comment_content " Italic"
comment
-- "--"
comment_content " Bold Italic"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " In this case, the font could be `Sans 10` or `Sans Bold Ita"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Here are examples of several font families:"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_wibox_widget_textbox_font1_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " The font size is a number at the end of the font descriptio"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content "@DOC_wibox_widget_textbox_font2_EXAMPLE@"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @property font"
comment
-- "--"
comment_content " @tparam[opt=beautiful.font] string font The font descriptio"...
comment
-- "--"
comment_content " @propemits true false"
comment
-- "--"
comment_content " @usebeautiful beautiful.font The default font."
function_declaration (+102 nodes collapsed)
function_declaration (+21 nodes collapsed)
comment
-- "--"
comment_content "- Create a new textbox."
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam[opt=\"\"] string text The textbox content"
comment
-- "--"
comment_content " @tparam[opt=false] boolean ignore_markup Ignore the pango/H"...
comment
-- "--"
comment_content " @treturn table A new textbox widget"
comment
-- "--"
comment_content " @constructorfct wibox.widget.textbox"
function_declaration (+231 nodes collapsed)
function_declaration (+26 nodes collapsed)
comment
-- "--"
comment_content "- Get geometry of text label, as if textbox would be created"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " @tparam string text The text content, pango markup supporte"...
comment
-- "--"
comment_content " @tparam[opt=nil] integer|screen s The screen on which the t"...
comment
-- "--"
comment_content " @tparam[opt=beautiful.font] string font The font descriptio"...
comment
-- "--"
comment_content " @treturn table Geometry (width, height) hashtable."
comment
-- "--"
comment_content " @staticfct wibox.widget.textbox.get_markup_geometry"
function_declaration (+183 nodes collapsed)
return_statement
return "return"
expression_list
function_call
identifier "setmetatable"
arguments
( "("
identifier "textbox"
, ","
dot_index_expression
identifier "textbox"
. "."
identifier "mt"
) ")"
comment
-- "--"
comment_content " vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabs"...