1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __PROPGUI_TYPES_H__
19 #define __PROPGUI_TYPES_H__
20 
21 
22 #include "display/display-enums.h"
23 
24 #include "widgets/widgets-types.h"
25 
26 
27 /*  enums, move to propgui-enums.h if we get more  */
28 
29 typedef enum
30 {
31   GIMP_CONTROLLER_TYPE_LINE,
32   GIMP_CONTROLLER_TYPE_SLIDER_LINE,
33   GIMP_CONTROLLER_TYPE_TRANSFORM_GRID,
34   GIMP_CONTROLLER_TYPE_TRANSFORM_GRIDS,
35   GIMP_CONTROLLER_TYPE_GYROSCOPE,
36   GIMP_CONTROLLER_TYPE_FOCUS
37 } GimpControllerType;
38 
39 
40 /*  structs  */
41 
42 typedef struct
43 {
44   gdouble        value;           /*  slider value                           */
45   gdouble        min;             /*  minimal allowable slider value         */
46   gdouble        max;             /*  maximal allowable slider value         */
47 
48   gboolean       visible    : 1;  /*  slider is visible                      */
49   gboolean       selectable : 1;  /*  slider is selectable                   */
50   gboolean       movable    : 1;  /*  slider movable                         */
51   gboolean       removable  : 1;  /*  slider is removable                    */
52 
53   gboolean       autohide   : 1;  /*  whether to autohide the slider         */
54   GimpHandleType type;            /*  slider handle type                     */
55   gdouble        size;            /*  slider handle size, as a fraction of   *
56                                    *  the default size                       */
57 
58   gpointer       data;            /*  user data                              */
59 } GimpControllerSlider;
60 
61 #define GIMP_CONTROLLER_SLIDER_DEFAULT                                         \
62   ((const GimpControllerSlider) {                                              \
63     .value      = 0.0,                                                         \
64     .min        = 0.0,                                                         \
65     .max        = 1.0,                                                         \
66                                                                                \
67     .visible    = TRUE,                                                        \
68     .selectable = TRUE,                                                        \
69     .movable    = TRUE,                                                        \
70     .removable  = FALSE,                                                       \
71                                                                                \
72     .autohide   = FALSE,                                                       \
73     .type       = GIMP_HANDLE_FILLED_DIAMOND,                                  \
74     .size       = 1.0,                                                         \
75                                                                                \
76     .data       = NULL                                                         \
77   })
78 
79 
80 /*  function types  */
81 
82 typedef void (* GimpPickerCallback)                   (gpointer                    data,
83                                                        gpointer                    identifier,
84                                                        gdouble                     x,
85                                                        gdouble                     y,
86                                                        const Babl                 *sample_format,
87                                                        const GimpRGB              *color);
88 
89 typedef void (* GimpControllerLineCallback)           (gpointer                    data,
90                                                        GeglRectangle              *area,
91                                                        gdouble                     x1,
92                                                        gdouble                     y1,
93                                                        gdouble                     x2,
94                                                        gdouble                     y2);
95 typedef void (* GimpControllerSliderLineCallback)     (gpointer                    data,
96                                                        GeglRectangle              *area,
97                                                        gdouble                     x1,
98                                                        gdouble                     y1,
99                                                        gdouble                     x2,
100                                                        gdouble                     y2,
101                                                        const GimpControllerSlider *sliders,
102                                                        gint                        n_sliders);
103 typedef void (* GimpControllerTransformGridCallback)  (gpointer                    data,
104                                                        GeglRectangle              *area,
105                                                        const GimpMatrix3          *transform);
106 typedef void (* GimpControllerTransformGridsCallback) (gpointer                    data,
107                                                        GeglRectangle              *area,
108                                                        const GimpMatrix3          *transforms,
109                                                        gint                        n_transforms);
110 typedef void (* GimpControllerGyroscopeCallback)      (gpointer                    data,
111                                                        GeglRectangle              *area,
112                                                        gdouble                     yaw,
113                                                        gdouble                     pitch,
114                                                        gdouble                     roll,
115                                                        gdouble                     zoom,
116                                                        gboolean                    invert);
117 typedef void (* GimpControllerFocusCallback)          (gpointer                    data,
118                                                        GeglRectangle              *area,
119                                                        GimpLimitType               type,
120                                                        gdouble                     x,
121                                                        gdouble                     y,
122                                                        gdouble                     radius,
123                                                        gdouble                     aspect_ratio,
124                                                        gdouble                     angle,
125                                                        gdouble                     inner_limit,
126                                                        gdouble                     midpoint);
127 
128 
129 typedef GtkWidget * (* GimpCreatePickerFunc)          (gpointer                    creator,
130                                                        const gchar                *property_name,
131                                                        const gchar                *icon_name,
132                                                        const gchar                *tooltip,
133                                                        gboolean                    pick_abyss,
134                                                        GimpPickerCallback          callback,
135                                                        gpointer                    callback_data);
136 
137 typedef GCallback   (* GimpCreateControllerFunc)      (gpointer                    creator,
138                                                        GimpControllerType          controller_type,
139                                                        const gchar                *status_title,
140                                                        GCallback                   callback,
141                                                        gpointer                    callback_data,
142                                                        gpointer                   *set_func_data);
143 
144 
145 #endif /* __PROPGUI_TYPES_H__ */
146