Module GeyserLabel
-- The Geyser Layout Manager by guy -- --
Functions
Geyser.Label:echo (message, color, format) | Prints a message to the window. |
Geyser.Label:rawEcho (message) | raw Echo without formatting/handholding stuff that Geyser.Label:echo() does |
Geyser.Label:setFont (font) | Sets the font face for the label, use empty string to clear the font and use css/default. |
Geyser.Label:setBold (bool) | Set whether or not the text in the label should be bold |
Geyser.Label:setUnderline (bool) | Set whether or not the text in the label should be underline |
Geyser.Label:setItalics (bool) | Set whether or not the text in the label should be italics |
Geyser.Label:setStrikethrough (bool) | Set whether or not the text in the label should be strikethrough |
Geyser.Label:setFontSize (fontSize) | Set the font size for the label to use |
Geyser.Label:setAlignment (alignment) | Sets the alignment for the label |
Geyser.Label:setBackgroundImage (imageFileName) | Sets a background image for this label. |
Geyser.Label:setTiledBackgroundImage (imageFileName) | Sets a tiled background image for this label. |
Geyser.Label:setClickCallback (func, ...) | Sets a callback to be used when this label is clicked. |
Geyser.Label:setDoubleClickCallback (func, ...) | Sets a callback to be used when this label is double clicked. |
Geyser.Label:setReleaseCallback (func, ...) | Sets a callback to be used when a mouse click is released over this label. |
Geyser.Label:setMoveCallback (func, ...) | Sets a callback to be used when the mouse cursor is moved over this label. |
Geyser.Label:setWheelCallback (func, ...) | Sets a callback to be used when the user scrolls over this label. |
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:setStyleSheet (css) | Sets the style sheet of the label |
Geyser.Label:setToolTip (txt, duration) | Sets the tooltip of the label |
Geyser.Label:resetToolTip () | Resets the tooltip of the label |
Geyser.Label:setCursor (cursorShape) | Set a predefined mouse cursor shape for this label |
Geyser.Label:setCustomCursor (customCursor) | Set a custom mouse cursor shape for this label |
Geyser.Label:resetCursor () | Resets the to the default Mouse Cursor Shape for this 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 |
doNestScroll (label) | Internal function. |
Geyser.Label:displayNest (label) | Displays the nested elements within label, and orients them appropiately |
doNestShow (label) | Internal function when a parent nest element is clicked to lay out the nested elements within |
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 |
Geyser.Label:new2 (cons, container) | Overridden constructor to use add2 |
Geyser.Label:addScrollbars (parent, layout) | internal function that adds the "More..." scrollbars |
Geyser.Label:addChild (cons) | |
Geyser.Label:enableClickthrough () | Sets label to no longer intercept mouse events |
Geyser.Label:disableClickthrough () | Sets label to once again intercept mouse events |
Geyser.Label:findMenuElement (name, only, findParent) | finds and returns a right click menu item |
Geyser.Label:setMenuAction (name, ...) | Sets a action to be used when this label from the right click menu is clicked |
Geyser.Label:hideMenuLabel (name) | hides a right click menu item |
Geyser.Label:showMenuLabel (name) | shows a previously hidden right click menu item |
Geyser.Label:addMenuLabel (name, parent, index) | adds a new item to the right click menu |
Geyser.Label:changeMenuIndex (name, index) | changes a right click menu items index |
Geyser.Label:createRightClickMenu (cons) | creates a right click menu for your Label |
Tables
Geyser.Label | Represents a label like we all know and love. |
mouseClickEvent | The table returned by setClickCallback |
mouseWheelEvent | The table returned by setWheelCallback |
Functions
- 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. 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: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: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:setBold (bool)
-
Set whether or not the text in the label should be bold
Parameters:
- bool True for bold
- Geyser.Label:setUnderline (bool)
-
Set whether or not the text in the label should be underline
Parameters:
- bool True for underline
- Geyser.Label:setItalics (bool)
-
Set whether or not the text in the label should be italics
Parameters:
- bool True for italics
- Geyser.Label:setStrikethrough (bool)
-
Set whether or not the text in the label should be strikethrough
Parameters:
- bool True for strikethrough
- 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: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:setTiledBackgroundImage (imageFileName)
-
Sets a tiled background image for this label.
Parameters:
- imageFileName The image to use for a background image.
- 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: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: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: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: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: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:setStyleSheet (css)
-
Sets the style sheet of the label
Parameters:
- css The style sheet string
- Geyser.Label:setToolTip (txt, duration)
-
Sets the tooltip of the label
Parameters:
- txt the tooltip txt
- duration the duration of the tooltip
- Geyser.Label:resetToolTip ()
- Resets the tooltip of the label
- Geyser.Label:setCursor (cursorShape)
-
Set a predefined mouse cursor shape for this label
see: https://wiki.mudlet.org/w/CursorShapes
Parameters:
- cursorShape the predefined cursorshape as a string
- Geyser.Label:setCustomCursor (customCursor)
-
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
- Geyser.Label:resetCursor ()
- Resets the to the default Mouse Cursor Shape for this 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
- doNestScroll (label)
-
Internal function. This is a callback from a nested
labels scrollbar.
Parameters:
- label The name of the scrollbar
- Geyser.Label:displayNest (label)
-
Displays the nested elements within label, and orients them
appropiately
Parameters:
- label The name of the label to use
- 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
- 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
- Geyser.Label:new2 (cons, container)
-
Overridden constructor to use add2
Parameters:
- cons
- container
- Geyser.Label:addScrollbars (parent, layout)
-
internal function that adds the "More..." scrollbars
Parameters:
- parent
- layout
- Geyser.Label:addChild (cons)
-
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)
- cons table of Geyser window options such as name, width, and height
- Geyser.Label:enableClickthrough ()
- Sets label to no longer intercept mouse events
- Geyser.Label:disableClickthrough ()
- Sets label to once again intercept mouse events
- Geyser.Label:findMenuElement (name, only, 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"
- only used internally the right click menu [optional]
- findParent only used internally to return a Parent [optional]
- 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: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: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: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: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 formating. 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"}
- cons different parameters controlling the size and style of the right click menu elements
Tables
- Geyser.Label
-
Represents a label like we all know and love.
Fields:
- fillBg 1 if the background is to be filled, 0 for no background.
- 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 correspinding 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 correspinding 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