Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #import "CocoaVLayout.h"
00010
00011
00012
00013 static GWENHYWFAR_CB
00014 int CocoaGui_WVLayout_SetIntProperty(GWEN_WIDGET *w,
00015 GWEN_DIALOG_PROPERTY prop,
00016 int index,
00017 int value,
00018 int doSignal) {
00019 CocoaVLayout *vlayout;
00020
00021 vlayout=(CocoaVLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00022 assert(vlayout);
00023
00024 switch(prop) {
00025 case GWEN_DialogProperty_Enabled:
00026
00027 return 0;
00028
00029 case GWEN_DialogProperty_Focus:
00030
00031 return 0;
00032
00033 default:
00034 break;
00035 }
00036
00037 DBG_WARN(GWEN_LOGDOMAIN,
00038 "Function is not appropriate for this type of widget (%s)",
00039 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00040 return GWEN_ERROR_INVALID;
00041 }
00042
00043
00044
00045
00046 static GWENHYWFAR_CB
00047 int CocoaGui_WVLayout_GetIntProperty(GWEN_WIDGET *w,
00048 GWEN_DIALOG_PROPERTY prop,
00049 int index,
00050 int defaultValue) {
00051 CocoaVLayout *vlayout;
00052
00053 vlayout=(CocoaVLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00054 assert(vlayout);
00055
00056 switch(prop) {
00057 case GWEN_DialogProperty_Enabled:
00058
00059 return 1;
00060
00061 case GWEN_DialogProperty_Focus:
00062
00063 return 0;
00064
00065 default:
00066 break;
00067 }
00068
00069 DBG_WARN(GWEN_LOGDOMAIN,
00070 "Function is not appropriate for this type of widget (%s)",
00071 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00072 return defaultValue;
00073 }
00074
00075
00076
00077 static GWENHYWFAR_CB
00078 int CocoaGui_WVLayout_SetCharProperty(GWEN_WIDGET *w,
00079 GWEN_DIALOG_PROPERTY prop,
00080 int index,
00081 const char *value,
00082 int doSignal) {
00083
00084
00085
00086
00087
00088 DBG_WARN(GWEN_LOGDOMAIN,
00089 "Function is not appropriate for this type of widget (%s)",
00090 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00091 return GWEN_ERROR_INVALID;
00092 }
00093
00094
00095
00096 static GWENHYWFAR_CB
00097 const char* CocoaGui_WVLayout_GetCharProperty(GWEN_WIDGET *w,
00098 GWEN_DIALOG_PROPERTY prop,
00099 int index,
00100 const char *defaultValue) {
00101
00102
00103
00104
00105
00106 DBG_WARN(GWEN_LOGDOMAIN,
00107 "Function is not appropriate for this type of widget (%s)",
00108 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00109 return defaultValue;
00110 }
00111
00112
00113
00114 static GWENHYWFAR_CB
00115 int CocoaGui_WVLayout_AddChildGuiWidget(GWEN_WIDGET *w, GWEN_WIDGET *wChild) {
00116 CocoaVLayout *vlayout;
00117 NSView *childView;
00118 uint32_t cflags;
00119
00120 vlayout=(CocoaVLayout*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00121 assert(vlayout);
00122
00123 childView=(NSView*)(GWEN_Widget_GetImplData(wChild, COCOA_DIALOG_WIDGET_REAL));
00124 assert(childView);
00125
00126 cflags=GWEN_Widget_GetFlags(wChild);
00127
00128
00129 [vlayout addLayoutSubview:childView];
00130
00131
00132
00133
00134
00135
00136
00137
00138 return 0;
00139 }
00140
00141
00142
00143 int CocoaGui_WVLayout_Setup(GWEN_WIDGET *w) {
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 CocoaVLayout *vlayout;
00166 uint32_t flags;
00167 GWEN_WIDGET *wParent;
00168
00169 flags=GWEN_Widget_GetFlags(w);
00170 wParent=GWEN_Widget_Tree_GetParent(w);
00171
00172 vlayout = [[[CocoaVLayout alloc] initWithFrame:NSMakeRect(10.0, 10.0, 200.0, 200.0)] autorelease];
00173 if (flags & GWEN_WIDGET_FLAGS_FILLX) vlayout.fillX = YES;
00174 if (flags & GWEN_WIDGET_FLAGS_FILLY) vlayout.fillY = YES;
00175
00176 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) vlayout);
00177 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_CONTENT, (void*) vlayout);
00178
00179 GWEN_Widget_SetSetIntPropertyFn(w, CocoaGui_WVLayout_SetIntProperty);
00180 GWEN_Widget_SetGetIntPropertyFn(w, CocoaGui_WVLayout_GetIntProperty);
00181 GWEN_Widget_SetSetCharPropertyFn(w, CocoaGui_WVLayout_SetCharProperty);
00182 GWEN_Widget_SetGetCharPropertyFn(w, CocoaGui_WVLayout_GetCharProperty);
00183 GWEN_Widget_SetAddChildGuiWidgetFn(w, CocoaGui_WVLayout_AddChildGuiWidget);
00184
00185 if (wParent)
00186 GWEN_Widget_AddChildGuiWidget(wParent, w);
00187
00188 return 0;
00189 }
00190
00191