Move unpack lwip ip address macro to macros module.
[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  *
34  * \author Bernie Innocenti <bernie@codewiz.org>
35  *
36  * \brief Very simple hierarchical windowing system.
37  *
38  * All functions in this module are to be intended as methods
39  * of the Window class.  Please see its documentation
40  * for a module-wise introduction.
41  *
42  * \see struct Window
43  */
44
45 /*#*
46  *#* $Log$
47  *#* Revision 1.3  2006/07/19 12:56:27  bernie
48  *#* Convert to new Doxygen style.
49  *#*
50  *#* Revision 1.2  2006/01/26 00:36:48  bernie
51  *#* Const correctness for some new functions.
52  *#*
53  *#* Revision 1.1  2006/01/23 23:14:29  bernie
54  *#* Implement simple, but impressive windowing system.
55  *#*
56  *#*/
57
58 #ifndef GFX_WIN_H
59 #define GFX_WIN_H
60
61 #include <struct/list.h> /* Node, List */
62 #include <gfx/gfx.h>    /* coord_t */
63
64
65 EXTERN_C_BEGIN
66
67 /**
68  * Window handle and context structure.
69  *
70  * A window is a small rectangular area on the
71  * screen backed by its own bitmap where you
72  * can draw.
73  *
74  * A window can contain any number of children
75  * sub-windows that can be depth arranged with
76  * respect to their siblings.
77  *
78  * At any time, a window and all its children
79  * can be drawn into another bitmap to display
80  * a complete screen, taking depth and
81  * overlapping into account.
82  *
83  * This rendering model is commonly referred to as
84  * screen composition, and is quite popular among
85  * modern windowing systems.
86  */
87 typedef struct Window
88 {
89         Node    link;      /**< Link us with other siblings into our parent.  */
90         struct Window *parent;  /**< Our parent window.  NULL for the root window. */
91
92         Bitmap *bitmap;    /**< Pixel storage for window contents. */
93         Rect    geom;      /**< [px] Window size and position relative to parent. */
94
95         /**
96          * List of child windows, arranged by depth (front to back).
97          *
98          * Child top/left coordinates are relative to us.
99          */
100         List    children;
101
102 } Window;
103
104 /*
105  * Public function prototypes
106  */
107 void win_compose(Window *w);
108 void win_open(Window *w, Window *parent);
109 void win_close(Window *w);
110 void win_raise(Window *w);
111 void win_setGeometry(Window *w, const Rect *new_geom);
112 void win_move(Window *w, coord_t left, coord_t top);
113 void win_resize(Window *w, coord_t width, coord_t height);
114 void win_create(Window *w, Bitmap *bm);
115
116 EXTERN_C_END
117
118 #endif /* GFX_WIN_H */
119