From 925b576e48e76fa015c6bce879f8ac23e8d79e9d Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Wed, 16 Aug 2023 23:39:04 +0200 Subject: [PATCH] TaskDialog: TLCLTaskDialog: implement Expand/Collapse. Resolves issues ##31397 and ##31396. --- lcl/taskdlgemulation.pp | 179 ++++++++++++++++++++++++++++------------ 1 file changed, 124 insertions(+), 55 deletions(-) diff --git a/lcl/taskdlgemulation.pp b/lcl/taskdlgemulation.pp index eb5cbc04fd..4a9a20f9c1 100644 --- a/lcl/taskdlgemulation.pp +++ b/lcl/taskdlgemulation.pp @@ -68,7 +68,10 @@ type SmallImageSize = 16; CommandLinkButtonHeight = 40; RadioVSpacing = 16; + LabelVSpacing = 16; CommandLinkButtonVSpacing = 2; + BevelMargin = 2; + BevelHeight = 2; private /// the Task Dialog structure which created the form FDlg: TTaskDialog; @@ -79,6 +82,7 @@ type CommandLinkButtonSpacing: Integer; //Height of TBitBtns ButtonHeight: Integer; //Height of TButtons GlobalLeftMargin: Integer; + ExpandHeightRequired: Integer; Timer: TTimer; TimerStartTime: TTime; RadioButtonArray: array of TRadioButton; @@ -92,7 +96,9 @@ type TopPanel: TPanel; MidPanel: TPanel; BottomPanel: TPanel; - Image: TImage; + MainImage: TImage; + FooterImage: TImage; + ExpandedTextBevel: TBevel; /// the labels corresponding to the Task Dialog main elements Element: array[tdeContent..tdeMainInstruction] of TLabel; /// the Task Dialog query selection list @@ -115,8 +121,10 @@ type procedure AddButtons(const ALeft: Integer; var ATop, AButtonLeft: Integer; AWidth, AButtonDef: Integer; APArent: TWinControl); procedure AddCheckBox(const ALeft: Integer; var ATop, XB: Integer; AWidth: Integer; APArent: TWinControl); procedure AddExpandButton(const ALeft: Integer; var ATop, XB: Integer; AWidth: Integer; APArent: TWinControl); + function AddBevel(var ATop: Integer; aWidth: Integer; AParent: TWinControl; Hidden: Boolean = False): TBevel; procedure AddFooter(const ALeft: Integer; var ATop, XB: Integer; AFontHeight, AWidth: Integer; APArent: TWinControl); - function AddLabel(const AText: string; BigFont: Boolean; const ALeft: Integer; var ATop: Integer; AFontHeight, AWidth: Integer; APArent: TWinControl): TLabel; + function AddLabel(const AText: string; BigFont: Boolean; const ALeft: Integer; var ATop: Integer; AFontHeight, + AWidth: Integer; APArent: TWinControl; Hidden: Boolean = False): TLabel; procedure AddQueryCombo(const ALeft: Integer; var ATop: Integer; AWidth: Integer; AParent: TWinControl); procedure AddQueryEdit(var X,Y: Integer; AWidth: Integer; AParent: TWinControl); procedure SetupTimer; @@ -469,23 +477,23 @@ begin aDialogIcon := TF_DIALOGICON(FDlg.MainIcon); if (LCL_IMAGES[aDialogIcon]<>0) then begin - Image := TImage.Create(Self); - Image.Parent := AParent; - Image.Images := DialogGlyphs; - Image.ImageIndex := DialogGlyphs.DialogIcon[LCL_IMAGES[aDialogIcon]]; - Image.SetBounds(AGlobalLeftMargin, AGlobalLeftMargin, LargeImageSize, LargeImageSize); - Image.Stretch := True; - Image.StretchOutEnabled := False; - Image.Proportional := True; - Image.Center := True; - ALeft := Image.Width+AGlobalLeftMargin*2; - ATop := Image.Top; + MainImage := TImage.Create(Self); + MainImage.Parent := AParent; + MainImage.Images := DialogGlyphs; + MainImage.ImageIndex := DialogGlyphs.DialogIcon[LCL_IMAGES[aDialogIcon]]; + MainImage.SetBounds(AGlobalLeftMargin, AGlobalLeftMargin, LargeImageSize, LargeImageSize); + MainImage.Stretch := True; + MainImage.StretchOutEnabled := False; + MainImage.Proportional := True; + MainImage.Center := True; + ALeft := MainImage.Width+AGlobalLeftMargin*2; + ATop := MainImage.Top; if (tfEmulateClassicStyle in FDlg.Flags) then inc(ATop, 8); end else begin - Image := nil; + MainImage := nil; ALeft := AGlobalLeftMargin; ATop := AGlobalLeftMargin; end; @@ -732,51 +740,69 @@ begin Inc(ATop, AHeight+8); end; +function TLCLTaskDialog.AddBevel(var ATop: Integer; aWidth: Integer; AParent: TWinControl; Hidden: Boolean): TBevel; +begin + Result := TBevel.Create(Self); + with Result do begin + Parent := AParent; + //if (FooterImage<>nil) and (ATop