gwenhywfar 4.0.3
|
00001 /*************************************************************************** 00002 begin : Aug 17 2010 00003 copyright : (C) 2010 by Samuel Strupp 00004 00005 *************************************************************************** 00006 * Please see toplevel file COPYING for license details * 00007 ***************************************************************************/ 00008 00009 00010 #import "CocoaSpacer.h" 00011 00012 00013 static GWENHYWFAR_CB 00014 int CocoaGui_WHSpacer_SetIntProperty(GWEN_WIDGET *w, 00015 GWEN_DIALOG_PROPERTY prop, 00016 int index, 00017 int value, 00018 int doSignal) { 00019 CocoaSpacer *hSpacer; 00020 00021 hSpacer=(CocoaSpacer*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL)); 00022 assert(hSpacer); 00023 00024 switch(prop) { 00025 case GWEN_DialogProperty_Enabled: 00026 return 0; 00027 00028 case GWEN_DialogProperty_Focus: 00029 return 0; 00030 00031 default: 00032 break; 00033 } 00034 00035 DBG_WARN(GWEN_LOGDOMAIN, 00036 "Function is not appropriate for this type of widget (%s)", 00037 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w))); 00038 return GWEN_ERROR_INVALID; 00039 } 00040 00041 00042 00043 00044 static GWENHYWFAR_CB 00045 int CocoaGui_WHSpacer_GetIntProperty(GWEN_WIDGET *w, 00046 GWEN_DIALOG_PROPERTY prop, 00047 int index, 00048 int defaultValue) { 00049 CocoaSpacer *hSpacer; 00050 00051 hSpacer=(CocoaSpacer*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL)); 00052 assert(hSpacer); 00053 00054 switch(prop) { 00055 case GWEN_DialogProperty_Enabled: 00056 return 1; 00057 00058 case GWEN_DialogProperty_Focus: 00059 return 0; 00060 00061 default: 00062 break; 00063 } 00064 00065 DBG_WARN(GWEN_LOGDOMAIN, 00066 "Function is not appropriate for this type of widget (%s)", 00067 GWEN_Widget_Type_toString(GWEN_Widget_GetType(w))); 00068 return defaultValue; 00069 } 00070 00071 00072 00073 int CocoaGui_WHSpacer_Setup(GWEN_WIDGET *w) { 00074 CocoaSpacer *hSpacer; 00075 uint32_t flags; 00076 GWEN_WIDGET *wParent; 00077 00078 flags=GWEN_Widget_GetFlags(w); 00079 wParent=GWEN_Widget_Tree_GetParent(w); 00080 00081 hSpacer = [[[CocoaSpacer alloc] initWithFrame:NSMakeRect(0.0, 0.0, 10.0, 10.0)] autorelease]; 00082 GWEN_Widget_AddFlags(w, GWEN_WIDGET_FLAGS_FILLX); 00083 hSpacer.fillX = YES; 00084 if (flags & GWEN_WIDGET_FLAGS_FILLY) hSpacer.fillY = YES; 00085 00086 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) hSpacer); 00087 GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_CONTENT, (void*) hSpacer); 00088 00089 GWEN_Widget_SetSetIntPropertyFn(w, CocoaGui_WHSpacer_SetIntProperty); 00090 GWEN_Widget_SetGetIntPropertyFn(w, CocoaGui_WHSpacer_GetIntProperty); 00091 00092 if (wParent) 00093 GWEN_Widget_AddChildGuiWidget(wParent, w); 00094 00095 return 0; 00096 } 00097 00098