FixGUI Documentation

Back to summary

import "gui/view";

View class

Super class of native views.

Subclasses: Window, Label, TextField, Button, Canvas

Object

static function is_instance(obj): Boolean
Returns true when the passed object is a view.
function destroy()
Destroys the view.

Position & size

function get_rect(): Rect
Returns the outer rectangle of the view.
function get_content_rect(): Rect
Returns the inner content rectangle of the view.
function get_inner_rect(): Rect
TODO
function set_rect(x: Integer, y: Integer, width: Integer, height: Integer)
function set_rect(rect: Rect)
Sets the outer rectangle of the view.

Visibility

function set_visible(visible: Boolean)
Sets the view visible.

View tree

function add(view: View or SubView)
function add(view: View or SubView, rect: Rect)
Adds another view into this.
function get_parent(): View
Returns the parent view or null when this is the topmost view.
function get_next(): View
Returns the next view (sibling) or null when this is the last view.
function get_prev(): View
Returns the previous view (sibling) or null when this is the first view.
function get_first_child(): View
Returns the first child view or null when this view has no children.
function get_last_child(): View
Returns the last child view or null when this view has no children.
function get_child_count(): Integer
Returns the number of child views.
function get_child(idx: Integer): View
Returns the child view at given index.

Focus

function focus()
Focuses this view (making it receive keyboard events).
function has_focus(): Boolean
Returns whether this view has keyboard focus.

Layout

function get_sizing(): ViewSizing
Returns the sizing properties for layout.
function get_scale(): Float
Returns the current scale for this view.
static function get_current_scale(): Float
Returns the current scale that would be used for a newly created window.

Mouse cursor

function set_cursor(type: Integer)
Sets the cursor type:

CURSOR_DEFAULT - default view cursor
CURSOR_ARROW - arrow cursor
CURSOR_EMPTY - empty cursor
CURSOR_TEXT - text cursor
CURSOR_CROSS - cross cursor
CURSOR_HAND - hand cursor
CURSOR_MOVE - move cursor
CURSOR_RESIZE_N - resize north cursor
CURSOR_RESIZE_NE - resize north-east cursor
CURSOR_RESIZE_E - resize east cursor
CURSOR_RESIZE_SE - resize south-east cursor
CURSOR_RESIZE_S - resize south cursor
CURSOR_RESIZE_SW - resize south-west cursor
CURSOR_RESIZE_W - resize west cursor
CURSOR_RESIZE_NW - resize north-west cursor
CURSOR_WAIT - wait cursor
function get_cursor(): Integer
Returns the cursor type.

Event handlers

virtual function handle_mouse_event(event: MouseEvent): Boolean
Override to process mouse events. Return true if you handled the event and want to stop further processing.
virtual function handle_touch_event(event: TouchEvent): Boolean
Override to process touch events. Return true if you handled the event and want to stop further processing.
virtual function handle_key_event(event: KeyEvent): Boolean
Override to process keyboard events. Return true if you handled the event and want to stop further processing.
virtual function handle_focus_event(event: FocusEvent)
Override to process focus events.