CEF4Delphi/source/uCEFFileDialogCallback.pas

65 lines
1.3 KiB
ObjectPascal
Raw Normal View History

2017-01-27 16:37:51 +01:00
unit uCEFFileDialogCallback;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
2017-02-05 20:56:46 +01:00
{$I cef.inc}
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
2017-01-27 16:37:51 +01:00
interface
uses
2017-02-05 20:56:46 +01:00
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
2017-02-05 20:56:46 +01:00
{$ELSE}
Classes, SysUtils,
2017-02-05 20:56:46 +01:00
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
2017-01-27 16:37:51 +01:00
type
TCefFileDialogCallbackRef = class(TCefBaseRefCountedRef, ICefFileDialogCallback)
2017-01-27 16:37:51 +01:00
protected
2022-05-26 13:08:20 +02:00
procedure Cont(const filePaths: TStrings);
2017-01-27 16:37:51 +01:00
procedure Cancel;
public
class function UnWrap(data: Pointer): ICefFileDialogCallback;
end;
implementation
uses
2018-03-29 20:02:04 +02:00
uCEFMiscFunctions, uCEFLibFunctions, uCEFStringList;
2017-01-27 16:37:51 +01:00
procedure TCefFileDialogCallbackRef.Cancel;
begin
PCefFileDialogCallback(FData)^.cancel(PCefFileDialogCallback(FData));
2017-01-27 16:37:51 +01:00
end;
2022-05-26 13:08:20 +02:00
procedure TCefFileDialogCallbackRef.Cont(const filePaths: TStrings);
2017-01-27 16:37:51 +01:00
var
2018-03-29 20:02:04 +02:00
TempSL : ICefStringList;
2017-01-27 16:37:51 +01:00
begin
try
2018-03-29 20:02:04 +02:00
TempSL := TCefStringListOwn.Create;
TempSL.AddStrings(filePaths);
PCefFileDialogCallback(FData)^.cont(PCefFileDialogCallback(FData),
TempSL.Handle);
2017-01-27 16:37:51 +01:00
finally
2018-03-29 20:02:04 +02:00
TempSL := nil;
2017-01-27 16:37:51 +01:00
end;
end;
2018-02-26 18:40:51 +01:00
class function TCefFileDialogCallbackRef.UnWrap(data: Pointer): ICefFileDialogCallback;
2017-01-27 16:37:51 +01:00
begin
2018-02-26 18:40:51 +01:00
if (data <> nil) then
Result := Create(data) as ICefFileDialogCallback
else
2017-01-27 16:37:51 +01:00
Result := nil;
end;
end.