mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 05:39:36 +01:00
LCL: TGraphicControl.VisuallyEnabled moved to TControl.IsEnabled, also fixed var naming in some units from IsEnabled to AIsEnabled. issue #20291
git-svn-id: trunk@32492 -
This commit is contained in:
parent
5c685fc3d9
commit
dabae664fe
@ -11,7 +11,7 @@ uses
|
||||
type
|
||||
|
||||
TImageIndexEvent = function (Str: String; Data: TObject;
|
||||
var IsEnabled: Boolean): Integer of object;
|
||||
var AIsEnabled: Boolean): Integer of object;
|
||||
|
||||
{ TTreeFilterEdit }
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ type
|
||||
procedure SetShowDirectoryHierarchy(const AValue: boolean);
|
||||
procedure SetSortAlphabetically(const AValue: boolean);
|
||||
procedure SetupComponents;
|
||||
function ChooseImageIndex(Str: String; Data: TObject; var IsEnabled: Boolean): Integer;
|
||||
function ChooseImageIndex(Str: String; Data: TObject; var AIsEnabled: Boolean): Integer;
|
||||
procedure UpdateProjectFiles(Immediately: boolean);
|
||||
procedure UpdateRequiredPackages;
|
||||
procedure UpdateRemovedRequiredPackages;
|
||||
@ -600,7 +600,7 @@ begin
|
||||
end;
|
||||
|
||||
function TProjectInspectorForm.ChooseImageIndex(Str: String; Data: TObject;
|
||||
var IsEnabled: Boolean): Integer;
|
||||
var AIsEnabled: Boolean): Integer;
|
||||
begin
|
||||
if FilenameIsPascalUnit((Data as TUnitInfo).Filename) then
|
||||
Result:=ImageIndexUnit
|
||||
|
||||
@ -1357,6 +1357,7 @@ type
|
||||
function GetTopParent: TControl;
|
||||
function IsVisible: Boolean; virtual;// checks parents too
|
||||
function IsControlVisible: Boolean; virtual;// does not check parents
|
||||
function IsEnabled: Boolean; // checks parent too
|
||||
function FormIsUpdating: boolean; virtual;
|
||||
function IsProcessingPaintMsg: boolean;
|
||||
procedure Hide;
|
||||
@ -2024,7 +2025,6 @@ type
|
||||
procedure WMPaint(var Message: TLMPaint); message LM_PAINT;
|
||||
protected
|
||||
class procedure WSRegisterClass; override;
|
||||
function VisuallyEnabled: Boolean;
|
||||
procedure FontChanged(Sender: TObject); override;
|
||||
procedure Paint; virtual;
|
||||
procedure DoOnChangeBounds; override;
|
||||
|
||||
@ -655,6 +655,26 @@ begin
|
||||
and (not (csNoDesignVisible in ControlStyle))));
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TControl.IsEnabled
|
||||
Params: none
|
||||
Returns: Boolean
|
||||
|
||||
Returns True only if both TControl and it's parent hierarchy are enabled.
|
||||
Used internally by TGraphicControls for painting and various states during
|
||||
runtime.
|
||||
------------------------------------------------------------------------------}
|
||||
function TControl.IsEnabled: Boolean;
|
||||
var
|
||||
TheControl: TControl;
|
||||
begin
|
||||
TheControl := Self;
|
||||
repeat
|
||||
Result := TheControl.Enabled;
|
||||
TheControl := TheControl.Parent;
|
||||
until (not Result) or (TheControl.Parent = nil);
|
||||
end;
|
||||
|
||||
function TControl.FormIsUpdating: boolean;
|
||||
begin
|
||||
Result := Assigned(Parent) and Parent.FormIsUpdating;
|
||||
|
||||
@ -412,7 +412,7 @@ begin
|
||||
R := Rect(0,0,Width,Height);
|
||||
with Canvas do
|
||||
begin
|
||||
if VisuallyEnabled then
|
||||
if IsEnabled then
|
||||
Brush.Color := Self.Color
|
||||
else
|
||||
Brush.Color := clNone;
|
||||
@ -463,7 +463,7 @@ begin
|
||||
//debugln('TCustomLabel.Paint ',dbgs(Alignment=tacenter),' ',dbgs(Layout=tlCenter),' ',dbgs(TextLeft),' TextTop=',dbgs(TextTop),' ',dbgs(R));
|
||||
LabelText := GetLabelText;
|
||||
OldFontColor := Font.Color;
|
||||
if not VisuallyEnabled then
|
||||
if not IsEnabled then
|
||||
begin
|
||||
Font.Color := clBtnHighlight;
|
||||
TextRect(R, TextLeft + 1, TextTop + 1, LabelText, TR);
|
||||
|
||||
@ -77,22 +77,6 @@ begin
|
||||
RegisterGraphicControl;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TGraphicControl.VisuallyEnabled
|
||||
Params: none
|
||||
Returns: Boolean
|
||||
|
||||
Returns True only if both TGraphicControl and it's parent are enabled.
|
||||
Used internally by TGraphicControls for painting and various states during
|
||||
runtime.
|
||||
------------------------------------------------------------------------------}
|
||||
function TGraphicControl.VisuallyEnabled: Boolean;
|
||||
begin
|
||||
Result := Enabled;
|
||||
if Result and Assigned(Parent) then
|
||||
Result := Result and Parent.Enabled;
|
||||
end;
|
||||
|
||||
procedure TGraphicControl.FontChanged(Sender: TObject);
|
||||
begin
|
||||
Canvas.Font:=Font;
|
||||
|
||||
@ -291,7 +291,7 @@ var
|
||||
OldState: TButtonState;
|
||||
begin
|
||||
OldState := FState;
|
||||
if not VisuallyEnabled then
|
||||
if not IsEnabled then
|
||||
begin
|
||||
FState := bsDisabled;
|
||||
FDragging := False;
|
||||
@ -339,7 +339,7 @@ function TCustomSpeedButton.GetDrawDetails: TThemedElementDetails;
|
||||
|
||||
// no check states available
|
||||
Result := tbPushButtonNormal;
|
||||
if not VisuallyEnabled then
|
||||
if not IsEnabled then
|
||||
Result := tbPushButtonDisabled
|
||||
else
|
||||
if FState in [bsDown, bsExclusive] then
|
||||
@ -355,7 +355,7 @@ function TCustomSpeedButton.GetDrawDetails: TThemedElementDetails;
|
||||
begin
|
||||
// ttbButtonNormal, ttbButtonHot, ttbButtonPressed, ttbButtonDisabled
|
||||
// ttbButtonChecked, ttbButtonCheckedHot
|
||||
if not VisuallyEnabled then
|
||||
if not IsEnabled then
|
||||
Result := ttbButtonDisabled
|
||||
else
|
||||
begin
|
||||
@ -738,7 +738,7 @@ begin
|
||||
inherited MouseDown(Button, Shift, X, Y);
|
||||
if csDesigning in ComponentState then exit;
|
||||
|
||||
if (Button = mbLeft) and VisuallyEnabled then
|
||||
if (Button = mbLeft) and IsEnabled then
|
||||
begin
|
||||
if not FDown then
|
||||
begin
|
||||
@ -1053,7 +1053,7 @@ end;
|
||||
procedure TCustomSpeedButton.MouseEnter;
|
||||
begin
|
||||
if csDesigning in ComponentState then exit;
|
||||
if not FMouseInControl and VisuallyEnabled and (GetCapture = 0) then
|
||||
if not FMouseInControl and IsEnabled and (GetCapture = 0) then
|
||||
begin
|
||||
FMouseInControl := True;
|
||||
UpdateState(true);
|
||||
@ -1074,7 +1074,7 @@ begin
|
||||
if FMouseInControl then
|
||||
begin
|
||||
FMouseInControl := False;
|
||||
if VisuallyEnabled then
|
||||
if IsEnabled then
|
||||
begin
|
||||
if FDragging and (not MouseCapture) then
|
||||
begin
|
||||
|
||||
@ -99,7 +99,7 @@ type
|
||||
procedure SetOldInstalledPackages(const AValue: TPkgDependency);
|
||||
procedure AssignOldInstalledPackagesToList;
|
||||
function PackageInInstallList(PkgName: string): boolean;
|
||||
function ChooseImageIndex(Str: String; Data: TObject; var IsEnabled: Boolean): Integer;
|
||||
function ChooseImageIndex(Str: String; Data: TObject; var AIsEnabled: Boolean): Integer;
|
||||
procedure UpdateAvailablePackages(Immediately: boolean = false);
|
||||
procedure UpdateNewInstalledPackages;
|
||||
procedure OnIteratePackages(APackageID: TLazPackageID);
|
||||
@ -354,7 +354,7 @@ begin
|
||||
end;
|
||||
|
||||
function TInstallPkgSetDialog.ChooseImageIndex(Str: String; Data: TObject;
|
||||
var IsEnabled: Boolean): Integer;
|
||||
var AIsEnabled: Boolean): Integer;
|
||||
var
|
||||
Pkg: TLazPackageID;
|
||||
APackage: TLazPackage;
|
||||
|
||||
@ -244,7 +244,7 @@ type
|
||||
procedure SetShowDirectoryHierarchy(const AValue: boolean);
|
||||
procedure SetSortAlphabetically(const AValue: boolean);
|
||||
procedure SetupComponents;
|
||||
function ChooseImageIndex(Str: String; Data: TObject; var IsEnabled: Boolean): Integer;
|
||||
function ChooseImageIndex(Str: String; Data: TObject; var AIsEnabled: Boolean): Integer;
|
||||
procedure UpdateTitle;
|
||||
procedure UpdateButtons;
|
||||
procedure UpdateFiles;
|
||||
@ -1611,7 +1611,7 @@ begin
|
||||
end;
|
||||
|
||||
function TPackageEditorForm.ChooseImageIndex(Str: String; Data: TObject;
|
||||
var IsEnabled: Boolean): Integer;
|
||||
var AIsEnabled: Boolean): Integer;
|
||||
begin
|
||||
case TPkgFile(Data).FileType of
|
||||
pftUnit,pftVirtualUnit,pftMainUnit:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user