import "gui/view";
The Canvas class is used for creation of custom views.
You can use it directly but it is better to use the hierarchy of SubViews. The easiest way is to use the as_view method of any SubView which creates a Canvas with all the events handled automatically. You can also add any SubView directly to container Views as it internally calls this method for SubViews.
The canvas supports ability to scroll the content. However in many cases it is better to use PureScrollView to have a full control of the scrolling capability as the native support varies a lot between platforms.
Inherits from View.
static function create(): Canvas
static function create(flags: Integer): Canvas
function set_scroll_state(type: Integer, pos: Integer, max: Integer, page_size: Integer, always_show: Boolean)
SCROLL_HORIZ
or SCROLL_VERT
,
the scroll position is in pixels, the maximum position is excluding the size and the page size.
You can choose if to always show scrollbars or hide them when not needed (may not work on all
platforms or both directions are affected).
function set_scroll_position(type: Integer, pos: Integer)
SCROLL_HORIZ
or SCROLL_VERT
.
function get_scroll_position(type: Integer)
SCROLL_HORIZ
or SCROLL_VERT
.
function set_active_rendering(enable: Boolean)
function get_active_rendering(): Boolean
function set_relative_mode(enable: Boolean)
EVENT_MOUSE_RELATIVE
event type).
function get_relative_mode(): Boolean
function set_overdraw_size(amount: Integer)
function get_overdraw_size(): Integer
function set_focusable(enable: Boolean)
function is_focusable(): Boolean
function repaint()
function repaint(x: Integer, y: Integer, width: Integer, height: Integer)
function repaint(r: Rect)
virtual function handle_destroy()
virtual function handle_resize()
virtual function handle_paint(p: Painter)