home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ICNREHDR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
9KB
|
178 lines
#ifndef _ICNREHDR_
#define _ICNREHDR_
/*******************************************************************************
* FILE NAME: icnrehdr.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* ICnrEditHandler *
* *
* COPYRIGHT: *
* (C) Copyright IBM Corporation 1992 *
* All Rights Reserved *
* Licensed Materials * Property of IBM *
* *
* HISTORY: *
*******************************************************************************/
#ifndef _IHANDLER_
#include <ihandler.hpp>
#endif
#ifndef _ICNREEVT_
#include <icnreevt.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
class IHandlerWindow;
class IWindowHandle;
class IMultiLineEdit;
class ICnrEditHandler : public IHandler
{
typedef IHandler Inherited;
/*******************************************************************************
* The ICnrEditHandler class supports direct editing of data in the container. *
*******************************************************************************/
public:
/*----------------------- Related Types ---------------------------------------
| The following ICnrEditHandler types are defined: |
| StringType - Identifies the real type of user data in the details |
| view of the container: |
| isIString - The data is an instance of the IString class. |
| isCharacterPointer - The data is a pointer to a character (char*). |
------------------------------------------------------------------------------*/
enum StringType { isIString, isCharacterPointer };
/*------------------------ Constructors ----------------------------------------
| The only way to construct an instance of this class is by providing the type |
| of the user data that needs to be edited. The data can be one of the |
| following types:
|
| - isIString, in which the user data is an IString. This is the
| recommended form of text.
| - isCharacterPointer, in which the data is a pointer to a NULL-terminated
| character array (char*).
|
| The default behavior of this class provides for the reallocation of the
| user data. The default behavior of this class also manages the allocation
| of other tpes of editable data, such as:
|
| - Icon text
| - Container title
| - Details view column headings
------------------------------------------------------------------------------*/
ICnrEditHandler (StringType stringType = isIString);
~ICnrEditHandler ( );
/*------------------------ Event Processing Functions --------------------------
| These functions must be supplied by a derived class in order to provide |
| processing for an edit event: |
| beginEdit - Called when an edit window has been opened in the |
| container. The default behavior is to create an |
| instance of an IMultiLineEdit by calling the |
| multiLineEdit function. If the setMLEHandler function |
| was previously called to store an edit handler, the |
| handler will be added to the multiple-line entry field |
| (MLE) control. |
| NOTE: If this function is overridden in a subclass, you |
| must call the library version of this function |
| before adding any behavior. Other handler |
| functions do not work correctly before this |
| function is called. |
| reallocateString - Called when text has been modified in the container and |
| storage needs to be reallocated. If the data is an |
| IString, the reallocation is provided by calling the |
| ICnrReallocStringEvent::reallocateString function. If |
| the type of the data is isCharacterPointer, the |
| reallocation is provided by calling the |
| ICnrReallocStringEvent::reallocateText function. |
| endEdit - Called when editing has ended. This is received after |
| the reallocateString function is called. |
| NOTE: If this function is overridden in a subclass, you |
| must call the library version of this function |
| after adding any behavior. Some handler |
| functions do not work correctly after this |
| function is called. |
| isDataIString - Returns true if the user data is type IString. |
------------------------------------------------------------------------------*/
virtual Boolean
beginEdit ( ICnrBeginEditEvent& event),
reallocateString ( ICnrReallocStringEvent& event),
endEdit ( ICnrEndEditEvent& event);
Boolean
isDataIString ( );
/*---------------------------- Window Attachment -------------------------------
| These functions permit attaching and detaching the handler object to and from|
| a container window: |
| handleEventsFor - Attaches the handler to the container control |
| passed in the argument. |
| stopHandlingEventsFor - Detaches the handler from the container control |
| passed in the argument. |
------------------------------------------------------------------------------*/
virtual ICnrEditHandler
&handleEventsFor ( IContainerControl* container ),
&stopHandlingEventsFor ( IContainerControl* container );
/*---------------------------- Multiple-Line Edit Processing -------------------
| The following functions are used to enable processing of events to the |
| container's edit field: |
| setMLEHandler - Stores a handler to be added to the multiple-line entry |
| field control when that control is created. |
| multiLineEdit - Called to return an IMultiLineEdit "wrapper." This |
| function can be overridden to specialize the edit control. |
| mleHandler - Called to return the handler for a multiple-line entry |
| field. If a handler has not been provided, 0 is returned. |
------------------------------------------------------------------------------*/
void
setMLEHandler ( IHandler* anMLEHandler);
virtual IMultiLineEdit
*multiLineEdit ( const IWindowHandle& handleMultiLineEdit);
IHandler
*mleHandler ( ) const;
protected:
/*----------------------------- Implementation ---------------------------------
| This function is used to implement the class: |
| dispatchHandlerEvent - Routes the edit events to the appropriate event |
| functions. |
------------------------------------------------------------------------------*/
virtual Boolean
dispatchHandlerEvent ( IEvent& event);
private:
IHandler
*_phdrMLE;
int _stringType;
/* Hidden functions */
virtual IHandler
&handleEventsFor ( IWindow* window ),
&stopHandlingEventsFor ( IWindow* window );
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
/*--------------------------------- INLINES ----------------------------------*/
#ifndef I_NO_INLINES
#include <icnrehdr.inl>
#endif
#endif