home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
ICNREEVT.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
14KB
|
262 lines
#ifndef _ICNREEVT_
#define _ICNREEVT_
/*******************************************************************************
* FILE NAME: icnreevt.hpp *
* *
* DESCRIPTION: *
* Declaration of the class(es): *
* ICnrEditEvent *
* ICnrBeginEditEvent *
* ICnrEndEditEvent *
* ICnrReallocStringEvent *
* *
* COPYRIGHT: *
* (C) Copyright IBM Corporation 1992 *
* All Rights Reserved *
* Licensed Materials * Property of IBM *
* *
* HISTORY: *
*******************************************************************************/
#ifndef _ICNREVT_
#include <icnrevt.hpp>
#endif
#ifndef _ISTRING_
#include <istring.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
// Forward Declarations
class IContainerObject;
class IContainerControl;
class IContainerColumn;
class ICnrEditEvent : public ICnrEvent
{
typedef ICnrEvent Inherited;
/*******************************************************************************
* The ICnrEditEvent class forms the base of the container edit events. These *
* events are dispatched during direct editing operations in the container. *
* An edit operation can be initiated by the user or by program control (see *
* IContainerControl::editObject, IContainerControl::editColumnTitle, and *
* IContainerControl::editContainerTitle). Direct editing of a field in the *
* container is not allowed unless the field is set to "editable." Whether *
* the container is editable is controlled by the following styles: *
* *
* - IContainerControl::readOnly *
* - IContainerColumn::readOnly *
* - IContainerColumn::readOnlyHeading *
* *
* and the following functions: *
* *
* - IContainerObject::enableDataUpdate *
* - IContainerObject::disableDataUpdate *
* *
* The ICnrEditEvent class and its subclasses provide information describing *
* the location in the container being edited, as well as describing the *
* contents of the data being edited. *
*******************************************************************************/
public:
/*------------------------ Constructors ----------------------------------------
| The only way to construct an instance of this class is from the |
| IControlEvent class. |
------------------------------------------------------------------------------*/
ICnrEditEvent ( IControlEvent& event);
~ICnrEditEvent ( );
/*-------------------------------- Accessors -----------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| isTitleWindow - Returns true if the title is being edited. |
| isLeftDetailsHeading - Returns true if the left details heading is |
| being edited. |
| isRightDetailsHeading - Returns true if the right details heading is |
| being edited. |
| isDetailsData - Returns true if data in a column of the details |
| view is being edited. |
| isLeftDetails - Returns true if data in the left column of the |
| details view is being edited. |
| isRightDetails - Returns true if data in the right column of the |
| details view is being edited. |
| object - Returns the object being edited. If the edit is |
| not object-related (for example, a title edit), |
| 0 is returned. |
| column - Returns the column being edited. If the edit is |
| not column-related (for example, a title edit), |
| 0 is returned. |
| container - Returns the container in which the edit is taking |
| place. |
------------------------------------------------------------------------------*/
Boolean
isTitleWindow() const,
isLeftDetailsHeading() const,
isRightDetailsHeading() const,
isDetailsData() const,
isLeftDetails() const,
isRightDetails() const;
IContainerObject
*object();
IContainerColumn
*column();
IContainerControl
*container();
protected:
/*----------------------------- Implementation ---------------------------------
| These functions are used to implement the class: |
| textRef - Returns a pointer to the current text pointer for the |
| ICnrBeginEditEvent and ICnrReallocStringEvent events. For |
| ICnrEndEditEvent, a pointer to the new text pointer is |
| returned. |
| textSize - Returns the number of bytes in the text string (not counting |
| the null termination) for the ICnrEndEditEvent and |
| ICnrReallocStringEvent events; otherwise, 0 is returned. |
------------------------------------------------------------------------------*/
char
**textRef();
unsigned long
textSize() const;
};
class ICnrReallocStringEvent : public ICnrEditEvent
{
typedef ICnrEditEvent Inherited;
/*******************************************************************************
* The ICnrReallocStringEvent class is dispatched when text is edited in the *
* container and it is necessary to reallocate the storage for the text. *
*******************************************************************************/
public:
/*------------------------ Constructors ----------------------------------------
| The only way to construct an instance of this class is from the |
| IControlEvent class. ICnrReallocStringEvent is constructed by |
| ICnrEditHandler::dispatchHandlerEvent from an IControlEvent in response to |
| a notification from the container that text has changed and storage for the |
| text may need to be reallocated. |
------------------------------------------------------------------------------*/
ICnrReallocStringEvent ( IControlEvent& event);
~ICnrReallocStringEvent ( );
/*-------------------------------- Accessors -----------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| currentText - Returns the current text stored in the edit field. |
| newTextSize - Returns the size (not counting the null termination) of the |
| storage that needs to be allocated to store the new text |
| string. |
| newText - Returns the text the user added to the edit control. |
------------------------------------------------------------------------------*/
virtual IString
currentText(),
newText();
long
newTextSize();
/*------------------------------ Text Allocation -------------------------------
| These functions reallocate the storage for the text field either by updating |
| an IString or using operator new() for a char*: |
| reallocateString - Creates and stores an IString of the appropriate size |
| to hold the new data. |
| reallocateText - Calls global operator new to acquire storage of the |
| appropriate size to hold the new data. |
------------------------------------------------------------------------------*/
void
reallocateString();
void
reallocateText();
};
class ICnrBeginEditEvent : public ICnrEditEvent
{
typedef ICnrEditEvent Inherited;
/*******************************************************************************
* An ICnrBeginEditEvent event is dispatched to the ICnrEditHandler::beginEdit *
* function when an edit operation is initiated on one of the editable fields *
* of a container. The event provides information about the text being *
* edited, as well as the type of text (heading, icon, or details view) being *
* edited. *
*******************************************************************************/
public:
/*------------------------ Constructors ----------------------------------------
| Instances of this class can only be constructed from an instance of the |
| IControlEvent class. This typically occurs in the |
| ICnrEditHandler::dispatchHandlerEvent function in response to a request to |
| begin an edit operation. Such an occurrence is either as a result of user |
| action or under program control. |
------------------------------------------------------------------------------*/
ICnrBeginEditEvent ( IControlEvent& event);
~ICnrBeginEditEvent ( );
/*-------------------------------- Accessors -----------------------------------
| This function provides a means of getting and setting the accessible |
| attributes of instances of this class: |
| currentText - Returns the current text stored in the edit field. |
------------------------------------------------------------------------------*/
IString
currentText();
};
class ICnrEndEditEvent : public ICnrEditEvent
{
typedef ICnrEditEvent Inherited;
/*******************************************************************************
* The ICnrEndEditEvent class is dispatched when text editing is complete. *
*******************************************************************************/
public:
/*------------------------ Constructors ----------------------------------------
| ICnrEndEditEvent is constructed by ICnrEditHandler::dispatchHandlerEvent |
| from an IControlEvent in response to a notification from the container that |
| direct editing has ended. |
------------------------------------------------------------------------------*/
ICnrEndEditEvent ( IControlEvent& evt);
~ICnrEndEditEvent ( );
/*-------------------------------- Accessors -----------------------------------
| This function provides a means of getting and setting the accessible |
| attributes of instances of this class: |
| newText - Returns text entered by the user in the edit field. |
| currentText - Returns the current text stored in the container. |
| |
| If ICnrReallocStringEvent::reallocateString returns true, |
| indicating that the text was reallocated, then the text |
| that is returned will be the text entered by the user in |
| the edit field. |
| |
| If ICnrReallocStringEvent::reallocateString returns |
| false, indicating that the text was not reallocated, then |
| the text that is returned will be the text that was in |
| the edit field before the edit operation began. |
------------------------------------------------------------------------------*/
IString
newText(),
currentText();
private:
friend class ICnrEditHandler;
IString
strNewText;
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#endif