home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / igraphbt.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  5.8 KB  |  169 lines

  1. #ifndef _IGRAPHBT_
  2.   #define _IGRAPHBT_
  3. /*******************************************************************************
  4. * FILE NAME: igraphbt.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *    IGraphicPushButton                                                        *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - 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. #include <ipushbut.hpp>
  19. #include <irect.hpp>
  20. #include <ipoint.hpp>
  21. #include <ihandle.hpp>
  22.  
  23. class IIconControl;
  24. class IGraphicPushButtonData;
  25. class IResourceId;
  26.  
  27. #pragma pack(4)
  28.  
  29. class IGraphicPushButton : public IPushButton  {
  30. typedef IPushButton
  31.   Inherited;
  32. public:
  33. class Style;
  34. /*------------------------------- Constructors -------------------------------*/
  35.   IGraphicPushButton( unsigned long         id,
  36.                       IWindow*              parent,
  37.                       IWindow*              owner,
  38.                       const IResourceId&    bitmapOrIconId,
  39.                       const IRectangle&     initial = IRectangle(),
  40.                       const Style&          style = defaultStyle() );
  41.  
  42.   IGraphicPushButton( unsigned long         id,
  43.                       IWindow*              parent,
  44.                       IWindow*              owner,
  45.                       unsigned long         bitmapOrIconId,
  46.                       const IRectangle&     initial = IRectangle(),
  47.                       const Style&          style = defaultStyle() );
  48.  
  49.   IGraphicPushButton( unsigned long         id,
  50.                       IWindow*              parent,
  51.                       IWindow*              owner,
  52.                       const IBitmapHandle&  bitmap = IBitmapHandle(),
  53.                       const IRectangle&     initial = IRectangle(),
  54.                       const Style&          style = defaultStyle() );
  55.  
  56.   IGraphicPushButton( unsigned long         id,
  57.                       IWindow*              parent,
  58.                       IWindow*              owner,
  59.                       const IPointerHandle& icon,
  60.                       const IRectangle&     initial = IRectangle(),
  61.                       const Style&          style = defaultStyle() );
  62.  
  63.   IGraphicPushButton( unsigned long         id,
  64.                       IWindow*              parent );
  65.  
  66.   IGraphicPushButton( const IWindowHandle&  handle);
  67.  
  68. virtual
  69.  ~IGraphicPushButton( );
  70.  
  71. /*---------------------------------- Styles ----------------------------------*/
  72. INESTEDBITFLAGCLASSDEF4(Style, IGraphicPushButton, IWindow,
  73.                         IControl, IButton, IPushButton);
  74.  
  75. static const Style
  76.   IC_IMPORTU classDefaultStyle,
  77.   IC_IMPORTU sizeToGraphic;
  78.  
  79. static Style
  80.   defaultStyle      ( );
  81.  
  82. static void
  83.   setDefaultStyle   ( const Style&    style );
  84.  
  85. virtual unsigned long
  86.   convertToGUIStyle ( const IBitFlag& style,
  87.                       Boolean         extendedOnly = false ) const;
  88.  
  89. /*--------------------------------- Graphic ----------------------------------*/
  90. enum GraphicType {
  91.   bitmapType,
  92.   iconType
  93. };
  94.  
  95. virtual IGraphicPushButton
  96.  &setGraphic         ( unsigned long         bitmapOrIconId ),
  97.  &setGraphic         ( const IResourceId&    bitmapOrIconId ),
  98.  &setGraphic         ( const IBitmapHandle&  handle ),
  99.  &setGraphic         ( const IPointerHandle& handle );
  100. IPointerHandle
  101.   icon               ( ) const;
  102. IBitmapHandle
  103.   bitmap             ( ) const;
  104. GraphicType
  105.   currentGraphicType ( ) const;
  106. IIconControl&
  107.   graphicWindow      ( ) const;
  108.  
  109. /*----------------------------- Graphic Size ---------------------------------*/
  110. virtual IGraphicPushButton
  111.  &enableSizeToGraphic   ( Boolean sizeToGraphic = true ),
  112.  &disableSizeToGraphic  ( );
  113. Boolean
  114.   isSizeToGraphic       ( ) const;
  115.  
  116. /*---------------------------------- Margins ---------------------------------*/
  117. IGraphicPushButton
  118.  &setMarginSize   ( const ISize& size );
  119. ISize
  120.   marginSize      ( ) const;
  121.  
  122. /*---------------------------- Window Positioning ----------------------------*/
  123.  
  124. protected:
  125. /*------------------------------ Layout Support ------------------------------*/
  126. virtual ISize
  127.   calcMinimumSize ( ) const;
  128.  
  129. private:
  130. /*------------------------------ Hidden Members ------------------------------*/
  131.   IGraphicPushButton  (const IGraphicPushButton& button );
  132. IGraphicPushButton
  133.  &operator=           (const IGraphicPushButton& button );
  134.  
  135. /*--------------------------------- Private ----------------------------------*/
  136. friend class IGraphicPushButtonHandler;
  137.  
  138. IGraphicPushButton
  139.  &initialize( const Style& style,
  140.               const IRectangle& initial,
  141.               unsigned long id );
  142.  
  143. IGraphicPushButton
  144.  &setControlData( const IBitmapHandle& handle );
  145.  
  146. static Style
  147.   currentDefaultStyle;
  148.  
  149. IIconControl*
  150.   aIcon;
  151. Boolean
  152.   bSizeTo,
  153.   returnBack;
  154. GraphicType
  155.   contains;
  156. ISize
  157.   border;
  158.  
  159. IGraphicPushButtonData
  160.  *fGraphicPushButtonData;
  161.  
  162. };  // class IGraphicPushButton
  163.  
  164. INESTEDBITFLAGCLASSFUNCS(Style, IGraphicPushButton);
  165.  
  166. #pragma pack()
  167.  
  168. #endif  // _IGRAPHBT_
  169.