dialog.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:7k
- /*
- * dialog.h
- *
- * No-modal 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: dialog.h,v $
- * Revision 1.21 1999/11/01 00:07:17 robertj
- * Changed semantics of OnClose() to be the same as PTitledWindow
- *
- * Revision 1.20 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.19 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.18 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.17 1998/09/23 06:23:19 robertj
- * Added open source copyright license.
- *
- * Revision 1.16 1995/10/14 14:55:18 robertj
- * Moved standard button code from modal to non-modal dialogs.
- *
- * Revision 1.15 1995/06/17 11:12:28 robertj
- * Documentation update.
- *
- * Revision 1.14 1995/03/14 12:41:18 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.13 1994/12/13 11:47:53 robertj
- * Documentation.
- *
- * Revision 1.12 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.11 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.10 1994/08/21 23:43:02 robertj
- * Changed semantics of Close() function.
- *
- * Revision 1.9 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.8 1994/01/13 03:36:48 robertj
- * Created intermediate class PInteractorLayout for dialog-ish windows.
- *
- * Revision 1.7 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.6 1993/12/01 16:09:05 robertj
- * Windows NT port.
- *
- * Revision 1.5 1993/09/27 16:35:25 robertj
- * Removed special constructor for dialog resource loading.
- *
- * Revision 1.4 1993/08/21 01:50:33 robertj
- * Made Clone() function optional, default will assert if called.
- *
- * Revision 1.3 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PDIALOG
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**This class defines a user inteface entity that consists of a collection of
- zero or more other interactors. These interactors are expected to be
- descendents of the PControl class. Controls allow information to be
- transferred between the user and the application.
-
- The external and internal layout of a dialog is usually described using
- application resources.
- */
- class PDialog : public PInteractorLayout
- {
- PCLASSINFO(PDialog, PInteractorLayout);
- public:
- /**Create a new empty dialog. There are no controls contained within the
- dialog and it is expected that these are to added manually by the
- application.
- */
- PDialog(
- PInteractor * parent /// Interactor that owns the dialog.
- );
- /**Create a new dialog by loading it from a resource. The resource
- description determines the position, dimensions and title of the dialog
- as well as the position, dimensions, title and other options for all of
- the controls in the dialog.
- */
- PDialog(
- PInteractor * parent, /// Interactor that owns the dialog.
- PRESOURCE_ID resID /// Resource identifier for loading controls.
- );
- /**Destroy the dialog, releasing its data and all of its associated
- controls.
- */
- virtual ~PDialog();
- /**@name New functions for class */
- /**Get the current dialog title string. This usually appear ina caption at
- the top of the dialog.
-
- @return
- string for the dialog title.
- */
- virtual PString GetTitle() const;
- /**Set the new window title string. This will be updated on the screen
- immediately (subject to OS constraints).
- */
- virtual void SetTitle(
- const PString & title /// New title string for dialog.
- );
- /**Close the PDialog interactor. This will do a "safe" delete of the
- PDialog object, ie after all the member functions on the object have
- returned and the programme is in the main message handling loop, then
- the delete operator is executed on the object. This will prevent
- problems with the "this" pointer being invalid when a PDialog is closed
- via a call back function such as Ref{OnCancel()}.
- */
- virtual void Close();
- /**Set the default OK, Cancel & Help buttons. The Ok button will call the
- Ref{OnOk()} function, the Cancel button will call the
- Ref{OnCancel()} function and the Help button will call the
- Ref{OnSelectHelp()} function.
- */
- void SetStdButtons(
- PPushButton * okBtn, /// The OK button for the dialog.
- PPushButton * cancelBtn = NULL, /// The Cancel button for the dialog.
- PPushButton * helpBtn = NULL /// The Help button for the dialog.
- );
- protected:
- /**The system calls this whenever the window is being closed. There is no
- way to prevent this action at this point. Override the Ref{OnCancel()}
- function if you wish to control if the close operation proceeds.
- The application writer may override this function to do any clean up
- or state saving operations.
-
- The default action does nothing.
- */
- virtual void OnClose();
- /**Function called when the dialog OK button has been pressed. The default
- behaviour is to close the dialog using Ref{Close()}.
- */
- virtual void OnOk();
- /**Function called when the dialog Cancel button has been pressed. The
- default behaviour is to close the dialog using Ref{Close()}.
- */
- virtual void OnCancel();
- // Member variables
- /** The OK button. */
- PPushButton * ok;
- /** The Cancel button. */
- PPushButton * cancel;
- /** The Help button. */
- PPushButton * help;
- private:
- PDECLARE_NOTIFIER(PPushButton, PDialog, StdButtonPressed);
- // Called by the ok or cancel button control
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////