opendlg.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:7k
- /*
- * opendlg.h
- *
- * Open existing file dialog.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: opendlg.h,v $
- * Revision 1.18 1999/03/10 03:49:52 robertj
- * More documentation adjustments.
- *
- * Revision 1.17 1999/03/09 08:01:49 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.16 1999/02/16 08:08:46 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.15 1998/09/23 06:24:31 robertj
- * Added open source copyright license.
- *
- * Revision 1.14 1998/03/09 07:15:29 robertj
- * More implementation of file type lists.
- *
- * Revision 1.13 1998/03/09 01:41:14 robertj
- * Enhanced file types for standard file dialog.
- *
- * Revision 1.12 1995/06/17 11:12:49 robertj
- * Documentation update.
- *
- * Revision 1.11 1995/03/14 12:41:55 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.10 1994/12/21 11:53:17 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.9 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.8 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.7 1994/04/20 12:17:44 robertj
- * Split name into PFilePath
- *
- * Revision 1.6 1994/04/11 14:13:05 robertj
- * Added extra standard resource IDs and normalised dialog ids.
- *
- * Revision 1.5 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.4 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.3 1993/12/01 16:09:05 robertj
- * Windows NT port.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _POPENFILEDIALOG
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A standard dialog for obtaining an existing file name for loading by the
- application. The exact appearance of the dialog is platform specific,
- however they all consists of the same basic functions.
- The semantics of the set of file types is slightly different on different
- platforms. For the Macintosh all files in the set are displayed. For
- MS-Window a choice box is available which allows the user to select one
- of the types in the set and only files for that single type are available.
- Note that unlike most dialogs, most operations such as
- Ref{PInteractor::Show()}, Ref{PInteractorLayout::GetControl()} etc may
- {bf not} be executed before the Ref{PModalDialog::RunModal()} function
- has been executed. Furthermore, they are not available {bf after}
- Ref{PModalDialog::RunModal()} has returned. Similarly some functions such
- as Ref{PFileDialog::SetDirectory()} are not available {bf within} the
- centext of Ref{PModalDialog::RunModal()}. This is due to the
- implementation on some platforms which goes to great lengths to use the
- actual standard file dialog for the platform.
- */
- class POpenFileDialog : public PFileDialog
- {
- PCLASSINFO(POpenFileDialog, PFileDialog);
- public:
- /**Create a new standard open file dialog. The actual appearence is
- platform dependent and is displayed using the standard resource. This
- resource may be overridden by the #resID# parameter but must
- still contain all of the controls of the standard resource.
- */
- POpenFileDialog(
- PInteractor * parent, /// Owner interactor for the dialog.
- PRESOURCE_ID resID = PSTD_ID_DIALOG_OPEN_FILE
- /// Resource identifier for the dialog description resource.
- );
-
- /** Destroy the standard open file dialog. */
- virtual ~POpenFileDialog();
- /**@name New functions for class */
- /**Add a file type to the array of file types that may be specified for the
- file dialog.
- The file type array is used to filter out file names unless they have
- a file type within the set. If the array is empty then all files are
- available. They may be subsequently filtered by the
- Ref{OnFilterFile()} callback function.
- @return
- Index of new entry in array
- */
- PINDEX AddFileType(
- const PString & type /// File type to add to set of file types.
- );
- /**Get the array of file types that may be specified for the file dialog.
- The file type array is used to filter out file names unless they have
- a file type within the set. If the set is empty then all files are
- available. They may be subsequently filtered by the
- Ref{OnFilterFile()} callback function.
- @return
- array of file type strings.
- */
- PStringArray GetFileTypes() const;
- /**Set the array of file types that may be specified for the file dialog.
- */
- void SetFileTypes(
- const PStringArray & array
- );
-
- /**Set the file type displayed when dialog is opened
- */
- void SetInitialFileType(
- PINDEX idx
- );
- void SetInitialFileType(
- const PString & str
- );
- /**Get file type that was finally displayed
- */
- PINDEX GetFinalFileType() const;
- BOOL GetFinalFileType(
- PString & str
- ) const;
- /**@name Callback functions */
- /**This is called as the dialog fills the list of files available to be
- selected. An application specific file select dialog may filter out
- files from the list. The default is to display the current file type(s)
- only.
- Note that the files are pre-filtered with those files that are specified
- in the file types set created with the Ref{AddFileType()} function.
-
- @return
- TRUE if the file is to be included in the list.
- */
- virtual BOOL OnFilterFile(
- const PFilePath & file /// File to determine if is displayed.
- );
- protected:
- // Member variables
- PStringArray fileTypes;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////