awful.titlebar: use pairs instead of ipairs
[awesome.git] / widget.h
blob78430c2dda836c034d851fbdbff5643bf324d83b
1 /*
2 * widget.h - widget managing header
4 * Copyright © 2007-2008 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 "structs.h"
27 #define WIDGET_CACHE_EMBEDDED (1<<3)
29 struct widget_node_t
31 /** The widget */
32 widget_t *widget;
33 /** The geometry where the widget was drawn */
34 area_t geometry;
37 /** Delete a widget structure.
38 * \param widget The widget to destroy.
40 static inline void
41 widget_delete(widget_t **widget)
43 if((*widget)->destructor)
44 (*widget)->destructor(*widget);
45 button_array_wipe(&(*widget)->buttons);
46 p_delete(&(*widget)->name);
47 p_delete(widget);
50 DO_RCNT(widget_t, widget, widget_delete)
52 void widget_invalidate_cache(int, int);
53 int widget_calculate_offset(int, int, int, int);
54 void widget_common_new(widget_t *);
55 void widget_render(widget_node_array_t *, draw_context_t *, xcb_gcontext_t, xcb_drawable_t, int, orientation_t, int, int, wibox_t *);
57 int luaA_widget_userdata_new(lua_State *, widget_t *);
58 void luaA_table2widgets(lua_State *, widget_node_array_t *);
60 void widget_invalidate_bywidget(widget_t *);
62 widget_constructor_t textbox_new;
63 widget_constructor_t progressbar_new;
64 widget_constructor_t graph_new;
65 widget_constructor_t systray_new;
66 widget_constructor_t imagebox_new;
68 /** Delete a widget node structure.
69 * \param node The node to destroy.
71 static inline void
72 widget_node_delete(widget_node_t *node)
74 widget_unref(&node->widget);
77 ARRAY_FUNCS(widget_node_t, widget_node, widget_node_delete)
79 #endif
81 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80