14a01681592b0d832167e3c292d60b5507a0a4f6
[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.2  2006/01/26 00:36:48  bernie
24  *#* Const correctness for some new functions.
25  *#*
26  *#* Revision 1.1  2006/01/23 23:14:29  bernie
27  *#* Implement simple, but impressive windowing system.
28  *#*
29  *#*/
30
31 #ifndef GFX_WIN_H
32 #define GFX_WIN_H
33
34 #include <mware/list.h> /* Node, List */
35 #include <gfx/gfx.h>    /* coord_t */
36
37
38 EXTERN_C_BEGIN
39
40 /**
41  * Window handle and context structure.
42  *
43  * A window is a small rectangular area on the
44  * screen backed by its own bitmap where you
45  * can draw.
46  *
47  * A window can contain any number of children
48  * sub-windows that can be depth arranged with
49  * respect to their siblings.
50  *
51  * At any time, a window and all its children
52  * can be drawn into another bitmap to display
53  * a complete screen, taking depth and
54  * overlapping into account.
55  *
56  * This rendering model is commonly referred to as
57  * screen composition, and is quite popular among
58  * modern windowing systems.
59  */
60 typedef struct Window
61 {
62         Node    link;      /**< Link us with other siblings into our parent.  */
63         struct Window *parent;  /**< Our parent window.  NULL for the root window. */
64
65         Bitmap *bitmap;    /**< Pixel storage for window contents. */
66         Rect    geom;      /**< [px] Window size and position relative to parent. */
67
68         /**
69          * List of child windows, arranged by depth (front to back).
70          *
71          * Child top/left coordinates are relative to us.
72          */
73         List    children;
74
75 } Window;
76
77 /*
78  * Public function prototypes
79  */
80 void win_compose(Window *w);
81 void win_open(Window *w, Window *parent);
82 void win_close(Window *w);
83 void win_raise(Window *w);
84 void win_setGeometry(Window *w, const Rect *new_geom);
85 void win_move(Window *w, coord_t left, coord_t top);
86 void win_resize(Window *w, coord_t width, coord_t height);
87 void win_create(Window *w, Bitmap *bm);
88
89 EXTERN_C_END
90
91 #endif /* GFX_WIN_H */
92