Before

…lines 1–297 unchanged (297 lines)
298 self:emit_signal("widget::redraw_needed")
299 self:emit_signal("widget::layout_changed")
300 self:emit_signal("property::wrap", mode)
301 end
302end
303
304--- The textbox' vertical alignment.
305--
306-- Valid values are:
307--
308-- * **top**
309-- * **center**
310-- * **bottom**
311--
312--@DOC_wibox_widget_textbox_valign1_EXAMPLE@
313--
314-- @property valign
315-- @tparam[opt="center"] string mode Where should the textbox be drawn? "top", "center" or
316-- "bottom".
317-- @propemits true false
318
319function textbox:set_valign(mode)
320 local allowed = { top = true, center = true, bottom = true }
321 if allowed[mode] then
322 if self._private.valign == mode then
323 return
324 end
325 self._private.valign = mode
326 self:emit_signal("widget::redraw_needed")
327 self:emit_signal("widget::layout_changed")
328 self:emit_signal("property::valign", mode)
329 end
330end
331
332--- Set a textbox horizontal alignment.
333--
334-- Valid values are:
335--
336-- * **left**
337-- * **center**
338-- * **right**
339--
340--@DOC_wibox_widget_textbox_align1_EXAMPLE@
341--
342-- @property align
343-- @tparam[opt="left"] string mode Where should the textbox be drawn? "left", "center" or
344-- "right".
345-- @propemits true false
346
347function textbox:set_align(mode)
348 local allowed = { left = "LEFT", center = "CENTER", right = "RIGHT" }
349 if allowed[mode] then
350 if self._private.layout:get_alignment() == allowed[mode] then
…lines 351–481 unchanged (131 lines)

After

…lines 1–297 unchanged (297 lines)
298 self:emit_signal("widget::redraw_needed")
299 self:emit_signal("widget::layout_changed")
300 self:emit_signal("property::wrap", mode)
301 end
302end
303
304--- The vertical text alignment.
305--
306-- This aligns the text within the widget's bounds. In some situations this may
307-- differ from aligning the widget with `wibox.container.place`.
308--
309-- Valid values are:
310--
311-- * `"top"`
312-- * `"center"`
313-- * `"bottom"`
314--
315--@DOC_wibox_widget_textbox_valign1_EXAMPLE@
316--
317-- @property valign
318-- @tparam[opt="center"] string mode The vertical alignment
319-- @propemits true false
320
321function textbox:set_valign(mode)
322 local allowed = { top = true, center = true, bottom = true }
323 if allowed[mode] then
324 if self._private.valign == mode then
325 return
326 end
327 self._private.valign = mode
328 self:emit_signal("widget::redraw_needed")
329 self:emit_signal("widget::layout_changed")
330 self:emit_signal("property::valign", mode)
331 end
332end
333
334--- The horizontal text alignment.
335--
336-- This aligns the text within the widget's bounds. In some situations this may
337-- differ from aligning the widget with `wibox.container.place`.
338--
339-- Valid values are:
340--
341-- * `"left"`
342-- * `"center"`
343-- * `"right"`
344--
345--@DOC_wibox_widget_textbox_align1_EXAMPLE@
346--
347-- @property align
348-- @tparam[opt="left"] string mode The horizontal alignment
349-- @propemits true false
350
351function textbox:set_align(mode)
352 local allowed = { left = "LEFT", center = "CENTER", right = "RIGHT" }
353 if allowed[mode] then
354 if self._private.layout:get_alignment() == allowed[mode] then
…lines 355–485 unchanged (131 lines)

Before

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 textbox' vertical alignment."
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 Where should the textbox "...
comment
-- "--"
comment_content " \"bottom\"."
comment
-- "--"
comment_content " @propemits true false"
function_declaration (+113 nodes collapsed)
comment
-- "--"
comment_content "- Set a textbox horizontal alignment."
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 Where should the textbox be"...
comment
-- "--"
comment_content " \"right\"."
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"...

After

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"...