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
12
13
14 static GWENHYWFAR_CB
Gtk3Gui_WHSpacer_SetIntProperty(GWEN_WIDGET * w,GWEN_DIALOG_PROPERTY prop,GWEN_UNUSED int index,int value,GWEN_UNUSED int doSignal)15 int Gtk3Gui_WHSpacer_SetIntProperty(GWEN_WIDGET *w,
16 GWEN_DIALOG_PROPERTY prop,
17 GWEN_UNUSED int index,
18 int value,
19 GWEN_UNUSED int doSignal)
20 {
21 GtkWidget *g;
22
23 g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
24 assert(g);
25
26 switch (prop) {
27 case GWEN_DialogProperty_Enabled:
28 gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
29 return 0;
30
31 case GWEN_DialogProperty_Focus:
32 gtk_widget_grab_focus(GTK_WIDGET(g));
33 return 0;
34
35 default:
36 break;
37 }
38
39 DBG_WARN(GWEN_LOGDOMAIN,
40 "Function is not appropriate for this type of widget (%s)",
41 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
42 return GWEN_ERROR_INVALID;
43 }
44
45
46
47
48 static GWENHYWFAR_CB
Gtk3Gui_WHSpacer_GetIntProperty(GWEN_WIDGET * w,GWEN_DIALOG_PROPERTY prop,GWEN_UNUSED int index,int defaultValue)49 int Gtk3Gui_WHSpacer_GetIntProperty(GWEN_WIDGET *w,
50 GWEN_DIALOG_PROPERTY prop,
51 GWEN_UNUSED int index,
52 int defaultValue)
53 {
54 GtkWidget *g;
55
56 g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
57 assert(g);
58
59 switch (prop) {
60 case GWEN_DialogProperty_Enabled:
61 return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
62
63 case GWEN_DialogProperty_Focus:
64 return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
65 return 0;
66
67 default:
68 break;
69 }
70
71 DBG_WARN(GWEN_LOGDOMAIN,
72 "Function is not appropriate for this type of widget (%s)",
73 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
74 return defaultValue;
75 }
76
77
78
Gtk3Gui_WHSpacer_Setup(GWEN_WIDGET * w)79 int Gtk3Gui_WHSpacer_Setup(GWEN_WIDGET *w)
80 {
81 GtkWidget *g;
82 GWEN_WIDGET *wParent;
83
84 wParent=GWEN_Widget_Tree_GetParent(w);
85
86 g=gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
87 GWEN_Widget_AddFlags(w, GWEN_WIDGET_FLAGS_FILLX);
88
89 GWEN_Widget_SetImplData(w, GTK3_DIALOG_WIDGET_REAL, (void *) g);
90 GWEN_Widget_SetImplData(w, GTK3_DIALOG_WIDGET_CONTENT, (void *) g);
91
92 GWEN_Widget_SetSetIntPropertyFn(w, Gtk3Gui_WHSpacer_SetIntProperty);
93 GWEN_Widget_SetGetIntPropertyFn(w, Gtk3Gui_WHSpacer_GetIntProperty);
94
95 if (wParent)
96 GWEN_Widget_AddChildGuiWidget(wParent, w);
97
98 return 0;
99 }
100
101
102