gwenhywfar  4.3.1
dlg_progress.c
Go to the documentation of this file.
00001 /***************************************************************************
00002  begin       : Tue Feb 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 #ifdef HAVE_CONFIG_H
00012 # include <config.h>
00013 #endif
00014 
00015 #define DISABLE_DEBUGLOG
00016 
00017 
00018 #include "dlg_progress_p.h"
00019 
00020 #include <gwenhywfar/gwenhywfar.h>
00021 #include <gwenhywfar/pathmanager.h>
00022 #include <gwenhywfar/debug.h>
00023 #include <gwenhywfar/text.h>
00024 
00025 
00026 
00027 #define DIALOG_MINWIDTH        520
00028 #define DIALOG_MINHEIGHT       400
00029 #define DIALOG_MINHEIGHT_NOLOG 100
00030 
00031 
00032 
00033 GWEN_INHERIT(GWEN_DIALOG, GWEN_DLGPROGRESS)
00034 
00035 
00036 
00037 
00038 
00039 GWEN_DIALOG *GWEN_DlgProgress_new(void) {
00040   GWEN_DIALOG *dlg;
00041   GWEN_DLGPROGRESS *xdlg;
00042   GWEN_BUFFER *fbuf;
00043   int rv;
00044 
00045   dlg=GWEN_Dialog_new("dlg_gwen_progress");
00046   GWEN_NEW_OBJECT(GWEN_DLGPROGRESS, xdlg);
00047 
00048   GWEN_INHERIT_SETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg, xdlg,
00049                        GWEN_DlgProgress_FreeData);
00050 
00051   GWEN_Dialog_SetSignalHandler(dlg, GWEN_DlgProgress_SignalHandler);
00052 
00053   /* get path of dialog description file */
00054   fbuf=GWEN_Buffer_new(0, 256, 0, 1);
00055   rv=GWEN_PathManager_FindFile(GWEN_PM_LIBNAME, GWEN_PM_SYSDATADIR,
00056                                "gwenhywfar/dialogs/dlg_progress.dlg",
00057                                fbuf);
00058   if (rv<0) {
00059     DBG_INFO(GWEN_LOGDOMAIN, "Dialog description file not found (%d).", rv);
00060     GWEN_Buffer_free(fbuf);
00061     GWEN_Dialog_free(dlg);
00062     return NULL;
00063   }
00064 
00065   /* read dialog from dialog description file */
00066   rv=GWEN_Dialog_ReadXmlFile(dlg, GWEN_Buffer_GetStart(fbuf));
00067   if (rv<0) {
00068     DBG_INFO(GWEN_LOGDOMAIN, "here (%d).", rv);
00069     GWEN_Buffer_free(fbuf);
00070     GWEN_Dialog_free(dlg);
00071     return NULL;
00072   }
00073   GWEN_Buffer_free(fbuf);
00074 
00075   xdlg->logBufferTxt=GWEN_Buffer_new(0, 256, 0, 1);
00076   xdlg->logBufferHtml=GWEN_Buffer_new(0, 256, 0, 1);
00077 
00078   return dlg;
00079 }
00080 
00081 
00082 
00083 void GWENHYWFAR_CB GWEN_DlgProgress_FreeData(void *bp, void *p) {
00084   GWEN_DLGPROGRESS *xdlg;
00085 
00086   xdlg=(GWEN_DLGPROGRESS*) p;
00087 
00088   GWEN_Buffer_free(xdlg->logBufferHtml);
00089   GWEN_Buffer_free(xdlg->logBufferTxt);
00090 
00091   GWEN_FREE_OBJECT(xdlg);
00092 }
00093 
00094 
00095 
00096 void GWEN_DlgProgress_SetAllowClose(GWEN_DIALOG *dlg, int b) {
00097   GWEN_DLGPROGRESS *xdlg;
00098 
00099   assert(dlg);
00100   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00101   assert(xdlg);
00102 
00103   xdlg->allowClose=b;
00104   if (xdlg->wasInit) {
00105     GWEN_Dialog_SetIntProperty(dlg, "abortButton", GWEN_DialogProperty_Enabled, 0, 0, 0);
00106     GWEN_Dialog_SetIntProperty(dlg, "closeButton", GWEN_DialogProperty_Enabled, 0, 1, 0);
00107   }
00108 }
00109 
00110 
00111 
00112 void GWEN_DlgProgress_SetStayOpen(GWEN_DIALOG *dlg, int b) {
00113   GWEN_DLGPROGRESS *xdlg;
00114 
00115   assert(dlg);
00116   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00117   assert(xdlg);
00118 
00119   xdlg->stayOpen=b;
00120 }
00121 
00122 
00123 
00124 int GWEN_DlgProgress_GetStayOpen(const GWEN_DIALOG *dlg) {
00125   GWEN_DLGPROGRESS *xdlg;
00126 
00127   assert(dlg);
00128   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00129   assert(xdlg);
00130 
00131   return xdlg->stayOpen;
00132 }
00133 
00134 
00135 
00136 void GWEN_DlgProgress_SetShowLog(GWEN_DIALOG *dlg, int b) {
00137   GWEN_DLGPROGRESS *xdlg;
00138 
00139   assert(dlg);
00140   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00141   assert(xdlg);
00142 
00143   if (xdlg->showLog!=b) {
00144     xdlg->showLog=b;
00145     if (xdlg->wasInit) {
00146 
00147       GWEN_Dialog_SetIntProperty(dlg, "logGroup", GWEN_DialogProperty_Visibility, 0, b, 0);
00148       if (b) {
00149         int i;
00150 
00151         i=xdlg->withLogWidth;
00152         if (i<DIALOG_MINWIDTH)
00153           i=DIALOG_MINWIDTH;
00154         GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0);
00155 
00156         i=xdlg->withLogHeight;
00157         if (i<DIALOG_MINHEIGHT)
00158           i=DIALOG_MINHEIGHT;
00159         GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0);
00160       }
00161     }
00162   }
00163 }
00164 
00165 
00166 
00167 GWEN_PROGRESS_DATA *GWEN_DlgProgress_GetFirstProgress(const GWEN_DIALOG *dlg) {
00168   GWEN_DLGPROGRESS *xdlg;
00169 
00170   assert(dlg);
00171   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00172   assert(xdlg);
00173 
00174   return xdlg->firstProgress;
00175 }
00176 
00177 
00178 
00179 void GWEN_DlgProgress_SetFirstProgress(GWEN_DIALOG *dlg, GWEN_PROGRESS_DATA *pd) {
00180   GWEN_DLGPROGRESS *xdlg;
00181 
00182   assert(dlg);
00183   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00184   assert(xdlg);
00185 
00186   xdlg->firstProgress=pd;
00187 
00188   if (xdlg->wasInit) {
00189     if (xdlg->firstProgress) {
00190       const char *s;
00191 
00192       s=GWEN_ProgressData_GetTitle(xdlg->firstProgress);
00193       if (s && *s)
00194         GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, s, 0);
00195 
00196       s=GWEN_ProgressData_GetText(xdlg->firstProgress);
00197       if (s && *s)
00198         GWEN_Dialog_SetCharProperty(dlg, "descrLabel", GWEN_DialogProperty_Title, 0, s, 0);
00199 
00200       GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_Enabled, 0, 1, 0);
00201       GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_MaxValue, 0,
00202                                  GWEN_ProgressData_GetTotal(xdlg->firstProgress), 0);
00203       GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_Value, 0,
00204                                  GWEN_ProgressData_GetCurrent(xdlg->firstProgress), 0);
00205     }
00206     else {
00207       /* let it show 100 % */
00208       GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_MaxValue, 0, 100, 0);
00209       GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_Value, 0, 100, 0);
00210     }
00211   }
00212 }
00213 
00214 
00215 
00216 GWEN_PROGRESS_DATA *GWEN_DlgProgress_GetSecondProgress(const GWEN_DIALOG *dlg) {
00217   GWEN_DLGPROGRESS *xdlg;
00218 
00219   assert(dlg);
00220   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00221   assert(xdlg);
00222 
00223   return xdlg->secondProgress;
00224 }
00225 
00226 
00227 
00228 void GWEN_DlgProgress_SetSecondProgress(GWEN_DIALOG *dlg, GWEN_PROGRESS_DATA *pd) {
00229   GWEN_DLGPROGRESS *xdlg;
00230 
00231   assert(dlg);
00232   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00233   assert(xdlg);
00234 
00235   xdlg->secondProgress=pd;
00236 
00237   if (xdlg->wasInit) {
00238     if (xdlg->secondProgress) {
00239       GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_Enabled, 0, 1, 0);
00240       GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_MaxValue, 0,
00241                                  GWEN_ProgressData_GetTotal(xdlg->secondProgress), 0);
00242       GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_Value, 0,
00243                                  GWEN_ProgressData_GetCurrent(xdlg->secondProgress), 0);
00244     }
00245     else {
00246       GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_Value, 0, 0, 0);
00247       GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_Enabled, 0, 0, 0);
00248     }
00249   }
00250 }
00251 
00252 
00253 
00254 void GWEN_DlgProgress_AddLogText(GWEN_DIALOG *dlg,
00255                                  GWEN_LOGGER_LEVEL level,
00256                                  const char *s) {
00257   GWEN_DLGPROGRESS *xdlg;
00258   GWEN_TIME *ti;
00259   int rv;
00260   GWEN_BUFFER *tbuf;
00261   const char *col;
00262 
00263   assert(dlg);
00264   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00265   assert(xdlg);
00266 
00267   ti=GWEN_CurrentTime();
00268 
00269   /* setup text string */
00270   if (GWEN_Buffer_GetUsedBytes(xdlg->logBufferTxt))
00271     GWEN_Buffer_AppendString(xdlg->logBufferTxt, "\n");
00272   if (ti)
00273     rv=GWEN_Time_toString(ti, "hh:mm:ss", xdlg->logBufferTxt);
00274   else
00275     rv=GWEN_ERROR_GENERIC;
00276   if (rv<0)
00277     GWEN_Buffer_AppendString(xdlg->logBufferTxt, "??:??:??");
00278   GWEN_Buffer_AppendString(xdlg->logBufferTxt, " ");
00279   if (s)
00280     GWEN_Buffer_AppendString(xdlg->logBufferTxt, s);
00281 
00282   /* setup HTML string */
00283   GWEN_Buffer_AppendString(xdlg->logBufferHtml, "<tr><td>");
00284   if (ti)
00285     rv=GWEN_Time_toString(ti, "hh:mm:ss", xdlg->logBufferHtml);
00286   else
00287     rv=GWEN_ERROR_GENERIC;
00288   if (rv<0)
00289     GWEN_Buffer_AppendString(xdlg->logBufferHtml, "??:??:??");
00290   GWEN_Buffer_AppendString(xdlg->logBufferHtml, "</td><td>");
00291 
00292   if (level<=GWEN_LoggerLevel_Error)
00293     col="red";
00294   else if (level==GWEN_LoggerLevel_Warning)
00295     col="blue";
00296   else if (level==GWEN_LoggerLevel_Info)
00297     col="green";
00298   else
00299     col=NULL;
00300   if (col) {
00301     GWEN_Buffer_AppendString(xdlg->logBufferHtml, "<font color=\"");
00302     GWEN_Buffer_AppendString(xdlg->logBufferHtml, col);
00303     GWEN_Buffer_AppendString(xdlg->logBufferHtml,"\">");
00304   }
00305   if (s)
00306     GWEN_Text_EscapeXmlToBuffer(s, xdlg->logBufferHtml);
00307   if (col)
00308     GWEN_Buffer_AppendString(xdlg->logBufferHtml, "</font>");
00309   GWEN_Buffer_AppendString(xdlg->logBufferHtml, "</td></tr>");
00310 
00311   /* assemble full string, containing HTML and text log */
00312   tbuf=GWEN_Buffer_new(0,
00313                        GWEN_Buffer_GetUsedBytes(xdlg->logBufferHtml)+
00314                        GWEN_Buffer_GetUsedBytes(xdlg->logBufferTxt)+256,
00315                        0,
00316                        1);
00317 
00318   GWEN_Buffer_AppendString(tbuf, "<html><table>");
00319   GWEN_Buffer_AppendString(tbuf, GWEN_Buffer_GetStart(xdlg->logBufferHtml));
00320   GWEN_Buffer_AppendString(tbuf, "</table></html>");
00321   GWEN_Buffer_AppendString(tbuf, GWEN_Buffer_GetStart(xdlg->logBufferTxt));
00322 
00323   GWEN_Dialog_SetCharProperty(dlg, "logText", GWEN_DialogProperty_Value, 0,
00324                               GWEN_Buffer_GetStart(tbuf), 0);
00325   GWEN_Buffer_free(tbuf);
00326 }
00327 
00328 
00329 
00330 void GWEN_DlgProgress_Advanced(GWEN_DIALOG *dlg, GWEN_PROGRESS_DATA *pd) {
00331   GWEN_DLGPROGRESS *xdlg;
00332   const char *s;
00333 
00334   assert(dlg);
00335   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00336   assert(xdlg);
00337 
00338   if (pd==xdlg->firstProgress)
00339     s="allProgress";
00340   else if (pd==xdlg->secondProgress)
00341     s="currentProgress";
00342   else {
00343     DBG_ERROR(GWEN_LOGDOMAIN, "Progress %08x is neither primary nor secondary",
00344               GWEN_ProgressData_GetId(pd));
00345     return;
00346   }
00347 
00348   if (xdlg->wasInit) {
00349     GWEN_Dialog_SetIntProperty(dlg, s, GWEN_DialogProperty_Value, 0,
00350                                GWEN_ProgressData_GetCurrent(pd), 0);
00351   }
00352 }
00353 
00354 
00355 
00356 void GWEN_DlgProgress_TotalChanged(GWEN_DIALOG *dlg, GWEN_PROGRESS_DATA *pd) {
00357   GWEN_DLGPROGRESS *xdlg;
00358   const char *s;
00359 
00360   assert(dlg);
00361   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00362   assert(xdlg);
00363 
00364   if (pd==xdlg->firstProgress)
00365     s="allProgress";
00366   else if (pd==xdlg->secondProgress)
00367     s="currentProgress";
00368   else {
00369     DBG_ERROR(GWEN_LOGDOMAIN, "Progress %08x is neither primary nor secondary",
00370               GWEN_ProgressData_GetId(pd));
00371     return;
00372   }
00373 
00374   if (xdlg->wasInit) {
00375     GWEN_Dialog_SetIntProperty(dlg, s, GWEN_DialogProperty_MaxValue, 0,
00376                                GWEN_ProgressData_GetTotal(pd), 0);
00377   }
00378 }
00379 
00380 
00381 
00382 void GWEN_DlgProgress_Init(GWEN_DIALOG *dlg) {
00383   GWEN_DLGPROGRESS *xdlg;
00384   int i;
00385   GWEN_DB_NODE *dbParams;
00386 
00387   assert(dlg);
00388   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00389   assert(xdlg);
00390 
00391   dbParams=GWEN_Dialog_GetPreferences(dlg);
00392   assert(dbParams);
00393 
00394   xdlg->withLogWidth=GWEN_DB_GetIntValue(dbParams, "dialog_width", 0, -1);
00395   xdlg->withLogHeight=GWEN_DB_GetIntValue(dbParams, "dialog_height", 0, -1);
00396 
00397   if (xdlg->showLog) {
00398     int i;
00399   
00400     i=xdlg->withLogWidth;
00401     if (i>=DIALOG_MINWIDTH)
00402       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0);
00403   
00404     i=xdlg->withLogHeight;
00405     if (i>=DIALOG_MINHEIGHT)
00406       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0);
00407 
00408     GWEN_Dialog_SetIntProperty(dlg, "logGroup", GWEN_DialogProperty_Visibility, 0, 1, 0);
00409   }
00410   else {
00411     /* read width */
00412     i=GWEN_DB_GetIntValue(dbParams, "dialog_width_nolog", 0, -1);
00413     if (i>=DIALOG_MINWIDTH)
00414       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0);
00415   
00416     /* read height */
00417     i=GWEN_DB_GetIntValue(dbParams, "dialog_height_nolog", 0, -1);
00418     if (i>=DIALOG_MINHEIGHT_NOLOG)
00419       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0);
00420     GWEN_Dialog_SetIntProperty(dlg, "logGroup", GWEN_DialogProperty_Visibility, 0, 0, 0);
00421   }
00422 
00423 
00424   if (xdlg->firstProgress) {
00425     const char *s;
00426 
00427     s=GWEN_ProgressData_GetTitle(xdlg->firstProgress);
00428     if (s && *s)
00429       GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, s, 0);
00430 
00431     s=GWEN_ProgressData_GetText(xdlg->firstProgress);
00432     if (s && *s)
00433       GWEN_Dialog_SetCharProperty(dlg, "descrLabel", GWEN_DialogProperty_Title, 0, s, 0);
00434 
00435     GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_MaxValue, 0,
00436                                GWEN_ProgressData_GetTotal(xdlg->firstProgress), 0);
00437     GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_Value, 0,
00438                                GWEN_ProgressData_GetCurrent(xdlg->firstProgress), 0);
00439   }
00440 
00441   if (xdlg->secondProgress) {
00442     GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_MaxValue, 0,
00443                                GWEN_ProgressData_GetTotal(xdlg->secondProgress), 0);
00444     GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_Value, 0,
00445                                GWEN_ProgressData_GetCurrent(xdlg->secondProgress), 0);
00446   }
00447 
00448   GWEN_Dialog_SetIntProperty(dlg, "abortButton", GWEN_DialogProperty_Enabled, 0, 1, 0);
00449   GWEN_Dialog_SetIntProperty(dlg, "closeButton", GWEN_DialogProperty_Enabled, 0, 0, 0);
00450 
00451   xdlg->wasInit=1;
00452 }
00453 
00454 
00455 
00456 void GWEN_DlgProgress_Fini(GWEN_DIALOG *dlg) {
00457   GWEN_DLGPROGRESS *xdlg;
00458   int i;
00459   GWEN_DB_NODE *dbParams;
00460 
00461   assert(dlg);
00462   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00463   assert(xdlg);
00464 
00465   dbParams=GWEN_Dialog_GetPreferences(dlg);
00466   assert(dbParams);
00467 
00468   /* store dialog width */
00469   if (xdlg->showLog) {
00470     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1);
00471     GWEN_DB_SetIntValue(dbParams,
00472                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00473                         "dialog_width",
00474                         i);
00475 
00476     /* store dialog height */
00477     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1);
00478     GWEN_DB_SetIntValue(dbParams,
00479                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00480                         "dialog_height",
00481                         i);
00482   }
00483   else {
00484     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1);
00485     GWEN_DB_SetIntValue(dbParams,
00486                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00487                         "dialog_width_nolog",
00488                         i);
00489 
00490     /* store dialog height */
00491     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1);
00492     GWEN_DB_SetIntValue(dbParams,
00493                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00494                         "dialog_height_nolog",
00495                         i);
00496   }
00497 }
00498 
00499 
00500 
00501 
00502 int GWEN_DlgProgress_HandleActivated(GWEN_DIALOG *dlg, const char *sender) {
00503   GWEN_DLGPROGRESS *xdlg;
00504 
00505   assert(dlg);
00506   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00507   assert(xdlg);
00508 
00509   if (strcasecmp(sender, "closeButton")==0) {
00510     return GWEN_DialogEvent_ResultAccept;
00511   }
00512   else if (strcasecmp(sender, "abortButton")==0) {
00513     if (xdlg->firstProgress)
00514       GWEN_ProgressData_SetAborted(xdlg->firstProgress, 1);
00515     if (xdlg->secondProgress)
00516       GWEN_ProgressData_SetAborted(xdlg->secondProgress, 1);
00517 
00518     xdlg->stayOpen=1;
00519     GWEN_Dialog_SetIntProperty(dlg, "abortButton", GWEN_DialogProperty_Enabled, 0, 0, 0);
00520     GWEN_Dialog_SetIntProperty(dlg, "closeButton", GWEN_DialogProperty_Enabled, 0, 1, 0);
00521 
00522     return GWEN_DialogEvent_ResultHandled;
00523   }
00524 
00525   return GWEN_DialogEvent_ResultNotHandled;
00526 }
00527 
00528 
00529 
00530 
00531 int GWENHYWFAR_CB GWEN_DlgProgress_SignalHandler(GWEN_DIALOG *dlg,
00532                                                  GWEN_DIALOG_EVENTTYPE t,
00533                                                  const char *sender) {
00534   GWEN_DLGPROGRESS *xdlg;
00535 
00536   assert(dlg);
00537   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00538   assert(xdlg);
00539 
00540   switch(t) {
00541   case GWEN_DialogEvent_TypeInit:
00542     GWEN_DlgProgress_Init(dlg);
00543     return GWEN_DialogEvent_ResultHandled;;
00544 
00545   case GWEN_DialogEvent_TypeFini:
00546     GWEN_DlgProgress_Fini(dlg);
00547     return GWEN_DialogEvent_ResultHandled;;
00548 
00549   case GWEN_DialogEvent_TypeValueChanged:
00550     break;
00551 
00552   case GWEN_DialogEvent_TypeActivated:
00553     return GWEN_DlgProgress_HandleActivated(dlg, sender);
00554 
00555   case GWEN_DialogEvent_TypeEnabled:
00556   case GWEN_DialogEvent_TypeDisabled:
00557 
00558   case GWEN_DialogEvent_TypeClose:
00559     if (xdlg->allowClose==0)
00560       return GWEN_DialogEvent_ResultReject;
00561     else
00562       return GWEN_DialogEvent_ResultAccept;
00563 
00564   case GWEN_DialogEvent_TypeLast:
00565     return GWEN_DialogEvent_ResultNotHandled;
00566   }
00567 
00568   return GWEN_DialogEvent_ResultNotHandled;
00569 
00570 }
00571 
00572 
00573 
00574 
00575 
00576