Skip to main content

core.statusview

A status bar implementation, check core.status_view.

local statusview = require "core.statusview"

Item

(field) Item: core.statusview.item

__index

(field) __index: core.object

active_items

(field) active_items: core.statusview.item[]

context

(field) context: 'application'|'session'

current_scale

(field) current_scale: number

cursor

(field) cursor: string

dragged_panel

(field) dragged_panel: ""|"left"|"right"

get_items_warn

(field) get_items_warn: boolean

h_scrollbar

(field) h_scrollbar: core.scrollbar

Scrollbar Use Scrollbar:set_size to set the bounding box of the view the scrollbar belongs to. Use Scrollbar:update to update the scrollbar animations. Use Scrollbar:draw to draw the scrollbar. Use Scrollbar:on_mouse_pressed, Scrollbar:on_mouse_released, Scrollbar:on_mouse_moved and Scrollbar:on_mouse_left to react to mouse movements; the scrollbar won't update automatically. Use Scrollbar:set_percent to set the scrollbar location externally.

To manage all the orientations, the scrollbar changes the coordinates system accordingly. The "normal" coordinate system adapts the scrollbar coordinates as if it's always a vertical scrollbar, positioned at the end of the bounding box.


hide_messages

(field) hide_messages: boolean

hovered_item

(field) hovered_item: core.statusview.item

hovered_panel

(field) hovered_panel: ""|"left"|"right"

hovered_scrollbar

(field) hovered_scrollbar: boolean

items

(field) items: core.statusview.item[]

left_width

(field) left_width: number

left_xoffset

(field) left_xoffset: number

message

(field) message: table<integer, string|renderer.color|renderer.font>

message_timeout

(field) message_timeout: number

pointer

(field) pointer: table

position

(field) position: core.view.position

r_left_width

(field) r_left_width: number

r_right_width

(field) r_right_width: number

right_width

(field) right_width: number

right_xoffset

(field) right_xoffset: number

scroll

(field) scroll: core.view.scroll

scrollable

(field) scrollable: boolean

separator

(field) separator: string

Space separator


separator2

(field) separator2: string

Pipe separator


size

(field) size: core.view.position

super

(field) super: core.view

Base view.


tooltip

(field) tooltip: table<integer, string|renderer.color|renderer.font>

tooltip_mode

(field) tooltip_mode: boolean

v_scrollbar

(field) v_scrollbar: core.scrollbar

Scrollbar Use Scrollbar:set_size to set the bounding box of the view the scrollbar belongs to. Use Scrollbar:update to update the scrollbar animations. Use Scrollbar:draw to draw the scrollbar. Use Scrollbar:on_mouse_pressed, Scrollbar:on_mouse_released, Scrollbar:on_mouse_moved and Scrollbar:on_mouse_left to react to mouse movements; the scrollbar won't update automatically. Use Scrollbar:set_percent to set the scrollbar location externally.

To manage all the orientations, the scrollbar changes the coordinates system accordingly. The "normal" coordinate system adapts the scrollbar coordinates as if it's always a vertical scrollbar, positioned at the end of the bounding box.


visible

(field) visible: boolean

core.statusview.item

LEFT

(field) LEFT: integer

Flag to tell the item should be aligned on left side of status bar.


(field) RIGHT: integer

Flag to tell the item should be aligned on right side of status bar.


__index

(field) __index: core.object

active

(field) active: boolean

alignment

(field) alignment: `StatusView.Item.LEFT`|`StatusView.Item.RIGHT`

background_color

(field) background_color: renderer.color|nil

background_color_hover

(field) background_color_hover: renderer.color|nil

cached_item

(field) cached_item: table<integer, string|renderer.color|renderer.font>

command

(field) command: string|nil

Command to perform when the item is clicked.


name

(field) name: string

on_click

(field) on_click: fun(button: string, x: number, y: number)|nil

Function called when item is clicked and no command is set.


on_draw

(field) on_draw: fun(x: any, y: any, h: any, hovered: boolean, calc_only?: boolean):number|nil

Custom drawing that when passed calc true should return the needed width for drawing and when false should draw.


predicate

(field) predicate: fun():boolean

separator

(field) separator: `StatusView.separator2`|`StatusView.separator`

super

(field) super: core.object

tooltip

(field) tooltip: string

visible

(field) visible: boolean

w

(field) w: number

x

(field) x: number

get_item

fun(self: core.statusview.item):table<integer, string|renderer.color|renderer.font>?, table<integer, string|renderer.color|renderer.font>?

__call

(method) core.object:__call(...any)
-> core.object

Metamethod to allow using the object call as a constructor.


__tostring

