Loading...
Searching...
No Matches
view_port.h File Reference

GUI: ViewPort API. More...

#include <input/input.h>
#include "canvas.h"

Go to the source code of this file.

Typedefs

typedef struct ViewPort ViewPort
 
typedef void(* ViewPortDrawCallback) (Canvas *canvas, void *context)
 ViewPort Draw callback.
 
typedef void(* ViewPortInputCallback) (InputEvent *event, void *context)
 ViewPort Input callback.
 

Enumerations

enum  ViewPortOrientation {
  ViewPortOrientationHorizontal , ViewPortOrientationHorizontalFlip , ViewPortOrientationVertical , ViewPortOrientationVerticalFlip ,
  ViewPortOrientationMAX
}
 

Functions

ViewPortview_port_alloc (void)
 ViewPort allocator.
 
void view_port_free (ViewPort *view_port)
 ViewPort deallocator.
 
void view_port_set_width (ViewPort *view_port, uint8_t width)
 Set view_port width.
 
uint8_t view_port_get_width (const ViewPort *view_port)
 
void view_port_set_height (ViewPort *view_port, uint8_t height)
 Set view_port height.
 
uint8_t view_port_get_height (const ViewPort *view_port)
 
void view_port_enabled_set (ViewPort *view_port, bool enabled)
 Enable or disable view_port rendering.
 
bool view_port_is_enabled (const ViewPort *view_port)
 
void view_port_draw_callback_set (ViewPort *view_port, ViewPortDrawCallback callback, void *context)
 ViewPort event callbacks.
 
void view_port_input_callback_set (ViewPort *view_port, ViewPortInputCallback callback, void *context)
 
void view_port_update (ViewPort *view_port)
 Emit update signal to GUI system.
 
void view_port_set_orientation (ViewPort *view_port, ViewPortOrientation orientation)
 Set ViewPort orientation.
 
ViewPortOrientation view_port_get_orientation (const ViewPort *view_port)
 

Detailed Description

GUI: ViewPort API.

Typedef Documentation

◆ ViewPortDrawCallback

typedef void(* ViewPortDrawCallback) (Canvas *canvas, void *context)

ViewPort Draw callback.

Warning
called from GUI thread

◆ ViewPortInputCallback

typedef void(* ViewPortInputCallback) (InputEvent *event, void *context)

ViewPort Input callback.

Warning
called from GUI thread

Enumeration Type Documentation

◆ ViewPortOrientation

Enumerator
ViewPortOrientationMAX 

Special value, don't use it.

Function Documentation

◆ view_port_alloc()

ViewPort * view_port_alloc ( void )

ViewPort allocator.

always returns view_port or stops system if not enough memory.

Returns
ViewPort instance

◆ view_port_draw_callback_set()

void view_port_draw_callback_set ( ViewPort * view_port,
ViewPortDrawCallback callback,
void * context )

ViewPort event callbacks.

Parameters
view_portViewPort instance
callbackappropriate callback function
contextcontext to pass to callback

◆ view_port_enabled_set()

void view_port_enabled_set ( ViewPort * view_port,
bool enabled )

Enable or disable view_port rendering.

Parameters
view_portViewPort instance
enabledIndicates if enabled
Warning
automatically dispatches update event

◆ view_port_free()

void view_port_free ( ViewPort * view_port)

ViewPort deallocator.

Ensure that view_port was unregistered in GUI system before use.

Parameters
view_portViewPort instance

◆ view_port_set_height()

void view_port_set_height ( ViewPort * view_port,
uint8_t height )

Set view_port height.

Will be used to limit canvas drawing area and autolayout feature.

Parameters
view_portViewPort instance
heightwanted height, 0 - auto.

◆ view_port_set_orientation()

void view_port_set_orientation ( ViewPort * view_port,
ViewPortOrientation orientation )

Set ViewPort orientation.

Parameters
view_portViewPort instance
orientationdisplay orientation, horizontal or vertical.

◆ view_port_set_width()

void view_port_set_width ( ViewPort * view_port,
uint8_t width )

Set view_port width.

Will be used to limit canvas drawing area and autolayout feature.

Parameters
view_portViewPort instance
widthwanted width, 0 - auto.

◆ view_port_update()

void view_port_update ( ViewPort * view_port)

Emit update signal to GUI system.

Rendering will happen later after GUI system process signal.

Parameters
view_portViewPort instance