home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pwrgu2.zip / POWERGU2.EXE / LISTCTLS / DRAWLIST / LISTDHDR.HPP < prev    next >
Text File  |  1995-08-23  |  2KB  |  52 lines

  1. #ifndef _LISTDHDR_
  2. #define _LISTDHDR_
  3. //************************************************************
  4. // List Controls - List Box Custom Drawing           
  5. //
  6. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  7. // All Rights Reserved.
  8. //************************************************************
  9. #include <ihandle.hpp>
  10. #include <ilbdihdr.hpp>
  11. #include <istring.hpp>
  12.  
  13. // The handler to draw the item.  The handler is
  14. // preloaded with the amount to indent each
  15. // item, and containes the bitmaps necessary
  16. // to indicate whether an item is expanded or
  17. // collapsed.  The handler processes all requests
  18. // for drawing by routing them to the private
  19. // function drawListItem with an indication of whether
  20. // selection needs to be drawn.
  21. class DrawHandler : public IListBoxDrawItemHandler {
  22. public:
  23.   DrawHandler ( unsigned long indentBits=18 )
  24.      :   _indent( indentBits ),
  25.          _collapseIcon( ISystemBitmapHandle::collapsedTree ),
  26.          _expandIcon( ISystemBitmapHandle::expandedTree )
  27.   { }
  28.  
  29. protected:
  30. virtual Boolean
  31.   setHeight   ( short& height )
  32.   { height = 20; return true; }
  33.  
  34. virtual Boolean
  35.   highlight   ( IListBoxDrawItemEvent& event ),
  36.   unhighlight ( IListBoxDrawItemEvent& event ),
  37.   draw        ( IListBoxDrawItemEvent& event,
  38.                 DrawFlag& flag );
  39.  
  40. private:
  41. unsigned long
  42.   _indent;
  43. ISystemBitmapHandle
  44.   _expandIcon,
  45.   _collapseIcon;
  46. Boolean
  47.   drawListItem ( IListBoxDrawItemEvent& event, 
  48.                  Boolean selected );
  49. };
  50.  
  51. #endif // _LISTDHDR_
  52.