home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / toolbar / cbuthdr / graphbut.hpp < prev    next >
Text File  |  1996-10-29  |  2KB  |  72 lines

  1. //************************************************************
  2. // Tool Bars  - Custom Button Handler Example
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //************************************************************
  8. #include <icustbut.hpp>
  9. #include <icustbhd.hpp>
  10. #include <istring.hpp>
  11. #include <ipoint.hpp>
  12.  
  13. class IGraphic;
  14. class GraphicButtonHandler;
  15.  
  16. // Define our graphic button as a custom button
  17. // that stores a graphic to display.
  18. class GraphicButton : public ICustomButton
  19. {
  20. typedef ICustomButton
  21.   Inherited;
  22. public:
  23.    GraphicButton (unsigned long identifier,
  24.                          IWindow*      parent,
  25.                          IWindow*      owner,
  26.                          const ISize&  graphicSize =
  27.                                                 ISize(40,40),
  28.                          IGraphic*      upGraphicToAdopt = 0,
  29.                          IGraphic*      downGraphicToAdopt = 0);
  30. virtual 
  31.   ~GraphicButton ( );
  32.  
  33.  
  34. IGraphic
  35.  *upGraphic       ( ) const,
  36.  *downGraphic     ( ) const;
  37.  
  38.  
  39. virtual ISize
  40.   calcMinimumSize ( ) const;
  41.  
  42. private:
  43. IGraphic
  44.  *fUpGraphic,
  45.  *fDownGraphic;
  46.  
  47. GraphicButtonHandler
  48.  *fGraphicButtonHandler;
  49.  
  50. ISize
  51.   fGraphicSize;
  52.  
  53. IString
  54.   fUpText,
  55.   fDownText;
  56.  
  57.  GraphicButton ( const GraphicButton&);
  58.  GraphicButton& operator = (const GraphicButton&);
  59. };
  60.  
  61. // Define a draw handler so that we can
  62. // take over drawing the foreground.
  63. class GraphicButtonHandler : public ICustomButtonDrawHandler
  64. {
  65. typedef ICustomButtonDrawHandler
  66.   Inherited;
  67. protected:
  68. virtual void
  69.   drawForeground (ICustomButtonDrawEvent& event);
  70.  
  71. };
  72.