Module Geyser.Label

Label class to use CSS and images.


See also: Mudlet Manual

Info:

  • Author: guy

Functions

Geyser.Label:addChild (cons, container) Add a child to this label.
Geyser.Label:addMenuLabel (name, parent, index) adds a new item to the right click menu
Geyser.Label:addScrollbars (parent, layout) internal function that adds the "More..." scrollbars
Geyser.Label:adjustHeight () adjust size of the Label to the suggested height (probably the content height)
Geyser.Label:adjustSize () adjust size of the Label to the suggested size (probably the content size)
Geyser.Label:adjustWidth () adjust size of the Label to the suggested width (probably the content width)
Geyser.Label:changeMenuIndex (name, index) changes a right click menu items index
Geyser.Label:createRightClickMenu (cons) creates a right click menu for your Label
Geyser.Label:disableAutoAdjustSize () Disable autoAdjustSize
Geyser.Label:disableClickthrough () Sets label to once again intercept mouse events
Geyser.Label:displayNest (label) Displays the nested elements within label, and orients them appropriately
Geyser.Label:echo (message, color, format) Prints a message to the window.
Geyser.Label:enableAutoAdjustSize (width, height) Enable autoAdjustSize
Geyser.Label:enableClickthrough () Sets label to no longer intercept mouse events
Geyser.Label:findMenuElement (name, parent, findParent) Finds and returns a right click menu item.
Geyser.Label:getFormat () Returns a table in the format of getTextFormat which describes the default formatting created by any stylesheets.
Geyser.Label:getSizeHint () return the size hint (the suggested size) of the label
Geyser.Label:hideMenuLabel (name) hides a right click menu item
Geyser.Label:new2 (cons, container) Overridden constructor to use add2
Geyser.Label:pauseMovie () pauseMovie pauses animation on a label
Geyser.Label:rawEcho (message) raw Echo without formatting/handholding stuff that Geyser.Label:echo() does
Geyser.Label:resetCursor () Resets the to the default Mouse Cursor Shape for this label
Geyser.Label:resetToolTip () Resets the tooltip of the label
Geyser.Label:scaleMovie (autoScale) scaleMovie resizes the movie to the label size
Geyser.Label:setAlignment (alignment) Sets the alignment for the label
Geyser.Label:setBackgroundImage (imageFileName) Sets a background image for this label.
Geyser.Label:setBold (bool) Set whether or not the text in the label should be bold
Geyser.Label:setClickCallback (func, ...) Sets a callback to be used when this label is clicked.
Geyser.Label:setCursor (cursorShape) Set a predefined mouse cursor shape for this label
Geyser.Label:setCustomCursor (customCursor, hotX, hotY) Set a custom mouse cursor shape for this label.
Geyser.Label:setDoubleClickCallback (func, ...) Sets a callback to be used when this label is double clicked.
Geyser.Label:setFgColor (color) sets the color of the text on the label
Geyser.Label:setFont (font) Sets the font face for the label, use empty string to clear the font and use css/default.
Geyser.Label:setFontSize (fontSize) Set the font size for the label to use
Geyser.Label:setFormat (format) sets the formatting options for text on the label using a formatting string
Geyser.Label:setItalics (bool) Set whether or not the text in the label should be italics
Geyser.Label:setMenuAction (name, ...) Sets a action to be used when this label from the right click menu is clicked
Geyser.Label:setMoveCallback (func, ...) Sets a callback to be used when the mouse cursor is moved over this label.
Geyser.Label:setMovie (fileName) setMovie allows to set a gif animation on a label
Geyser.Label:setMovieFrame (frameNr) setMovieFrame jumps to the given frame of the animation
Geyser.Label:setMovieSpeed (speed) setMovieSpeed change the speed of the animation
Geyser.Label:setOnEnter (func, ...) Sets a callback to be used when the mouse passes over this label.
Geyser.Label:setOnLeave (func, ...) Sets a callback to be used when the mouse leaves this label.
Geyser.Label:setReleaseCallback (func, ...) Sets a callback to be used when a mouse click is released over this label.
Geyser.Label:setStrikethrough (bool) Set whether or not the text in the label should be strikethrough
Geyser.Label:setStyleSheet (css) Sets the style sheet of the label
Geyser.Label:setTiledBackgroundImage (imageFileName) Sets a tiled background image for this label.
Geyser.Label:setToolTip (txt, duration) Sets the tooltip of the label
Geyser.Label:setUnderline (bool) Set whether or not the text in the label should be underline
Geyser.Label:setWheelCallback (func, ...) Sets a callback to be used when the user scrolls over this label.
Geyser.Label:showMenuLabel (name) shows a previously hidden right click menu item
Geyser.Label:startMovie () startMovie starts animation on a label
closeAllLevels (label) closes all nested labels
closeNestChildren (label) Closes all nested labels under the given label, including any nested children those children might possess
doNestEnter (label) Internal function when a nested element is moused over to lay out the nested elements within that nested element
doNestLeave (label) Internal function when a nested element is left to renest elements and restore order
doNestScroll (label) Internal function.
doNestShow (label) Internal function when a parent nest element is clicked to lay out the nested elements within

