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

Generated on Wed May 31 15:26:55 2006 for TNTsdk by  doxygen 1.3.8-20040913