home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / BUTTONS.INT < prev    next >
Text File  |  1997-02-14  |  3KB  |  104 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Visual Component Library                 }
  5. {                                                       }
  6. {       Copyright (c) 1995,96 Borland International     }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit Buttons;
  11.  
  12. {$S-,W-,R-}
  13. {$C PRELOAD}
  14.  
  15. interface
  16.  
  17. uses Windows, Messages, Classes, Controls, Forms, Graphics, StdCtrls,
  18.   ExtCtrls, CommCtrl;
  19.  
  20. type
  21.   TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
  22.   TButtonState = (bsUp, bsDisabled, bsDown, bsExclusive);
  23.   TButtonStyle = (bsAutoDetect, bsWin31, bsNew);
  24.   TNumGlyphs = 1..4;
  25.  
  26.   TSpeedButton = class(TGraphicControl)
  27.   protected
  28.     FState: TButtonState;
  29.     function GetPalette: HPALETTE; override;
  30.     procedure Loaded; override;
  31.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
  32.       X, Y: Integer); override;
  33.     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
  34.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
  35.       X, Y: Integer); override;
  36.     procedure Paint; override;
  37.   public
  38.     constructor Create(AOwner: TComponent); override;
  39.     destructor Destroy; override;
  40.     procedure Click; override;
  41.   published
  42.     property AllowAllUp: Boolean default False;
  43.     property GroupIndex: Integer default 0;
  44.     property Down: Boolean default False;
  45.     property Caption;
  46.     property Enabled;
  47.     property Font;
  48.     property Glyph: TBitmap;
  49.     property Layout: TButtonLayout default blGlyphLeft;
  50.     property Margin: Integer default -1;
  51.     property NumGlyphs: TNumGlyphs default 1;
  52.     property ParentFont;
  53.     property ParentShowHint;
  54.     property ShowHint;
  55.     property Spacing: Integer default 4;
  56.     property Visible;
  57.     property OnClick;
  58.     property OnDblClick;
  59.     property OnMouseDown;
  60.     property OnMouseMove;
  61.     property OnMouseUp;
  62.   end;
  63.  
  64.   TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose,
  65.     bkAbort, bkRetry, bkIgnore, bkAll);
  66.  
  67.   TBitBtn = class(TButton)
  68.   protected
  69.     procedure CreateHandle; override;
  70.     procedure CreateParams(var Params: TCreateParams); override;
  71.     function GetPalette: HPALETTE; override;
  72.     procedure SetButtonStyle(ADefault: Boolean); override;
  73.   public
  74.     constructor Create(AOwner: TComponent); override;
  75.     destructor Destroy; override;
  76.     procedure Click; override;
  77.   published
  78.     property Cancel stored IsCustom;
  79.     property Caption stored IsCustomCaption;
  80.     property Default stored IsCustom;
  81.     property Enabled;
  82.     property Glyph: TBitmap;
  83.     property Kind: TBitBtnKind default bkCustom;
  84.     property Layout: TButtonLayout default blGlyphLeft;
  85.     property Margin: Integer default -1;
  86.     property ModalResult stored IsCustom;
  87.     property NumGlyphs: TNumGlyphs default 1;
  88.     property ParentShowHint;
  89.     property ShowHint;
  90.     property Style: TButtonStyle default bsAutoDetect;
  91.     property Spacing: Integer default 4;
  92.     property TabOrder;
  93.     property TabStop;
  94.     property Visible;
  95.     property OnEnter;
  96.     property OnExit;
  97.   end;
  98.  
  99. function DrawButtonFace(Canvas: TCanvas; const Client: TRect;
  100.   BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
  101.   IsFocused: Boolean): TRect;
  102.  
  103. implementation
  104.