LCL: added new LCL capability - lcNativeTaskDialog, defaults to true, on mswindows is false for qt/qt5. issue #35577

git-svn-id: trunk@61219 -
This commit is contained in:
zeljko 2019-05-13 12:57:11 +00:00
parent 416786fef1
commit 5981e87a6b
5 changed files with 24 additions and 13 deletions

View File

@ -90,7 +90,8 @@ begin
lcModalWindow, lcModalWindow,
lcReceivesLMClearCutCopyPasteReliably, lcReceivesLMClearCutCopyPasteReliably,
lcSendsUTF8KeyPress, lcSendsUTF8KeyPress,
lcEmulatedMDI: Result := LCL_CAPABILITY_YES; lcEmulatedMDI,
lcNativeTaskDialog: Result := LCL_CAPABILITY_YES;
else else
Result := LCL_CAPABILITY_NO; Result := LCL_CAPABILITY_NO;
end; end;

View File

@ -70,7 +70,8 @@ type
lcAccessibilitySupport, // Indicates that accessibility is implemented, mostly for TCustomControl descendents as native widgests should have in-built accessibility lcAccessibilitySupport, // Indicates that accessibility is implemented, mostly for TCustomControl descendents as native widgests should have in-built accessibility
lcRadialGradientBrush, // Indicates that the function CreateBrushWithRadialGradient is supported, i.e. we can create a brush with a radial gradient pattern lcRadialGradientBrush, // Indicates that the function CreateBrushWithRadialGradient is supported, i.e. we can create a brush with a radial gradient pattern
lcTransparentWindow, // ability to pass mouse messages through a window (on win32 LM_NCHITTEST with HTTRANSPARENT result) lcTransparentWindow, // ability to pass mouse messages through a window (on win32 LM_NCHITTEST with HTTRANSPARENT result)
lcTextHint // native TextHint support lcTextHint, // native TextHint support
lcNativeTaskDialog // task dialog under mswindows for widgetsets different than win32/wince. Used in LCLTaskDialog. eg Qt/Qt5 must set this option to false otherwise taskdialog segfaults.
); );
{ TDialogButton } { TDialogButton }

View File

@ -1306,6 +1306,7 @@ begin
lcReceivesLMClearCutCopyPasteReliably: Result := LCL_CAPABILITY_NO; lcReceivesLMClearCutCopyPasteReliably: Result := LCL_CAPABILITY_NO;
lcRadialGradientBrush: Result := LCL_CAPABILITY_YES; lcRadialGradientBrush: Result := LCL_CAPABILITY_YES;
lcTransparentWindow: Result := LCL_CAPABILITY_YES; lcTransparentWindow: Result := LCL_CAPABILITY_YES;
lcNativeTaskDialog: Result := {$ifdef MSWINDOWS} LCL_CAPABILITY_NO {$else} LCL_CAPABILITY_YES {$endif};
else else
Result := inherited GetLCLCapability(ACapability); Result := inherited GetLCLCapability(ACapability);
end; end;

View File

@ -1232,6 +1232,7 @@ begin
lcRadialGradientBrush: Result := LCL_CAPABILITY_YES; lcRadialGradientBrush: Result := LCL_CAPABILITY_YES;
lcTransparentWindow: Result := LCL_CAPABILITY_YES; lcTransparentWindow: Result := LCL_CAPABILITY_YES;
lcTextHint: Result := LCL_CAPABILITY_YES; lcTextHint: Result := LCL_CAPABILITY_YES;
lcNativeTaskDialog: Result := {$ifdef MSWINDOWS} LCL_CAPABILITY_NO {$else} LCL_CAPABILITY_YES {$endif};
else else
Result := inherited GetLCLCapability(ACapability); Result := inherited GetLCLCapability(ACapability);
end; end;

View File

