gwenhywfar 4.0.3

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() {
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_Init(GWEN_DIALOG *dlg) {
00357   GWEN_DLGPROGRESS *xdlg;
00358   int i;
00359   GWEN_DB_NODE *dbParams;
00360 
00361   assert(dlg);
00362   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00363   assert(xdlg);
00364 
00365   dbParams=GWEN_Dialog_GetPreferences(dlg);
00366   assert(dbParams);
00367 
00368   xdlg->withLogWidth=GWEN_DB_GetIntValue(dbParams, "dialog_width", 0, -1);
00369   xdlg->withLogHeight=GWEN_DB_GetIntValue(dbParams, "dialog_height", 0, -1);
00370 
00371   if (xdlg->showLog) {
00372     int i;
00373   
00374     i=xdlg->withLogWidth;
00375     if (i>=DIALOG_MINWIDTH)
00376       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0);
00377   
00378     i=xdlg->withLogHeight;
00379     if (i>=DIALOG_MINHEIGHT)
00380       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0);
00381 
00382     GWEN_Dialog_SetIntProperty(dlg, "logGroup", GWEN_DialogProperty_Visibility, 0, 1, 0);
00383   }
00384   else {
00385     /* read width */
00386     i=GWEN_DB_GetIntValue(dbParams, "dialog_width_nolog", 0, -1);
00387     if (i>=DIALOG_MINWIDTH)
00388       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, i, 0);
00389   
00390     /* read height */
00391     i=GWEN_DB_GetIntValue(dbParams, "dialog_height_nolog", 0, -1);
00392     if (i>=DIALOG_MINHEIGHT_NOLOG)
00393       GWEN_Dialog_SetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, i, 0);
00394     GWEN_Dialog_SetIntProperty(dlg, "logGroup", GWEN_DialogProperty_Visibility, 0, 0, 0);
00395   }
00396 
00397 
00398   if (xdlg->firstProgress) {
00399     const char *s;
00400 
00401     s=GWEN_ProgressData_GetTitle(xdlg->firstProgress);
00402     if (s && *s)
00403       GWEN_Dialog_SetCharProperty(dlg, "", GWEN_DialogProperty_Title, 0, s, 0);
00404 
00405     s=GWEN_ProgressData_GetText(xdlg->firstProgress);
00406     if (s && *s)
00407       GWEN_Dialog_SetCharProperty(dlg, "descrLabel", GWEN_DialogProperty_Title, 0, s, 0);
00408 
00409     GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_MaxValue, 0,
00410                                GWEN_ProgressData_GetTotal(xdlg->firstProgress), 0);
00411     GWEN_Dialog_SetIntProperty(dlg, "allProgress", GWEN_DialogProperty_Value, 0,
00412                                GWEN_ProgressData_GetCurrent(xdlg->firstProgress), 0);
00413   }
00414 
00415   if (xdlg->secondProgress) {
00416     GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_MaxValue, 0,
00417                                GWEN_ProgressData_GetTotal(xdlg->secondProgress), 0);
00418     GWEN_Dialog_SetIntProperty(dlg, "currentProgress", GWEN_DialogProperty_Value, 0,
00419                                GWEN_ProgressData_GetCurrent(xdlg->secondProgress), 0);
00420   }
00421 
00422   GWEN_Dialog_SetIntProperty(dlg, "abortButton", GWEN_DialogProperty_Enabled, 0, 1, 0);
00423   GWEN_Dialog_SetIntProperty(dlg, "closeButton", GWEN_DialogProperty_Enabled, 0, 0, 0);
00424 
00425   xdlg->wasInit=1;
00426 }
00427 
00428 
00429 
00430 void GWEN_DlgProgress_Fini(GWEN_DIALOG *dlg) {
00431   GWEN_DLGPROGRESS *xdlg;
00432   int i;
00433   GWEN_DB_NODE *dbParams;
00434 
00435   assert(dlg);
00436   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00437   assert(xdlg);
00438 
00439   dbParams=GWEN_Dialog_GetPreferences(dlg);
00440   assert(dbParams);
00441 
00442   /* store dialog width */
00443   if (xdlg->showLog) {
00444     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1);
00445     GWEN_DB_SetIntValue(dbParams,
00446                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00447                         "dialog_width",
00448                         i);
00449 
00450     /* store dialog height */
00451     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1);
00452     GWEN_DB_SetIntValue(dbParams,
00453                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00454                         "dialog_height",
00455                         i);
00456   }
00457   else {
00458     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Width, 0, -1);
00459     GWEN_DB_SetIntValue(dbParams,
00460                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00461                         "dialog_width_nolog",
00462                         i);
00463 
00464     /* store dialog height */
00465     i=GWEN_Dialog_GetIntProperty(dlg, "", GWEN_DialogProperty_Height, 0, -1);
00466     GWEN_DB_SetIntValue(dbParams,
00467                         GWEN_DB_FLAGS_OVERWRITE_VARS,
00468                         "dialog_height_nolog",
00469                         i);
00470   }
00471 }
00472 
00473 
00474 
00475 
00476 int GWEN_DlgProgress_HandleActivated(GWEN_DIALOG *dlg, const char *sender) {
00477   GWEN_DLGPROGRESS *xdlg;
00478 
00479   assert(dlg);
00480   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00481   assert(xdlg);
00482 
00483   if (strcasecmp(sender, "closeButton")==0) {
00484     return GWEN_DialogEvent_ResultAccept;
00485   }
00486   else if (strcasecmp(sender, "abortButton")==0) {
00487     if (xdlg->firstProgress)
00488       GWEN_ProgressData_SetAborted(xdlg->firstProgress, 1);
00489     if (xdlg->secondProgress)
00490       GWEN_ProgressData_SetAborted(xdlg->secondProgress, 1);
00491 
00492     xdlg->stayOpen=1;
00493     GWEN_Dialog_SetIntProperty(dlg, "abortButton", GWEN_DialogProperty_Enabled, 0, 0, 0);
00494     GWEN_Dialog_SetIntProperty(dlg, "closeButton", GWEN_DialogProperty_Enabled, 0, 1, 0);
00495 
00496     return GWEN_DialogEvent_ResultHandled;
00497   }
00498 
00499   return GWEN_DialogEvent_ResultNotHandled;
00500 }
00501 
00502 
00503 
00504 
00505 int GWENHYWFAR_CB GWEN_DlgProgress_SignalHandler(GWEN_DIALOG *dlg,
00506                                                  GWEN_DIALOG_EVENTTYPE t,
00507                                                  const char *sender) {
00508   GWEN_DLGPROGRESS *xdlg;
00509 
00510   assert(dlg);
00511   xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GWEN_DLGPROGRESS, dlg);
00512   assert(xdlg);
00513 
00514   switch(t) {
00515   case GWEN_DialogEvent_TypeInit:
00516     GWEN_DlgProgress_Init(dlg);
00517     return GWEN_DialogEvent_ResultHandled;;
00518 
00519   case GWEN_DialogEvent_TypeFini:
00520     GWEN_DlgProgress_Fini(dlg);
00521     return GWEN_DialogEvent_ResultHandled;;
00522 
00523   case GWEN_DialogEvent_TypeValueChanged:
00524     break;
00525 
00526   case GWEN_DialogEvent_TypeActivated:
00527     return GWEN_DlgProgress_HandleActivated(dlg, sender);
00528 
00529   case GWEN_DialogEvent_TypeEnabled:
00530   case GWEN_DialogEvent_TypeDisabled:
00531 
00532   case GWEN_DialogEvent_TypeClose:
00533     if (xdlg->allowClose==0)
00534       return GWEN_DialogEvent_ResultReject;
00535     else
00536       return GWEN_DialogEvent_ResultAccept;
00537 
00538   case GWEN_DialogEvent_TypeLast:
00539     return GWEN_DialogEvent_ResultNotHandled;
00540   }
00541 
00542   return GWEN_DialogEvent_ResultNotHandled;
00543 
00544 }
00545 
00546 
00547 
00548 
00549 
00550