Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
widget.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2015-2021 darktable developers.
4
5 darktable is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 darktable is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with darktable. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include "lua/call.h"
22#include "lua/lua.h"
23#include <gtk/gtk.h>
25typedef struct {
26 GtkWidget *widget;
29
31
32typedef struct dt_lua_widget_type_t{
35 const char * name;
36 gboolean visible;
37 size_t alloc_size;
39 // private, do not override
41 GType gtk_type;
43
45
46
47
51void dt_lua_widget_set_callback(lua_State *L,int index,const char* name);
53void dt_lua_widget_get_callback(lua_State *L,int index,const char* name);
64
65/* wrapper to automatically implement a callback on a GTK signal */
66#define dt_lua_widget_register_gtk_callback(L,widget_type,signal_name,lua_name,callback) \
67 dt_lua_widget_register_gtk_callback_type(L,luaA_type_find(L, #widget_type),signal_name,lua_name,callback)
68void dt_lua_widget_register_gtk_callback_type(lua_State *L,luaA_Type type_id,const char* signal_name, const char* lua_name,GCallback callback);
69
70
71#define dt_lua_init_widget_type(L, widget_type,lua_type,gtk_type) \
72 dt_lua_init_widget_type_type(L, widget_type, #lua_type,gtk_type)
74
84
85
87
88// clang-format off
89// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
90// vim: shiftwidth=2 expandtab tabstop=2 cindent
91// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
92// clang-format on
93
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
char * name
Definition common/metadata.c:41
int luaA_Type
Definition lua.h:92
int lua_State
Definition lua.h:90
Definition widget.h:25
GtkWidget * widget
Definition widget.h:26
struct dt_lua_widget_type_t * type
Definition widget.h:27
Definition widget.h:32
luaA_Type associated_type
Definition widget.h:40
size_t alloc_size
Definition widget.h:37
gboolean visible
Definition widget.h:36
GType gtk_type
Definition widget.h:41
void(* gui_init)(lua_State *L)
Definition widget.h:33
void(* gui_cleanup)(lua_State *L, lua_widget widget)
Definition widget.h:34
struct dt_lua_widget_type_t * parent
Definition widget.h:38
const char * name
Definition widget.h:35
int dt_lua_widget_trigger_callback(lua_State *L)
Definition widget.c:167
void dt_lua_widget_register_gtk_callback_type(lua_State *L, luaA_Type type_id, const char *signal_name, const char *lua_name, GCallback callback)
Definition widget.c:295
void dt_lua_widget_set_callback(lua_State *L, int index, const char *name)
Definition widget.c:149
void dt_lua_widget_get_callback(lua_State *L, int index, const char *name)
Definition widget.c:159
dt_lua_widget_t * lua_widget
Definition widget.h:30
void dt_lua_widget_bind(lua_State *L, lua_widget widget)
Definition widget.c:323
void dt_lua_widget_unbind(lua_State *L, lua_widget widget)
Definition widget.c:338
int dt_lua_init_widget(lua_State *L)
Definition widget.c:348
dt_lua_widget_type_t widget_type
Definition widget.c:37
luaA_Type dt_lua_init_widget_type_type(lua_State *L, dt_lua_widget_type_t *widget_type, const char *lua_type, GType gtk_type)
Definition widget.c:120