home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 August / VPR9708A.ISO / D3TRIAL / INSTALL / DATA.Z / BUTTONS.INT < prev    next >
Text File  |  1997-03-21  |  3KB  |  105 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Visual Component Library                 }
  5. {                                                       }
  6. {       Copyright (c) 1995,97 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 Flat: Boolean default False;
  48.     property Font;
  49.     property Glyph: TBitmap;
  50.     property Layout: TButtonLayout default blGlyphLeft;
  51.     property Margin: Integer default -1;
  52.     property NumGlyphs: TNumGlyphs default 1;
  53.     property ParentFont;
  54.     property ParentShowHint;
  55.     property ShowHint;
  56.     property Spacing: Integer default 4;
  57.     property Visible;
  58.     property OnClick;
  59.     property OnDblClick;
  60.     property OnMouseDown;
  61.     property OnMouseMove;
  62.     property OnMouseUp;
  63.   end;
  64.  
  65.   TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose,
  66.     bkAbort, bkRetry, bkIgnore, bkAll);
  67.  
  68.   TBitBtn = class(TButton)
  69.   protected
  70.     procedure CreateHandle; override;
  71.     procedure CreateParams(var Params: TCreateParams); override;
  72.     function GetPalette: HPALETTE; override;
  73.     procedure SetButtonStyle(ADefault: Boolean); override;
  74.   public
  75.     constructor Create(AOwner: TComponent); override;
  76.     destructor Destroy; override;
  77.     procedure Click; override;
  78.   published
  79.     property Cancel stored IsCustom;
  80.     property Caption stored IsCustomCaption;
  81.     property Default stored IsCustom;
  82.     property Enabled;
  83.     property Glyph: TBitmap;
  84.     property Kind: TBitBtnKind default bkCustom;
  85.     property Layout: TButtonLayout default blGlyphLeft;
  86.     property Margin: Integer default -1;
  87.     property ModalResult stored IsCustom;
  88.     property NumGlyphs: TNumGlyphs default 1;
  89.     property ParentShowHint;
  90.     property ShowHint;
  91.     property Style: TButtonStyle default bsAutoDetect;
  92.     property Spacing: Integer default 4;
  93.     property TabOrder;
  94.     property TabStop;
  95.     property Visible;
  96.     property OnEnter;
  97.     property OnExit;
  98.   end;
  99.  
  100. function DrawButtonFace(Canvas: TCanvas; const Client: TRect;
  101.   BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
  102.   IsFocused: Boolean): TRect;
  103.  
  104. implementation
  105.