mdlg.h

Go to the documentation of this file.
00001 /**
00002  * \file mdlg.h <mi32/mdlg.h>
00003  * \brief Definitions for standard dialogs
00004  *
00005  * \if NODOC
00006  * $Id: mdlg.h_v 1.85 2004/06/22 20:54:28 mju Exp $
00007  *
00008  * $Log: mdlg.h_v $
00009  * Revision 1.85  2004/06/22 20:54:28  mju
00010  * Move mdlgShowErrorCode to stddefns.
00011  *
00012  * Revision 1.84  2004/05/13 19:24:12  scowan
00013  * Added continue for ask question button.
00014  *
00015  * Revision 1.83  2004/03/05 14:35:55  mju
00016  * Add default ctor for getfolderfilter.
00017  *
00018  * Revision 1.82  2004/03/04 18:40:00  mju
00019  * Use forward-decl to avoid unneeded hdr.
00020  *
00021  * Revision 1.81  2004/03/03 14:55:19  mju
00022  * Ignore warning about deprecated declaration within header.
00023  *
00024  * Revision 1.80  2004/03/01 15:24:35  dwilliss
00025  * Hook function needed callback data
00026  *
00027  * Revision 1.79  2004/03/01 15:10:11  dwilliss
00028  * Added function to set message hook
00029  *
00030  * Revision 1.78  2004/02/18 20:17:07  mju
00031  * Only ifdef out certain prototypes.
00032  *
00033  * Revision 1.77  2004/02/18 17:46:58  mju
00034  * Exclude entire header unless X/MFC.
00035  *
00036  * Revision 1.76  2004/02/17 13:06:55  mju
00037  * Remove unwanted inline.
00038  *
00039  * Revision 1.75  2004/02/16 21:34:10  mju
00040  * Don't have inline call deprecated function as warns unnecessarily.
00041  *
00042  * Revision 1.74  2004/02/16 20:57:15  mju
00043  * Warn on deprecated usage.
00044  *
00045  * Revision 1.73  2003/12/18 13:39:36  mju
00046  * Remove deprecated items.
00047  *
00048  * Revision 1.72  2003/10/24 21:11:20  mju
00049  * Remove obsolete mdlgAskNumber variants.
00050  *
00051  * Revision 1.71  2003/10/24 20:03:16  mju
00052  * Rmv mdlgshowmessagestr prototype.
00053  *
00054  * Revision 1.70  2003/10/24 15:11:37  mju
00055  * Remove obsolete ShowMsg variant using textid and char* helpid.
00056  *
00057  * Revision 1.69  2003/10/24 13:47:20  mju
00058  * Can't inline deprecated asknumber/string as calls another deprecated fn.
00059  *
00060  * Revision 1.68  2003/10/24 13:09:32  mju
00061  * Fully deprecate stuff using char* title but not groupkey.
00062  *
00063  * Revision 1.67  2003/10/22 15:16:25  mju
00064  * Change default for flag to MdlgShowMessageCode to allow saving text.
00065  *
00066  * Revision 1.66  2003/10/17 14:53:05  mju
00067  * Remove unused stuff.
00068  * Add MdlgAskNumber/String variants with no 'title' parm.
00069  * Deprecate more group/key stuff.
00070  * Document MdlgAskYesno/Cancel as being "deprecated".
00071  *
00072  * Revision 1.65  2003/10/15 17:02:03  mju
00073  * Add ShowMessage variant using const MISTRING& and HELPID.
00074  * Use DEPRECATE_OLDHELP on other ShowMessage... variants.
00075  *
00076  * Revision 1.64  2003/10/09 15:10:14  scowan
00077  * Fixed for deprecated groupkey define.
00078  *
00079  * Revision 1.63  2003/09/25 21:29:07  dwilliss
00080  * Don't capitalize enum any more. Genitor needed it, doxygen doesn't like it.
00081  *
00082  * Revision 1.62  2003/09/15 13:49:56  fileserver!dwilliss
00083  * Doxygen
00084  *
00085  * Revision 1.61  2003/09/09 14:20:18  msmith
00086  * removed savediscardcancel
00087  *
00088  * Revision 1.60  2003/09/08 21:05:05  dwilliss
00089  * Added doxygen start/end tags for functions groups
00090  *
00091  * Revision 1.59  2003/09/08 19:40:49  scowan
00092  * Changed dl;gqw enum flags.
00093  *
00094  * Revision 1.58  2003/09/05 21:26:41  mju
00095  * Add DLGQSTYLE and MdlgAskQuestion.
00096  *
00097  * Revision 1.57  2003/08/29 19:48:47  mju
00098  * Forgot to inline some things.
00099  *
00100  * Revision 1.56  2003/08/29 16:44:22  mju
00101  * Fix helpid stuff.
00102  * Add versions taking const mistring refs.
00103  * Be specific about DLGRESPONSE values.
00104  * Add MdlgAskYN/NYC variants using DLGRESPONSE.
00105  *
00106  * Revision 1.55  2003/08/19 22:39:55  msmith
00107  * Added MdlgAskSaveDiscardCancel
00108  *
00109  * Revision 1.54  2003/08/19 21:03:49  msmith
00110  * Nothing.
00111  *
00112  * Revision 1.53  2003/06/26 16:17:36  mju
00113  * Add DEPRECATE_GROUPKEY.
00114  *
00115  * Revision 1.52  2003/05/28 16:09:37  mju
00116  * ?
00117  *
00118  * Revision 1.51  2003/04/01 16:45:46  mju
00119  * Add MdlgShowProductInfo.
00120  *
00121  * Revision 1.50  2003/02/24 15:00:33  mju
00122  * Don't define unimplemented versions for X.
00123  *
00124  * Revision 1.49  2003/02/05 15:08:26  scowan
00125  * nc.
00126  *
00127  * Revision 1.48  2003/01/16 16:06:27  mju
00128  * Add filter to AskString.
00129  * Add TEXTID version of AskString.
00130  *
00131  * Revision 1.47  2003/01/15 21:56:44  mju
00132  * Add TEXTID version of YesNo/Cancel dialogs.
00133  *
00134  * Revision 1.46  2002/08/14 13:51:23  mju
00135  * Add more getfile variants for mfc.
00136  *
00137  * Revision 1.45  2002/08/13 15:51:41  mju
00138  * Limit use of older getfile fns to X version.
00139  *
00140  * Revision 1.44  2002/08/13 14:39:59  scowan
00141  * nc.
00142  *
00143  * Revision 1.43  2002/05/29 20:56:08  mju
00144  * Remove ambiguous overload.
00145  *
00146  * Revision 1.42  2002/05/29 17:31:22  mju
00147  * Add defaults for MdlgShowMessage.
00148  *
00149  * Revision 1.41  2002/03/29 21:13:35  mju
00150  * Remove varargs parm from DlgShowMessage.
00151  *
00152  * Revision 1.40  2002/03/29 18:50:08  mju
00153  * Add MdlgShowMessage using TEXTID.
00154  *
00155  * Revision 1.39  2002/03/29 18:40:43  mju
00156  * Un-deprecated MdlgShowMessage.
00157  *
00158  * Revision 1.38  2002/03/29 18:15:40  mju
00159  * Deprecate var args version.
00160  *
00161  * Revision 1.37  2001/12/20 21:46:13  mju
00162  * Enum docs.
00163  *
00164  * Revision 1.36  2001/09/13 21:09:45  mju
00165  * MFC stuff no longer in DLL.
00166  *
00167  * Revision 1.35  2001/07/16 14:44:22  mju
00168  * In MdlgAskNumber/String for msg lookup use "promptpopup" for group if NULL.
00169  *
00170  * Revision 1.34  2001/07/16 14:30:16  mju
00171  * Forgot inlines.
00172  *
00173  * Revision 1.33  2001/07/16 14:10:05  mju
00174  * Add MdlgAskNumber/String.
00175  *
00176  * Revision 1.31  2001/05/09 16:50:06  mju
00177  * Add MdlgGetFolder defns.
00178  *
00179  * Revision 1.30  2001/03/13 22:49:50  mju
00180  * Add GETFILEFLAG_AllowAllFiles.
00181  *
00182  * Revision 1.29  2000/12/28 21:07:50  mju
00183  * Add MdlgShowMessage with no flags parm.
00184  *
00185  * Revision 1.1  1998/12/28  16:29:52  mju
00186  * Initial revision
00187  * \endif
00188 **/
00189 
00190 #ifndef  INC_MI32_MDLG_H
00191 #define  INC_MI32_MDLG_H
00192 
00193 #ifndef  INC_MI32_STDDEFNS_H
00194    #include <mi32/stddefns.h>
00195 #endif
00196 
00197 #ifndef  INC_MI32_HELPID_H
00198    #include <mi32/helpid.h>
00199 #endif
00200 
00201 #ifndef  INC_MI32_FILEPATH_H
00202    #include <mi32/filepath.h>
00203 #endif
00204 
00205 #ifdef WIN32
00206 #pragma warning (disable:4996)   // Disable warning about deprecated declaration within header
00207 #endif
00208 
00209 //! Forward declarations
00210 struct FNAMEUC;
00211 class GETSTRINGFILTER;
00212 
00213 
00214 //-------------------------------------------------------------------------------------------------------------------
00215 //! Base class for filter used in file/folder selection dialogs.
00216 class GETFILEFILTER {
00217    public:
00218 
00219       //! Constructor.
00220       GETFILEFILTER (
00221          ) { }
00222 
00223       //! Destructor.
00224       virtual ~GETFILEFILTER (
00225          ) { }
00226 
00227       //! Method called when user attempts to select a file (or folder).
00228       //! @return 'true' if selection acceptable, 'false' if not.
00229       virtual bool OnSelection (
00230          const FILEPATH& path
00231          ) = 0;
00232 
00233       //! Set message returned by filter using message lookup from [getfile] group.
00234       void SetFilterMsg (
00235          const char *msgkey
00236          );
00237 
00238       //! Set message returned by filter using UNICODE string.
00239       void SetFilterMsg (
00240          const UNICODE* string
00241          );
00242 
00243    private:
00244       #ifndef GENERATING_DOXYGEN_OUTPUT
00245       MISTRING m_msgstr;
00246 
00247       GETFILEFILTER (const GETFILEFILTER&);
00248       GETFILEFILTER& operator= (const GETFILEFILTER&);
00249       #endif // GENERATING_DOXYGEN_OUTPUT
00250    };
00251 
00252 //-------------------------------------------------------------------------------------------------------------------
00253 //!      Definitions for MdlgGetFile...                                          
00254 //-------------------------------------------------------------------------------------------------------------------
00255 
00256 typedef int (*MdlgGetFilesValidMultiProto) (const FILEPATHLIST& list, void*, char*);
00257 typedef int (*MdlgGetFileFilterProto) (UNICODE*, char*, void*);
00258 
00259 enum GETFILEFLAGS {
00260    GETFILEFLAG_None =            0,
00261    GETFILEFLAG_NewOK =           0x00000001, //!< Let user create new file
00262    GETFILEFLAG_DftNew =          0x00000002, //!< Default to new file if user presses OK
00263    GETFILEFLAG_SkipOK =          0x00000004, //!< Allow user to skip this selection
00264    GETFILEFLAG_OnlyNew =         0x00000008, //!< Don't let user select existing files
00265    GETFILEFLAG_MakeNew =         0x00000010, //!< Warn user if select existing file for overwrite
00266    GETFILEFLAG_NoDftExtn =       0x00000020, //!< XXX obsolete
00267    GETFILEFLAG_CanChgExtn =      0x00000040, //!< XXX obsolete
00268    GETFILEFLAG_AltDescFunc =     0x00000100, //!< Use alternate description function XXX implemented?
00269    GETFILEFLAG_UseFilter =       0x00000200, //!< XXX obsolete
00270    GETFILEFLAG_FilterByExtn =    0x00000400, //!< Filter by extension
00271    GETFILEFLAG_SortByExtn =      0x00000800, //!< Sort files by extension, then name
00272    GETFILEFLAG_Unicode =         0x00001000, //!< Use Unicode prompt string directly instead of doing lookup
00273    GETFILEFLAG_SkipNone =        0x00002000, //!< Change "Skip" button to "None"
00274    GETFILEFLAG_AllowFewer =      0x00004000, //!< Allow fewer than requested number of files for MdlgGetFileSet...()
00275    GETFILEFLAG_AllowAutoName =   0x00008000, //!< Allow "auto-name" for MdlgGetFileSet...()
00276    GETFILEFLAG_ExtnUnicode =     0x00010000, //!< XXX obsolete
00277    GETFILEFLAG_SelectDir =       0x00020000, //!< Select directory instead of file
00278    GETFILEFLAG_AllowDefault =    0x00080000, //!< Use provided filename for default new file
00279    GETFILEFLAG_AllowAllFiles =   0x00100000, //!< Allow all file types option
00280    };
00281 DEFINE_ENUM_OPERATORS(GETFILEFLAGS);
00282 
00283 
00284 //-------------------------------------------------------------------------------------------------------------------
00285 
00286 //!\addtogroup mdlg Mdlg functions
00287 //!@{
00288 
00289 #if defined(X_NATIVE) || defined(WIN32_MFC)
00290 //! Dialog to prompt user for single file using UNICODE filename (X only).
00291 int MdlgGetFile (
00292    MDLGPARENT dlgparent,
00293    UNICODE *filename,                        //!< File path/name passed/returned
00294    const char *extns,                        //!< Extensions to show, if any
00295    const void *prompt,
00296    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00297    void *funcdata = 0,                       //!< Data to pass to filter function
00298    GETFILEFLAGS flags = GETFILEFLAG_None,
00299    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00300    void *createoptdata = 0
00301    );
00302 #endif
00303 
00304 
00305 #if defined(X_NATIVE) || defined(WIN32_MFC)
00306 int MdlgGetFile (
00307    MDLGPARENT dlgparent,
00308    FILEPATH& filename,                       //!< File path/name passed/returned
00309    const char *extns,                        //!< Extensions to show, if any
00310    const void *prompt,
00311    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00312    void *funcdata = 0,                       //!< Data to pass to filter function
00313    GETFILEFLAGS flags = GETFILEFLAG_None
00314 #ifdef X_NATIVE
00315    ,
00316    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00317    void *createoptdata = 0
00318 #endif
00319    );
00320 #endif
00321 
00322 
00323 #if defined(X_NATIVE) || defined(WIN32_MFC)
00324 //! Dialog to prompt user for single file using UNICODE filename and UNICODE extension (X only).
00325 int MdlgGetFileExtnUC (
00326    MDLGPARENT dlgparent,
00327    UNICODE *filename,                        //!< File path/name passed/returned
00328    const UNICODE *extns,                     //!< Extensions to show, if any
00329    const void *prompt,
00330    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00331    void *funcdata = 0,                       //!< Data to pass to filter function
00332    GETFILEFLAGS flags = GETFILEFLAG_None,
00333    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00334    void *createoptdata = 0
00335    );
00336 #endif
00337 
00338 
00339 #if defined(X_NATIVE) || defined(WIN32_MFC)
00340 //! Dialog to prompt user for single file using FILEPATH and UNICODE extension (X only).
00341 int MdlgGetFileExtnUC (
00342    MDLGPARENT dlgparent,
00343    FILEPATH& filename,                       //!< File path/name passed/returned
00344    const MISTRING& extns,                    //!< Extensions to show, if any
00345    const void *prompt,
00346    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00347    void *funcdata = 0,                       //!< Data to pass to filter function
00348    GETFILEFLAGS flags = GETFILEFLAG_None,
00349    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00350    void *createoptdata = 0
00351    );
00352 #endif
00353 
00354 
00355 #if /*defined(X_NATIVE) ||*/ defined(WIN32_MFC)
00356 //! Prompt user for single file using UNICODE* title and extension filter list.
00357 ERRVALUE MdlgGetFile (
00358    MDLGPARENT parent,            //!< Parent for dialog
00359    FILEPATH& filepath,           //!< Path to file passed/returned
00360    const char *ExtnFilters,      //!< Extension filters in form "msgkey|extns|msgkey|extns"  extns are ;-separated and must include "*."
00361    const UNICODE *title,         //!< Title for dialog prompt
00362    GETFILEFLAGS getfileflags,    //!< Flags
00363    GETFILEFILTER *filter = 0     //!< Optional filter
00364    );
00365 #endif
00366 
00367 
00368 #if /*defined(X_NATIVE) ||*/ defined(WIN32_MFC)
00369 //! Prompt user for single file using title from message lookup.
00370 ERRVALUE MdlgGetFile (
00371    MDLGPARENT parent,            //!< Parent for dialog
00372    FILEPATH& filepath,           //!< Path to file passed/returned
00373    const char *ExtnFilters,      //!< Extension filters in form "msgkey|extns|msgkey|extns"  extns are ;-separated and must include "*."
00374    const char *TitleKey,         //!< Title key for use with 'getfile' group in message file
00375    GETFILEFLAGS getfileflags,    //!< Flags
00376    GETFILEFILTER *filter = 0     //!< Optional filter
00377    );
00378 #endif
00379 
00380 
00381 #ifdef X_NATIVE
00382 //! Display dialog allowing user to select multiple files (X only).
00383 int MdlgGetFiles (
00384    Widget dlgparent,
00385    UNICODE *filename,                        //!< Default filename
00386    const char *extns,                        //!< Extensions to show, if any
00387    const void *prompt,
00388    int minfiles,                             //!< Minimum number of files required
00389    int maxfiles,                             //!< Maximum allowed to be selected, 0 if no limit
00390    FNAMEUC **fnameret,
00391    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00392    void *funcdata = 0,                       //!< Data to pass to filter function
00393    GETFILEFLAGS flags = GETFILEFLAG_None,
00394    MdlgGetFilesValidMultiProto validfunc = 0,
00395    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00396    void *createoptdata = 0
00397    );
00398 #endif
00399 
00400 
00401 #if defined(X_NATIVE) || defined(WIN32_MFC)
00402 //! Display dialog allowing user to select multiple files.
00403 int MdlgGetFiles (
00404    Widget dlgparent,
00405    FILEPATH& filename,                       //!< Default filename
00406    const char *extns,                        //!< Extensions to show, if any
00407    const void *prompt,
00408    int minfiles,                             //!< Minimum number of files required
00409    int maxfiles,                             //!< Maximum allowed to be selected, 0 if no limit
00410    FILEPATHLIST& FileList,
00411    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00412    void *funcdata = 0,                       //!< Data to pass to filter function
00413    GETFILEFLAGS flags = GETFILEFLAG_None,
00414    MdlgGetFilesValidMultiProto validfunc = 0
00415 #ifdef X_NATIVE
00416    ,
00417    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00418    void *createoptdata = 0
00419 #endif
00420    );
00421 #endif
00422 
00423 
00424 #ifdef X_NATIVE
00425 //! Prompt user for "set" of filenames with allowance for optional controls (X only).
00426 int MdlgGetFileSet (
00427    Widget dlgparent,
00428    UNICODE *filename,                        //!< Default filename
00429    const char *extns,                        //!< Extensions to show, if any
00430    const void *prompt,
00431    int setnumfiles,                          //!< Number of files to be selected
00432    FNAMEUC fname[],
00433    UNICODE **filelabel,                      //!< Labels and default names for each file
00434    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00435    void *funcdata = 0,                       //!< Data to pass to filter function
00436    GETFILEFLAGS flags = GETFILEFLAG_None,
00437    MdlgGetFilesValidMultiProto validfunc = 0,
00438    int (*updatefunc)(FILEPATHLIST::ITERATOR,void*) = 0,  //!< Function called when any file in the set is changed by the user
00439    int (*createoptfunc)(Widget,void*) = 0,   //!< Function to create optional controls on dialog
00440    void *createoptdata = 0
00441    );
00442 #endif
00443 
00444 
00445 //! Prompt for a text file with user-specified encoding.
00446 ERRVALUE MdlgGetTextFile (
00447    MDLGPARENT dlgparent,                     //!< Parent for dialog
00448    FILEPATH& filepath,                       //!< File path passed/returned
00449    CHAR_ENCODING& encoding,                  //!< Text character encoding passed/returned
00450    ENCODELIST_FLAGS enclistflags,            //!< Flags specifying allowed encodings
00451    const char *extns,                        //!< Extensions to show, if any
00452    const void *prompt,                       //!< Prompt message
00453    MdlgGetFileFilterProto filterfunc = 0,    //!< Filter function
00454    void *funcdata = 0,                       //!< Data to pass to filter function
00455    GETFILEFLAGS flags = GETFILEFLAG_None     //!< File selection flags
00456    );
00457 
00458 //!@}
00459 
00460 //----------------------------------------------------------------------------
00461 //    Definitions for MdlgGetFolder...
00462 //----------------------------------------------------------------------------
00463 
00464 class GETFOLDERFILTER : public GETFILEFILTER {
00465    public:
00466       GETFOLDERFILTER () {}
00467    private:
00468       GETFOLDERFILTER (const GETFOLDERFILTER&);
00469       GETFOLDERFILTER& operator= (const GETFOLDERFILTER&);
00470    };
00471 
00472 //! Flags for MdlgGetFolder.
00473 enum GETFOLDERFLAGS {
00474    GETFOLDERFLAG_None =          0,
00475    GETFOLDERFLAG_AllowNew =      0x0001,     //!< Allow new folder to be created
00476    GETFOLDERFLAG_CheckWritable = 0x0002,     //!< Check if selected folder is writable
00477    GETFOLDERFLAG_CheckEmpty =    0x0004,     //!< Selected folder must be empty
00478    };
00479 DEFINE_ENUM_OPERATORS(GETFOLDERFLAGS);
00480 
00481 
00482 //!\addtogroup mdlg Mdlg functions
00483 //!@{
00484 
00485 //! Dialog to allow user to select folder.
00486 ERRVALUE MdlgGetFolder (
00487    MDLGPARENT dlgparent,                        //!< Parent for dialog
00488    FILEPATH& filepath,                          //!< Folder path passed/returned
00489    const MISTRING& promptstr,                   //!< Prompt string (also allows TEXTID)
00490    GETFOLDERFLAGS flags = GETFOLDERFLAG_None,   //!< Flags
00491    GETFOLDERFILTER *filter = 0                  //!< Filter
00492    );
00493 
00494 //!@}
00495 
00496 //----------------------------------------------------------------------------
00497 //    Definitions for MdlgShowMessage...                                      
00498 //----------------------------------------------------------------------------
00499 
00500 // Do not change the values of existing flags as they may be passed to DLLs.
00501 enum MDLG_MESSAGEFLAGS {
00502    MDLG_MESSAGEFLAG_None =             0,
00503    MDLG_MESSAGEFLAG_AllowNoShowAgain = 0x00000001, //!< Include "Don't show this message again" toggle
00504    MDLG_MESSAGEFLAG_AllowSaveText =    0x00000002, //!< Allow message text to be saved to file
00505    MDLG_MESSAGEFLAG_CenterDialog =     0x00000004, //!< Center dialog on screen
00506    MDLG_MESSAGEFLAG_NoCancel =         0x00000100, //!< Don't include "cancel" button if default is to show
00507    MDLG_MESSAGEFLAG_AllowCancel =      0x00000200, //!< Include cancel button if default is not to
00508    MDLG_MESSAGEFLAG_NoOK =             0x00000400, //!< Don't include "ok" button
00509    MDLG_MESSAGEFLAG_RetryButton =      0x01000000, //!< Use "Retry" instead of "OK"
00510    };
00511 DEFINE_ENUM_OPERATORS(MDLG_MESSAGEFLAGS);
00512 
00513 // Do not change the values of existing types as they may be passed to DLLs.
00514 //! Message type, used to select icon and window title.
00515 enum MDLG_MESSAGETYPE {
00516    MDLG_MESSAGETYPE_Default =       0,       //!< No icon
00517    MDLG_MESSAGETYPE_Information =   1,       //!< 'i' (information) icon
00518    MDLG_MESSAGETYPE_Warning =       2,       //!< Exclamation point icon
00519    MDLG_MESSAGETYPE_Error =         3,       //!< circle/slash icon
00520    MDLG_MESSAGETYPE_Message =       4,       //!< No icon
00521    MDLG_MESSAGETYPE_Working =       5,       //!< Hourglass icon
00522    MDLG_MESSAGETYPE_Question =      6,       //!< Question mark icon
00523    };
00524 
00525 
00526 //----------------------------------------------------------------------------
00527 
00528 typedef int (*MESSAGEHOOKFUNC)(void* cbdata, MDLG_MESSAGETYPE msgtype, const MISTRING& msg, const UNICODE* details);
00529 
00530 //----------------------------------------------------------------------------
00531 
00532 #if defined(X_NATIVE) || defined(WIN32_MFC)
00533 //! Styles for MdlgAskQuestion().
00534 enum DLGQ_STYLE {
00535    //! Possible buttons, will appear in order listed at bottom of dialog.
00536    DLGQ_BUTTON_Ok =           0x00000001,    //!< Cannot use with BUTTON_Yes
00537    DLGQ_BUTTON_Yes =          0x00000002,    //!< Cannot use with BUTTON_Ok
00538    DLGQ_BUTTON_No =           0x00000004,
00539    DLGQ_BUTTON_Retry =        0x00000008,
00540    DLGQ_BUTTON_Save =         0x00000010,
00541    DLGQ_BUTTON_SaveAs =       0x00000020,
00542    DLGQ_BUTTON_SaveAll =      0x00000040,
00543    DLGQ_BUTTON_Discard =      0x00000080,
00544    DLGQ_BUTTON_DiscardAll =   0x00000100,
00545    DLGQ_BUTTON_Skip =         0x00000200,
00546    DLGQ_BUTTON_Continue =     0x00000400,
00547 
00548    DLGQ_BUTTON_Cancel =       0x00010000,
00549 
00550    //! Common button combinations
00551    DLGQ_BUTTONS_OkCancel =          DLGQ_BUTTON_Ok | DLGQ_BUTTON_Cancel,
00552    DLGQ_BUTTONS_YesNo =             DLGQ_BUTTON_Yes | DLGQ_BUTTON_No,
00553    DLGQ_BUTTONS_YesNoCancel =       DLGQ_BUTTON_Yes | DLGQ_BUTTON_No | DLGQ_BUTTON_Cancel,
00554    DLGQ_BUTTONS_RetryCancel =       DLGQ_BUTTON_Retry | DLGQ_BUTTON_Cancel,
00555    DLGQ_BUTTONS_SaveDiscardCancel = DLGQ_BUTTON_Save | DLGQ_BUTTON_Discard | DLGQ_BUTTON_Cancel,
00556    DLGQ_BUTTONS_ContinueCancel =    DLGQ_BUTTON_Continue | DLGQ_BUTTON_Cancel,
00557 
00558    DLGQ_STYLE_CenterText = 0x10000000  //!< Center text in the dialog
00559    };
00560 DEFINE_ENUM_OP_BITWISE(DLGQ_STYLE);
00561 
00562 //! Responses for MdlgAskQuestion().
00563 enum DLGRESPONSE {
00564    DLGRESPONSE_Cancel = -1000,            //!< Same as EUserCancel
00565    DLGRESPONSE_No = 0,
00566    DLGRESPONSE_Ok = 1,
00567    DLGRESPONSE_Yes = DLGRESPONSE_Ok,
00568    DLGRESPONSE_Continue = DLGRESPONSE_Ok,
00569    DLGRESPONSE_Save = 2,
00570    DLGRESPONSE_SaveAs = 3,
00571    DLGRESPONSE_SaveAll = 4,
00572    DLGRESPONSE_Discard = 5,
00573    DLGRESPONSE_Skip = DLGRESPONSE_Discard,
00574    DLGRESPONSE_DiscardAll = 6,
00575    DLGRESPONSE_Retry = 7
00576    };
00577 #endif
00578 
00579 //!\addtogroup mdlg Mdlg functions
00580 //!@{
00581 
00582 #if defined(X_NATIVE) || defined(WIN32_MFC)
00583 //! Dialog to ask user for numeric value (default window title).
00584 ERRVALUE MdlgAskNumber (
00585    MDLGPARENT dlgparent,                  //!< Parent for dialog
00586    const MISTRING& prompt,                //!< Prompt string
00587    double& value,                         //!< Value passed/returned
00588    double minvalue,                       //!< Minimum allowed value
00589    double maxvalue,                       //!< Maximum allowed value
00590    int decplaces,                         //!< Number of decimal places to show
00591    HELPID helpid = HELPID__None           //!< Help ID if help provided
00592    );
00593 #endif
00594 
00595 #if defined(X_NATIVE) || defined(WIN32_MFC)
00596 //! Dialog to ask user for numeric value (window title specified).
00597 ERRVALUE MdlgAskNumber (
00598    MDLGPARENT dlgparent,                  //!< Parent for dialog
00599    const MISTRING& dlgtitle,              //!< Dialog title
00600    const MISTRING& prompt,                //!< Prompt string
00601    double& value,                         //!< Value passed/returned
00602    double minvalue,                       //!< Minimum allowed value
00603    double maxvalue,                       //!< Maximum allowed value
00604    int decplaces,                         //!< Number of decimal places to show
00605    HELPID helpid = HELPID__None           //!< Help ID if help provided
00606    );
00607 #endif
00608 
00609 #if defined(X_NATIVE) || defined(WIN32_MFC)
00610 //! Dialog to ask user question with buttons for responses (default window title).
00611 //! @return DLGRESPONSE value
00612 DLGRESPONSE MdlgAskQuestion (
00613    MDLGPARENT parent,                     //!< Parent for dialog, NULL for default
00614    const MISTRING& text,                  //!< Text to display
00615    DLGQ_STYLE style,                      //!< Dialog style and buttons
00616    DLGRESPONSE dftresponse,               //!< Default response (DLGRESPONSE_Yes or DLGRESPONSE_No)
00617    HELPID helpid = HELPID__None           //!< Help ID if help provided
00618    );
00619 #endif
00620 
00621 #if defined(X_NATIVE) || defined(WIN32_MFC)
00622 //! Dialog to ask user question with buttons for responses (window title specified).
00623 //! @return DLGRESPONSE value
00624 DLGRESPONSE MdlgAskQuestion (
00625    MDLGPARENT parent,                     //!< Parent for dialog, NULL for default
00626    const MISTRING& dlgtitle,              //!< Title for dialog window
00627    const MISTRING& text,                  //!< Text to display
00628    DLGQ_STYLE style,                      //!< Dialog style and buttons
00629    DLGRESPONSE dftresponse,               //!< Default response (DLGRESPONSE_Yes or DLGRESPONSE_No)
00630    HELPID helpid = HELPID__None           //!< Help ID if help provided
00631    );
00632 #endif
00633 
00634 #if defined(X_NATIVE) || defined(WIN32_MFC)
00635 //! Dialog to ask user for string value (default window title).
00636 ERRVALUE MdlgAskString (
00637    MDLGPARENT dlgparent,                  //!< Parent for dialog
00638    const MISTRING& prompt,                //!< Prompt string
00639    MISTRING& string,                      //!< String passed/returned
00640    int maxchars = 0,                      //!< Maximum number of characters in string, 0 for no maximum
00641    HELPID helpid = HELPID__None,          //!< Help ID if help provided
00642    GETSTRINGFILTER *filter = 0            //!< Optional filter for string validation
00643    );
00644 #endif
00645 
00646 #if defined(X_NATIVE) || defined(WIN32_MFC)
00647 //! Dialog to ask user for string value (window title specified).
00648 ERRVALUE MdlgAskString (
00649    MDLGPARENT dlgparent,                  //!< Parent for dialog
00650    const MISTRING& dlgtitle,              //!< Dialog title
00651    const MISTRING& prompt,                //!< Prompt string
00652    MISTRING& string,                      //!< String passed/returned
00653    int maxchars = 0,                      //!< Maximum number of characters in string, 0 for no maximum
00654    HELPID helpid = HELPID__None,          //!< Help ID if help provided
00655    GETSTRINGFILTER *filter = 0            //!< Optional filter for string validation
00656    );
00657 #endif
00658 
00659 #ifndef DEPRECATE_ALL
00660 #if defined(X_NATIVE) || defined(WIN32_MFC)
00661 //! DEPRECATED Dialog to ask user for Yes/No response.
00662 //! \deprecated Replaced by MdlgAskQuestion
00663 //! @return DLGRESPONSE_Yes or DLGRESPONSE_No
00664 DEPRECATED DLGRESPONSE MdlgAskYesNo (
00665    MDLGPARENT parent,                     //!< Parent for dialog, NULL for default
00666    const MISTRING& text,                  //!< Text to display
00667    DLGRESPONSE dftresponse,               //!< Default response (DLGRESPONSE_Yes or DLGRESPONSE_No)
00668    HELPID helpid = HELPID__None           //!< Help ID if help provided
00669    );
00670 #endif
00671 #endif
00672 
00673 #ifndef DEPRECATE_GROUPKEY
00674 #if defined(X_NATIVE) || defined(WIN32_MFC)
00675 //! DEPRECATED Dialog to ask user for Yes/No response with prompt from message lookup.
00676 //! \deprecated Replaced by MdlgAskQuestion
00677 //! @return 0 = "No", 1 = "Yes".
00678 DEPRECATED int MdlgAskYesNo (
00679    MDLGPARENT parent,                     //!< Parent for dialog, NULL for default
00680    const char *msgname,                   //!< Message name for lookup in "popupync" group
00681    int dft,                               //!< Default response
00682    HELPID helpid = HELPID__None           //!< Help ID if help provided
00683    );
00684 #endif
00685 #endif
00686 
00687 #ifndef DEPRECATE_ALL
00688 #if defined(X_NATIVE) || defined(WIN32_MFC)
00689 //! DEPRECATED Dialog to ask user for Yes/No/Cancel response.
00690 //! \deprecated Replaced by MdlgAskQuestion
00691 //! @return DLGRESPONSE_Yes, DLGRESPONSE_No or DLGRESPONSE_Cancel
00692 DEPRECATED DLGRESPONSE MdlgAskYesNoCancel (
00693    MDLGPARENT parent,                     //!< Parent for dialog, NULL for default
00694    const MISTRING& text,                  //!< Text to display
00695    DLGRESPONSE dftresponse,               //!< Default response (DLGRESPONSE_Yes, DLGRESPONSE_No or DLGRESPONSE_Cancel)
00696    HELPID helpid = HELPID__None           //!< Help ID if help provided
00697    );
00698 #endif
00699 #endif
00700 
00701 #ifndef DEPRECATE_GROUPKEY
00702 #if defined(X_NATIVE) || defined(WIN32_MFC)
00703 //! DEPRECATED Dialog to ask user for Yes/No/Cancel response with prompt from message lookup.
00704 //! \deprecated Replaced by MdlgAskQuestion
00705 //! @return 0 = "No", 1 = "Yes", -1 = "Cancel".
00706 DEPRECATED int MdlgAskYesNoCancel (
00707    MDLGPARENT parent,                     //!< Parent for dialog, NULL for default
00708    const char *msgname,                   //!< Message name for lookup in "popupync" group
00709    int dft,                               //!< Default response
00710    HELPID helpid = HELPID__None           //!< Help ID if help provided
00711    );
00712 #endif
00713 #endif
00714 
00715 //! Retrieve default parent for creating dialog.
00716 //! @return Default parent for creating dialog.
00717 //! This function should be used by the individual Mdlg... function itself, not by the caller.
00718 //!   If the default parent is desired, pass NULL as the parent for any Mdlg function.
00719 MDLGPARENT MdlgGetDefaultParent (void);
00720 
00721 #if defined(X_NATIVE) || defined(WIN32_MFC)
00722 //! Dialog for general file maintenance.
00723 int MdlgMaintGeneralFile (
00724    MDLGPARENT dlgparent,               //!< Parent for dialog
00725    bool mainproc                       //!< Treat as "main process (show "Exit" instead of "Close" button)
00726    );
00727 #endif
00728 
00729 
00730 //! Arrange to intercept all messages.
00731 //!
00732 //! This is to be used by non-interactive applications such as the automated
00733 //! test suite which don't work very well if they sit all night waiting for
00734 //! somebody to click OK on an error dialog.  It allows you to register a 
00735 //! function that will get called instead of popping up the error dialog.
00736 void MdlgSetMessageHookFunc (
00737    MESSAGEHOOKFUNC HookFunc,
00738    void* cbdata
00739    );
00740 
00741 //! Display message window with specified text.
00742 //! @return EUserCancel or 0.
00743 int MdlgShowMessage (
00744    MDLGPARENT parent,                                 //!< Parent for dialog, NULL for default
00745    MDLG_MESSAGETYPE msgtype,                          //!< Message type
00746    const MISTRING& msgtext,                           //!< Message string, multiple lines allowed, TEXTID implied.
00747    MDLG_MESSAGEFLAGS flags = MDLG_MESSAGEFLAG_None,   //!< Flags
00748    HELPID helpid = HELPID__None,                      //!< Help ID (HELPID__None for no 'help' button)
00749    const char *inibasetag = 0,                        //!< Ini base tag for savable settings (eg. MDLG_MESSAGEFLAG_AllowNoShowAgain)
00750    const UNICODE *details = 0                         //!< Optional message "details"
00751    );
00752 
00753 #if !defined(DEPRECATE_GROUPKEY) && !defined(DEPRECATE_OLDHELP)
00754 //! Show dialog displaying a message using message file (DEPRECATED)
00755 //!
00756 //! \deprecated Replaced by version using MISTRING and HELPID.
00757 //!
00758 //! @return EUserCancel or 0.
00759 //!
00760 //! If the MDLG_MESSAGEFLAG_AllowNoShowAgain flag is set, an entry in the ini file in the "popupmsg"
00761 //!   section based on the group/key will be checked to determine if the user has previously
00762 //!   requested that this dialog not be shown.  If set, the dialog will not be displayed and
00763 //!   a value of 0 will be returned.
00764 DEPRECATED int MdlgShowMessage (
00765    MDLGPARENT parent,                              //!< Parent for dialog, NULL for default
00766    MDLG_MESSAGETYPE msgtype,                       //!< Message type
00767    const char *group,                              //!< Message database group, eg: "tntdisp"
00768    const char *key,                                //!< Message database key, eg: "SelectRaster"
00769    const char *help = NULL,                        //!< Help code (NULL for no help button)
00770    MDLG_MESSAGEFLAGS flags = MDLG_MESSAGEFLAG_None //!< Flags
00771    );
00772 #endif
00773 
00774 //! Display message dialog with text for specified error code.
00775 //!
00776 //! @return If AllowCancel flag specified will return 0 or EUserCancel, otherwise the error code is returned.
00777 int MdlgShowMessageCode (
00778    MDLGPARENT parent,                  //!< Parent for dialog, NULL for default
00779    int errcode,                        //!< Error code
00780    MDLG_MESSAGETYPE msgtype = MDLG_MESSAGETYPE_Default,     //!< Message type
00781    MDLG_MESSAGEFLAGS flags = MDLG_MESSAGEFLAG_AllowSaveText //!< Flags
00782    );
00783 
00784 
00785 //! Display (modeless) dialog showing standard product information.
00786 void MdlgShowProductInfo (
00787    MDLGPARENT dlgparent = 0
00788    );
00789 
00790 //!@}
00791 
00792 #ifdef WIN32
00793 #pragma warning (default:4996)   // Restore warning about deprecated declaration
00794 #endif
00795 
00796 #endif   // INC_MI32_MDLG_H
00797 

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