@ -126,7 +126,7 @@ interface
{$MODE DELPHI} {$MODE DELPHI}
uses uses
LCLType, LCLStrConsts, LCLIntf, LCLType, LCLStrConsts, LCLIntf, InterfaceBase,
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
Windows, CommCtrl, Messages, Windows, CommCtrl, Messages,
{$ENDIF} {$ENDIF}
@ -803,7 +803,8 @@ begin
aParent := 0; aParent := 0;
Dialog.OnButtonClicked := aOnButtonClicked; Dialog.OnButtonClicked := aOnButtonClicked;
{$ifdef MSWINDOWS} {$ifdef MSWINDOWS}
if Assigned(TaskDialogIndirect) and not aNonNative and if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and
Assigned(TaskDialogIndirect) and not aNonNative and
not (tdfQuery in aFlags) and (Selection='') then begin not (tdfQuery in aFlags) and (Selection='') then begin
Dialog.Emulated := False; Dialog.Emulated := False;
// use Vista/Seven TaskDialog implementation (not tdfQuery nor Selection) // use Vista/Seven TaskDialog implementation (not tdfQuery nor Selection)
@ -887,13 +888,15 @@ begin
IconBorder := 10 else IconBorder := 10 else
IconBorder := 24; IconBorder := 24;
if (LAZ_ICONS[aDialogIcon]<>'') {$IFDEF MSWINDOWS}or (WIN_ICONS[aDialogIcon]<>nil){$ENDIF} then if (LAZ_ICONS[aDialogIcon]<>'') {$IFDEF MSWINDOWS}or
((WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and (WIN_ICONS[aDialogIcon]<>nil)){$ENDIF} then
begin begin
Image := TImage.Create(Dialog.Form); Image := TImage.Create(Dialog.Form);
Image.Parent := Par; Image.Parent := Par;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
if WIN_ICONS[aDialogIcon]<>nil then if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and
IconHandle := LoadIcon(0,WIN_ICONS[aDialogIcon]) (WIN_ICONS[aDialogIcon]<>nil) then
IconHandle := LoadIcon(0,WIN_ICONS[aDialogIcon])
else else
IconHandle := 0; IconHandle := 0;
{$ELSE} {$ELSE}
@ -1085,7 +1088,7 @@ begin
if XB<>0 then if XB<>0 then
AddBevel else AddBevel else
inc(Y,16); inc(Y,16);
if (LAZ_FOOTERICONS[aFooterIcon]<>'') {$IFDEF MSWINDOWS}or (WIN_FOOTERICONS[aFooterIcon]<>nil){$ENDIF} then if (LAZ_FOOTERICONS[aFooterIcon]<>'') {$IFDEF MSWINDOWS}or ((WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) and (WIN_FOOTERICONS[aFooterIcon]<>nil)){$ENDIF} then
begin begin
Image := TImage.Create(Dialog.Form); Image := TImage.Create(Dialog.Form);
Image.Parent := Par; Image.Parent := Par;
@ -1095,7 +1098,7 @@ begin
try try
Bmp.Transparent := true; Bmp.Transparent := true;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
if WIN_FOOTERICONS[aFooterIcon]<>nil then if (WIN_FOOTERICONS[aFooterIcon]<>nil) and (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) then
begin begin
IconHandle := LoadIcon(0,WIN_FOOTERICONS[aFooterIcon]); IconHandle := LoadIcon(0,WIN_FOOTERICONS[aFooterIcon]);
if IconHandle<>0 then if IconHandle<>0 then
@ -1125,8 +1128,9 @@ begin
else else
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
DrawIconEx(Bmp.Canvas.Handle,0,0,Ico.Handle,Bmp.Width,Bmp.Height,0, if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) then
Bmp.Canvas.Brush.{%H-}Handle,DI_NORMAL); DrawIconEx(Bmp.Canvas.Handle,0,0,Ico.Handle,Bmp.Width,Bmp.Height,0,
Bmp.Canvas.Brush.{%H-}Handle,DI_NORMAL);
{$ENDIF} {$ENDIF}
end; end;
Image.Picture.Bitmap := Bmp; Image.Picture.Bitmap := Bmp;
@ -1191,8 +1195,11 @@ begin
Dialog.Form.Element[element].Caption := CR(Text) Dialog.Form.Element[element].Caption := CR(Text)
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
else else
SendMessageW(Dialog.Wnd,TDM_UPDATE_ELEMENT_TEXT,ord(element), begin
{%H-}NativeInt(PWideChar(_WS(Text)))) if (WidgetSet.GetLCLCapability(lcNativeTaskDialog) = LCL_CAPABILITY_YES) then
SendMessageW(Dialog.Wnd,TDM_UPDATE_ELEMENT_TEXT,ord(element),
{%H-}NativeInt(PWideChar(_WS(Text))))
end
{$ENDIF}; {$ENDIF};
tdeEdit: tdeEdit:
if Dialog.Emulated then if Dialog.Emulated then