home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / runnable / ibmc / ibmclass / icnreevt.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-26  |  10.1 KB  |  211 lines

  1. #ifndef _ICNREEVT_
  2.    #define _ICNREEVT_
  3. /*******************************************************************************
  4. * FILE NAME: icnreevt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     ICnrBeginEditEvent                                                       *
  9. *     ICnrEndEditEvent                                                         *
  10. *     ICnrReallocStringEvent                                                   *
  11. *                                                                              *
  12. * COPYRIGHT:                                                                   *
  13. *   (C) Copyright IBM Corporation 1992                                         *
  14. *   All Rights Reserved                                                        *
  15. *   Licensed Materials * Property of IBM                                       *
  16. *                                                                              *
  17. * HISTORY:                                                                     *
  18. * $Log:   R:/ibmclass/icnr/vcs/icnreevt.hpv  $
  19. //
  20. //   Rev 1.6   26 Oct 1992 00:12:36   BOBLOVE
  21. //External Beta release
  22. *                                                                              *
  23. *******************************************************************************/
  24.  
  25. #ifndef _ICNRBEVT_
  26.    #include <icnrbevt.hpp>
  27. #endif
  28.  
  29. //    Forward Declarations  
  30. class IContainerObject;
  31. class IContainerControl;
  32. class IContainerColumn;
  33.  
  34.  
  35. class ICnrEditEvent : public ICnrEvent 
  36. {
  37. /*******************************************************************************
  38. * This class forms the base of the container edit events.                      *
  39. *******************************************************************************/
  40.  
  41. public:
  42. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  43. | There is only one way to construct instances of this class:                  |
  44. |   1. From the base IEvent class.                                             |
  45. ------------------------------------------------------------------------------*/
  46.   ICnrEditEvent(IEvent& cpszevt);
  47.  
  48. /*-------------------------------- ACCESSORS -----------------------------------
  49. | These functions provide means of getting and setting the accessible          |
  50. | attributes of instances of this class:                                       |
  51. |                                                                              |
  52. | isTitleWindow         - Returns true if the title is being edited.           |
  53. | isLeftDetailsHeading  - Returns true if the left details heading is being    |
  54. |                         edited.                                              |
  55. | isRightDetailsHeading - Returns true if the right details heading is being   |
  56. |                         edited.                                              |
  57. | isDetailsData         - Returns true if editing data in a column of the      |
  58. |                         details view.                                        |
  59. | isLeftDetails         - Returns true if editing the left column of the       |
  60. |                         details view.                                        |
  61. | isRightDetails        - Returns true if editing the right column of the      |
  62. |                         details view.                                        |
  63. | object                - Return the object being edited or zero if the edit   |
  64. |                         is not object related (e.g. title).                  |
  65. | column                - Returns the column being edited or zero if the edit  |
  66. |                         is not column related (e.g. title).                  |
  67. | container             - Returns the container where editing is occurring.    |
  68. ------------------------------------------------------------------------------*/
  69. Boolean 
  70.   isTitleWindow() const,
  71.   isLeftDetailsHeading() const,
  72.   isRightDetailsHeading() const,
  73.   isDetailsData() const,
  74.   isLeftDetails() const,
  75.   isRightDetails() const;
  76.  
  77. IContainerObject
  78.  *object();
  79.  
  80. IContainerColumn
  81.  *column();
  82.  
  83. IContainerControl
  84.  *container();
  85.  
  86. protected:
  87. /*----------------------------- IMPLEMENTATION ---------------------------------
  88. | These functions are used to implement the class:                             |
  89. | textRef       - Returns a pointer to the current text pointer for BeginEdit  |
  90. |                 and ReallocString events. Returns a pointer to the new       |
  91. |                 text pointer for EndEdit.                                    |
  92. | textSize      - Returns the number of bytes in the text string for EndEdit   |
  93. |                 and ReallocString events otherwise returns zero.             |
  94. ------------------------------------------------------------------------------*/
  95. char
  96.  **textRef();
  97.  
  98. unsigned long
  99.  textSize() const;
  100.  
  101. };
  102.  
  103.  
  104. class ICnrReallocStringEvent : public ICnrEditEvent
  105. {
  106. /*******************************************************************************
  107. * This class is dispatched when text is edited in the container and it is      *
  108. * necessary to reallocate the storage for the text.                            *
  109. *******************************************************************************/
  110. public:
  111. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  112. | There is only one way to construct instances of this class:                  |
  113. |   1. From the base IEvent class.                                             |
  114. ------------------------------------------------------------------------------*/
  115.   ICnrReallocStringEvent(IEvent& event);
  116.  
  117. /*-------------------------------- ACCESSORS -----------------------------------
  118. | These functions provide means of getting and setting the accessible          |
  119. | attributes of instances of this class:                                       |
  120. |                                                                              |
  121. | currentText           - Returns the current text stored in the edit field.   |
  122. | newTextSize           - Returns the size of storage that needs to be         |
  123. |                         allocated to store the new text string.              |
  124. ------------------------------------------------------------------------------*/
  125. virtual IString 
  126.   currentText();
  127.  
  128. long 
  129.   newTextSize();
  130.  
  131. /*------------------------------ TEXT ALLOCATION -------------------------------
  132. | These functions reallocate the storage for the text field either by updating |
  133. | an IString or using operator new() for a char*.                              |
  134. |                                                                              |
  135. | reallocString   - Create and store an IString of the appropriate size        |
  136. |                   to hold the new data.                                      |
  137. | reallocText     - Call operator new() to acquire storage of the appropriate  |
  138. |                   size to hold the new data.                                 |
  139. ------------------------------------------------------------------------------*/
  140. void 
  141.   reallocateString();
  142. void 
  143.   reallocateText();
  144. };
  145.  
  146.  
  147. class ICnrBeginEditEvent : public ICnrEditEvent  
  148. {
  149. /*******************************************************************************
  150. * This class is dispatched when a request is mage to edit text in the          *
  151. * container.                                                                   *
  152. *******************************************************************************/
  153. public:
  154.  
  155. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  156. | There is only one way to construct instances of this class:                  |
  157. |   1. From the base IEvent class.                                             |
  158. ------------------------------------------------------------------------------*/
  159. ICnrBeginEditEvent(IEvent& event);
  160.  
  161. /*-------------------------------- ACCESSORS -----------------------------------
  162. | These functions provide means of getting and setting the accessible          |
  163. | attributes of instances of this class:                                       |
  164. |                                                                              |
  165. | currentText           - Returns the current text stored in the edit field.   |
  166. ------------------------------------------------------------------------------*/
  167. IString 
  168.   currentText();
  169.  };
  170.  
  171. class ICnrEndEditEvent : public ICnrEditEvent 
  172. {
  173. /*******************************************************************************
  174. * This class is dispatched when text editing is complete.                      *
  175. *******************************************************************************/
  176. public:
  177.  
  178. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  179. | There is only one way to construct instances of this class:                  |
  180. |   1. From the base IEvent class.                                             |
  181. ------------------------------------------------------------------------------*/
  182. ICnrEndEditEvent(IEvent& evt);
  183.  
  184. /*-------------------------------- ACCESSORS -----------------------------------
  185. | These functions provide means of getting and setting the accessible          |
  186. | attributes of instances of this class:                                       |
  187. |                                                                              |
  188. | newText    - Returns the new text stored in the edited field.                |
  189. ------------------------------------------------------------------------------*/
  190. IString 
  191.   newText();
  192. };
  193.  
  194.  
  195. /* INLINES */
  196.  
  197. inline ICnrEditEvent ::  ICnrEditEvent(IEvent& cpszevt)
  198.                      : ICnrEvent(cpszevt) {}
  199.  
  200. inline ICnrReallocStringEvent :: ICnrReallocStringEvent(IEvent& cpszevt)
  201.                      : ICnrEditEvent(cpszevt) {}
  202.  
  203. inline ICnrBeginEditEvent :: ICnrBeginEditEvent(IEvent& evt)
  204.                            : ICnrEditEvent(evt) {}
  205.  
  206. inline ICnrEndEditEvent :: ICnrEndEditEvent(IEvent& evt)
  207.                      : ICnrEditEvent(evt) {}
  208.  
  209.  
  210. #endif
  211.