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

  1. #ifndef _ITBARBUT_
  2. #define _ITBARBUT_
  3. /*******************************************************************************
  4. * FILE NAME: itbarbut.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IToolBarButton                                                           *
  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 <icustbut.hpp>
  19. #include <irect.hpp>
  20. #include <ipoint.hpp>
  21. #include <icolor.hpp>
  22.  
  23. class IBitmapHandle;
  24. class IResourceId;
  25. class IToolBarButtonData;
  26.  
  27. #pragma pack(4)
  28.  
  29.  
  30. class IToolBarButton : public ICustomButton {
  31. typedef ICustomButton
  32.   Inherited;
  33. public:
  34. class Style;
  35. /*----------------------------- Constructors ---------------------------------*/
  36.   IToolBarButton  ( unsigned long     id,
  37.                     IWindow*          parent,
  38.                     IWindow*          owner,
  39.                     const IRectangle& initial = IRectangle(),
  40.                     const Style&      style = defaultStyle() );
  41.  
  42. virtual
  43.   ~IToolBarButton ( );
  44.  
  45.  
  46. /*------------------------------- Styles -------------------------------------*/
  47. INESTEDBITFLAGCLASSDEF4(Style, IToolBarButton, IWindow,
  48.                         IControl, IButton, ICustomButton);
  49.                                   // style class definition
  50. static const Style
  51.   IC_IMPORTU bitmapVisible,
  52.   IC_IMPORTU textVisible,
  53.   IC_IMPORTU bitmapAndTextVisible,
  54.   IC_IMPORTU useIdForBitmap,
  55.   IC_IMPORTU useIdForText,
  56.   IC_IMPORTU standardFormat,
  57.   IC_IMPORTU noDragDelete,
  58.   IC_IMPORTU classDefaultStyle;
  59.  
  60. static Style
  61.   defaultStyle      ( );
  62.  
  63. static void
  64.   setDefaultStyle   ( const Style&    style );
  65.  
  66. virtual unsigned long
  67.   convertToGUIStyle ( const IBitFlag& style,
  68.                       Boolean         extendedOnly = false ) const;
  69.  
  70. /*------------------------------ Bitmaps -------------------------------------*/
  71. virtual IToolBarButton
  72.   &setBitmap        ( const IResourceId&   bitmapId ),
  73.   &setBitmap        ( const IBitmapHandle& handle ),
  74.   &setBitmap        ( unsigned long        id ),
  75.   &setLatchedBitmap ( const IResourceId&   latchedBitmapId ),
  76.   &setLatchedBitmap ( const IBitmapHandle& handle ),
  77.   &setLatchedBitmap ( unsigned long        id );
  78.  
  79. IBitmapHandle
  80.   bitmap            ( ) const,
  81.   latchedBitmap     ( ) const;
  82.  
  83. virtual ISize
  84.   bitmapSize        ( ) const;
  85.  
  86. /*-------------------------------- Views -------------------------------------*/
  87. enum View {
  88.   bitmapView,
  89.   textView,
  90.   bitmapAndTextView
  91. };
  92.  
  93. virtual IToolBarButton
  94.   &setView        ( View buttonView );
  95.  
  96. View
  97.   view            ( ) const;
  98.  
  99. Boolean
  100.   isBitmapVisible ( ) const,
  101.   isTextVisible   ( ) const;
  102.  
  103. /*------------------------------ Transparency --------------------------------*/
  104. virtual IToolBarButton
  105.   &setTransparentColor   ( const IColor& color = IColor::pink ),
  106.   &resetTransparentColor ( );
  107.  
  108. virtual IColor
  109.   transparentColor       ( ) const;
  110.  
  111. virtual Boolean
  112.   hasTransparentColor    ( ) const;
  113.  
  114. static IColor
  115.   defaultTransparentColor ( );
  116. static void
  117.   setDefaultTransparentColor ( const IColor& aColor = IColor(IColor::pink) );
  118. static void
  119.   clearDefaultTransparentColor ( );
  120. static Boolean
  121.   isDefaultTransparentColorSet ( );
  122.  
  123. /*-------------------------- Canvas Support ----------------------------------*/
  124. virtual IToolBarButton
  125.   &setLayoutDistorted ( unsigned long layoutAttributeOn,
  126.                         unsigned long layoutAttributeOff );
  127.  
  128. /*-------------------------- Standard Format ---------------------------------*/
  129. static unsigned long
  130.   standardTextWidth     ( ),
  131.   standardTextLines     ( );
  132.  
  133. static ISize
  134.   standardBitmapSize    ( );
  135.  
  136. static void
  137.   setStandardTextWidth  ( unsigned long newWidth = 50 ),
  138.   setStandardTextLines  ( unsigned long newLines = 1 ),
  139.   setStandardBitmapSize ( const ISize&  newSize  = ISize(20,17) );
  140.  
  141. Boolean
  142.   isStandardFormat      ( ) const;
  143.  
  144. /*------------------------------- Shredder Support ---------------------------*/
  145. virtual IToolBarButton
  146.  &enableDragDelete  ( Boolean enable = true ),
  147.  &disableDragDelete ( );
  148.  
  149. Boolean
  150.   allowsDragDelete  ( ) const;
  151.  
  152. protected:
  153. /*----------------------------- Canvas Layout --------------------------------*/
  154. virtual ISize
  155.   calcMinimumSize ( ) const;
  156.  
  157. private:
  158. /*--------------------------------- Private ----------------------------------*/
  159.   IToolBarButton            (const IToolBarButton&);
  160.   IToolBarButton& operator= (const IToolBarButton&);
  161. static Style
  162.   fCurrentDefaultStyle;
  163. static IColor
  164.   *fCurrentDefaultTransparent;
  165. static unsigned long
  166.   fgStandardWidth,
  167.   fgStandardLines;
  168. static ISize
  169.   fgStandardSize;
  170. IToolBarButtonData
  171.  *fToolBarButtonData;
  172. };
  173.  
  174. INESTEDBITFLAGCLASSFUNCS(Style, IToolBarButton);
  175.  
  176.  
  177. #pragma pack()
  178.  
  179. #endif /* _ITBARBUT_ */
  180.