Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
icon_cell_renderer.c
Go to the documentation of this file.
1/*
2 This file is part of the Ansel project.
3 Copyright (C) 2025 Aurélien PIERRE.
4
5 Ansel 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 Ansel 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 Ansel. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "icon_cell_renderer.h"
19
21{
22 GtkCellRendererPixbuf parent_instance; /* mandatory first member */
23 /* add private data here if you need it */
24};
25
26enum
27{
30};
31static guint signals[N_SIGNALS];
32
33static gboolean dtgtk_cell_renderer_button_activate(GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget,
34 const gchar *path, const GdkRectangle *bg,
35 const GdkRectangle *area, GtkCellRendererState flags)
36{
37 gboolean handled = FALSE;
38
39 g_signal_emit(cell, signals[DTGTK_RENDERER_BUTTON_ACTIVATE], 0, /* detail */
40 event, widget, path, bg, area, flags, &handled); /* return value from handlers */
41
42 /* propagate TRUE/FALSE back to GTK */
43 return handled;
44}
45
46G_DEFINE_TYPE(DtGtkCellRendererButton, dtgtk_cell_renderer_button, GTK_TYPE_CELL_RENDERER_PIXBUF)
47
48static void dtgtk_cell_renderer_button_class_init(DtGtkCellRendererButtonClass *klass)
49{
50 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(klass);
51 cell_class->activate = dtgtk_cell_renderer_button_activate;
52
54 = g_signal_new("activate", /* signal name */
55 G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, /* act-like */
56 0, /* class_offset */
57 NULL, NULL, NULL, /* no accumulator*/
58 G_TYPE_BOOLEAN, /* return type */
59 6, /* n_params */
60 GDK_TYPE_EVENT, /* event */
61 GTK_TYPE_WIDGET, /* widget */
62 G_TYPE_STRING, /* path */
63 GDK_TYPE_RECTANGLE, /* background */
64 GDK_TYPE_RECTANGLE, /* cell_area */
65 GTK_TYPE_CELL_RENDERER_STATE); /* flags enum */
66}
67
68static void dtgtk_cell_renderer_button_init(DtGtkCellRendererButton *self)
69{
70 g_object_set(self, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
71}
72
73GtkCellRenderer *dtgtk_cell_renderer_button_new(void)
74{
75 return g_object_new(DTGTK_TYPE_CELL_RENDERER_BUTTON, NULL);
76}
#define FALSE
Definition ashift_lsd.c:158
G_DEFINE_TYPE(GtkDarktableDrawingArea, dtgtk_drawing_area, GTK_TYPE_DRAWING_AREA)
static guint signals[N_SIGNALS]
static void dtgtk_cell_renderer_button_init(DtGtkCellRendererButton *self)
static gboolean dtgtk_cell_renderer_button_activate(GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, const GdkRectangle *bg, const GdkRectangle *area, GtkCellRendererState flags)
GtkCellRenderer * dtgtk_cell_renderer_button_new(void)
static void dtgtk_cell_renderer_button_class_init(DtGtkCellRendererButtonClass *klass)
@ DTGTK_RENDERER_BUTTON_ACTIVATE
@ N_SIGNALS
#define DTGTK_TYPE_CELL_RENDERER_BUTTON
dt_mipmap_buffer_dsc_flags flags
Definition mipmap_cache.c:4
struct _GtkWidget GtkWidget
Definition splash.h:29
GtkCellRendererPixbuf parent_instance