Tables

mouseClickEvent The table returned by setClickCallback
mouseWheelEvent The table returned by setWheelCallback

Fields

Geyser.Label Represents a label like we all know and love.


Functions

Geyser.Label:addChild (cons, container)
Add a child to this label.

Parameters:

  • cons table of Geyser window options such as name, width, and height
    • name a unique name for the label
    • height height of the label - specify it as the defaults are huge
    • width width of the label - specify it as the defaults are huge
    • layoutDir specifies in which direction and axis should the labels align, where 2 letters combine into the option: first letter R for right, L for left, T for top, B for bottom, followed by the orientation: V for vertical or H for horizontal. So options are: layoutDir="RV", layoutDir="RH", layoutDir="LV", layoutDir="LH", and so on (default 'LV')
    • flyOut allows labels to show up when mouse is hovered over (default false)
    • message initial message to show on the label (default '')
    • fgColor optional foreground colour - colour to use for text on the label (default 'white')
    • bgColor optional background colour - colour of the whole label (default 'black')
    • fillBg 1 if the background is to be filled, 0 for no background (default 1)
  • container the container to add as a child
Geyser.Label:addMenuLabel (name, parent, index)
adds a new item to the right click menu

Parameters:

  • name Name of the new menu item.
  • parent name of the parent where the new item will be created in (optional)
  • index of the new menu item (optional)
Geyser.Label:addScrollbars (parent, layout)
internal function that adds the "More..." scrollbars

Parameters:

  • parent
  • layout
Geyser.Label:adjustHeight ()
adjust size of the Label to the suggested height (probably the content height)
Geyser.Label:adjustSize ()
adjust size of the Label to the suggested size (probably the content size)
Geyser.Label:adjustWidth ()
adjust size of the Label to the suggested width (probably the content width)
Geyser.Label:changeMenuIndex (name, index)
changes a right click menu items index

Parameters:

  • name Name of the menu item. If the menu item has a parent name needs to be given as "Parent.MenuItemName"
  • index the new index
Geyser.Label:createRightClickMenu (cons)
creates a right click menu for your Label

Parameters:

  • cons different parameters controlling the size and style of the right click menu elements
    • MenuWidth default menu height of your right click menu. to give levels different height add a number at the end per level usage MenuHeight1 (default "25" )
    • MenuWidth default menu height of your right click menu. to give levels different height add a number at the end per level usage MenuHeight1 (default "25" )
    • MenuFormat default font/echo format of your right click menu. different levels can use different formatting. usage MenuFormat1 MenuFormat2 (default "c10")
    • Style default styling mode of your right click menu. 2 possible modes "light" and "dark". different levels can also have different styling modes (default "light")
    • MenuStyle default style of your menu. if this is given cons.Style will be ignored. different levels can also have different MenuStyles
    • MenuItems list of right click menu items/elements. usage example: MenuItems = {"First", "Second", {"First"},"Third"}
Geyser.Label:disableAutoAdjustSize ()
Disable autoAdjustSize
Geyser.Label:disableClickthrough ()
Sets label to once again intercept mouse events
Geyser.Label:displayNest (label)
Displays the nested elements within label, and orients them appropriately

Parameters:

  • label The name of the label to use
Geyser.Label:echo (message, color, format)
Prints a message to the window. All parameters are optional and if not specified will use the last set value.

Parameters:

  • message The message to print. Can contain html formatting.
  • color The color to use. Accepts color names like "red", decho codes like "<255,0,0>", and hex codes like "#ff0000". If no color formatting is needed it is possible to use 'nocolor' which allows color formatting by using :setStyleSheet
  • format A format list to use. 'c' - center, 'l' - left, 'r' - right, 'b' - bold, 'i' - italics, 'u' - underline, 's' - strikethrough, '##' - font size. For example, "cb18" specifies center bold 18pt font be used. Order doesn't matter.
