mstatus.h

Go to the documentation of this file.
00001 /**
00002  * \file mstatus.h <mi32/mstatus.h>
00003  * \brief Include file for "status display" functions
00004  *
00005  * \if NODOC
00006  * $Id: mstatus.h_v 1.70 2004/10/29 16:26:00 scowan Exp $
00007  *
00008  * $Log: mstatus.h_v $
00009  * Revision 1.70  2004/10/29 16:26:00  scowan
00010  * *** empty log message ***
00011  *
00012  * Revision 1.69  2004/03/01 21:09:45  mju
00013  * Can't use 'interface' as Microsoft #defines it as 'struct'.
00014  *
00015  * Revision 1.68  2004/03/01 17:29:55  mju
00016  * Use inlines instead of macros and mark most legacy Mstatus functions as deprecated.
00017  *
00018  * Revision 1.67  2004/02/16 21:29:17  mju
00019  * Don't call deprecated item from inline as warns unnecessarily.
00020  *
00021  * Revision 1.66  2004/02/16 21:00:54  mju
00022  * Warn on deprecated usage.
00023  *
00024  * Revision 1.65  2003/12/18 14:19:20  mju
00025  * Remove deprecated textUpdateTimer method.
00026  *
00027  * Revision 1.64  2003/10/20 17:16:01  dwilliss
00028  * Added and immediately deprecated a method to get the handle from a dialog
00029  *
00030  * Revision 1.63  2003/10/10 15:21:26  mju
00031  * Add ReportDone and UpdateTimer methods using textid.
00032  *
00033  * Revision 1.62  2003/10/08 16:41:55  mju
00034  * Include mtimer header.
00035  *
00036  * Revision 1.61  2003/09/15 13:49:56  fileserver!dwilliss
00037  * Doxygen
00038  *
00039  * Revision 1.60  2003/09/08 16:36:16  dwilliss
00040  * never mind.
00041  *
00042  * Revision 1.59  2003/08/13 20:18:45  scowan
00043  * Added bool value to disable cancel class.
00044  *
00045  * Revision 1.58  2003/07/21 17:04:01  mju
00046  * Add deprecate_groupkey for stuff using old msg group/ley.
00047  *
00048  * Revision 1.57  2003/05/21 22:19:06  dwilliss
00049  * Never mind.  Wrong version
00050  *
00051  * Revision 1.56  2003/05/21 14:43:33  dwilliss
00052  * Oops.  Accidently pasted the new method twice
00053  *
00054  * Revision 1.55  2003/05/21 14:40:22  dwilliss
00055  * Added STATUSDIALOG::SetSelfAsDefault()
00056  *
00057  * Revision 1.54  2003/03/04 17:01:44  dwilliss
00058  * *** empty log message ***
00059  *
00060  * Revision 1.53  2003/02/17 20:52:47  dwilliss
00061  * never mind
00062  *
00063  * Revision 1.52  2002/05/30 21:55:51  mju
00064  * Remove varargs defns.
00065  *
00066  * Revision 1.51  2002/05/06 15:21:18  mju
00067  * Deprecate var-arg statusinterface functions.
00068  *
00069  * Revision 1.50  2002/04/26 13:57:16  mju
00070  * Retire statuscontext::textupdatef.
00071  *
00072  * Revision 1.48  2002/03/28 17:24:01  mju
00073  * Add TextUpdate using TEXTID.
00074  *
00075  * Revision 1.47  2002/03/27 17:27:14  mju
00076  * Deprecate remaining varargs macros.
00077  *
00078  * Revision 1.46  2002/03/27 16:33:39  mju
00079  * Deprecate STATUSCONTEXT::TextUpdateF, Remove TextUpdateLineF.
00080  *
00081  * Revision 1.45  2002/03/20 17:49:59  mju
00082  * Add STATUSCONTEXT::Destroy() method.
00083  *
00084  * Revision 1.44  2002/02/20 18:06:07  mju
00085  * In CheckCancel check if context null before dereference.
00086  *
00087  * Revision 1.43  2001/06/21 22:34:30  scowan
00088  * Reinstate call to get the default handle.
00089  *
00090  * Revision 1.42  2001/05/15 14:30:50  scowan
00091  * Doc.
00092  *
00093  * Revision 1.41  2001/05/15 14:28:50  scowan
00094  * Added disable cancel class.
00095  *
00096  * Revision 1.40  2001/02/07 16:34:37  scowan
00097  * Check for status context == 0 defore enable / disable cancel button.
00098  *
00099  * Revision 1.39  2001/02/02 22:11:35  polson
00100  * changed ~STATUSDIALOG to check if already destroyed
00101  *
00102  * Revision 1.38  2000/11/20 17:20:54  scowan
00103  * Added a get handle method for legacy functions.
00104  *
00105  * Revision 1.37  2000/10/23 15:06:54  mju
00106  * Add STATUSDIALOG class.
00107  *
00108  * Revision 1.36  2000/08/31 14:51:52  mju
00109  * Add dft for line in BarUpdate.
00110  *
00111  * Revision 1.35  2000/06/26 20:42:09  mju
00112  * *** empty log message ***
00113  *
00114  * Revision 1.34  2000/06/26 19:42:55  sparsons
00115  * Genitor documentation.
00116  *
00117  * Revision 1.33  2000/06/01 16:48:02  scowan
00118  * Added capability to create a status context instance without creating a context
00119  * untill later with a create method.
00120  *
00121  * Revision 1.32  1999/11/19 17:19:01  mju
00122  * Use INT16 for line number to avoid warnings.
00123  *
00124  * Revision 1.31  1999/09/03  15:01:43  mju
00125  * Add STATUSCONTEXT class.
00126  *
00127  * Revision 1.30  1999/06/09  14:36:24  mju
00128  * Add win32-native prototypes.
00129  *
00130  * Revision 1.29  1999/05/19  14:48:45  mju
00131  * Use const for group/field parms.
00132  *
00133  * Revision 1.28  1999/05/07  21:20:01  mju
00134  * Header restruct.
00135  *
00136  * Revision 1.27  1999/01/05  19:12:44  scowan
00137  * Swapped multiple keywords
00138  *
00139  * Revision 1.26  1998/12/18 22:41:21  mju
00140  * Make most Mstatus... functions into macros reference public status interface so can pass to DLL.
00141  * Add rest of status functions to MSTATUSINTERFACE.
00142  *
00143  * Revision 1.23  1998/08/26  16:50:17  scowan
00144  * Move status interface code to here.
00145  *
00146  * Revision 1.22  1998/07/20  21:14:44  mju
00147  * Add MSTATUSFLAG_AllowFinish.
00148  *
00149  * Revision 1.21  1997/12/10  16:56:20  shovland
00150  * add a newline to end of file to make Digital UNIX (DrPepper) system happy
00151  *
00152  * Revision 1.20  1997/11/19  17:11:44  mju
00153  * Add MstatusTextUpdateFV().
00154  *
00155  * Revision 1.19  1997/10/17  16:15:34  mju
00156  * Change to use MTIMER.
00157  * Add MstatusTimerGet and MstatusTimerReset.
00158  *
00159  * Revision 1.18  1997/10/06  16:50:11  mju
00160  * Change prototype for MstatusTextUpdateTimer().
00161  *
00162  * Revision 1.17  1997/10/03  20:01:07  mju
00163  * Add MstatusTextUpdateString().
00164  *
00165  * Revision 1.16  1997/08/28  20:07:51  dwilliss
00166  * Added a field to STATUSLINEDATA
00167  *
00168  * Revision 1.15  1997/05/23  21:24:03  dwilliss
00169  * Added support for MSTATUS_DelayPopup
00170  *
00171  * Revision 1.14  1997/01/03  16:57:05  mju
00172  * Change MstatusClearBar to MstatusBarClear.  ditto for Text.
00173  *
00174  * Revision 1.13  1996/12/20  16:37:34  coffee!dwilliss
00175  * Added __cplusplus things
00176  *
00177  * Revision 1.12  1996/12/05  16:37:50  dwilliss
00178  * Added MstatusForm functions
00179  *
00180  * Revision 1.11  1996/12/03  18:34:58  mju
00181  * Add MstatusWaitForOK() and MstatusDialogGetForm().
00182  *
00183  * Revision 1.10  1996/11/25  23:13:03  mju
00184  * Allow multi-line text.
00185  *
00186  * Revision 1.9  1996/11/25  15:04:02  mju
00187  * Add MstatusTextUpdateF() prototype.
00188  *
00189  * Revision 1.8  1996/11/22  15:03:03  mju
00190  * Change Mstatus...Bar to MstatusBar...
00191  * Change Mstatus...Text to MstatusText...
00192  *
00193  * Revision 1.7  1996/11/21  22:59:47  mju
00194  * Add MstatusInitBar() and MstatusIncrementBar().
00195  *
00196  * Revision 1.6  1996/11/21  21:12:15  mju
00197  * Change MstatusUpdate... to return int (for cancelled status).
00198  *
00199  * Revision 1.5  1996/11/21  20:51:36  mju
00200  * MstatusDialogCreate() prototype changed.
00201  *
00202  * Revision 1.4  1996/11/21  18:33:42  mju
00203  * Include private definition if MSTATUS_LIB defined.
00204  *
00205  * Revision 1.3  1996/11/21  15:14:52  mju
00206  * Changed MstatusContextDestroy() to MstatusContextFree().
00207  *
00208  * Revision 1.2  1996/11/20  23:04:28  mju
00209  * Change cancelled from Boolean to int so works if xdefns not included.
00210  *
00211  * Revision 1.1  1996/11/20  14:45:23  mju
00212  * Initial revision
00213  *
00214  * Revision 1.1  1994/08/10  14:49:25  mju
00215  * Initial revision
00216  *
00217  * \endif
00218 **/
00219 
00220 #ifndef  INC_MI32_MSTATUS_H
00221 #define  INC_MI32_MSTATUS_H
00222 
00223 #ifndef  INC_STDARG_H
00224    #include <stdarg.h>
00225    #define  INC_STDARG_H
00226 #endif
00227 
00228 #ifndef  INC_MI32_STDDEFNS_H
00229    #include <mi32/stddefns.h>
00230 #endif
00231 
00232 #if defined(MSTATUS_LIB) && !defined(INC_MI32_MIODEFNS_H)
00233    #include <mi32/miodefns.h>
00234 #endif
00235 
00236 #ifndef INC_MI32_MISTRING_H
00237 #include <mi32/mistring.h>
00238 #endif
00239 
00240 #ifndef  INC_MI32_MTIMER_H
00241 #include <mi32/mtimer.h>
00242 #endif
00243 
00244 
00245 #ifdef WIN32
00246 #pragma warning (disable:4996)   // Disable warning about deprecated declaration within header
00247 #endif
00248 
00249 #ifdef RVCLOWDLL
00250    #define RVCLOWLIBEXPORT MI_DLLEXPORT
00251 #else
00252    #define RVCLOWLIBEXPORT MI_DLLIMPORT
00253 #endif
00254 
00255 
00256 
00257 #if defined(__cplusplus)
00258 extern "C" {
00259 #endif
00260 
00261 #define  MSTATUSFLAG_NoCancel    0x0001   //!<  Don't include "Cancel" button 
00262 #define  MSTATUSFLAG_DelayPopup  0x0002   //!<  Don't popup until after a given time (read from Ini file) 
00263 #define  MSTATUSFLAG_AllowFinish 0x0004   //!<  Include "Finish" button 
00264 
00265 typedef struct _MSTATUSCONTEXT {
00266    struct _MSTATUSHANDLE *shandle;
00267    #ifdef MSTATUS_LIB
00268       /* Private members */
00269       struct _MSTATUSCONTEXT *nextcontext;
00270       INT16 firstline;
00271       INT16 lastline;
00272    #endif
00273    } *MSTATUSCONTEXT;
00274 
00275 #ifdef MSTATUS_LIB
00276    typedef struct {
00277       UNICODE *text;                      //!<  NULL if no text for this line 
00278       UINT8 HasBar;                       //!<  Set if we have a progress bar for this line 
00279       UINT8 textrows;                     //!<  Number of text rows 
00280       UINT16 textwidth;                   //!<  Width of text in pixels 
00281       INT32 curval, maxval;                  //!<  Current and "maximum" values for progress bar 
00282       INT32 barupdatemodval;              //!<  Modulus value for actually updating bar 
00283       INT32 barcancelmodval;              //!<  Modulus value for checking for cancel during bar update 
00284       INT32 lastupdateval;                //!<  Last bar width (pixels) at which we updated status bar 
00285       } MSTATUSLINEDATA;
00286 #endif
00287 
00288 typedef struct _MSTATUSHANDLE {
00289    int cancelled;
00290    #ifdef MSTATUS_LIB
00291       /* Private members */
00292       int canceldisablecount;             //!<  Number of times cancel button has been disabled 
00293       int (*TestCancel)(struct _MSTATUSHANDLE *, void *);
00294       void *TestCancelData;
00295       MSTATUSLINEDATA *linedata;
00296       MSTATUSCONTEXT firstcontext;        //!<  First status context in linked-list 
00297       MSTATUSCONTEXT curcontext;
00298       MTIMER timer;
00299       struct _MSTATUSHANDLE *prevdfthandle;  //!<  Previous default status handle 
00300       void *privptr;                         //!<  Used by implementation 
00301    #endif
00302    } *MSTATUSHANDLE;
00303 
00304 
00305 /**
00306 *  Generic status interface structure
00307 **/
00308 
00309 typedef struct _MSTATUSINTERFACE {
00310    /* This structure is passed to multiple DLLs */
00311    /* To maintain compatibility, do not change or remove any existing members */
00312    /* New members must be added to the end */
00313    /* All functions must be initialized to non-NULL in mstatusi.c or ILLOPs will occur */
00314    INT32 size;
00315    void (*StatusBarClear)(MSTATUSCONTEXT, INT16);
00316    int (*StatusBarIncrement)(MSTATUSCONTEXT, INT16, INT32);
00317    int (*StatusBarInit)(MSTATUSCONTEXT, INT16, INT32);
00318    int (*StatusBarUpdate)(MSTATUSCONTEXT, INT16, INT32, INT32);
00319    void (*StatusClearAll)(MSTATUSCONTEXT);
00320    void (*StatusClearLine)(MSTATUSCONTEXT, INT16);
00321    int (*StatusCheckCancel)(MSTATUSHANDLE);
00322    MSTATUSCONTEXT (*StatusContextCreate)(MSTATUSHANDLE);
00323    void (*StatusContextFree)(MSTATUSCONTEXT);
00324    void (*StatusDisableCancel)(MSTATUSHANDLE);
00325    void (*StatusEnableCancel)(MSTATUSHANDLE);
00326    void (*StatusResetCancel)(MSTATUSHANDLE); /* Has default */
00327    void (*StatusTextClear)(MSTATUSCONTEXT, INT16);
00328    int (*StatusTextUpdate)(MSTATUSCONTEXT, INT16, const char*, const char*);  /* Has default */
00329    int (*StatusTextUpdateString)(MSTATUSCONTEXT, INT16, const UNICODE*);
00330    int (*REMOVED_StatusTextUpdateF)();
00331    MSTATUSHANDLE (*StatusGetDefaultHandle)(void);     //! Do not obsolete, needed to support multi-threading  SBC 21 Jun 01
00332    int (*StatusDialogCreate)(void*, MSTATUSHANDLE*, MSTATUSCONTEXT*, UINT32);
00333    void (*StatusDialogDestroy)(MSTATUSHANDLE);
00334    void (*StatusReportDone)(MSTATUSHANDLE, const char*, const char*);
00335    void (*StatusSetCancelFunc)(MSTATUSHANDLE, int(*)(MSTATUSHANDLE, void*), void*); /* Has default */
00336    int (*REMOVED_StatusTextUpdateFV)();
00337    int (*StatusTextUpdateTimer) (MSTATUSCONTEXT, INT16, const char*, const char*, MTIMER*);  /* Has default */
00338    MTIMER *(*StatusTimerGet)(MSTATUSHANDLE); /* Has default */
00339    void (*StatusTimerReset)(MSTATUSHANDLE);  /* Has default */
00340    void (*StatusWaitForOK)(MSTATUSHANDLE);
00341    MSTATUSHANDLE (*StatusSetDefaultHandle)(MSTATUSHANDLE);  /* Cannot override */
00342    MSTATUSHANDLE DefaultHandle;
00343    void (*ReportDone) (MSTATUSHANDLE, TEXTID);
00344    int (*TextUpdateTimer) (MSTATUSCONTEXT, INT16, TEXTID, MTIMER*);
00345    } *MSTATUSINTERFACE;
00346 
00347 
00348 #if defined(MAC_OSX) && defined(RVCSYSDLL)
00349 //! linker on Mac OS X exports all symbols and we get clashes if we use the
00350 //! same name
00351 #define DftStatusInterface DftStatusInterfaceRVCSYS
00352 #endif
00353 
00354 extern MSTATUSINTERFACE DftStatusInterface;
00355 
00356 /* When implementing a DLL, DftStatusInterface must be defined as a public global */
00357 /* in one of the DLL modules.  It must be initialized to the process' value when */
00358 /* the DLL is initialized */
00359 
00360 
00361 //=====================================================================================================================
00362 
00363 //! Get the status.
00364 RVCLOWLIBEXPORT MSTATUSINTERFACE MfStatusGet (void);
00365 
00366 //! Set the status.
00367 RVCLOWLIBEXPORT void MfStatusSet (
00368    MSTATUSINTERFACE status
00369    );
00370 
00371 DEPRECATED inline void MstatusBarClear (
00372    MSTATUSCONTEXT c,
00373    INT16 ln
00374    ) { (*DftStatusInterface->StatusBarClear)(c,ln); }
00375 
00376 DEPRECATED inline int MstatusBarIncrement (
00377    MSTATUSCONTEXT c,
00378    INT16 ln,
00379    INT32 inc
00380    ) { return ((*DftStatusInterface->StatusBarIncrement)(c,ln,inc)); }
00381 
00382 DEPRECATED inline int MstatusBarInit (
00383    MSTATUSCONTEXT c,
00384    INT16 ln,
00385    INT32 max
00386    ) { return ((*DftStatusInterface->StatusBarInit)(c,ln,max)); }
00387 
00388 DEPRECATED inline int MstatusBarUpdate (
00389    MSTATUSCONTEXT c,
00390    INT16 ln,
00391    INT32 val,
00392    INT32 max
00393    ) { return ((*DftStatusInterface->StatusBarUpdate)(c,ln,val,max)); }
00394 
00395 DEPRECATED inline int MstatusCheckCancel (
00396    MSTATUSHANDLE h
00397    ) { return ((*DftStatusInterface->StatusCheckCancel)(h)); }
00398 
00399 DEPRECATED inline void MstatusClearAll (
00400    MSTATUSCONTEXT c
00401    ) { (*DftStatusInterface->StatusClearAll)(c); }
00402 
00403 DEPRECATED inline void MstatusClearLine (
00404    MSTATUSCONTEXT c,
00405    INT16 ln
00406    ) { (*DftStatusInterface->StatusClearLine)(c,ln); }
00407 
00408 DEPRECATED inline MSTATUSCONTEXT MstatusContextCreate (
00409    MSTATUSHANDLE h
00410    ) { return ((*DftStatusInterface->StatusContextCreate)(h)); }
00411 
00412 DEPRECATED inline void MstatusContextFree (
00413    MSTATUSCONTEXT c
00414    ) { (*DftStatusInterface->StatusContextFree)(c); }
00415 
00416 DEPRECATED inline int MstatusDialogCreate (
00417    MDLGPARENT p,
00418    MSTATUSHANDLE *ph,
00419    MSTATUSCONTEXT *pc,
00420    UINT32 flags
00421    ) { return ((*DftStatusInterface->StatusDialogCreate)(p,ph,pc,flags)); }
00422 
00423 DEPRECATED inline void MstatusDialogDestroy (
00424    MSTATUSHANDLE h
00425    ) { (*DftStatusInterface->StatusDialogDestroy)(h); }
00426 
00427 DEPRECATED inline void MstatusDisableCancel (
00428    MSTATUSHANDLE h
00429    ) { (*DftStatusInterface->StatusDisableCancel)(h); }
00430 
00431 DEPRECATED inline void MstatusEnableCancel (
00432    MSTATUSHANDLE h
00433    ) { (*DftStatusInterface->StatusEnableCancel)(h); }
00434 
00435 inline MSTATUSHANDLE MstatusGetDefaultHandle (
00436    ) { return ((*DftStatusInterface->StatusGetDefaultHandle)()); }
00437 
00438 inline MSTATUSINTERFACE& MstatusInterfaceGet (
00439    ) { return (DftStatusInterface); }
00440 
00441 void MstatusInterfaceSet (
00442    MSTATUSINTERFACE StatusInterface
00443    );
00444 
00445 #ifndef DEPRECATE_GROUPKEY
00446 DEPRECATED inline void MstatusReportDone (
00447    MSTATUSHANDLE h,
00448    const char *mg,
00449    const char *mc
00450    ) { (*DftStatusInterface->StatusReportDone)(h,mg,mc); }
00451 #endif
00452 
00453 DEPRECATED inline void MstatusResetCancel (
00454    MSTATUSHANDLE h
00455    ) { (*DftStatusInterface->StatusResetCancel)(h); }
00456 
00457 DEPRECATED inline void MstatusSetCancelFunc (
00458    MSTATUSHANDLE h,
00459    int (*f)(MSTATUSHANDLE, void*),
00460    void *d
00461    ) { (*DftStatusInterface->StatusSetCancelFunc)(h,f,d); }
00462 
00463 DEPRECATED inline MSTATUSHANDLE MstatusSetDefaultHandle (
00464    MSTATUSHANDLE h
00465    ) { return ((*DftStatusInterface->StatusSetDefaultHandle)(h)); }
00466 
00467 DEPRECATED inline void MstatusTextClear (
00468    MSTATUSCONTEXT c,
00469    INT16 ln
00470    ) { (*DftStatusInterface->StatusTextClear)(c,ln); }
00471 
00472 DEPRECATED inline int MstatusTextUpdateString (
00473    MSTATUSCONTEXT c,
00474    INT16 ln,
00475    const UNICODE *s
00476    ) { return ((*DftStatusInterface->StatusTextUpdateString)(c,ln,s)); }
00477 
00478 #ifndef DEPRECATE_GROUPKEY
00479 DEPRECATED inline int MstatusTextUpdateTimer (
00480    MSTATUSCONTEXT c,
00481    INT16 ln,
00482    const char *mg,
00483    const char *mc,
00484    MTIMER *t
00485    ) { return ((*DftStatusInterface->StatusTextUpdateTimer)(c,ln,mg,mc,t)); }
00486 #endif
00487 
00488 DEPRECATED inline MTIMER* MstatusTimerGet (
00489    MSTATUSHANDLE h
00490    ) { return ((*DftStatusInterface->StatusTimerGet)(h)); }
00491 
00492 DEPRECATED inline void MstatusTimerReset (
00493    MSTATUSHANDLE h
00494    ) { (*DftStatusInterface->StatusTimerReset)(h); }
00495 
00496 DEPRECATED inline void MstatusWaitForOK (
00497    MSTATUSHANDLE h
00498    ) { (*DftStatusInterface->StatusWaitForOK)(h); }
00499 
00500 #if defined(WIN32_NATIVE)
00501 
00502 class CStatusBar;
00503 
00504 //! Create and manage a single line status form.
00505 int MstatusFormCreate (
00506    CStatusBar *pStatusBar,             //!< Parent widget for dialog (will use toplevel if NULL)
00507    MSTATUSHANDLE *rshandle,            //!< Status handle returned
00508    UINT32 flags                        //!< Flags
00509    );
00510 
00511 //! Destroy and clear status form.
00512 void MstatusFormDestroy (
00513    MSTATUSHANDLE shandle
00514    );
00515 
00516 //! Initialize status interface to Windows functions.
00517 void MstatusInterfaceInitWin (void);
00518 
00519 #else    //!< X
00520 
00521 //! Initialize status interface to X functions.
00522 void MstatusInterfaceInitX (void);
00523 
00524 #endif
00525 
00526 #if defined(__cplusplus)
00527 }
00528 #endif
00529 
00530 
00531 #ifndef  DEPRECATE_GROUPKEY
00532 DEPRECATED inline ERRVALUE MstatusTextUpdate (
00533    MSTATUSCONTEXT c, 
00534    INT16 line,
00535    const char *msggroup,
00536    const char *msgkey
00537    ) { return ((*DftStatusInterface->StatusTextUpdate)(c,line,msggroup,msgkey)); }
00538 #endif
00539 
00540 inline ERRVALUE MstatusTextUpdate (
00541    MSTATUSCONTEXT c, 
00542    INT16 line,
00543    TEXTID textid
00544    ) { return ((*DftStatusInterface->StatusTextUpdateString)(c,line,MISTRING(textid))); }
00545 
00546 
00547 
00548 //! Status dialog.
00549 class STATUSDIALOG {
00550    public:
00551 
00552       enum FLAGS {
00553          FLAG_NoCancel =      MSTATUSFLAG_NoCancel,
00554          FLAG_DelayPopup =    MSTATUSFLAG_DelayPopup,
00555          FLAG_AllowFinish =   MSTATUSFLAG_AllowFinish,
00556          FLAG_None =          0
00557          };
00558 
00559       //! Constructor, performs initialization only, does not create dialog itself.
00560       STATUSDIALOG (
00561          ): m_shandle(0) { }
00562 
00563       //! Destructor, will destroy dialog if exists.
00564       ~STATUSDIALOG (
00565          ) { if (m_shandle != 0) MstatusDialogDestroy(m_shandle); }
00566 
00567       //! Check if 'Cancel' button has been pressed.
00568       //! @return EUserCancel if pressed or 0 if not.
00569       ERRVALUE CheckCancel (
00570          ) const { return (MstatusCheckCancel(m_shandle)); }
00571 
00572       //! Create the actual dialog.
00573       ERRVALUE Create (
00574          MDLGPARENT dlgparent,               //!< Parent for dialog
00575          FLAGS flags = FLAG_None
00576          ) { return (MstatusDialogCreate(dlgparent,&m_shandle,0,flags)); }
00577 
00578       //! Destroy dialog without destroying class instance.
00579       void Destroy (
00580          ) { MstatusDialogDestroy(m_shandle); m_shandle = 0; }
00581 
00582       //! Disable the 'Cancel' button on the dialog (if any).
00583       void DisableCancel (
00584          ) const { MstatusDisableCancel(m_shandle); }
00585 
00586       //! Enable the 'Cancel' button on the dialog (if any).
00587       void EnableCancel (
00588          ) const { MstatusEnableCancel(m_shandle); }
00589 
00590       //! Get the MSTATUSHANDLE for the dialog.
00591       //! \deprecated No new code should be written to take an MSTATUSHANDLE
00592       //!   directly, however this method is still necessary for calling some
00593       //!   old code.
00594       MSTATUSHANDLE GetHandle (
00595          ) const {
00596          return (m_shandle);
00597          }
00598 
00599       //! Get timer associated with status dialog.
00600       MTIMER* GetTimer (
00601          ) const { return (MstatusTimerGet(m_shandle)); }
00602 
00603       //! Report that process is finished with time.
00604       //! This will change the 'Cancel' button to 'OK' wait for the user to press.
00605       //! If the TEXTID__None is specified a generic 'time to process' message will be shown.
00606       void ReportDone (
00607          TEXTID textid = TEXTID__None
00608          ) const { (*DftStatusInterface->ReportDone)(m_shandle,textid); }
00609 
00610    #ifndef DEPRECATE_GROUPKEY
00611       //! Report that process is finished.
00612       //! This will change the 'Cancel' button to 'OK' and is normally
00613       //! followed by WaitForOK().
00614       DEPRECATED void ReportDone (
00615          const char *msggroup,
00616          const char *msgkey
00617          ) const { (*DftStatusInterface->StatusReportDone)(m_shandle,msggroup,msgkey); }
00618    #endif
00619 
00620       //! Reset the 'Cancel' button on the dialog (if any).
00621       void ResetCancel (
00622          ) const { MstatusResetCancel(m_shandle); }
00623 
00624       //! Reset timer associated with status dialog.
00625       void ResetTimer (
00626          ) const { MstatusTimerReset(m_shandle); }
00627       
00628       //! Sets this dialog to be the default status handle.  
00629       //! Useful when calling functions that don't play nice and set the
00630       //! default back to 0 when they exit.
00631       MSTATUSHANDLE SetSelfAsDefault (
00632          ) { return (MstatusSetDefaultHandle(m_shandle)); }
00633 
00634       //! Wait for user to press 'OK' button.
00635       void WaitForOK (
00636          ) const { MstatusWaitForOK(m_shandle); }
00637 
00638    private:
00639       #ifndef GENERATING_DOXYGEN_OUTPUT
00640       MSTATUSHANDLE m_shandle;
00641 
00642       STATUSDIALOG (const STATUSDIALOG&);
00643       STATUSDIALOG& operator= (const STATUSDIALOG&);
00644 
00645       friend class STATUSCONTEXT;
00646       #endif // GENERATING_DOXYGEN_OUTPUT
00647    };
00648 DEFINE_ENUM_OPERATORS(STATUSDIALOG::FLAGS);
00649 
00650 
00651 //! Status context.
00652 class STATUSCONTEXT {
00653    public:
00654 
00655       //! Constructor using default status dialog.
00656       explicit STATUSCONTEXT (            
00657          MSTATUSHANDLE shandle = 0,
00658          bool CreateContext = true
00659          ) :
00660          m_scontext(0)
00661          { if (CreateContext) Create(shandle); }
00662 
00663       //! Construct context in STATUSDIALOG.
00664       explicit STATUSCONTEXT (
00665          STATUSDIALOG& sdialog
00666          ):
00667          m_scontext(0)
00668          { if (sdialog.m_shandle != 0) Create(sdialog.m_shandle); }
00669 
00670       //! Destructor.
00671       ~STATUSCONTEXT (                    
00672          ) { Destroy(); }
00673 
00674       //! Clear the status bar.
00675       void BarClear (
00676          INT16 line = 0
00677          ) { MstatusBarClear(m_scontext,line); }
00678 
00679       //! Increment progress indicator bar position.
00680       int BarIncrement (
00681          INT32 increment = 1,             //!< Amount to increment by 
00682          INT16 line = 0                   //!< Line number within context
00683          ) { return (MstatusBarIncrement(m_scontext,line,increment)); }
00684 
00685       //! Initialize or reset progress bar.
00686       int BarInit (
00687          INT32 maximum,                   //!< Maximum expected number of calls to MstatusBarIncrement()
00688          INT16 line = 0                   //!< Line number within context
00689          ) { return (MstatusBarInit(m_scontext,line,maximum)); }
00690             
00691       //! Update progress indicator bar position. 
00692       int BarUpdate (
00693          INT32 value,                     //!< Current bar position
00694          INT32 maximum,                   //!< Maximum bar position
00695          INT16 line = 0                   //!< Line number within context
00696          ) { return (MstatusBarUpdate(m_scontext,line,value,maximum)); }
00697 
00698       //! Check if cancel button has been pressed.
00699       int CheckCancel (
00700          ) { return ((m_scontext != 0) ? MstatusCheckCancel(m_scontext->shandle) : 0); }
00701 
00702       //! Clear all lines in status context.
00703       void Clear (
00704          ) { MstatusClearAll(m_scontext); }
00705 
00706       //! Clear both text and indicator bar in context.
00707       void ClearLine (
00708          INT16 line = 0
00709          ) { MstatusClearLine(m_scontext,line); }
00710          
00711       //! Create a status context.
00712       void Create (
00713          MSTATUSHANDLE shandle = 0
00714          ) { m_scontext = MstatusContextCreate(shandle); }
00715 
00716       //! Destroy status context.
00717       //! Automatically called by destructor.
00718       void Destroy (
00719          ) { MstatusContextFree(m_scontext); m_scontext = 0; }
00720 
00721       //! Disable cancel button.
00722       void DisableCancel (
00723          ) { if (m_scontext != 0) MstatusDisableCancel(m_scontext->shandle); }
00724 
00725       //! Enable cancel button.
00726       void EnableCancel (
00727          ) { if (m_scontext != 0) MstatusEnableCancel(m_scontext->shandle); }
00728 
00729       //! Obtain internal handle for legacy functions    
00730       MSTATUSCONTEXT GetHandle (
00731          ) const { return (m_scontext); }
00732 
00733    #ifndef  DEPRECATE_GROUPKEY
00734       //! Update text line using a message.
00735       //! \deprecated
00736       DEPRECATED int TextUpdate (
00737          const char *MsgGroup,
00738          const char *MsgName,
00739          INT16 line = 0
00740          ) { return ((*DftStatusInterface->StatusTextUpdate)(m_scontext,line,MsgGroup,MsgName)); }
00741    #endif
00742 
00743       //! Update text line using a string.
00744       int TextUpdate (
00745          const MISTRING& string,             //!< Text string (also implies TEXTID)
00746          INT16 line = 0
00747          ) { return (MstatusTextUpdateString(m_scontext,line,string)); }
00748 
00749       //! Update text line using status timer and description.
00750       int TextUpdateTimer (
00751          TEXTID textid,
00752          INT16 line = 0
00753          ) { return ((*DftStatusInterface->TextUpdateTimer)(m_scontext,line,textid,NULL)); }
00754 
00755       //! Update text line using specified timer and description.
00756       int TextUpdateTimer (
00757          TEXTID textid,
00758          MTIMER& timer,
00759          INT16 line = 0
00760          ) { return ((*DftStatusInterface->TextUpdateTimer)(m_scontext,line,textid,&timer)); }
00761 
00762    private:
00763       #ifndef GENERATING_DOXYGEN_OUTPUT
00764       MSTATUSCONTEXT m_scontext;
00765 
00766       STATUSCONTEXT (const STATUSCONTEXT&);
00767       STATUSCONTEXT& operator= (const STATUSCONTEXT&);
00768       #endif // GENERATING_DOXYGEN_OUTPUT
00769    };
00770    
00771 
00772 //! Class to disable status "Cancel" button when an instance is created and reenable the button when the instance is destroyed   
00773 class STATUSDISABLECANCEL {
00774    public:
00775 
00776       //! Constructor.
00777       STATUSDISABLECANCEL (
00778          MSTATUSHANDLE sdh = 0,
00779          bool Enable = true
00780          ) :
00781          m_msh(sdh)
00782          {
00783          if (Enable) {
00784             if (m_msh == 0) m_msh = MstatusGetDefaultHandle();
00785             if (m_msh != 0) MstatusDisableCancel(m_msh);
00786             }
00787          else {
00788             m_msh = 0;
00789             }
00790          }
00791 
00792       //! Destructor.
00793       ~STATUSDISABLECANCEL (
00794          ) { if (m_msh != 0) MstatusEnableCancel(m_msh); }
00795 
00796    private:
00797       #ifndef GENERATING_DOXYGEN_OUTPUT
00798       MSTATUSHANDLE m_msh;
00799 
00800       STATUSDISABLECANCEL (const STATUSDISABLECANCEL&);
00801       STATUSDISABLECANCEL& operator=(const STATUSDISABLECANCEL&);
00802       #endif // GENERATING_DOXYGEN_OUTPUT
00803    };
00804 
00805 #ifdef WIN32
00806 #pragma warning (default:4996)   // Restore warning about deprecated declaration
00807 #endif
00808 
00809 #endif   // INC_MI32_MSTATUS_H 

Generated on Tue Dec 14 13:18:30 2004 for TNTsdk by  doxygen 1.3.8-20040913