filedlg.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:6k
- /*
- * filedlg.h
- *
- * File selection dialog ancestor class.
- *
- * 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: filedlg.h,v $
- * Revision 1.16 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.15 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.14 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.13 1998/09/23 06:23:27 robertj
- * Added open source copyright license.
- *
- * Revision 1.12 1995/06/17 11:12:35 robertj
- * Documentation update.
- *
- * Revision 1.11 1995/03/14 12:41:24 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.10 1995/01/22 07:29:36 robertj
- * Added font & colour standard dialogs.
- *
- * Revision 1.9 1994/12/21 11:52:56 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.8 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.7 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.6 1994/04/20 12:17:44 robertj
- * Split name into PFilePath
- *
- * Revision 1.5 1994/01/13 03:36:48 robertj
- * Created intermediate class PInteractorLayout for dialog-ish windows.
- *
- * 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 _PFILEDIALOG
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A standard dialog for obtaining a file name to load or save. This is really
- an abstract class for the descendents that get file names for loading and
- saving, or get a directory name. The exact appearance of the dialog is
- platform specific, however they all consists of the same basic functions.
- 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{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 PFileDialog : public PModalDialog
- {
- PCLASSINFO(PFileDialog, PModalDialog);
- public:
- /**Create a new standard dile dialog. The actual appearence is platform
- dependent and is displayed using the standard resource for loading or
- saving a file. This resource may be overridden by the #resID#
- parameter but must still contain all of the controls of the standard
- resource.
- */
- PFileDialog(
- PInteractor * parent, /// Owner interactor for the dialog.
- PRESOURCE_ID resID
- /// Resource identifier for the dialog description resource.
- );
- /** Destroy the standard file dialog. */
- ~PFileDialog();
- /**@name New functions for class */
- /**Set the title to the standard file dialog.
- */
- void SetTitle(
- const PString & title /// New title for the dialog.
- );
- /**Set the initial directory before the dialog is presented.
- This function should be called {bf before} the
- Ref{PModalDialog::RunModal()} function is called. Afterwards it will
- have no effect.
- */
- void SetDirectory(
- const PDirectory & dir /// Initial directory for the dialog.
- );
- /**Get the directory that was selected in the dialog.
- This function may be called at any time for the life of the object.
- @return
- selected directory.
- */
- const PDirectory & GetDirectory() const;
- /**Set the initial file name before the dialog is presented.
- This function should be called {bf before} the
- Ref{PModalDialog::RunModal()} function is called. Afterwards it will
- have no effect.
- */
- void SetDefaultFilename(const PString & fname);
- /**Get the file that was selected in the dialog.
- This function may be called at any time for the life of the object.
- @return
- selected file description.
- */
- const PFilePath & GetFile() const;
- /**@name Callback functions */
- /**A file has been selected from the list presented to the user but the
- user has not pressed OK. The application specific file select dialog
- may use this to display some extra information in the dialog when the
- user clicks on a file (e.g. size, time of creation etc).
- */
- virtual void OnFileSelect(
- const PFilePath & file /// File that has been selected.
- );
- protected:
- // Member variables
- /** The current directory for the dialog. */
- PDirectory directory;
- /** The final, selected file name for the dialog. */
- PFilePath file;
- /** The initial file name to be used. */
- PFilePath defaultFilename;
-
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////