Geyser.Label:enableAutoAdjustSize (width, height)
Enable autoAdjustSize

Parameters:

  • width set width to false if just autoAdjust height
  • height set height to false if just autoAdjust width
Geyser.Label:enableClickthrough ()
Sets label to no longer intercept mouse events
Geyser.Label:findMenuElement (name, parent, findParent)
Finds and returns a right click menu item.

Parameters:

  • name name of the menu item. If the menu item has a parent name needs to be given as "Parent.MenuItemName"
  • parent only used internally the right click menu [optional]
  • findParent only used internally to return a Parent [optional]
Geyser.Label:getFormat ()
Returns a table in the format of getTextFormat which describes the default formatting created by any stylesheets. which are applied to the label. See: https://wiki.mudlet.org/w/Manual:Lua_Functions#getLabelFormat See: https://wiki.mudlet.org/w/Manual:Lua_Functions#getLabelFormat
Geyser.Label:getSizeHint ()
return the size hint (the suggested size) of the label
Geyser.Label:hideMenuLabel (name)
hides a right click menu item

Parameters:

  • name Name of the menu item. If the menu item has a parent name needs to be given as "Parent.MenuItemName"
Geyser.Label:new2 (cons, container)
Overridden constructor to use add2

Parameters:

  • cons
  • container
Geyser.Label:pauseMovie ()
pauseMovie pauses animation on a label
Geyser.Label:rawEcho (message)
raw Echo without formatting/handholding stuff that Geyser.Label:echo() does

Parameters:

  • message The message to print. Can contain html formatting.
Geyser.Label:resetCursor ()
Resets the to the default Mouse Cursor Shape for this label
Geyser.Label:resetToolTip ()
Resets the tooltip of the label
Geyser.Label:scaleMovie (autoScale)
scaleMovie resizes the movie to the label size

Parameters:

  • autoScale optional parameter to stop scaling movie if false
Geyser.Label:setAlignment (alignment)
Sets the alignment for the label

Parameters:

  • alignment Valid alignments are 'c', 'center', 'l', 'left', 'r', 'right', or '' to not include the alignment as part of the echo
Geyser.Label:setBackgroundImage (imageFileName)
Sets a background image for this label.

Parameters:

  • imageFileName The image to use for a background image.
Geyser.Label:setBold (bool)
Set whether or not the text in the label should be bold

Parameters:

  • bool True for bold
Geyser.Label:setClickCallback (func, ...)
Sets a callback to be used when this label is clicked. When this function is called by the event system, details of the event will be appended as the final argument (see mouseClickEvent)

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:setCursor (cursorShape)
Set a predefined mouse cursor shape for this label

Parameters:

Geyser.Label:setCustomCursor (customCursor, hotX, hotY)
Set a custom mouse cursor shape for this label. See: https://doc.qt.io/qt-5/qcursor.html#shape

Parameters:

  • customCursor location of your custom cursor. It's suggested to use a png with size of 32x32 which is supported on all platforms
  • hotX the X position of the cursor hotspot
  • hotY the Y position of the cursor hotspot
Geyser.Label:setDoubleClickCallback (func, ...)
Sets a callback to be used when this label is double clicked. When this function is called by the event system, details of the event will be appended as the final argument (see mouseClickEvent)

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:setFgColor (color)
sets the color of the text on the label

Parameters:

  • color the color you want the text to be. Can use color names such as "red", decho codes such as "<255,0,0>" and hex codes such as "#ff0000"
Geyser.Label:setFont (font)
Sets the font face for the label, use empty string to clear the font and use css/default. Returns true if the font changed, nil+error if not.

Parameters:

  • font font face to use
Geyser.Label:setFontSize (fontSize)
Set the font size for the label to use

Parameters:

  • fontSize the font size to use for the label. Should be a number
Geyser.Label:setFormat (format)
sets the formatting options for text on the label using a formatting string

Parameters:

  • format A format list to use. 'c' - center, 'l' - left, 'r' - right, 'b' - bold, 'i' - italics, 'u' - underline, 's' - strikethrough, '##' - font size. For example, "cb18" specifies center bold 18pt font be used. Order doesn't matter.
Geyser.Label:setItalics (bool)
Set whether or not the text in the label should be italics

Parameters:

  • bool True for italics
