# FixGUI Documentation

Back to summary

`import "gui/view";`

## View class

Superclass of native views.

Subclasses: Window

- Initialization
- Position & size
- Visibility
- View tree
- Focus
- Layout
- Mouse cursor
- Event handlers

### Initialization

`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(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)
function add(view: View, rect: Rect)`
  Adds another view into this.

### 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_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.