(method) core.object:__tostring()
-> string

Metamethod to get a string representation of an object.


extend

(method) core.object:extend()
-> core.object

extends

(method) core.object:extends(T: any)
-> boolean

Check if the object inherits from the given type.


get_item

(method) core.statusview.item:get_item()
-> table<integer, string|renderer.color|renderer.font>

Called by the status bar each time that the item needs to be rendered, if on_draw() is set this function is obviated.


hide

(method) core.statusview.item:hide()

Do not show the item on the status bar.


is

(method) core.object:is(T: any)
-> boolean

Check if the object is strictly of the given type.


is_class_of

(method) core.object:is_class_of(T: any)
-> boolean

Check if the parameter is strictly of the object type.


is_extended_by

(method) core.object:is_extended_by(T: any)
-> boolean

Check if the parameter inherits from the object.


new

(method) core.statusview.item:new(options: core.statusview.item.options)

Constructor


set_predicate

(method) core.statusview.item:set_predicate(predicate: string|table|fun():boolean)

A condition to evaluate if the item should be displayed. If a string is given it is treated as a require import that should return a valid object which is checked against the current active view, the sames applies if a table is given. A function that returns a boolean can be used instead to perform a custom evaluation, setting to nil means always evaluates to true.


show

(method) core.statusview.item:show()

Show the item on the status bar.


core.statusview.item.options

Available StatusViewItem options.

alignment

(field) alignment: `StatusView.Item.LEFT`|`StatusView.Item.RIGHT`

command

(field) command: string|fun(button: string, x: number, y: number)|nil

The name of a valid registered command or a callback function to execute when the item is clicked.


get_item

(field) get_item: fun(self: core.statusview.item):table<integer, string|renderer.color|renderer.font>?, table<integer, string|renderer.color|renderer.font>?

A function that should return a core.statusview.styledtext element, returning an empty table is allowed.


name

(field) name: string

A unique name to identify the item on the status bar.


position

(field) position: integer?

The position in which to insert the given item on the internal table, a value of -1 inserts the item at the end which is the default. A value of 1 will insert the item at the beggining.


predicate

(field) predicate: string|table|fun():boolean

A condition to evaluate if the item should be displayed. If a string is given it is treated as a require import that should return a valid object which is checked against the current active view, the sames applies if a table is given. A function that returns a boolean can be used instead to perform a custom evaluation, setting to nil means always evaluates to true.


separator

(field) separator: (`StatusView.separator2`|`StatusView.separator`)?

The type of separator rendered to the right of the item if another item follows it.


tooltip

(field) tooltip: string?

Text displayed when mouse hovers the item.


visible

(field) visible: boolean?

Flag to show or hide the item


__call

(method) core.object:__call(...any)
-> core.object

Metamethod to allow using the object call as a constructor.


__tostring

(method) core.object:__tostring()
-> string

Metamethod to get a string representation of an object.


add_item

(method) core.statusview:add_item(options: core.statusview.item.options)
-> core.statusview.item

Adds an item to be rendered in the status bar.


clamp_scroll_position

(method) core.view:clamp_scroll_position()

display_messages

(method) core.statusview:display_messages(enable: boolean)

Enable or disable system wide messages on the status bar.


drag_panel

(method) core.statusview:drag_panel(panel: "left"|"right", dx: number)

Drag the given panel if possible.

panel:
| "left"
| "right"

draw

(method) core.statusview:draw()

draw_background

(method) core.view:draw_background(color: renderer.color)

draw_item_tooltip

(method) core.statusview:draw_item_tooltip(item: core.statusview.item)

Draw the tooltip of a given status bar item.


draw_items

(method) core.statusview:draw_items(items: table<integer, string|renderer.color|renderer.font>, right_align?: boolean, xoffset?: number, yoffset?: number)

Draws a table of styled text on the status bar starting on the left or right.


draw_scrollbar

(method) core.view:draw_scrollbar()

extend

(method) core.object:extend()
-> core.object

extends

(method) core.object:extends(T: any)
-> boolean

Check if the object inherits from the given type.


get_content_bounds

(method) core.view:get_content_bounds()
-> number
2. number
3. number
4. number

get_content_offset

(method) core.view:get_content_offset()
-> x: number
2. y: number

get_h_scrollable_size

(method) core.view:get_h_scrollable_size()
-> number

get_hovered_panel

(method) core.statusview:get_hovered_panel(x: number, y: number)
-> string

Return the currently hovered panel or empty string if none.


get_item

(method) core.statusview:get_item(name: string)
-> core.statusview.item|nil

Get an item object associated to a name or nil if not found.


get_item_visible_area