Geyser.Label:setMenuAction (name, ...)
Sets a action to be used when this label from the right click menu is clicked

Parameters:

  • name Name of the menu item. If the menu item has a parent name needs to be given as "Parent.MenuItemName"
  • ... Parameters to pass to the function. Will be passed directly to the setClickCallback function.

See also:

Geyser.Label:setMoveCallback (func, ...)
Sets a callback to be used when the mouse cursor is moved over this label. When this function is called by the event system, details of the event will be appended as the final argument (see mouseClickEvent)

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:setMovie (fileName)
setMovie allows to set a gif animation on a label

Parameters:

  • fileName the path to the gif file
Geyser.Label:setMovieFrame (frameNr)
setMovieFrame jumps to the given frame of the animation

Parameters:

  • frameNr is the number of the frame to jump
Geyser.Label:setMovieSpeed (speed)
setMovieSpeed change the speed of the animation

Parameters:

  • speed is the speed in percent for example 200 for 200% which means double the animation speed
Geyser.Label:setOnEnter (func, ...)
Sets a callback to be used when the mouse passes over this label.

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:setOnLeave (func, ...)
Sets a callback to be used when the mouse leaves this label.

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:setReleaseCallback (func, ...)
Sets a callback to be used when a mouse click is released over this label. When this function is called by the event system, details of the event will be appended as the final argument (see mouseClickEvent)

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:setStrikethrough (bool)
Set whether or not the text in the label should be strikethrough

Parameters:

  • bool True for strikethrough
Geyser.Label:setStyleSheet (css)
Sets the style sheet of the label

Parameters:

  • css The style sheet string
Geyser.Label:setTiledBackgroundImage (imageFileName)
Sets a tiled background image for this label.

Parameters:

  • imageFileName The image to use for a background image.
Geyser.Label:setToolTip (txt, duration)
Sets the tooltip of the label

Parameters:

  • txt the tooltip txt
  • duration the duration of the tooltip
Geyser.Label:setUnderline (bool)
Set whether or not the text in the label should be underline

Parameters:

  • bool True for underline
Geyser.Label:setWheelCallback (func, ...)
Sets a callback to be used when the user scrolls over this label. When this function is called by the event system, details of the event will be appended as the final argument (see mouseWheelEvent)

Parameters:

  • func The function to use.
  • ... Parameters to pass to the function. Must be strings or numbers.
Geyser.Label:showMenuLabel (name)
shows a previously hidden right click menu item

Parameters:

  • name Name of the menu item. If the menu item has a parent name needs to be given as "Parent.MenuItemName"
Geyser.Label:startMovie ()
startMovie starts animation on a label
closeAllLevels (label)
closes all nested labels

Parameters:

  • label
closeNestChildren (label)
Closes all nested labels under the given label, including any nested children those children might possess

Parameters:

  • label The name of the label to use
doNestEnter (label)
Internal function when a nested element is moused over to lay out the nested elements within that nested element

Parameters:

  • label The name of the label to use
doNestLeave (label)
Internal function when a nested element is left to renest elements and restore order

Parameters:

  • label The name of the label to use
doNestScroll (label)
Internal function. This is a callback from a nested labels scrollbar.

Parameters:

  • label The name of the scrollbar
doNestShow (label)
Internal function when a parent nest element is clicked to lay out the nested elements within

Parameters:

  • label The name of the label to use

Tables

mouseClickEvent
The table returned by setClickCallback

Fields:

  • x The x coordinate of the click local to the label
  • y The y coordinate of the click local to the label
  • globalX The global x coordinate of the click
  • globalY The global y coordinate of the click
  • button A string corresponding to the button clicked
  • buttons A table of strings corresponding to additional buttons held down during the click event
mouseWheelEvent
The table returned by setWheelCallback

Fields:

  • x The x coordinate of the click local to the label
  • y The y coordinate of the click local to the label
  • globalX The global x coordinate of the click
  • globalY The global y coordinate of the click
  • buttons A table of strings corresponding to additional buttons held down during the click event
  • angleDeltaX A number corresponding with the vertical wheel motion. For most devices, this number is in increments of 120
  • angleDeltaY A number corresponding with the horizontal wheel motion. For most devices, this number is in increments of 120

Fields

Geyser.Label
Represents a label like we all know and love.
  • fillBg 1 if the background is to be filled, 0 for no background.
generated by LDoc 1.5.0 Last updated 2024-04-26 00:56:21