home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CCicnButton 1.0 / CCicnButton.h < prev   
Encoding:
C/C++ Source or Header  |  1994-11-30  |  3.5 KB  |  117 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CCicnButton.h
  3.  
  4.         Interface for CicnButton class
  5.         
  6.     SUPERCLASS = CIconPane
  7.     
  8.     Copyright © 1992 Object Factory Incorporated. All rights reserved.
  9.  
  10.     Modified     12/93 by Martin R. Wachter
  11.  
  12.  ******************************************************************************/
  13.  
  14. #pragma once
  15.  
  16. #include <CIconPane.h>
  17.  
  18. enum {                                // Button kinds
  19.     kSAPushButton,
  20.     kSACheckBox,
  21.     kSARadioButton
  22. };
  23.  
  24. enum {                                // Highlight styles
  25.     kSAStateHilight,                //     Highlight by drawing different picture
  26.     kSADimHilight                    //     Highlight by dimming (somehow)
  27. };
  28.  
  29. enum {                                // Ways to indicate button is "on"
  30.     kSAStateOn,                        //     Show on by drawing different picture
  31.     kSABorderOn                        //     Show on by drawing border around button
  32. };
  33.  
  34. enum {                                // Whether or not needs update to highlight
  35.     kSANoUpdate,                    //     Nope, just draw it
  36.     kSANeedsUpdate                    //     Must update. Call the artist!
  37. };
  38.  
  39. enum {                                // Graphical states in order
  40.     kSAOffState,
  41.     kSAOffHiliteState,
  42.     kSAOnState,
  43.     kSAOnHiliteState
  44. };
  45.  
  46. class CCicnButton : public CIconPane
  47. {    
  48. public:
  49.     Str32        itsLabels[4];        // labels used for each icon state
  50.                                     // 1 - off (normal)
  51.                                     // 2 - offHilite
  52.                                     // 3 - on
  53.                                     // 4 - onHilite
  54.     
  55.     RGBColor    itsColors[4];        // colors to draw itsLables in for each
  56.                                     // of the four states.
  57.                             
  58.     short        itsShadow;            // pixel width of the label's drop shadow
  59.     
  60.     short        buttonKind;            // Button kind
  61.     Boolean        colorHilite;        // TRUE if hilight with color
  62.     Boolean        outlineOn;            // TRUE if "on" button has border
  63.     short        value;                // Control value, 0 or 1
  64.     short        groupID;            // Group ID used for radio buttons
  65.  
  66.                                     // Arrays where CIconPane has single values
  67.     short        itsIconID[4];
  68.     char        itsIcon[4][kIconBytes];
  69.     CIconHandle    itsCicnH[4];
  70.  
  71.     Point        borderPen;            // Saved border width and height
  72.     
  73.  
  74.                                     /** Init/Dispose **/
  75.     void     ICicnButton(CView *anEnclosure, CBureaucrat *aSupervisor,
  76.                     short aHEncl, short aVEncl,
  77.                     SizingOption aHSizing, SizingOption aVSizing,
  78.                     short aButtonKind, short hilightStyle, short onStyle,
  79.                     short offID, short offHiliteID, short onID, short onHiliteID);
  80.  
  81.     void            ICicnButtonX(short offHiliteID, short onID, short onHiliteID);
  82.     
  83.     virtual void CCicnButton::SetLabel(short strListID, 
  84.                             short offIndex, short offHiliteIndex, short onIndex, short onHiliteIndex,
  85.                             short fontNumber, short fontFace, short fontSize, short itsShadow);
  86.     
  87.     virtual void     SetStateIcons(short offHiliteID, short onID, short onHiliteID);
  88.     virtual void     Dispose(void);
  89.     virtual void     DrawIcon(Boolean fHilite);
  90.     virtual void    DoDrawIcon(Boolean fHilite);
  91.     virtual void    AdjustCursor(Point where, RgnHandle mouseRgn);
  92.     virtual Boolean    Track(void);
  93.     virtual void    SetLabelColors(RGBColor offColor, RGBColor offHiliteColor, RGBColor onColor, RGBColor onHiliteColor);
  94.     virtual void    DrawLabel(Rect *fBounds, short state);
  95.     virtual void    SetShadow(short aShadow);
  96.     virtual short    GetShadow(short aShadow);
  97.     virtual void    ChangeValue(short aValue);
  98.     virtual void     SetValue(short aValue);
  99.     virtual short    GetValue(void);
  100.     virtual void     SetGroupID(short anID);
  101.     virtual short    GetGroupID(void);
  102.     virtual void     SetButtonKind(short aKind);
  103.     virtual short    GetButtonKind(void);
  104.     virtual void     FixupBorder(void);
  105.  
  106.     virtual short    CalcDrawState(Boolean fHilite);
  107.     virtual void    SetEnable(void);
  108.     virtual void    SetDisable(void);
  109.     virtual short    GetEnable(void);
  110.     virtual void     ResetIconGroup(void);
  111.  
  112. private:
  113.  
  114.     CursHandle        itsPointerHand;
  115.     
  116. };
  117.