Add P{B,F,N,S}_CASE & LUAKIT_WIDGET_{,BIN_}INDEX_COMMON macros
[luakit.git] / widgets / common.h
blob97c305d51f62eb77b89090fd702d0fee321519e8
1 /*
2 * widgets/common.h - common widget functions or callbacks
4 * Copyright (C) 2010 Mason Larobina <mason.larobina@gmail.com>
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 3 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
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef LUAKIT_WIDGETS_COMMON_H
22 #define LUAKIT_WIDGETS_COMMON_H
24 #include "widget.h"
26 #define LUAKIT_WIDGET_INDEX_COMMON \
27 case L_TK_SHOW: \
28 lua_pushcfunction(L, luaH_widget_show); \
29 return 1; \
30 case L_TK_HIDE: \
31 lua_pushcfunction(L, luaH_widget_hide); \
32 return 1; \
33 case L_TK_FOCUS: \
34 lua_pushcfunction(L, luaH_widget_focus); \
35 return 1; \
36 case L_TK_DESTROY: \
37 lua_pushcfunction(L, luaH_widget_destroy); \
38 return 1;
40 #define LUAKIT_WIDGET_BIN_INDEX_COMMON \
41 case L_TK_SET_CHILD: \
42 lua_pushcfunction(L, luaH_widget_set_child); \
43 return 1; \
44 case L_TK_GET_CHILD: \
45 lua_pushcfunction(L, luaH_widget_get_child); \
46 return 1;
48 gboolean button_release_cb(GtkWidget*, GdkEventButton*, widget_t*);
49 gboolean focus_cb(GtkWidget*, GdkEventFocus*, widget_t*);
50 gboolean key_press_cb(GtkWidget*, GdkEventKey*, widget_t*);
51 gboolean key_release_cb(GtkWidget*, GdkEventKey*, widget_t*);
52 gboolean true_cb();
54 gint luaH_widget_destroy(lua_State*);
55 gint luaH_widget_focus(lua_State*);
56 gint luaH_widget_get_child(lua_State*);
57 gint luaH_widget_hide(lua_State*);
58 gint luaH_widget_set_child(lua_State*);
59 gint luaH_widget_show(lua_State*);
61 void add_cb(GtkContainer*, GtkWidget*, widget_t*);
62 void parent_set_cb(GtkWidget*, GtkObject*, widget_t*);
63 void remove_cb(GtkContainer*, GtkWidget*, widget_t*);
64 void widget_destructor(widget_t*);
67 #endif
68 // vim: ft=c:et:sw=4:ts=8:sts=4:tw=80