gwenhywfar 5.14.1
gtk3/w_gridlayout.c
Go to the documentation of this file.
1/***************************************************************************
2 begin : Sun May 16 2010
3 copyright : (C) 2010 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * Please see toplevel file COPYING for license details *
8 ***************************************************************************/
9
10
11
20
21
23
24
25
26static GWENHYWFAR_CB
29 GWEN_UNUSED int index,
30 int value,
31 GWEN_UNUSED int doSignal)
32{
33 GtkWidget *g;
34
36 assert(g);
37
38 switch (prop) {
40 gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
41 return 0;
42
44 gtk_widget_grab_focus(GTK_WIDGET(g));
45 return 0;
46
47 default:
48 break;
49 }
50
52 "Function is not appropriate for this type of widget (%s)",
54 return GWEN_ERROR_INVALID;
55}
56
57
58
59
60static GWENHYWFAR_CB
63 GWEN_UNUSED int index,
64 int defaultValue)
65{
66 GtkWidget *g;
67
69 assert(g);
70
71 switch (prop) {
73 return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
74
76 return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
77 return 0;
78
79 default:
80 break;
81 }
82
84 "Function is not appropriate for this type of widget (%s)",
86 return defaultValue;
87}
88
89
90
91static GWENHYWFAR_CB
94 GWEN_UNUSED int index,
95 GWEN_UNUSED const char *value,
96 GWEN_UNUSED int doSignal)
97{
98 GtkWidget *g;
99
101 assert(g);
102
104 "Function is not appropriate for this type of widget (%s)",
106 return GWEN_ERROR_INVALID;
107}
108
109
110
111static GWENHYWFAR_CB
114 GWEN_UNUSED int index,
115 const char *defaultValue)
116{
117 GtkWidget *g;
118
120 assert(g);
121
123 "Function is not appropriate for this type of widget (%s)",
125 return defaultValue;
126}
127
128
129
130static GWENHYWFAR_CB
132{
134 GtkWidget *g;
135 GtkWidget *gChild;
136 int x;
137 int y;
138
139 assert(w);
141 assert(xw);
142
143
145 assert(g);
146
147 gChild=GTK_WIDGET(GWEN_Widget_GetImplData(wChild, GTK3_DIALOG_WIDGET_REAL));
148 assert(gChild);
149
150 if (xw->sortByRow) {
151 /* fill rows, enter next column if column full */
152 y=(xw->currentRow)++;
153 if (y>=xw->allocatedRows) {
154 xw->currentRow=0;
155 y=(xw->currentRow)++;
156 xw->currentColumn++;
157 }
158
159 x=xw->currentColumn;
160 if (x>=xw->allocatedColumns) {
161 xw->allocatedColumns=x+1;
162 }
163 }
164 else {
165 /* fill columns, enter next row if row full */
166 x=(xw->currentColumn)++;
167 if (x>=xw->allocatedColumns) {
168 xw->currentColumn=0;
169 x=(xw->currentColumn)++;
170 xw->currentRow++;
171 }
172
173 y=xw->currentRow;
174 if (y>=xw->allocatedRows) {
175 xw->allocatedRows=y+1;
176 }
177 }
178
179 Gtk3Gui_ApplyFlags(GTK_WIDGET(gChild), GWEN_Widget_GetFlags(wChild));
180 gtk_grid_attach(GTK_GRID(g), gChild, x, y, 1, 1);
181
182 return 0;
183}
184
185
186
187
188static GWENHYWFAR_CB
190{
192
193 xw=(GTK3_GRIDLAYOUT_WIDGET *) p;
194
196}
197
198
199
201{
202 GtkWidget *g;
203 GWEN_WIDGET *wParent;
205 int rows;
206 int cols;
207
210
211 wParent=GWEN_Widget_Tree_GetParent(w);
213 rows=GWEN_Widget_GetRows(w);
214
215 if (rows>0) {
216 xw->sortByRow=1;
217 xw->allocatedRows=rows;
218 xw->allocatedColumns=1;
219 }
220 else {
221 xw->sortByRow=0;
222 xw->allocatedColumns=cols;
223 xw->allocatedRows=1;
224 }
225
226 g=gtk_grid_new();
227
230
236
237 if (wParent)
239
240 return 0;
241}
242
243
#define DBG_WARN(dbg_logger, format,...)
Definition debug.h:125
GWEN_DIALOG_PROPERTY
Definition dialog.h:260
@ GWEN_DialogProperty_Enabled
Definition dialog.h:267
@ GWEN_DialogProperty_Focus
Definition dialog.h:276
#define GWEN_ERROR_INVALID
Definition error.h:67
static GWENHYWFAR_CB void Gtk3Gui_WGridLayout_FreeData(GWEN_UNUSED void *bp, void *p)
static GWENHYWFAR_CB int Gtk3Gui_WGridLayout_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int value, GWEN_UNUSED int doSignal)
static GWENHYWFAR_CB const char * Gtk3Gui_WGridLayout_GetCharProperty(GWEN_WIDGET *w, GWEN_UNUSED GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, const char *defaultValue)
static GWENHYWFAR_CB int Gtk3Gui_WGridLayout_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
static GWENHYWFAR_CB int Gtk3Gui_WGridLayout_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, int defaultValue)
static GWENHYWFAR_CB int Gtk3Gui_WGridLayout_SetCharProperty(GWEN_WIDGET *w, GWEN_UNUSED GWEN_DIALOG_PROPERTY prop, GWEN_UNUSED int index, GWEN_UNUSED const char *value, GWEN_UNUSED int doSignal)
int Gtk3Gui_WGridLayout_Setup(GWEN_WIDGET *w)
#define GTK3_DIALOG_WIDGET_CONTENT
#define GTK3_DIALOG_WIDGET_REAL
void Gtk3Gui_ApplyFlags(GtkWidget *g, uint32_t flags)
#define GWEN_UNUSED
#define GWENHYWFAR_CB
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition inherit.h:300
#define GWEN_INHERIT(bt, t)
Definition inherit.h:264
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition inherit.h:279
#define GWEN_LOGDOMAIN
Definition logger.h:32
#define GWEN_FREE_OBJECT(varname)
Definition memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition memory.h:55
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition widget.c:740
int GWEN_Widget_GetColumns(const GWEN_WIDGET *w)
Definition widget.c:203
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition widget.c:710
GWEN_WIDGET_ADDCHILDGUIWIDGET_FN GWEN_Widget_SetAddChildGuiWidgetFn(GWEN_WIDGET *w, GWEN_WIDGET_ADDCHILDGUIWIDGET_FN fn)
Definition widget.c:755
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition widget.c:836
void GWEN_Widget_SetImplData(GWEN_WIDGET *w, int index, void *ptr)
Store a pointer with the widget.
Definition widget.c:136
void * GWEN_Widget_GetImplData(const GWEN_WIDGET *w, int index)
Definition widget.c:122
GWEN_WIDGET_SETINTPROPERTY_FN GWEN_Widget_SetSetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETINTPROPERTY_FN fn)
Definition widget.c:695
uint32_t GWEN_Widget_GetFlags(const GWEN_WIDGET *w)
Definition widget.c:149
const char * GWEN_Widget_Type_toString(GWEN_WIDGET_TYPE t)
Definition widget.c:456
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition widget.c:185
int GWEN_Widget_GetRows(const GWEN_WIDGET *w)
Definition widget.c:221
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition widget.c:725
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34