gwenhywfar  4.3.1
w_vline.c
Go to the documentation of this file.
00001 /***************************************************************************
00002     begin       : Sun May 16 2010
00003     copyright   : (C) 2010 by Martin Preuss
00004     email       : martin@libchipcard.de
00005 
00006  ***************************************************************************
00007  *          Please see toplevel file COPYING for license details           *
00008  ***************************************************************************/
00009 
00010 
00011 
00012 
00013 
00014 static GWENHYWFAR_CB
00015 int Gtk2Gui_WVLine_SetIntProperty(GWEN_WIDGET *w,
00016                                  GWEN_DIALOG_PROPERTY prop,
00017                                  int index,
00018                                  int value,
00019                                  int doSignal) {
00020   GtkWidget *g;
00021 
00022   g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK2_DIALOG_WIDGET_REAL));
00023   assert(g);
00024 
00025   switch(prop) {
00026   case GWEN_DialogProperty_Enabled:
00027     gtk_widget_set_sensitive(GTK_WIDGET(g), (value==0)?FALSE:TRUE);
00028     return 0;
00029   
00030   case GWEN_DialogProperty_Focus:
00031     gtk_widget_grab_focus(GTK_WIDGET(g));
00032     return 0;
00033 
00034   default:
00035     break;
00036   }
00037 
00038   DBG_WARN(GWEN_LOGDOMAIN,
00039            "Function is not appropriate for this type of widget (%s)",
00040            GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
00041   return GWEN_ERROR_INVALID;
00042 }
00043 
00044 
00045 
00046 
00047 static GWENHYWFAR_CB
00048 int Gtk2Gui_WVLine_GetIntProperty(GWEN_WIDGET *w,
00049                                  GWEN_DIALOG_PROPERTY prop,
00050                                  int index,
00051                                  int defaultValue) {
00052   GtkWidget *g;
00053 
00054   g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK2_DIALOG_WIDGET_REAL));
00055   assert(g);
00056 
00057   switch(prop) {
00058   case GWEN_DialogProperty_Enabled:
00059     return (gtk_widget_get_sensitive(GTK_WIDGET(g))==TRUE)?1: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 Gtk2Gui_WVLine_Setup(GWEN_WIDGET *w) {
00078   GtkWidget *g;
00079   uint32_t flags;
00080   GWEN_WIDGET *wParent;
00081 
00082   flags=GWEN_Widget_GetFlags(w);
00083   wParent=GWEN_Widget_Tree_GetParent(w);
00084 
00085   g=gtk_vseparator_new();
00086   GWEN_Widget_SetImplData(w, GTK2_DIALOG_WIDGET_REAL, (void*) g);
00087   GWEN_Widget_SetImplData(w, GTK2_DIALOG_WIDGET_CONTENT, (void*) g);
00088 
00089   GWEN_Widget_SetSetIntPropertyFn(w, Gtk2Gui_WVLine_SetIntProperty);
00090   GWEN_Widget_SetGetIntPropertyFn(w, Gtk2Gui_WVLine_GetIntProperty);
00091 
00092   if (wParent)
00093     GWEN_Widget_AddChildGuiWidget(wParent, w);
00094 
00095   return 0;
00096 }
00097 
00098