BeRTOS
Functions
win.c File Reference

Very simple hierarchical windowing system. More...

#include "win.h"
#include <struct/list.h>

Go to the source code of this file.

Functions

void win_compose (Window *w)
 Map the contents of all child-windows into the bitmap of w.
void win_open (Window *w, Window *parent)
 Map window w into parent.
void win_close (Window *w)
 Detach window from its parent.
void win_raise (Window *w)
 Move window to the topmost position relative to its sibling.
void win_setGeometry (Window *w, const Rect *new_geom)
 Set window position and size at the same time.
void win_move (Window *w, coord_t left, coord_t top)
 Move window to specified position.
void win_resize (Window *w, coord_t width, coord_t height)
 Resize the rectangle of a window.
void win_create (Window *w, Bitmap *bm)
 Initialize a new window structure.

Detailed Description

Very simple hierarchical windowing system.

Author:
Bernie Innocenti <bernie@codewiz.org>

All functions in this module are to be intended as methods of the Window class. Please see its documentation for a module-wise introduction.

See also:
Embedded optimized general purpose data types Window

Definition in file win.c.


Function Documentation

void win_close ( Window w)

Detach window from its parent.

Closing a window causes it to become orphan of its parent. Its content will no longer appear in its parent after the next refresh cycle.

Note:
Closing a window that has not been previously opened is illegal.
See also:
win_open()

Definition at line 123 of file win.c.

void win_compose ( Window w)

Map the contents of all child-windows into the bitmap of w.

Note:
Recursively drawing children into their parent effectively damages the parent buffer.

Definition at line 76 of file win.c.

void win_create ( Window w,
Bitmap bm 
)

Initialize a new window structure.

The new window initial position is set to (0,0). The size is set to the size of the installed bitmap, or (0,0) if there's no backing store.

  • bm The bitmap to install as backing store for drawing into the window, or NULL if the window is not drawable.

Definition at line 218 of file win.c.

void win_move ( Window w,
coord_t  left,
coord_t  top 
)

Move window to specified position.

Move the window top-left corner to the pixel coordinates left and top, which are relative to the parent window.

Note:
A window can also be moved outside the borders of its parent, or at negative coordinates.
It is allowed to move an orphan window.

Definition at line 173 of file win.c.

void win_open ( Window w,
Window parent 
)

Map window w into parent.

The new window becomes the topmost window.

Note:
Opening a window twice is illegal.
See also:
win_close()

Definition at line 104 of file win.c.

void win_raise ( Window w)

Move window to the topmost position relative to its sibling.

See also:
win_move(), win_resize(), win_setGeometry()

Definition at line 135 of file win.c.

void win_resize ( Window w,
coord_t  width,
coord_t  height 
)

Resize the rectangle of a window.

The window shrinks or grows to the specified size.

Note:
Growing a window beyond the size of its backing bitmap results in unspecified behavior.
It is allowed to resize an orphan window.

Definition at line 195 of file win.c.

void win_setGeometry ( Window w,
const Rect new_geom 
)

Set window position and size at the same time.

This function is equivalent to subsequent calls to win_move() and win_resize() using the coordinates provided by the new_geom rectangle.

Note:
The xmax and ymax members of new_geom are non-inclusive, as usual for the Rect interface.
See also:
win_move()
win_resize()

Definition at line 155 of file win.c.