Implement simple, but impressive windowing system.
[bertos.git] / gfx / win.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See README.devlib for information.
6  * -->
7  *
8  * \version $Id$
9  *
10  * \author Bernardo Innocenti <bernie@develer.com>
11  *
12  * \brief Very simple hierarchical windowing system.
13  *
14  * All functions in this module are to be intended as methods
15  * of the Window class.  Please see its documentation
16  * for a module-wise introduction.
17  *
18  * \see struct Window
19  */
20
21 /*#*
22  *#* $Log$
23  *#* Revision 1.1  2006/01/23 23:14:29  bernie
24  *#* Implement simple, but impressive windowing system.
25  *#*
26  *#*/
27
28 #ifndef GFX_WIN_H
29 #define GFX_WIN_H
30
31 #include <mware/list.h> /* Node, List */
32 #include <gfx/gfx.h>    /* coord_t */
33
34
35 EXTERN_C_BEGIN
36
37 /**
38  * Window handle and context structure.
39  *
40  * A window is a small rectangular area on the
41  * screen backed by its own bitmap where you
42  * can draw.
43  *
44  * A window can contain any number of children
45  * sub-windows that can be depth arranged with
46  * respect to their siblings.
47  *
48  * At any time, a window and all its children
49  * can be drawn into another bitmap to display
50  * a complete screen, taking depth and
51  * overlapping into account.
52  *
53  * This rendering model is commonly referred to as
54  * screen composition, and is quite popular among
55  * modern windowing systems.
56  */
57 typedef struct Window
58 {
59         Node    link;      /**< Link us with other siblings into our parent.  */
60         struct Window *parent;  /**< Our parent window.  NULL for the root window. */
61
62         Bitmap *bitmap;    /**< Pixel storage for window contents. */
63         Rect    geom;      /**< [px] Window size and position relative to parent. */
64
65         /**
66          * List of child windows, arranged by depth (front to back).
67          *
68          * Child top/left coordinates are relative to us.
69          */
70         List    children;
71
72 } Window;
73
74 /*
75  * Public function prototypes
76  */
77 void win_compose(Window *w);
78 void win_open(Window *w, Window *parent);
79 void win_close(Window *w);
80 void win_raise(Window *w);
81 void win_setGeometry(Window *w, Rect *new_geom);
82 void win_move(Window *w, coord_t left, coord_t top);
83 void win_resize(Window *w, coord_t width, coord_t height);
84 void win_create(Window *w, Bitmap *bm);
85
86 EXTERN_C_END
87
88 #endif /* GFX_WIN_H */
89