(method) core.statusview:get_item_visible_area(item: core.statusview.item)
-> x: number
2. w: number

get_items

(method) core.statusview:get_items(nowarn: boolean)
-> left: table
2. right: table

Older method of retrieving the status bar items and which is now deprecated in favour of core.status_view:add_item().


get_items_list

(method) core.statusview:get_items_list(alignment?: `StatusView.Item.LEFT`|`StatusView.Item.RIGHT`)
-> core.statusview.item[]

Get a list of items.

alignment:
-\> `StatusView.Item.LEFT`
| `StatusView.Item.RIGHT`

get_name

(method) core.view:get_name()
-> string

get_scrollable_size

(method) core.view:get_scrollable_size()
-> number

hide

(method) core.statusview:hide()

Hide the status bar


hide_items

(method) core.statusview:hide_items(names?: string|table<integer, string>)

Hides the given items from the status view or all if no names given.


is

(method) core.object:is(T: any)
-> boolean

Check if the object is strictly of the given type.


is_class_of

(method) core.object:is_class_of(T: any)
-> boolean

Check if the parameter is strictly of the object type.


is_extended_by

(method) core.object:is_extended_by(T: any)
-> boolean

Check if the parameter inherits from the object.


move_item

(method) core.statusview:move_item(name: string, position: integer, alignment?: `StatusView.Item.LEFT`|`StatusView.Item.RIGHT`)
-> moved: boolean

Move an item to a different position.

@param position — Can be negative value to position in reverse order

alignment:
-\> `StatusView.Item.LEFT`
| `StatusView.Item.RIGHT`

move_towards

(method) core.view:move_towards(t: any, k: any, dest: any, rate: any, name: any)

new

(method) core.statusview:new()

Constructor


on_file_dropped

(method) core.view:on_file_dropped(filename: string, x: number, y: number)
-> boolean

on_ime_text_editing

(method) core.view:on_ime_text_editing(text: any, start: any, length: any)

on_mouse_left

(method) core.statusview:on_mouse_left()

on_mouse_moved

(method) core.statusview:on_mouse_moved(x: number, y: number, dx: number, dy: number)

on_mouse_pressed

(method) core.statusview:on_mouse_pressed(button: 'left'|'right', x: number, y: number, clicks: integer)
-> boolean|nil

on_mouse_released

(method) core.statusview:on_mouse_released(button: 'left'|'right', x: number, y: number)

on_mouse_wheel

(method) core.statusview:on_mouse_wheel(y: number, x: number)

on_scale_change

(method) core.view:on_scale_change(new_scale: number, prev_scale: number)

Can be overriden to listen for scale change events to apply any neccesary changes in sizes, padding, etc...


on_text_input

(method) core.view:on_text_input(text: string)

on_touch_moved

(method) core.view:on_touch_moved(x: number, y: number, dx: number, dy: number, i: number)

order_items

(method) core.statusview:order_items(names: table<integer, string>)

Order the items by name


register_command_items

(method) core.statusview:register_command_items()

The predefined status bar items displayed when a command view is active.


register_docview_items

(method) core.statusview:register_docview_items()

The predefined status bar items displayed when a document view is active.


remove_item

(method) core.statusview:remove_item(name: string)
-> removed_item: core.statusview.item

Remove an item from the status view.


remove_tooltip

(method) core.statusview:remove_tooltip()

Deactivates tooltip mode.


scrollbar_dragging

(method) core.view:scrollbar_dragging()
-> boolean

scrollbar_hovering

(method) core.view:scrollbar_hovering()
-> boolean

scrollbar_overlaps_point

(method) core.view:scrollbar_overlaps_point(x: number, y: number)
-> boolean

show

(method) core.statusview:show()

Show the status bar


show_items

(method) core.statusview:show_items(names?: string|table<integer, string>)

Shows the given items from the status view or all if no names given.


show_message

(method) core.statusview:show_message(icon: string, icon_color: renderer.color, text: string)

Shows a message for a predefined amount of time.


show_tooltip

(method) core.statusview:show_tooltip(text: string|table<integer, string|renderer.color|renderer.font>)

Activates tooltip mode displaying only the given text until core.statusview:remove_tooltip() is called.


supports_text_input

(method) core.view:supports_text_input()
-> boolean

toggle

(method) core.statusview:toggle()

Toggle the visibility of the status bar


try_close

(method) core.view:try_close(do_close: any)

update

(method) core.statusview:update()

update_active_items

(method) core.statusview:update_active_items()

Set the active items that will be displayed on the left or right side of the status bar checking their predicates and performing positioning calculations for proper functioning of tooltips and clicks.


update_scrollbar

(method) core.view:update_scrollbar()