mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-24 05:20:14 +01:00
LCL: Update Images in BitBtn and SpeedButton from connected Action also when Glyph is not empty. Issue #22071.
git-svn-id: trunk@62642 -
This commit is contained in:
parent
72551f3c1e
commit
bc1e8a9946
@ -494,8 +494,8 @@ procedure TComponentWithOverrideValidateRename.ValidateRename(
|
|||||||
var
|
var
|
||||||
Designer: TIDesigner;
|
Designer: TIDesigner;
|
||||||
begin
|
begin
|
||||||
debugln(['TComponentWithOverrideValidateRename.ValidateRename ',DbgSName(Self),
|
//debugln(['TComponentWithOverrideValidateRename.ValidateRename ',DbgSName(Self),
|
||||||
' ',DbgSName(AComponent),' CurName=',CurName,' NewName=',NewName]);
|
// ' ',DbgSName(AComponent),' CurName=',CurName,' NewName=',NewName]);
|
||||||
inherited ValidateRename(AComponent, CurName, NewName);
|
inherited ValidateRename(AComponent, CurName, NewName);
|
||||||
Designer:=FindRootDesigner(Self);
|
Designer:=FindRootDesigner(Self);
|
||||||
if Designer <> nil then
|
if Designer <> nil then
|
||||||
|
|||||||
@ -201,20 +201,25 @@ end;
|
|||||||
|
|
||||||
procedure TCustomBitBtn.ActionChange(Sender: TObject; CheckDefaults: Boolean);
|
procedure TCustomBitBtn.ActionChange(Sender: TObject; CheckDefaults: Boolean);
|
||||||
var
|
var
|
||||||
ImagesRes: TScaledImageListResolution;
|
NewAct: TCustomAction;
|
||||||
|
Imgs: TCustomImageList;
|
||||||
|
ImgRes: TScaledImageListResolution;
|
||||||
begin
|
begin
|
||||||
inherited ActionChange(Sender,CheckDefaults);
|
inherited ActionChange(Sender,CheckDefaults);
|
||||||
if Sender is TCustomAction then
|
if Sender is TCustomAction then
|
||||||
begin
|
begin
|
||||||
with TCustomAction(Sender) do
|
NewAct := TCustomAction(Sender);
|
||||||
begin
|
//DebugLn(['TCustomBitBtn.ActionChange: Glyph.Empty=', Glyph.Empty,
|
||||||
if (Glyph.Empty) and (ActionList <> nil) and (ActionList.Images <> nil) and
|
// ', Action=', NewAct.Caption,
|
||||||
(ImageIndex >= 0) and (ImageIndex < ActionList.Images.Count) then
|
// ', ActionList=', NewAct.ActionList,
|
||||||
begin
|
// ', Images=', NewAct.ActionList.Images,
|
||||||
ImagesRes := ActionList.Images.ResolutionForPPI[ImageWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
|
// ', ImageIndex=', NewAct.ImageIndex ]);
|
||||||
ImagesRes.GetBitmap(ImageIndex, Glyph);
|
if (NewAct.ActionList = nil) or (NewAct.ImageIndex < 0) then Exit;
|
||||||
end;
|
Imgs := NewAct.ActionList.Images;
|
||||||
end;
|
if (Imgs = nil) or (NewAct.ImageIndex >= Imgs.Count) then Exit;
|
||||||
|
//DebugLn([' TCustomBitBtn.ActionChange: Setting image, ImageWidth=', ImageWidth]);
|
||||||
|
ImgRes := Imgs.ResolutionForPPI[ImageWidth,Font.PixelsPerInch,GetCanvasScaleFactor];
|
||||||
|
ImgRes.GetBitmap(NewAct.ImageIndex, Glyph);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -1553,7 +1553,7 @@ end;
|
|||||||
interface. This procedure just sets the private variables.
|
interface. This procedure just sets the private variables.
|
||||||
|
|
||||||
//todo
|
//todo
|
||||||
MWE: ??? shouln'd we get checked from the interface in that case ???
|
MWE: ??? shouldn't we get checked from the interface in that case ???
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TMenuItem.TurnSiblingsOff;
|
procedure TMenuItem.TurnSiblingsOff;
|
||||||
var
|
var
|
||||||
|
|||||||
@ -417,25 +417,23 @@ begin
|
|||||||
Result := ThemeServices.GetElementDetails(ButtonPart)
|
Result := ThemeServices.GetElementDetails(ButtonPart)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSpeedButton.ActionChange(Sender: TObject;
|
procedure TCustomSpeedButton.ActionChange(Sender: TObject; CheckDefaults: Boolean);
|
||||||
CheckDefaults: Boolean);
|
|
||||||
var
|
var
|
||||||
ImagesRes: TScaledImageListResolution;
|
NewAct: TCustomAction;
|
||||||
|
Imgs: TCustomImageList;
|
||||||
|
ImgRes: TScaledImageListResolution;
|
||||||
begin
|
begin
|
||||||
inherited ActionChange(Sender,CheckDefaults);
|
inherited ActionChange(Sender,CheckDefaults);
|
||||||
if Sender is TCustomAction then
|
if Sender is TCustomAction then
|
||||||
begin
|
begin
|
||||||
with TCustomAction(Sender) do
|
NewAct := TCustomAction(Sender);
|
||||||
begin
|
if (not CheckDefaults) or (GroupIndex = 0) then
|
||||||
if CheckDefaults or (Self.GroupIndex = 0) then
|
GroupIndex := NewAct.GroupIndex;
|
||||||
Self.GroupIndex := GroupIndex;
|
if (NewAct.ActionList = nil) or (NewAct.ImageIndex < 0) then Exit;
|
||||||
if (Glyph.Empty) and (ActionList <> nil) and (ActionList.Images <> nil) and
|
Imgs := NewAct.ActionList.Images;
|
||||||
(ImageIndex >= 0) and (ImageIndex < ActionList.Images.Count) then
|
if (Imgs = nil) or (NewAct.ImageIndex >= Imgs.Count) then Exit;
|
||||||
begin
|
ImgRes := Imgs.ResolutionForPPI[ImageWidth,Font.PixelsPerInch,GetCanvasScaleFactor];
|
||||||
ImagesRes := ActionList.Images.ResolutionForPPI[ImageWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
|
ImgRes.GetBitmap(NewAct.ImageIndex, Glyph);
|
||||||
ImagesRes.GetBitmap(ImageIndex, Glyph);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user