Refactor BeRTOS to be in his own directory.
[bertos.git] / bertos / gfx / win.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \version $Id$
34  *
35  * \author Bernardo Innocenti <bernie@develer.com>
36  *
37  * \brief Very simple hierarchical windowing system.
38  *
39  * All functions in this module are to be intended as methods
40  * of the Window class.  Please see its documentation
41  * for a module-wise introduction.
42  *
43  * \see struct Window
44  */
45
46 /*#*
47  *#* $Log$
48  *#* Revision 1.3  2006/07/19 12:56:27  bernie
49  *#* Convert to new Doxygen style.
50  *#*
51  *#* Revision 1.2  2006/01/26 00:36:48  bernie
52  *#* Const correctness for some new functions.
53  *#*
54  *#* Revision 1.1  2006/01/23 23:14:29  bernie
55  *#* Implement simple, but impressive windowing system.
56  *#*
57  *#*/
58
59 #ifndef GFX_WIN_H
60 #define GFX_WIN_H
61
62 #include <mware/list.h> /* Node, List */
63 #include <gfx/gfx.h>    /* coord_t */
64
65
66 EXTERN_C_BEGIN
67
68 /**
69  * Window handle and context structure.
70  *
71  * A window is a small rectangular area on the
72  * screen backed by its own bitmap where you
73  * can draw.
74  *
75  * A window can contain any number of children
76  * sub-windows that can be depth arranged with
77  * respect to their siblings.
78  *
79  * At any time, a window and all its children
80  * can be drawn into another bitmap to display
81  * a complete screen, taking depth and
82  * overlapping into account.
83  *
84  * This rendering model is commonly referred to as
85  * screen composition, and is quite popular among
86  * modern windowing systems.
87  */
88 typedef struct Window
89 {
90         Node    link;      /**< Link us with other siblings into our parent.  */
91         struct Window *parent;  /**< Our parent window.  NULL for the root window. */
92
93         Bitmap *bitmap;    /**< Pixel storage for window contents. */
94         Rect    geom;      /**< [px] Window size and position relative to parent. */
95
96         /**
97          * List of child windows, arranged by depth (front to back).
98          *
99          * Child top/left coordinates are relative to us.
100          */
101         List    children;
102
103 } Window;
104
105 /*
106  * Public function prototypes
107  */
108 void win_compose(Window *w);
109 void win_open(Window *w, Window *parent);
110 void win_close(Window *w);
111 void win_raise(Window *w);
112 void win_setGeometry(Window *w, const Rect *new_geom);
113 void win_move(Window *w, coord_t left, coord_t top);
114 void win_resize(Window *w, coord_t width, coord_t height);
115 void win_create(Window *w, Bitmap *bm);
116
117 EXTERN_C_END
118
119 #endif /* GFX_WIN_H */
120