Changeset 463 for branches/highdpi/Packages/CevoComponents/ButtonN.pas
- Timestamp:
- Nov 29, 2023, 2:35:44 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/ButtonN.pas
r303 r463 10 10 constructor Create(aOwner: TComponent); override; 11 11 private 12 FPossible, FLit: boolean;12 FPossible, FLit: Boolean; 13 13 FGraphic, FMask, FBackGraphic: TDpiBitmap; 14 FIndex, BackIndex: integer;14 FIndex, BackIndex: Integer; 15 15 FSmartHint: string; 16 16 ChangeProc: TNotifyEvent; 17 procedure SetPossible( x: boolean);18 procedure SetLit( x: boolean);19 procedure SetIndex( x: integer);20 procedure SetSmartHint( x: string);17 procedure SetPossible(X: Boolean); 18 procedure SetLit(X: Boolean); 19 procedure SetIndex(X: Integer); 20 procedure SetSmartHint(X: string); 21 21 published 22 property Possible: boolean read FPossible write SetPossible;23 property Lit: boolean read FLit write SetLit;22 property Possible: Boolean read FPossible write SetPossible; 23 property Lit: Boolean read FLit write SetLit; 24 24 property SmartHint: string read FSmartHint write SetSmartHint; 25 25 property Graphic: TDpiBitmap read FGraphic write FGraphic; 26 26 property Mask: TDpiBitmap read FMask write FMask; 27 27 property BackGraphic: TDpiBitmap read FBackGraphic write FBackGraphic; 28 property ButtonIndex: integer read FIndex write SetIndex;28 property ButtonIndex: Integer read FIndex write SetIndex; 29 29 property OnClick: TNotifyEvent read ChangeProc write ChangeProc; 30 30 protected 31 31 procedure Paint; override; 32 32 procedure MouseDown(Button: TMouseButton; Shift: TShiftState; 33 x, y: integer); override;33 X, Y: Integer); override; 34 34 end; 35 35 … … 46 46 begin 47 47 inherited; 48 ShowHint := true;48 ShowHint := True; 49 49 FGraphic := nil; 50 50 FBackGraphic := nil; 51 FPossible := true;52 FLit := false;51 FPossible := True; 52 FLit := False; 53 53 FIndex := -1; 54 54 ChangeProc := nil; … … 62 62 if FGraphic <> nil then 63 63 begin 64 DpiBit Canvas(Canvas, 1, 1, 40, 40, FBackGraphic.Canvas,65 1 + 80 * BackIndex + 40 * byte(FPossible and FLit), 176);64 DpiBitBltCanvas(Canvas, 1, 1, 40, 40, FBackGraphic.Canvas, 65 1 + 80 * BackIndex + 40 * Byte(FPossible and FLit), 176); 66 66 if FPossible then 67 67 begin 68 DpiBit Canvas(Canvas, 3, 3, 36, 36, FMask.Canvas,68 DpiBitBltCanvas(Canvas, 3, 3, 36, 36, FMask.Canvas, 69 69 195 + 37 * (FIndex mod 3), 21 + 37 * (FIndex div 3), SRCAND); 70 DpiBit Canvas(Canvas, 3, 3, 36, 36, FGraphic.Canvas,70 DpiBitBltCanvas(Canvas, 3, 3, 36, 36, FGraphic.Canvas, 71 71 195 + 37 * (FIndex mod 3), 21 + 37 * (FIndex div 3), SRCPAINT); 72 72 end; … … 83 83 84 84 procedure TButtonN.MouseDown(Button: TMouseButton; Shift: TShiftState; 85 x, y: integer);85 X, Y: Integer); 86 86 begin 87 87 if FPossible and (Button = mbLeft) and (@ChangeProc <> nil) then … … 89 89 end; 90 90 91 procedure TButtonN.SetPossible( x: boolean);91 procedure TButtonN.SetPossible(X: Boolean); 92 92 begin 93 if x<> FPossible then93 if X <> FPossible then 94 94 begin 95 FPossible := x;96 if xthen95 FPossible := X; 96 if X then 97 97 Hint := FSmartHint 98 98 else … … 102 102 end; 103 103 104 procedure TButtonN.SetLit( x: boolean);104 procedure TButtonN.SetLit(X: Boolean); 105 105 begin 106 if x<> FLit then106 if X <> FLit then 107 107 begin 108 FLit := x;108 FLit := X; 109 109 Invalidate; 110 110 end; 111 111 end; 112 112 113 procedure TButtonN.SetIndex( x: integer);113 procedure TButtonN.SetIndex(X: Integer); 114 114 begin 115 if x<> FIndex then115 if X <> FIndex then 116 116 begin 117 FIndex := x;118 if x< 6 then117 FIndex := X; 118 if X < 6 then 119 119 BackIndex := 1 120 120 else … … 124 124 end; 125 125 126 procedure TButtonN.SetSmartHint( x: string);126 procedure TButtonN.SetSmartHint(X: string); 127 127 begin 128 if x<> FSmartHint then128 if X <> FSmartHint then 129 129 begin 130 FSmartHint := x;130 FSmartHint := X; 131 131 if FPossible then 132 Hint := x;132 Hint := X; 133 133 end; 134 134 end;
Note:
See TracChangeset
for help on using the changeset viewer.