gwenhywfar  4.3.3
w_hline.mm
Go to the documentation of this file.
00001 /***************************************************************************
00002  begin       : Auf 10 2010
00003  copyright   : (C) 2010 by Samuel Strupp
00004  
00005  ***************************************************************************
00006  *          Please see toplevel file COPYING for license details           *
00007  ***************************************************************************/
00008 
00009 
00010 #import "CocoaHLineView.h"
00011 
00012 
00013 static GWENHYWFAR_CB
00014 int CocoaGui_WHLine_SetIntProperty(GWEN_WIDGET *w,
00015                                                                    GWEN_DIALOG_PROPERTY prop,
00016                                                                    int index,
00017                                                                    int value,
00018                                                                    int doSignal) {
00019         CocoaHLineView *hLineView;
00020         
00021         hLineView=(CocoaHLineView*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00022         assert(hLineView);
00023         
00024         switch(prop) {
00025                 case GWEN_DialogProperty_Enabled:
00026                         //gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
00027                         return 0;
00028                         
00029                 case GWEN_DialogProperty_Focus:
00030                         //gtk_widget_grab_focus(GTK_WIDGET(g));
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_WHLine_GetIntProperty(GWEN_WIDGET *w,
00048                                                                    GWEN_DIALOG_PROPERTY prop,
00049                                                                    int index,
00050                                                                    int defaultValue) {
00051         CocoaHLineView *hLineView;
00052         
00053         hLineView=(CocoaHLineView*)(GWEN_Widget_GetImplData(w, COCOA_DIALOG_WIDGET_REAL));
00054         assert(hLineView);
00055         
00056         switch(prop) {
00057                 case GWEN_DialogProperty_Enabled:
00058                         //return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1:0;
00059                         return 0;
00060                         
00061                 case GWEN_DialogProperty_Focus:
00062                         //return (gtk_widget_has_focus(GTK_WIDGET(g))==TRUE)?1:0;
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 int CocoaGui_WHLine_Setup(GWEN_WIDGET *w) {
00078         CocoaHLineView *hLineView;
00079         uint32_t flags;
00080         GWEN_WIDGET *wParent;
00081         
00082         flags=GWEN_Widget_GetFlags(w);
00083         wParent=GWEN_Widget_Tree_GetParent(w);
00084         
00085         hLineView = [[[CocoaHLineView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 100.0, 5.0)] autorelease];
00086         if (flags & GWEN_WIDGET_FLAGS_FILLX) hLineView.fillX = YES;
00087         if (flags & GWEN_WIDGET_FLAGS_FILLY) hLineView.fillY = YES;
00088         
00089         
00090         GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_REAL, (void*) hLineView);
00091         GWEN_Widget_SetImplData(w, COCOA_DIALOG_WIDGET_CONTENT, (void*) hLineView);
00092         
00093         GWEN_Widget_SetSetIntPropertyFn(w, CocoaGui_WHLine_SetIntProperty);
00094         GWEN_Widget_SetGetIntPropertyFn(w, CocoaGui_WHLine_GetIntProperty);
00095         
00096         if (wParent)
00097                 GWEN_Widget_AddChildGuiWidget(wParent, w);
00098         
00099         return 0;
00100 }
00101 
00102