Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #import "CocoaGridLayout.h"
00025
00026
00027 static GWENHYWFAR_CB
00028 int CocoaGui_WGridLayout_SetIntProperty(GWEN_WIDGET *w,
00029 GWEN_DIALOG_PROPERTY prop,
00030 int index,
00031 int value,
00032 int doSignal) {
00033 CocoaGridLayout *gridLayout;
00034
00035 gridLayout = (CocoaGridLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00036 assert(gridLayout);
00037
00038 switch(prop) {
00039 case GWEN_DialogProperty_Enabled:
00040
00041 return 0;
00042
00043 case GWEN_DialogProperty_Focus:
00044
00045 return 0;
00046
00047 default:
00048 break;
00049 }
00050
00051 DBG_WARN(GWEN_LOGDOMAIN,
00052 "Function is not appropriate for this type of widget (%s)",
00053 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00054 return GWEN_ERROR_INVALID;
00055 }
00056
00057
00058
00059
00060 static GWENHYWFAR_CB
00061 int CocoaGui_WGridLayout_GetIntProperty(GWEN_WIDGET *w,
00062 GWEN_DIALOG_PROPERTY prop,
00063 int index,
00064 int defaultValue) {
00065 CocoaGridLayout *gridLayout;
00066
00067 gridLayout = (CocoaGridLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00068 assert(gridLayout);
00069
00070 switch(prop) {
00071 case GWEN_DialogProperty_Enabled:
00072
00073 return 1;
00074
00075 case GWEN_DialogProperty_Focus:
00076
00077 return 0;
00078
00079 default:
00080 break;
00081 }
00082
00083 DBG_WARN(GWEN_LOGDOMAIN,
00084 "Function is not appropriate for this type of widget (%s)",
00085 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00086 return defaultValue;
00087 }
00088
00089
00090
00091 static GWENHYWFAR_CB
00092 int CocoaGui_WGridLayout_SetCharProperty(GWEN_WIDGET *w,
00093 GWEN_DIALOG_PROPERTY prop,
00094 int index,
00095 const char *value,
00096 int doSignal) {
00097 CocoaGridLayout *gridLayout;
00098
00099 gridLayout = (CocoaGridLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00100 assert(gridLayout);
00101
00102 DBG_WARN(GWEN_LOGDOMAIN,
00103 "Function is not appropriate for this type of widget (%s)",
00104 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00105 return GWEN_ERROR_INVALID;
00106 }
00107
00108
00109
00110 static GWENHYWFAR_CB
00111 const char* CocoaGui_WGridLayout_GetCharProperty(GWEN_WIDGET *w,
00112 GWEN_DIALOG_PROPERTY prop,
00113 int index,
00114 const char *defaultValue) {
00115 CocoaGridLayout *gridLayout;
00116
00117 gridLayout = (CocoaGridLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00118 assert(gridLayout);
00119
00120 DBG_WARN(GWEN_LOGDOMAIN,
00121 "Function is not appropriate for this type of widget (%s)",
00122 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00123 return defaultValue;
00124 }
00125
00126
00127
00128 static GWENHYWFAR_CB
00129 int CocoaGui_WGridLayout_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild) {
00130 CocoaGridLayout *gridLayout;
00131 NSView *childView;
00132 uint32_t cflags;
00133
00134 gridLayout=(CocoaGridLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00135 assert(gridLayout);
00136
00137 childView=(NSView*)(GWEN_Widget_GetImplData(wChild, COCOA_DIALOG_WIDGET_REAL));
00138 assert(childView);
00139
00140 cflags=GWEN_Widget_GetFlags(wChild);
00141
00142 [gridLayout addLayoutSubview:childView];
00143
00144 return 0;
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 return 0;
00204 }
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 int CocoaGui_WGridLayout_Setup(GWEN_WIDGET *w) {
00221 CocoaGridLayout *gridLayout;
00222 uint32_t flags;
00223 GWEN_WIDGET *wParent;
00224
00225 int rows;
00226 int cols;
00227
00228
00229
00230
00231 flags=GWEN_Widget_GetFlags(w);
00232 wParent=GWEN_Widget_Tree_GetParent(w);
00233 cols=GWEN_Widget_GetColumns(w);
00234 rows=GWEN_Widget_GetRows(w);
00235
00236
00237 gridLayout = [[[CocoaGridLayout alloc] initWithFrame:NSMakeRect(10.0, 10.0, 200.0, 200.0)] autorelease];
00238 gridLayout.columns = cols;
00239 gridLayout.rows = rows;
00240 if (flags & GWEN_WIDGET_FLAGS_FILLX) gridLayout.fillX = YES;
00241 if (flags & GWEN_WIDGET_FLAGS_FILLY) gridLayout.fillY = YES;
00242
00243
00244 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) gridLayout);
00245 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_CONTENT, (void*) gridLayout);
00246
00247 GWEN_Widget_SetSetIntPropertyFn(w, CocoaGui_WGridLayout_SetIntProperty);
00248 GWEN_Widget_SetGetIntPropertyFn(w, CocoaGui_WGridLayout_GetIntProperty);
00249 GWEN_Widget_SetSetCharPropertyFn(w, CocoaGui_WGridLayout_SetCharProperty);
00250 GWEN_Widget_SetGetCharPropertyFn(w, CocoaGui_WGridLayout_GetCharProperty);
00251 GWEN_Widget_SetAddChildGuiWidgetFn(w, CocoaGui_WGridLayout_AddChildGuiWidget);
00252
00253 if (wParent)
00254 GWEN_Widget_AddChildGuiWidget(wParent, w);
00255
00256 return 0;
00257 }
00258
00259