change codename
[awesome.git] / wibox.h
blob50cf3bbc32a5bd739ee6170bf2cbe5b0742251c2
1 /*
2 * wibox.h - wibox functions 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_STATUSBAR_H
23 #define AWESOME_STATUSBAR_H
25 #include "widget.h"
26 #include "swindow.h"
28 /** Wibox types */
29 typedef enum
31 WIBOX_TYPE_NORMAL = 0,
32 WIBOX_TYPE_TITLEBAR
33 } wibox_type_t;
35 /** Wibox type */
36 struct wibox_t
38 /** Lua references */
39 luaA_ref_array_t refs;
40 /** Ontop */
41 bool ontop;
42 /** Visible */
43 bool isvisible;
44 /** Position */
45 position_t position;
46 /** Wibox type */
47 wibox_type_t type;
48 /** Window */
49 simple_window_t sw;
50 /** Alignment */
51 alignment_t align;
52 /** Screen */
53 screen_t *screen;
54 /** Widget list */
55 widget_node_array_t widgets;
56 luaA_ref widgets_table;
57 /** Widget the mouse is over */
58 widget_t *mouse_over;
59 /** Mouse over event handler */
60 luaA_ref mouse_enter, mouse_leave;
61 /** Need update */
62 bool need_update;
63 /** Cursor */
64 char *cursor;
65 /** Background image */
66 image_t *bg_image;
67 /* Banned? used for titlebars */
68 bool isbanned;
69 /** Button bindings */
70 button_array_t buttons;
73 void wibox_unref_simplified(wibox_t **);
75 DO_ARRAY(wibox_t *, wibox, wibox_unref_simplified)
77 void wibox_refresh(void);
78 void wibox_update_positions(void);
80 void luaA_wibox_invalidate_byitem(lua_State *, const void *);
82 void wibox_position_update(wibox_t *);
83 wibox_t * wibox_getbywin(xcb_window_t);
84 void wibox_detach(wibox_t *);
86 static inline void
87 wibox_moveresize(wibox_t *wibox, area_t geometry)
89 if(wibox->sw.window && !wibox->isbanned)
90 simplewindow_moveresize(&wibox->sw, geometry);
91 else if(wibox->sw.window && wibox->isbanned)
93 area_t real_geom = geometry;
94 geometry.x = -geometry.width;
95 geometry.y = -geometry.height;
96 simplewindow_moveresize(&wibox->sw, geometry);
97 wibox->sw.geometry = real_geom;
99 else
100 wibox->sw.geometry = geometry;
101 wibox->need_update = true;
104 LUA_OBJECT_FUNCS(wibox_t, wibox, "wibox")
106 #endif
107 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80