change codename
[awesome.git] / widget.h
blob0c4aface999ea7475b1685f6982f4bce3da6467b
1 /*
2 * widget.h - widget managing header
4 * Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
6 * This program 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.
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.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef AWESOME_WIDGET_H
23 #define AWESOME_WIDGET_H
25 #include "button.h"
26 #include "draw.h"
27 #include "common/tokenize.h"
29 typedef widget_t *(widget_constructor_t)(widget_t *);
30 typedef void (widget_destructor_t)(widget_t *);
31 typedef struct widget_node widget_node_t;
33 /** Widget */
34 struct widget_t
36 LUA_OBJECT_HEADER
37 /** Widget type is constructor */
38 widget_constructor_t *type;
39 /** Widget destructor */
40 widget_destructor_t *destructor;
41 /** Extents function */
42 area_t (*extents)(lua_State *, widget_t *);
43 /** Draw function */
44 void (*draw)(widget_t *, draw_context_t *, area_t, wibox_t *);
45 /** Index function */
46 int (*index)(lua_State *, awesome_token_t);
47 /** Newindex function */
48 int (*newindex)(lua_State *, awesome_token_t);
49 /** Misc private data */
50 void *data;
51 /** Button bindings */
52 button_array_t buttons;
53 /** True if the widget is visible */
54 bool isvisible;
57 struct widget_node
59 /** The widget object */
60 widget_t *widget;
61 /** The geometry where the widget was drawn */
62 area_t geometry;
64 DO_ARRAY(widget_node_t, widget_node, DO_NOTHING)
66 widget_t *widget_getbycoords(orientation_t, widget_node_array_t *, int, int, int16_t *, int16_t *);
67 void widget_render(wibox_t *);
69 void widget_invalidate_bywidget(widget_t *);
70 void widget_invalidate_bytype(widget_constructor_t *);
72 lua_class_t widget_class;
73 void widget_class_setup(lua_State *);
75 widget_constructor_t widget_textbox;
76 widget_constructor_t widget_progressbar;
77 widget_constructor_t widget_graph;
78 widget_constructor_t widget_systray;
79 widget_constructor_t widget_imagebox;
81 #endif
83 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80