gwenhywfar 5.12.0
w_progressbar.mm
Go to the documentation of this file.
1/***************************************************************************
2 begin : August 10 2010
3 copyright : (C) 2010 by Samuel Strupp
4
5 ***************************************************************************
6 * Please see toplevel file COPYING for license details *
7 ***************************************************************************/
8
9
10#import "CocoaProgressbar.h"
11
12
19
20
22
23
24
25static GWENHYWFAR_CB
28 int index,
29 int value,
30 int doSignal) {
31 CocoaProgressbar *progressbar;
32 W_PROGRESSBAR *xw;
33
34 assert(w);
36 assert(xw);
37
39 assert(progressbar);
40
41 switch(prop) {
43 return 0;
44
46 return 0;
47
49 NSRect frame = [progressbar frame];
50 frame.size.width = value;
51 [progressbar setFrame:frame];
52 }
53 return 0;
54
56 NSRect frame = [progressbar frame];
57 frame.size.height = value;
58 [progressbar setFrame:frame];
59 }
60
61 return 0;
62
64 double d;
65
66 xw->currentValue=value;
67 d=(double)value;
68 [progressbar setDoubleValue:d];
69 //NSLog(@"progressbar value = %f",d);
70 return 0;
71 }
72
74 double d;
75
76 xw->minValue=value;
77 d=(double)value;
78 [progressbar setMinValue:d];
79 //NSLog(@"progressbar min value = %f",d);
80 return 0;
81 }
82
84 double d;
85
86 xw->maxValue=value;
87 d=(double)value;
88 [progressbar setMaxValue:d];
89 //NSLog(@"progressbar max value = %f",d);
90 return 0;
91 }
92
93 default:
94 break;
95 }
96
98 "Function is not appropriate for this type of widget (%s)",
100 return GWEN_ERROR_INVALID;
101}
102
103
104
105
106static GWENHYWFAR_CB
109 int index,
110 int defaultValue) {
111 CocoaProgressbar *progressbar;
112 W_PROGRESSBAR *xw;
113
114 assert(w);
116 assert(xw);
117
119 assert(progressbar);
120
121 switch(prop) {
123 return 1;
124
126 return 0;
127
129 return [progressbar frame].size.width;
131 return [progressbar frame].size.height;
132
134 return xw->currentValue;
135
137 return xw->minValue;
138
140 return xw->maxValue;
141
142 default:
143 break;
144 }
145
147 "Function is not appropriate for this type of widget (%s)",
149 return defaultValue;
150}
151
152
153
154static GWENHYWFAR_CB
157 int index,
158 const char *value,
159 int doSignal) {
161 "Function is not appropriate for this type of widget (%s)",
163 return GWEN_ERROR_INVALID;
164}
165
166
167
168static GWENHYWFAR_CB
171 int index,
172 const char *defaultValue) {
174 "Function is not appropriate for this type of widget (%s)",
176 return defaultValue;
177}
178
179
180
181static void GWENHYWFAR_CB CocoaGui_WProgressBar_FreeData(void *bp, void *p) {
182 W_PROGRESSBAR *xw;
183
184 xw=(W_PROGRESSBAR*) p;
186}
187
188
189
191 CocoaProgressbar *progressbar;
192 //const char *s;
193 uint32_t flags;
194 GWEN_WIDGET *wParent;
195 W_PROGRESSBAR *xw;
196
199
200 flags=GWEN_Widget_GetFlags(w);
201 wParent=GWEN_Widget_Tree_GetParent(w);
202 //s=GWEN_Widget_GetText(w, 0);
203
204 //g=gtk_progress_bar_new();
205 progressbar = [[[CocoaProgressbar alloc] initWithFrame:NSMakeRect(0.0, 0.0, 100.0, 20.0)] autorelease];
206 if (flags & GWEN_WIDGET_FLAGS_FILLX) progressbar.fillX = YES;
207 if (flags & GWEN_WIDGET_FLAGS_FILLY) progressbar.fillY = YES;
208 [progressbar setIndeterminate:NO];
209 [progressbar setUsesThreadedAnimation:YES];
210 [progressbar startAnimation:nil];
211 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) progressbar);
213
218
219 if (wParent)
221
222 return 0;
223}
224
225
#define COCOA_DIALOG_WIDGET_REAL
#define COCOA_DIALOG_WIDGET_CONTENT
#define DBG_WARN(dbg_logger, format,...)
Definition debug.h:125
#define GWEN_WIDGET_FLAGS_FILLY
Definition dialog.h:62
#define GWEN_WIDGET_FLAGS_FILLX
Definition dialog.h:61
GWEN_DIALOG_PROPERTY
Definition dialog.h:260
@ GWEN_DialogProperty_MinValue
Definition dialog.h:265
@ GWEN_DialogProperty_MaxValue
Definition dialog.h:266
@ GWEN_DialogProperty_Height
Definition dialog.h:273
@ GWEN_DialogProperty_Enabled
Definition dialog.h:267
@ GWEN_DialogProperty_Value
Definition dialog.h:264
@ GWEN_DialogProperty_Focus
Definition dialog.h:276
@ GWEN_DialogProperty_Width
Definition dialog.h:272
#define GWEN_ERROR_INVALID
Definition error.h:67
#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:35
#define GWEN_FREE_OBJECT(varname)
Definition memory.h:61
#define GWEN_NEW_OBJECT(typ, varname)
Definition memory.h:55
static GWENHYWFAR_CB int CocoaGui_WProgressBar_SetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
static GWENHYWFAR_CB const char * CocoaGui_WProgressBar_GetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
static GWENHYWFAR_CB int CocoaGui_WProgressBar_SetCharProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
static void GWENHYWFAR_CB CocoaGui_WProgressBar_FreeData(void *bp, void *p)
int CocoaGui_WProgressBar_Setup(GWEN_WIDGET *w)
static GWENHYWFAR_CB int CocoaGui_WProgressBar_GetIntProperty(GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
GWEN_WIDGET_GETCHARPROPERTY_FN GWEN_Widget_SetGetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETCHARPROPERTY_FN fn)
Definition widget.c:732
GWEN_WIDGET_GETINTPROPERTY_FN GWEN_Widget_SetGetIntPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_GETINTPROPERTY_FN fn)
Definition widget.c:702
int GWEN_Widget_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild)
Definition widget.c:828
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:687
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:452
GWEN_WIDGET_TYPE GWEN_Widget_GetType(const GWEN_WIDGET *w)
Definition widget.c:185
GWEN_WIDGET_SETCHARPROPERTY_FN GWEN_Widget_SetSetCharPropertyFn(GWEN_WIDGET *w, GWEN_WIDGET_SETCHARPROPERTY_FN fn)
Definition widget.c:717
struct GWEN_WIDGET GWEN_WIDGET
Definition widget_be.h:34