win.h File Reference

Very simple hierarchical windowing system. More...

#include <struct/list.h>
#include <gfx/gfx.h>

Go to the source code of this file.

Data Structures

struct  Window
 Window handle and context structure. More...

Typedefs

typedef EXTERN_C_BEGIN struct
Window 
Window
 Window handle and context structure.

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.

Version:
Id
win.h 2506 2009-04-15 08:29:07Z duplo
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:
struct Window

Definition in file win.h.


Typedef Documentation

typedef EXTERN_C_BEGIN struct Window Window

Window handle and context structure.

A window is a small rectangular area on the screen backed by its own bitmap where you can draw.

A window can contain any number of children sub-windows that can be depth arranged with respect to their siblings.

At any time, a window and all its children can be drawn into another bitmap to display a complete screen, taking depth and overlapping into account.

This rendering model is commonly referred to as screen composition, and is quite popular among modern windowing systems.


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 124 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 77 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 219 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 174 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 105 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 136 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 196 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 156 of file win.c.