Skip to main content

core.view

Base view.

local view = require "core.view"

__index

(field) __index: core.object

context

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

current_scale

(field) current_scale: number

cursor

(field) cursor: 'arrow'|'hand'|'ibeam'|'sizeh'|'sizev'

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.


hovered_scrollbar

(field) hovered_scrollbar: boolean

scrollable

(field) scrollable: boolean

size

(field) size: core.view.position

super

(field) super: core.object

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.


core.view.position

x

(field) x: number

y

(field) y: number

core.view.scroll

to

(field) to: core.view.position

x

(field) x: number

y

(field) y: number

core.view.scrollbar

h

(field) h: core.view.thumbtrack

w

(field) w: core.view.thumbtrackwidth

x

(field) x: core.view.thumbtrack

y

(field) y: core.view.thumbtrack

core.view.thumbtrack

thumb

(field) thumb: number

track

(field) track: number

core.view.thumbtrackwidth

thumb

(field) thumb: number

to

(field) to: core.view.thumbtrack

track

(field) track: number

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


clamp_scroll_position

(method) core.view:clamp_scroll_position()

draw

(method) core.view:draw()

draw_background

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

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_name

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

get_scrollable_size

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

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_towards

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

new

(method) core.view:new()

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.view:on_mouse_left()

on_mouse_moved

(method) core.view:on_mouse_moved(x: number, y: number, dx: number, dy: number)
-> boolean|nil

on_mouse_pressed

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

return boolean

button:
| 'left'
| 'right'

on_mouse_released

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

on_mouse_wheel

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

@param y — Vertical scroll delta; positive is "up"

@param x — Horizontal scroll delta; positive is "left"

@return — Capture event


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)

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

supports_text_input

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

try_close

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

update

(method) core.view:update()

update_scrollbar

(method) core.view:update_scrollbar()