gwenhywfar  4.3.3
w_vspacer.mm
Go to the documentation of this file.
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 
00014 static GWENHYWFAR_CB
00015 int CocoaGui_WVSpacer_SetIntProperty(GWEN_WIDGET *w,
00016                                                                          GWEN_DIALOG_PROPERTY prop,
00017                                                                          int index,
00018                                                                          int value,
00019                                                                          int doSignal) {
00020         CocoaSpacer *vSpacer;
00021         
00022         vSpacer=(CocoaSpacer*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00023         assert(vSpacer);
00024         
00025         switch(prop) {
00026                 case GWEN_DialogProperty_Enabled:
00027                         return 0;
00028                         
00029                 case GWEN_DialogProperty_Focus:
00030                         return 0;
00031                         
00032                 default:
00033                         break;
00034         }
00035         
00036         DBG_WARN(GWEN_LOGDOMAIN,
00037                          "Function is not appropriate for this type of widget (%s)",
00038                          GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00039         return GWEN_ERROR_INVALID;
00040 }
00041 
00042 
00043 
00044 
00045 static GWENHYWFAR_CB
00046 int CocoaGui_WVSpacer_GetIntProperty(GWEN_WIDGET *w,
00047                                                                          GWEN_DIALOG_PROPERTY prop,
00048                                                                          int index,
00049                                                                          int defaultValue) {
00050         CocoaSpacer *vSpacer;
00051         
00052         vSpacer=(CocoaSpacer*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00053         assert(vSpacer);
00054         
00055         switch(prop) {
00056                 case GWEN_DialogProperty_Enabled:
00057                         return 1;
00058                         
00059                 case GWEN_DialogProperty_Focus:
00060                         return 0;
00061                         
00062                 default:
00063                         break;
00064         }
00065         
00066         DBG_WARN(GWEN_LOGDOMAIN,
00067                          "Function is not appropriate for this type of widget (%s)",
00068                          GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00069         return defaultValue;
00070 }
00071 
00072 
00073 
00074 int CocoaGui_WVSpacer_Setup(GWEN_WIDGET *w) {
00075         CocoaSpacer *vSpacer;
00076         uint32_t flags;
00077         GWEN_WIDGET *wParent;
00078         
00079         flags=GWEN_Widget_GetFlags(w);
00080         wParent=GWEN_Widget_Tree_GetParent(w);
00081         
00082         vSpacer = [[[CocoaSpacer alloc] initWithFrame:NSMakeRect(0.0, 0.0, 10.0, 10.0)] autorelease];
00083         GWEN_Widget_AddFlags(w, GWEN_WIDGET_FLAGS_FILLY);
00084         vSpacer.fillY = YES;
00085         if (flags & GWEN_WIDGET_FLAGS_FILLX) vSpacer.fillX = YES;
00086         
00087         
00088         GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) vSpacer);
00089         GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_CONTENT, (void*) vSpacer);
00090         
00091         GWEN_Widget_SetSetIntPropertyFn(w, CocoaGui_WVSpacer_SetIntProperty);
00092         GWEN_Widget_SetGetIntPropertyFn(w, CocoaGui_WVSpacer_GetIntProperty);
00093         
00094         if (wParent)
00095                 GWEN_Widget_AddChildGuiWidget(wParent, w);
00096         
00097         return 0;
00098 }
00099 
00100