home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / ibmpctl.hp_ / IBMPCTL.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  6.8 KB  |  160 lines

  1. #ifndef _IBMPCTL_
  2.   #define _IBMPCTL_
  3. /*******************************************************************************
  4. * FILE NAME: Ibmpctl.hpp                                                       *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     Ibmpctl - This class creates and manages a bitmap control.               *
  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. * $Log:   R:/IBMCLASS/IBASECTL/VCS/IBMPCTL.HPV  $
  18. //
  19. //   Rev 1.9   25 Oct 1992 17:05:02   nunn
  20. //changed library name to ICLUI
  21. //
  22. //   Rev 1.8   25 Oct 1992 10:50:58   boezeman
  23. //Add documentation and converted file to skeleton.hpp format
  24.  
  25.       Rev 1.7   13 Oct 1992 21:12:36   tsuji
  26.    Correct comments around log directive.
  27.  
  28.       Rev 1.6   13 Oct 1992 20:56:22   tsuji
  29.    Correct log directive, remove IBM Confidential classification.
  30.  
  31.       Rev 1.5   13 Oct 1992 19:05:10   tsuji
  32.    Remove no-op virtual destructor, add Inherited typedef.
  33. *******************************************************************************/
  34. #ifndef _ICONTROL_
  35.   #include <icontrol.hpp>
  36. #endif
  37.  
  38. // Forward declarations for other classes:
  39. class IBitmapControl;  /* bc */
  40. class IBitmapHandle;
  41. class IRectangle;
  42. class IResourceId;
  43. class ISize;
  44. class IWindowHandle;
  45. #ifndef _IBITFLAG_
  46.   #include <ibitflag.hpp>
  47. #endif
  48.  
  49. class IBitmapControl : public IControl {
  50. /*******************************************************************************
  51. * This class creates and manages a bitmap control.                             *
  52. *                                                                              *
  53. * To use this class, create an instance of this class as follows:              *
  54. *   IBitmapControl bcBitmap(ID_BITMAP, this, IRectangle(10,10,20,20)),         *
  55. *                          ID_BITMAP_RES, IResourceMgr());                     *
  56. * The size of the control window is the size of the bitmap image.              *
  57. *                                                                              *
  58. * EXAMPLE:                                                                     *
  59. *   <sample code>                                                              *
  60. *******************************************************************************/
  61. /*The next release will provide an option to scale the image.                  */
  62. typedef IControl
  63.   Inherited;
  64. public:
  65. INESTEDBITFLAGCLASSDEF1(Style, IBitmapControl, IWindow);
  66.                                   // style class definition
  67. static const Style
  68.   autosize,
  69.   initSize;
  70. static const Style&
  71.   defStyle;
  72. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  73. | There are 4 ways to construct instances of this class:                       |
  74. |   1. default                                                                 |
  75. |   2. From a System Bitmap                                                    |
  76. |   3. From a Dialog Template                                                  |
  77. |   4. From a Window                                                           |
  78. ------------------------------------------------------------------------------*/
  79.   IBitmapControl(unsigned long Id,
  80.                  const IWindow* parent,
  81.                  const IWindow* owner,
  82.                  const IRectangle& initial,
  83.                  const IResourceId& bmpId,
  84.                  Style style = defStyle);
  85.  
  86.   IBitmapControl(unsigned long Id,
  87.                  const IWindow* parent,
  88.                  const IWindow* owner,
  89.                  const IRectangle& initial,
  90.                  ISysBitmapHandle::Type bmp,
  91.                  Style style = defStyle);
  92.  
  93.   IBitmapControl(unsigned long Id,
  94.                  const IWindow* parentDialog);
  95.  
  96.   IBitmapControl(IWindowHandle handle);
  97.  
  98. /*-------------------------------- STYLES --------------------------------------
  99. | These function provide means of getting and setting the default style        |
  100. | attributes of instances of this class:                                       |
  101. |   defaultStyle    - Returns the three state control default style setting    |
  102. |   setDefaultStyle - Sets the three state control default style               |
  103. ------------------------------------------------------------------------------*/
  104. static Style
  105.   defaultStyle();
  106. static void
  107.   setDefaultStyle(Style style);
  108.  
  109. /*-------------------------------- QUERY/SET HANDLE ----------------------------
  110. |   setBitmap - Changes a static bitmap control window.                        |
  111. |   bitmap    - Returns the handle to the static bitmap.                       |
  112. ------------------------------------------------------------------------------*/
  113. void
  114.   setBitmap(const IResourceId& bmpId),
  115.   setBitmap(IBitmapHandle handle),
  116.   setBitmap(ISysBitmapHandle::Type bmp),
  117.   setBitmap(ISysBitmapHandle handle);
  118. IBitmapHandle
  119.   bitmap() const;
  120. /***********************************************************/
  121. /* Scaling of bitmap -- need to handle later.              */
  122. /* Also, repaint buffer does not work with bitmaps -- can  */
  123. /* provide a solution here or in dispatch()?               */
  124. /***********************************************************/
  125.  
  126. protected:
  127. /*----------------------------- LAYOUT SIZE ------------------------------------
  128. |   calcMinSize - Returns the minimum size that this bitmap control should be. |
  129. ------------------------------------------------------------------------------*/
  130. virtual ISize
  131.   calcMinSize();
  132.  
  133. static Style
  134.   classDefaultStyle;
  135.  
  136. private:
  137. /*--------------------------------- PRIVATE ----------------------------------*/
  138.   IBitmapControl(const IBitmapControl&);
  139. //IBitmapControl& operator=(const IBitmapControl);
  140.  
  141. void
  142.   create(unsigned long Id,
  143.          const IWindow* parent,
  144.          const IWindow* owner,
  145.          const IRectangle& initial,
  146.          Style style);
  147.  
  148. static const Style
  149.   bitmapStyle;
  150.  
  151. IBitmapHandle
  152.   bmpHandle;
  153. Boolean
  154.   bSizeTo;
  155. };  // class IBitmapControl
  156.  
  157. INESTEDBITFLAGCLASSFUNCS(Style, IBitmapControl);
  158.                                   // global style functions
  159. #endif  /* _IBMPCTL_ */
  160.