home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IFILEHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
10KB
|
162 lines
#ifndef _IFILEHDR_
#define _IFILEHDR_
/*******************************************************************************
* FILE NAME: ifilehdr.hpp *
* *
* DESCRIPTION: *
* This file contains the declaration(s) of the class(es): *
* IFileDialogHandler *
* IFileDialogEvent *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
class IFileDialog;
class IString;
#ifndef _IEVENT_
#include <ievent.hpp>
#endif
#ifndef _IHANDLER_
#include <ihandler.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IFileDialogEvent : public IEvent {
typedef IEvent
Inherited;
/*******************************************************************************
* The IFileDialogEvent class encapsulates events used in an *
* IFileDialogHandler. It provides the name and length of the file to which *
* the event pertains. *
*******************************************************************************/
public:
/*------------------------------- Constructor/Destructor -----------------------
| The only way to construct an instance of this class is by using a |
| constructor that takes an IEvent as its only parameter. |
------------------------------------------------------------------------------*/
IFileDialogEvent ( IEvent& event );
virtual
~IFileDialogEvent ( );
/*--------------------------- File Name Accessors ------------------------------
| These functions provide means of getting and setting the accessible |
| instances of this class: |
| fileName - Returns the file name to which the event pertains. |
| fileLength - Returns the length of the file name. |
------------------------------------------------------------------------------*/
IString
fileName ( ) const;
unsigned long
fileLength ( ) const;
}; // IFileDialogEvent
class IFileDialogHandler : public IHandler {
typedef IHandler
Inherited;
/*******************************************************************************
* The IFileDialogHandler class handles the various messages that affect *
* the file dialog. *
* *
* To use it, you must create a handler derived from IFileDialogHandler. *
* This handler must then be attached to an instance of an IFileDialog. *
* To attach a handler to a modal IFileDialog, you must pass a pointer to the *
* handler on the IFileDialog constructor. *
* *
* *
* Example: *
* // Attaching a handler to a modeless dialog *
* MyFileHandler mfh; *
* IFileDialog* filed = *
* new IFileDialog(desktopWindow(), pwin, IFileDialog::modeless); *
* mfh.handleEventsFor(filed); *
* *
* // Attaching a handler to a modal dialog *
* MyFileHandler* pmf = new MyFileHandler; *
* IFileDialog* filed = *
* new IFileDialog((desktopWindow(), pwin, pmf); *
* *
*******************************************************************************/
public:
/*------------------------------- Constructor ----------------------------------
| The only way to construct an instance of this class is by using the |
| default constructor. |
------------------------------------------------------------------------------*/
virtual
~IFileDialogHandler ( );
protected:
/*----------------------------- Dispatch Events --------------------------------
| This method determines if the event is one of the file dialog events. |
| If it is, it calls the appropriate virtual function: |
| dispatchHandlerEvent - Checks for file dialog events. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent& event );
/*---------------------------- File Dialog Events ------------------------------
| These functions are called when a file dialog event occurs. Override these |
| to provide your own processing. |
| filter - Lets you determine which file names appear in the list |
| box. Use the IFileDialogEvent::fileName function to |
| determine the file that is about to be added to the |
| dialog's file list box. Call IEvent::setResult(false) |
| if you do not want the file to appear in the list box. |
| Return true if you do not want the event to be |
| processed by any other handlers. |
| filterName - Override this function for an easier way of filtering |
| files. The IFileDialog* pointer passed as the second |
| argument can be used if you need to access the |
| IFileDialog itself. |
| validate - Sent when a user selects a file and presses Enter or |
| double clicks on a file in the list box. Use the |
| IFileDialogEvent::fileName function to get the name |
| selected by the user. Call IEvent::setResult(false) if |
| the name is unacceptable. The dialog will not be |
| dismissed in this case. Return true if you do not want |
| the event to be processed by any other handlers. |
| validateName - Override this function for an easier way of validating. |
| The IFileDialog* pointer passed as the second argument |
| can be used in an IMessageBox constructor (for |
| informing the user why the name is being rejected.) |
| modelessResults - Used when a modeless dialog is dismissed. This |
| function is used even if the dialog is cancelled. This |
| is done so that you can destroy the IFileDialog if |
| needed. Use IFileDialog::pressedOK to determine |
| whether the user dismissed the dialog by pressing the |
| OK push button. |
| |
| If you need to destroy the IFileDialog object, do not |
| delete the IFileDialog* pointer from within |
| modelessResults. Instead, use |
| endingDialog->setAutoDeleteObject(). |
------------------------------------------------------------------------------*/
virtual Boolean
filter ( IFileDialogEvent& event ),
filterName ( const IString& fileName,
IFileDialog* dialog ),
validate ( IFileDialogEvent& event ),
validateName ( const IString& fileName,
IFileDialog* dialog ),
modelessResults ( IFileDialog* endingDialog );
}; // IFileDialogHandler
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif /* _IFILEHDR_ */