mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 08:36:04 +02:00
Win32: Use Vista dialogs independant from status of ThemesEnabled. Issue #0026940.
git-svn-id: trunk@48265 -
This commit is contained in:
parent
0df49b93a0
commit
486842dc6d
@ -338,6 +338,13 @@ begin
|
|||||||
ACommonDialog.UserChoice := mrCancel;
|
ACommonDialog.UserChoice := mrCancel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef UseVistaDialogs}
|
||||||
|
function CanUseVistaDialogs(const AOpenDialog: TOpenDialog): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (WindowsVersion >= wvVista) and not (ofOldStyleDialog in AOpenDialog.Options);
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
{ TWin32WSColorDialog }
|
{ TWin32WSColorDialog }
|
||||||
|
|
||||||
class function TWin32WSColorDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
|
class function TWin32WSColorDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
|
||||||
@ -755,6 +762,8 @@ end;
|
|||||||
|
|
||||||
{ TWin32WSOpenDialog }
|
{ TWin32WSOpenDialog }
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
|
|
||||||
|
|
||||||
class procedure TWin32WSOpenDialog.SetupVistaFileDialog(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
class procedure TWin32WSOpenDialog.SetupVistaFileDialog(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
||||||
{ non-used flags
|
{ non-used flags
|
||||||
FOS_PICKFOLDERS
|
FOS_PICKFOLDERS
|
||||||
@ -954,7 +963,8 @@ var
|
|||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||||
|
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||||
begin
|
begin
|
||||||
if Succeeded(CoCreateInstance(CLSID_FileOpenDialog, nil, CLSCTX_INPROC_SERVER, IFileOpenDialog, Dialog)) and Assigned(Dialog) then
|
if Succeeded(CoCreateInstance(CLSID_FileOpenDialog, nil, CLSCTX_INPROC_SERVER, IFileOpenDialog, Dialog)) and Assigned(Dialog) then
|
||||||
begin
|
begin
|
||||||
@ -976,7 +986,8 @@ var
|
|||||||
begin
|
begin
|
||||||
if ACommonDialog.Handle <> 0 then
|
if ACommonDialog.Handle <> 0 then
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||||
|
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||||
begin
|
begin
|
||||||
Dialog := IFileDialog(ACommonDialog.Handle);
|
Dialog := IFileDialog(ACommonDialog.Handle);
|
||||||
Dialog._Release;
|
Dialog._Release;
|
||||||
@ -1003,7 +1014,8 @@ begin
|
|||||||
lInitialDir := TOpenDialog(ACommonDialog).InitialDir;
|
lInitialDir := TOpenDialog(ACommonDialog).InitialDir;
|
||||||
if lInitialDir <> '' then SetCurrentDirUTF8(lInitialDir);
|
if lInitialDir <> '' then SetCurrentDirUTF8(lInitialDir);
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||||
|
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||||
begin
|
begin
|
||||||
Dialog := IFileOpenDialog(ACommonDialog.Handle);
|
Dialog := IFileOpenDialog(ACommonDialog.Handle);
|
||||||
VistaDialogShowModal(Dialog, TOpenDialog(ACommonDialog));
|
VistaDialogShowModal(Dialog, TOpenDialog(ACommonDialog));
|
||||||
@ -1039,7 +1051,8 @@ var
|
|||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||||
|
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||||
begin
|
begin
|
||||||
if Succeeded(CoCreateInstance(CLSID_FileSaveDialog, nil, CLSCTX_INPROC_SERVER, IFileSaveDialog, Dialog)) and Assigned(Dialog) then
|
if Succeeded(CoCreateInstance(CLSID_FileSaveDialog, nil, CLSCTX_INPROC_SERVER, IFileSaveDialog, Dialog)) and Assigned(Dialog) then
|
||||||
begin
|
begin
|
||||||
@ -1061,7 +1074,8 @@ var
|
|||||||
begin
|
begin
|
||||||
if ACommonDialog.Handle <> 0 then
|
if ACommonDialog.Handle <> 0 then
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||||
|
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||||
begin
|
begin
|
||||||
Dialog := IFileDialog(ACommonDialog.Handle);
|
Dialog := IFileDialog(ACommonDialog.Handle);
|
||||||
Dialog._Release;
|
Dialog._Release;
|
||||||
@ -1088,7 +1102,8 @@ begin
|
|||||||
lInitialDir := TSaveDialog(ACommonDialog).InitialDir;
|
lInitialDir := TSaveDialog(ACommonDialog).InitialDir;
|
||||||
if lInitialDir <> '' then SetCurrentDirUTF8(lInitialDir);
|
if lInitialDir <> '' then SetCurrentDirUTF8(lInitialDir);
|
||||||
{$ifdef UseVistaDialogs}
|
{$ifdef UseVistaDialogs}
|
||||||
if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
if CanUseVistaDialogs(TOpenDialog(ACommonDialog)) then
|
||||||
|
//if (WindowsVersion >= wvVista) and ThemeServices.ThemesEnabled then
|
||||||
begin
|
begin
|
||||||
Dialog := IFileSaveDialog(ACommonDialog.Handle);
|
Dialog := IFileSaveDialog(ACommonDialog.Handle);
|
||||||
TWin32WSOpenDialog.VistaDialogShowModal(Dialog, TOpenDialog(ACommonDialog));
|
TWin32WSOpenDialog.VistaDialogShowModal(Dialog, TOpenDialog(ACommonDialog));
|
||||||
|
Loading…
Reference in New Issue
Block a user