Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
widget.c File Reference
#include "control/control.h"
#include "lua/call.h"
#include "lua/modules.h"
#include "lua/types.h"
#include "lua/widget/common.h"
#include "stdarg.h"
+ Include dependency graph for widget.c:

Functions

static void cleanup_widget_sub (lua_State *L, dt_lua_widget_type_t *widget_type, lua_widget widget)
 
static void init_widget_sub (lua_State *L, dt_lua_widget_type_t *widget_type)
 
static void on_destroy (GtkWidget *widget, gpointer user_data)
 
static gboolean on_destroy_wrapper (gpointer user_data)
 
static int widget_gc (lua_State *L)
 
static int get_widget_params (lua_State *L)
 
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)
 
static int new_widget (lua_State *L)
 
void dt_lua_widget_set_callback (lua_State *L, int index, const char *name)
 
void dt_lua_widget_get_callback (lua_State *L, int index, const char *name)
 
int dt_lua_widget_trigger_callback (lua_State *L)
 
static int reset_member (lua_State *L)
 
static int tooltip_member (lua_State *L)
 
static int name_member (lua_State *L)
 
static int visible_member (lua_State *L)
 
static int sensitive_member (lua_State *L)
 
int dt_lua_widget_tostring_member (lua_State *L)
 
static int gtk_signal_member (lua_State *L)
 
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)
 
int widget_call (lua_State *L)
 
void dt_lua_widget_bind (lua_State *L, lua_widget widget)
 
void dt_lua_widget_unbind (lua_State *L, lua_widget widget)
 
int dt_lua_init_widget (lua_State *L)
 

Variables

dt_lua_widget_type_t widget_type
 

Function Documentation

◆ cleanup_widget_sub()

static void cleanup_widget_sub ( lua_State L,
dt_lua_widget_type_t widget_type,
lua_widget  widget 
)
static

◆ dt_lua_init_widget()

◆ dt_lua_init_widget_type_type()

◆ dt_lua_widget_bind()

void dt_lua_widget_bind ( lua_State L,
lua_widget  widget 
)

Bind a lua widget, i.e prevent it from being destroyed by the lua GC. after that, the lua object is guaranteed to exist until it is unbound or the associated GtkWidget is destroyed

You want to call that on widget you add to the UI so they stay alive.

References dt_lua_widget_t::widget.

Referenced by _guides_gui_callback(), register_lib(), register_pref_sub(), and register_storage().

◆ dt_lua_widget_get_callback()

void dt_lua_widget_get_callback ( lua_State L,
int  index,
const char *  name 
)

push the callback for name "name" on the stack, or nil if not available

References dt_lua_isa, and name.

Referenced by gtk_signal_member(), and reset_member().

◆ dt_lua_widget_register_gtk_callback_type()

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 
)

◆ dt_lua_widget_set_callback()

void dt_lua_widget_set_callback ( lua_State L,
int  index,
const char *  name 
)

pop a function from the top of the stack, register as a callback named "name" for the object (not type) at index index

References dt_lua_isa, and name.

Referenced by container_init(), gtk_signal_member(), register_pref_sub(), and reset_member().

◆ dt_lua_widget_tostring_member()

int dt_lua_widget_tostring_member ( lua_State L)

References dt_lua_widget_t::widget.

Referenced by dt_lua_init_widget().

◆ dt_lua_widget_trigger_callback()

int dt_lua_widget_trigger_callback ( lua_State L)

triggers a callback for the object, first param : the lua_storage to trigger second param : the name of the event to fire other params : passed to the callback returns nothing, might raise exceptions

this function is meant to be called via dt_lua_async_call if needed

References dt_lua_redraw_screen(), dt_lua_treated_pcall(), and name.

Referenced by changed_callback(), clicked_callback(), clicked_callback(), container_reset(), file_set_callback(), gui_reset_wrapper(), gui_reset_wrapper(), on_child_added(), on_child_removed(), reset_widget_lua(), response_callback_lua(), and update_widget_lua().

◆ dt_lua_widget_unbind()

void dt_lua_widget_unbind ( lua_State L,
lua_widget  widget 
)

Referenced by widget_gc().

◆ get_widget_params()

◆ gtk_signal_member()

static int gtk_signal_member ( lua_State L)
static

◆ init_widget_sub()

static void init_widget_sub ( lua_State L,
dt_lua_widget_type_t widget_type 
)
static

◆ name_member()

static int name_member ( lua_State L)
static

References dt_lua_widget_t::widget.

Referenced by dt_lua_init_widget().

◆ new_widget()

static int new_widget ( lua_State L)
static

◆ on_destroy()

static void on_destroy ( GtkWidget *  widget,
gpointer  user_data 
)
static

Referenced by get_widget_params().

◆ on_destroy_wrapper()

static gboolean on_destroy_wrapper ( gpointer  user_data)
static

Referenced by widget_gc().

◆ reset_member()

static int reset_member ( lua_State L)
static

◆ sensitive_member()

static int sensitive_member ( lua_State L)
static

References dt_lua_widget_t::widget.

Referenced by dt_lua_init_widget().

◆ tooltip_member()

static int tooltip_member ( lua_State L)
static

References dt_lua_widget_t::widget.

Referenced by dt_lua_init_widget().

◆ visible_member()

static int visible_member ( lua_State L)
static

References FALSE, TRUE, and dt_lua_widget_t::widget.

Referenced by dt_lua_init_widget().

◆ widget_call()

int widget_call ( lua_State L)

Referenced by dt_lua_init_widget().

◆ widget_gc()

Variable Documentation

◆ widget_type

dt_lua_widget_type_t widget_type
Initial value:
= {
.name = "widget",
.gui_init = NULL,
.gui_cleanup = NULL,
.alloc_size = sizeof(dt_lua_widget_t),
.parent = NULL
}
Definition widget.h:25

TODO use name to save/restore states as pref like other widgets have a way to save presets luastorage can't save presets dt_ui_section_label : make new lua widget - Done widget names : implement for CSS ? - Done

Referenced by cleanup_widget_sub(), dt_lua_init_widget(), dt_lua_init_widget_type_type(), get_widget_params(), and init_widget_sub().