home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OGraphicsButton.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  6KB  |  180 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OGraphicsButton.hpp
  5.  
  6.  
  7. /*
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  14.  *    endorse or promote products derived from this software
  15.  *    without specific prior written permission.
  16.  * 3. See OCL.INF for a detailed copyright notice.
  17.  *
  18.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  19.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  22.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28.  * SUCH DAMAGE.
  29.  */
  30.  
  31.  
  32. // $Header: W:/Projects/OCL/Include/rcs/OGraphicsButton.hpp 1.50 1996/08/11 23:47:14 B.STEIN Release $
  33.  
  34. #ifndef OGRBTN_INCLUDED
  35.   #define OGRBTN_INCLUDED
  36.  
  37.  
  38. #ifndef OUBTN_INCLUDED
  39.   #include <OUserButton.hpp>
  40. #endif
  41.  
  42. #ifndef OBITMAP_INCLUDED
  43.   #include <OBitmap.hpp>
  44. #endif
  45.  
  46. #ifndef OICON_INCLUDED
  47.   #include <OIcon.hpp>
  48. #endif
  49.  
  50.  
  51. // messages
  52.  
  53. #define OBUTTONBAR_MOVEOVER      WM_MOUSEMOVE
  54. #define OGRBTN_SETHILITE         BM_SETHILITE
  55. #define OGRBTN_WINDOWENTER       WM_WINDOWENTER
  56. #define OGRBTN_WINDOWLEAVE       WM_WINDOWLEAVE
  57. #define OGRBTN_PRESPARAMCHANGED  WM_PRESPARAMCHANGED
  58.  
  59.  
  60. // classes
  61.  
  62. // Objects of this class are used by OButtonBar.
  63. // The member OGraphicsButton::helpText should
  64. // be set for toolbar-buttons. This way fly-over-help
  65. // is enabled automatically.
  66.  
  67. typedef class OGraphicsButton *pOGraphicsButton;
  68.  
  69. class __CPP_EXPORT__ OGraphicsButton
  70.   : public OUserButton 
  71. {
  72.  private:
  73.     PFNWP            PM_ButtonProc;
  74.     BOOL             isEnabled;
  75.  
  76.  protected:
  77.     enum  
  78.       {
  79.        useBitmap = 1,
  80.        useIcon 
  81.       };    
  82.  
  83.     BOOL             pushState;
  84.     ULONG            imageType;
  85.     
  86.  public:
  87.  
  88.     pOIcon           pIco;
  89.     pOBitmap         pBmp;
  90.     OString          helpText;
  91.  
  92.  
  93.     OGraphicsButton (ULONG    id,          // id for this control
  94.                      HWND     Parent,      // parent window
  95.                      pOIcon   ico,         // image to draw
  96.                      PSZ      help = NULL, // help text for bubble help
  97.                      ULONG    x  = 0,      // x-dimension within parent
  98.                      ULONG    y  = 0,      // y-dimension within parent
  99.                      ULONG    cx = 40,     // width within parent
  100.                      ULONG    cy = 20);    // height within parent
  101.  
  102.     OGraphicsButton (ULONG    id,
  103.                      HWND     Parent,
  104.                      pOBitmap bmp,
  105.                      PSZ      help = NULL,
  106.                      ULONG    x  = 0,
  107.                      ULONG    y  = 0,
  108.                      ULONG    cx = 40,
  109.                      ULONG    cy = 20);
  110.  
  111.     OGraphicsButton (ULONG    id,
  112.                      OFrame&  Parent,
  113.                      pOIcon   ico,    
  114.                      PSZ      help = NULL,
  115.                      ULONG    x  = 0,
  116.                      ULONG    y  = 0,
  117.                      ULONG    cx = 40,
  118.                      ULONG    cy = 20);
  119.  
  120.     OGraphicsButton (ULONG    id,
  121.                      OFrame&  Parent,
  122.                      pOBitmap bmp,
  123.                      PSZ      help = NULL,
  124.                      ULONG    x  = 0,
  125.                      ULONG    y  = 0,
  126.                      ULONG    cx = 40,
  127.                      ULONG    cy = 20);
  128.  
  129.     OGraphicsButton (ULONG    id,
  130.                      pOFrame  Parent,
  131.                      pOIcon   ico,    
  132.                      PSZ      help = NULL,
  133.                      ULONG    x  = 0,
  134.                      ULONG    y  = 0,
  135.                      ULONG    cx = 40,
  136.                      ULONG    cy = 20);
  137.  
  138.     OGraphicsButton (ULONG    id,
  139.                      pOFrame  Parent,
  140.                      pOBitmap bmp,
  141.                      PSZ      help = NULL,
  142.                      ULONG    x  = 0,
  143.                      ULONG    y  = 0,
  144.                      ULONG    cx = 40,
  145.                      ULONG    cy = 20);
  146.  
  147.     virtual
  148.       ~OGraphicsButton    ();
  149.  
  150.     virtual
  151.       PSZ isOfType        () const;
  152.  
  153.  
  154.     MRESULT UBDefaultCall (ULONG  msg,  
  155.                            MPARAM mp1,
  156.                            MPARAM mp2);
  157.  
  158.     OButton&
  159.        createButton       ();
  160.  
  161.     OGraphicsButton&
  162.        drawButton         (HPS hPS);
  163.  
  164.     virtual BOOL 
  165.        OCommand           (ULONG msg, MPARAM mp1, MPARAM mp2);
  166. };
  167.  
  168. extern "C"
  169. {
  170.  MRESULT EXPENTRY OGraphicsButtonProc(HWND hwnd,
  171.                                       ULONG msg,
  172.                                       MPARAM mp1,
  173.                                       MPARAM mp2);
  174. }
  175.  
  176. #endif // OGRBTN_INCLUDED
  177.  
  178.  
  179. // end of source
  180.