Microchip® Advanced Software Framework

win.h File Reference

Graphical Window system.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <gfx.h>
#include <membag.h>
#include "conf_win.h"

Data Structures

struct  win_area
 Geometric type describing an area on screen. More...
 
struct  win_attributes
 Window attribute data. More...
 
struct  win_clip_region
 Geometric type describing a clipping region, used when drawing windows. More...
 
struct  win_command_event
 Event data for command events, e.g. More...
 
struct  win_event
 Event data for all events. More...
 
struct  win_keyboard_event
 Event data for all keyboard events, e.g. More...
 
struct  win_point
 Geometric type describing a point or vector on screen, relative or absolute. More...
 
struct  win_pointer_event
 Event data for all pointer events, e.g. More...
 

Macros

#define WIN_ATTR_BACKGROUND   (1 << 2)
 Attribute mask for updating window background type and color/pixmap. More...
 
#define WIN_ATTR_BEHAVIOR   (1 << 4)
 Attribute mask for updating window behavior flags. More...
 
#define WIN_ATTR_CUSTOM   (1 << 5)
 Attribute mask for updating window custom data. More...
 
#define WIN_ATTR_EVENTHANDLER   (1 << 3)
 Attribute mask for updating window event handler. More...
 
#define WIN_ATTR_POSITION   (1 << 0)
 Attribute mask for updating window position. More...
 
#define WIN_ATTR_SIZE   (1 << 1)
 Attribute mask for updating window size. More...
 
#define WIN_BEHAVIOR_RAISE_ON_PRESS   (1 << 0)
 Behavior mask for raising a window if itself or children are pressed. More...
 
#define WIN_BEHAVIOR_REDRAW_PARENT   (1 << 1)
 Behavior mask for requiring redraw of parent, e.g. More...
 

Typedefs

typedef uint8_t win_attribute_mask_t
 Datatype holding attribute masks, used when updating attributes. More...
 
typedef uint8_t win_behavior_t
 Data type holding window behavior flags. More...
 
typedef bool(* win_event_handler_t )(struct win_window *win, enum win_event_type type, const void *data)
 Function pointer type for window event handlers. More...
 

Enumerations

enum  win_event_type {
  WIN_EVENT_POINTER,
  WIN_EVENT_KEYBOARD,
  WIN_EVENT_COMMAND,
  WIN_EVENT_RAISE,
  WIN_EVENT_UNRAISE,
  WIN_EVENT_GETFOCUS,
  WIN_EVENT_LOSEFOCUS,
  WIN_EVENT_DRAW,
  WIN_EVENT_ATTRIBUTES,
  WIN_EVENT_DESTROY
}
 Valid event types sent to a window event handler. More...
 
enum  win_keyboard_event_type {
  WIN_KEYBOARD_PRESS,
  WIN_KEYBOARD_RELEASE
}
 Valid keyboard event types. More...
 
enum  win_pointer_event_type {
  WIN_POINTER_PRESS,
  WIN_POINTER_MOVE,
  WIN_POINTER_RELEASE
}
 Valid pointer event types. More...
 

Functions

bool win_compute_clipping (const struct win_window *win, const struct win_area *dirty_area, struct win_clip_region *clip)
 Compute clipping region in absolute coords from window and dirty area. More...
 
bool win_compute_intersection (struct win_clip_region *clip, const struct win_area *area)
 Compute the intersection of clipping region and area. More...
 
void win_compute_union (struct win_area *area, const struct win_area *merge)
 Compute the smallest square containing two areas. More...
 
struct win_windowwin_create (struct win_window *parent, const struct win_attributes *attributes)
 Create a window and return its pointer. More...
 
void win_destroy (struct win_window *win)
 Destroy a window, its contents and children to free up memory. More...
 
struct win_areawin_get_area (const struct win_window *win)
 Get a pointer to the window area struct. More...
 
struct win_attributeswin_get_attributes (const struct win_window *win)
 Get a pointer to the window attribute struct. More...
 
void * win_get_custom_data (const struct win_window *win)
 Get window custom data. More...
 
struct win_windowwin_get_parent (const struct win_window *win)
 Get pointer to parent window, or NULL for root window. More...
 
struct win_windowwin_get_root (void)
 Get pointer to root window, i.e. More...
 
void win_grab_pointer (struct win_window *win)
 Set pointer focus window or NULL, i.e. More...
 
void win_hide (struct win_window *win)
 Hide window, clear it from screen if it was visible. More...
 
void win_inflate_area (struct win_area *area, int16_t size)
 Expands a given area in all directions by a given amount. More...
 
void win_init (void)
 Initialize window system, set up root window, hook into touch driver. More...
 
bool win_is_inside_area (const struct win_area *area, const struct win_point *point)
 Check if point is inside area. More...
 
bool win_is_inside_clip (const struct win_clip_region *clip, const struct win_point *point)
 Check if point is inside clipping region. More...
 
bool win_is_inside_window (const struct win_window *win, const struct win_point *point)
 Check if global point is inside window. More...
 
void win_lower (struct win_window *win)
 Lower window to bottom of all its siblings. More...
 
void win_process_events (void)
 Process all pending events from the internal queue. More...
 
void win_queue_command_event (const struct win_command_event *event)
 Add a command event to the internal event queue. More...
 
void win_queue_keyboard_event (const struct win_keyboard_event *event)
 Add a keyboard event to the internal event queue. More...
 
void win_queue_pointer_event (const struct win_pointer_event *event)
 Add a pointer event to the internal event queue. More...
 
void win_raise (struct win_window *win)
 Raise window to top of all its siblings. More...
 
void win_redraw (struct win_window *win)
 Redraw window and its contents, if visible. More...
 
void win_reparent (struct win_window *child, struct win_window *new_parent)
 Change a window's parent. More...
 
void win_reset_root_geometry (void)
 Reset root window geometry to fullscreen. More...
 
void win_set_area (struct win_window *win, const struct win_area *new_area, win_attribute_mask_t attribute_mask)
 Update window position and/or size. More...
 
void win_set_attributes (struct win_window *win, const struct win_attributes *new_attributes, win_attribute_mask_t attribute_mask)
 Update window attributes specified in attribute mask. More...
 
void win_set_keyboard_focus (struct win_window *win)
 Set keyboard focus window or NULL, i.e., receiver of keyboard events. More...
 
void win_show (struct win_window *win)
 Show window, draw it to screen if parent is visible. More...
 
void win_translate_win_to_root (struct win_window const *start_win, struct win_point *return_pos)
 Compute window position on root window. More...