home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************}
- { }
- { Delphi Visual Component Library }
- { }
- { Copyright (c) 1995 Borland International }
- { }
- {*******************************************************}
-
- unit Buttons;
-
- {$S-,W-,R-}
- {$C PRELOAD}
-
- interface
-
- uses WinTypes, WinProcs, Messages, Classes, Controls, Forms, Graphics,
- StdCtrls, ExtCtrls;
-
- type
- TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
- TButtonStyle = (bsAutoDetect, bsWin31, bsNew);
- TNumGlyphs = 1..4;
-
- TSpeedButton = class(TGraphicControl)
- protected
- function GetPalette: HPALETTE; override;
- procedure Paint; override;
- procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
- X, Y: Integer); override;
- procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
- procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
- X, Y: Integer); override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure Click; override;
- published
- property AllowAllUp: Boolean default False;
- property GroupIndex: Integer default 0;
- { Ensure group index is declared before Down }
- property Down: Boolean default False;
- property Caption;
- property Enabled;
- property Font;
- property Glyph: TBitmap;
- property Layout: TButtonLayout default blGlyphLeft;
- property Margin: Integer default -1;
- property NumGlyphs: TNumGlyphs default 1;
- property ParentFont;
- property ParentShowHint;
- property ShowHint;
- property Spacing: Integer default 4;
- property Visible;
- property OnClick;
- property OnDblClick;
- property OnMouseDown;
- property OnMouseMove;
- property OnMouseUp;
- end;
-
- TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose,
- bkAbort, bkRetry, bkIgnore, bkAll);
-
- TBitBtn = class(TButton)
- protected
- procedure CreateParams(var Params: TCreateParams); override;
- function GetPalette: HPALETTE; override;
- procedure SetButtonStyle(ADefault: Boolean); override;
- public
- constructor Create(AOwner: TComponent); override;
- destructor Destroy; override;
- procedure Click; override;
- published
- property Cancel stored IsCustom;
- property Caption stored IsCustomCaption;
- property Default stored IsCustom;
- property Enabled;
- property Glyph: TBitmap;
- property Kind: TBitBtnKind default bkCustom;
- property Layout: TButtonLayout default blGlyphLeft;
- property Margin: Integer default -1;
- property ModalResult stored IsCustom;
- property NumGlyphs: TNumGlyphs default 1;
- property ParentShowHint;
- property ShowHint;
- property Style: TButtonStyle default bsAutoDetect;
- property Spacing: Integer default 4;
- property TabOrder;
- property TabStop;
- property Visible;
- property OnEnter;
- property OnExit;
- end;
-
- function DrawButtonFace(Canvas: TCanvas; const Client: TRect;
- BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
- IsFocused: Boolean): TRect;
-
- implementation
-