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

Generated on Thu Apr 26 04:45:09 2007 for TNTsdk by  doxygen 1.5.2