home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / ILBDIHDR.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  7KB  |  125 lines

  1. #ifndef _ILBDIHDR_
  2. #define _ILBDIHDR_
  3. /*******************************************************************************
  4. * FILE NAME: ilbdihdr.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IListBoxDrawItemHandler - The list-box draw item  event handler class    *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18.  
  19.  
  20. #ifndef _IHANDLER_
  21.  #include <ihandler.hpp>
  22. #endif
  23. #ifndef _IBITFLAG_
  24.   #include <ibitflag.hpp>
  25. #endif
  26. #ifndef _ILBDIEVT_
  27.  #include <ilbdievt.hpp>
  28. #endif
  29.  
  30. /*----------------------------------------------------------------------------*/
  31. /* Align classes on four byte boundary.                                       */
  32. /*----------------------------------------------------------------------------*/
  33. #pragma pack(4)
  34.  
  35. class IListBoxDrawItemHandler : public IHandler {
  36. typedef IHandler Inherited;
  37. /*******************************************************************************
  38. * The IListBoxDrawItemHandler class is used to process the list box draw item  *
  39. * event.                                                                       *
  40. *                                                                              *
  41. * The list box must be created with IListBox::drawItem style.                  *
  42. *******************************************************************************/
  43. public:
  44. /*------------------------ Constructor -----------------------------------------
  45. | The only way to construct instances of this class is by using the default    |
  46. | constructor.                                                                 |
  47. ------------------------------------------------------------------------------*/
  48.   IListBoxDrawItemHandler();
  49.  
  50.   virtual ~IListBoxDrawItemHandler();
  51.  
  52. protected:
  53. /*-------------------------------- DrawFlag ------------------------------------
  54. | This flag is set in the overridden draw function to indicate the actions     |
  55. | that were taken.                                                             |
  56. |                                                                              |
  57. |   DrawFlag - Nested class that provides static members that define the set   |
  58. |              of valid actions taken within a draw function.  An instance of  |
  59. |              a DrawFlag is passed as the second argument to an overridden    |
  60. |              IListBoxItemHandler::draw function.  The overridden function    |
  61. |              sets the drewSelected flag to indicate whether it drew the      |
  62. |              selection indication.                                           |
  63. |                                                                              |
  64. |              The declaration of the IListBoxItemHandler::DrawFlag nested     |
  65. |              class is generated by the INESTEDBITFLAGCLASSDEF0 macro.        |
  66. |                                                                              |
  67. | The valid list box draw flags are:                                           |
  68. |                                                                              |
  69. |   drewSelected - The highlighting of the list item was drawn.                |
  70. ------------------------------------------------------------------------------*/
  71. INESTEDBITFLAGCLASSDEF0(DrawFlag, IListBoxDrawItemHandler);
  72. static const DrawFlag
  73.   drewSelected;
  74.  
  75. /*------------------------- Override Functions ---------------------------------
  76. | dispatchHandlerEvent - Dispatches command functions for this handler.        |
  77. ------------------------------------------------------------------------------*/
  78. virtual Boolean
  79.   dispatchHandlerEvent(IEvent& evt);
  80.  
  81. /*------------------------- Event Handling Function ---------------------------|
  82. | These event handling functions are dispatched by this handler:               |
  83. |   setHeight  - Override this function to set the height of the list box      |
  84. |                item.  All items in a list box have the same height.  The     |
  85. |                height must be greater than or equal to the height of the     |
  86. |                current font.  Set the height argument to the desired height  |
  87. |                for the item.                                                 |
  88. |   draw       - Override this function to draw the list item.  By default,    |
  89. |                the system will invert the bits to indicate list item         |
  90. |                selection.  Unless the system default method is               |
  91. |                unacceptable, you should not have to draw the list item.  If  |
  92. |                you draw the list item yourself, set the DrawFlag before      |
  93. |                returning from the draw function.  This will prevent the      |
  94. |                system from drawing the list item.  The                       |
  95. |                IListBoxDrawItemEvent class provides the isSelected function  |
  96. |                to query whether the list item is selected.                   |
  97. |  highlight   - Override this function if you want to draw the highlight      |
  98. |                that indicates a list item has been selected.  You should do  |
  99. |                this only if the system default of inverting the bits for a   |
  100. |                selected item is unacceptable.                                |
  101. |  unhighlight - Override this function if you want to remove the highlight    |
  102. |                to indicate a list item has been de-selected.  You should do  |
  103. |                this only if the system default method is unacceptable.       |
  104. ------------------------------------------------------------------------------*/
  105. virtual Boolean
  106.   setHeight(short& height);
  107.  
  108. virtual Boolean
  109.   draw(IListBoxDrawItemEvent& evt, DrawFlag& flag);
  110.  
  111. virtual Boolean
  112.   highlight(IListBoxDrawItemEvent& evt);
  113.  
  114. virtual Boolean
  115.   unhighlight(IListBoxDrawItemEvent& evt);
  116.  
  117. };
  118.  
  119. /*----------------------------------------------------------------------------*/
  120. /* Resume compiler default packing.                                           */
  121. /*----------------------------------------------------------------------------*/
  122. #pragma pack()
  123.  
  124. #endif /* _ILBDIHDR_ */
  125.