mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 08:47:59 +02:00
LCL: Start implemention TOpenOptionsEx: widget set specific options for TOpen/SaveDialog that do not fit into TOpenOptions.
This commit is contained in:
parent
1fcb84da43
commit
33484eab0b
@ -192,7 +192,7 @@ type
|
|||||||
ofShowHelp, // show a help button
|
ofShowHelp, // show a help button
|
||||||
ofNoValidate,
|
ofNoValidate,
|
||||||
ofAllowMultiSelect,// allow multiselection
|
ofAllowMultiSelect,// allow multiselection
|
||||||
ofExtensionDifferent,
|
ofExtensionDifferent, // set after the dialog is executed (so, don't set it yourself) if DefaultExt <> '' and Extension <> DefaultExt
|
||||||
ofPathMustExist, // shows an error message if selected path does not exist
|
ofPathMustExist, // shows an error message if selected path does not exist
|
||||||
ofFileMustExist, // shows an error message if selected file does not exist
|
ofFileMustExist, // shows an error message if selected file does not exist
|
||||||
ofCreatePrompt,
|
ofCreatePrompt,
|
||||||
@ -212,6 +212,24 @@ type
|
|||||||
ofAutoPreview // details are OS and interface dependent
|
ofAutoPreview // details are OS and interface dependent
|
||||||
);
|
);
|
||||||
TOpenOptions = set of TOpenOption;
|
TOpenOptions = set of TOpenOption;
|
||||||
|
|
||||||
|
// WS specific options that cannot be (more or less) mapped to the standard TOpenOptions
|
||||||
|
// Currently just Windows Vista+ (IFileDialog) options
|
||||||
|
TOpenOptionEx = (
|
||||||
|
ofHidePinnedPlaces, //Windows Vista+ Hide items shown by default in the view's navigation pane.
|
||||||
|
ofForcePreviewPaneOn, //Windows Vista+ Indicates to the Open dialog box that the preview pane should always be displayed (a NARG/NARL option IMHO)
|
||||||
|
ofStrictFileTypes, //Windows Vista+ In the Save dialog, only allow the user to choose a file that has one of the file name extensions specified through Filter property
|
||||||
|
ofPickFolders, //Windows Vista+ Turns the dialog into a TSelectDirectoryDialog
|
||||||
|
ofOkButtonNeedsInteraction, //Windows Vista+ The OK button will be disabled until the user navigates the view or edits the filename (if applicable).
|
||||||
|
ofForceFileSystem, //Windows Vista+ Ensures that returned items are file system items
|
||||||
|
ofAllNonStorageItems //Windows Vista+ Enables the user to choose any item in the Shell namespace, not just those with SFGAO_STREAM or SFAGO_FILESYSTEM attributes.
|
||||||
|
// This flag cannot be combined with FOS_FORCEFILESYSTEM.
|
||||||
|
// Intentionally not supported: ofDefaultNoMiniMode, ofHideMruPlaces: these values are not supported as of Windows 7.
|
||||||
|
);
|
||||||
|
TOpenOptionsEx = set of TOpenOptionEx;
|
||||||
|
//Old Delpi OpenOptionEx, mapped to ofHidePinnedPlaces
|
||||||
|
const
|
||||||
|
ofExNoPlacesBar = ofHidePinnedPlaces;
|
||||||
|
|
||||||
const
|
const
|
||||||
DefaultOpenDialogOptions = [ofEnableSizing, ofViewDetail];
|
DefaultOpenDialogOptions = [ofEnableSizing, ofViewDetail];
|
||||||
@ -223,6 +241,7 @@ type
|
|||||||
FOnFolderChange: TNotifyEvent;
|
FOnFolderChange: TNotifyEvent;
|
||||||
FOnSelectionChange: TNotifyEvent;
|
FOnSelectionChange: TNotifyEvent;
|
||||||
FOptions: TOpenOptions;
|
FOptions: TOpenOptions;
|
||||||
|
FOptionsEx: TOpenOptionsEx;
|
||||||
FLastSelectionChangeFilename: string;
|
FLastSelectionChangeFilename: string;
|
||||||
protected
|
protected
|
||||||
class procedure WSRegisterClass; override;
|
class procedure WSRegisterClass; override;
|
||||||
@ -240,6 +259,7 @@ type
|
|||||||
procedure IntfSetOption(const AOption: TOpenOption; const AValue: Boolean);
|
procedure IntfSetOption(const AOption: TOpenOption; const AValue: Boolean);
|
||||||
published
|
published
|
||||||
property Options: TOpenOptions read FOptions write FOptions default DefaultOpenDialogOptions;
|
property Options: TOpenOptions read FOptions write FOptions default DefaultOpenDialogOptions;
|
||||||
|
property OptionsEx: TOpenOptionsEx read FOptionsEx write FOptionsEx default [];
|
||||||
property OnFolderChange: TNotifyEvent read FOnFolderChange write FOnFolderChange;
|
property OnFolderChange: TNotifyEvent read FOnFolderChange write FOnFolderChange;
|
||||||
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
property OnSelectionChange: TNotifyEvent read FOnSelectionChange write FOnSelectionChange;
|
||||||
end;
|
end;
|
||||||
|
@ -460,6 +460,7 @@ begin
|
|||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
fCompStyle:=csOpenFileDialog;
|
fCompStyle:=csOpenFileDialog;
|
||||||
FOptions := DefaultOpenDialogOptions;
|
FOptions := DefaultOpenDialogOptions;
|
||||||
|
FOptionsEx := [];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOpenDialog.DoCanClose(var CanClose: Boolean);
|
procedure TOpenDialog.DoCanClose(var CanClose: Boolean);
|
||||||
|
@ -77,7 +77,7 @@ type
|
|||||||
|
|
||||||
TWin32WSOpenDialog = class(TWSOpenDialog)
|
TWin32WSOpenDialog = class(TWSOpenDialog)
|
||||||
public
|
public
|
||||||
class function GetVistaOptions(Options: TOpenOptions; SelectFolder: Boolean): FileOpenDialogOptions;
|
class function GetVistaOptions(Options: TOpenOptions; OptionsEx: TOpenOptionsEx; SelectFolder: Boolean): FileOpenDialogOptions;
|
||||||
|
|
||||||
class procedure SetupVistaFileDialog(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
class procedure SetupVistaFileDialog(ADialog: IFileDialog; const AOpenDialog: TOpenDialog);
|
||||||
class function ProcessVistaDialogResult(ADialog: IFileDialog; const AOpenDialog: TOpenDialog): HResult;
|
class function ProcessVistaDialogResult(ADialog: IFileDialog; const AOpenDialog: TOpenDialog): HResult;
|
||||||
@ -815,7 +815,7 @@ begin
|
|||||||
ParsedFilter.Free;
|
ParsedFilter.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ADialog.SetOptions(GetVistaOptions(AOpenDialog.Options, AOpenDialog is TSelectDirectoryDialog));
|
ADialog.SetOptions(GetVistaOptions(AOpenDialog.Options, AOpenDialog.OptionsEx, AOpenDialog is TSelectDirectoryDialog));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWin32WSOpenDialog.GetFileName(ShellItem: IShellItem): String;
|
class function TWin32WSOpenDialog.GetFileName(ShellItem: IShellItem): String;
|
||||||
@ -832,20 +832,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWin32WSOpenDialog.GetVistaOptions(Options: TOpenOptions;
|
class function TWin32WSOpenDialog.GetVistaOptions(Options: TOpenOptions;
|
||||||
SelectFolder: Boolean): FileOpenDialogOptions;
|
OptionsEx: TOpenOptionsEx; SelectFolder: Boolean): FileOpenDialogOptions;
|
||||||
{ non-used flags
|
const
|
||||||
FOS_FORCEFILESYSTEM
|
FOS_OKBUTTONNEEDSINTERACTION = $200000; //not yet in ShlObj
|
||||||
FOS_ALLNONSTORAGEITEMS
|
|
||||||
FOS_HIDEMRUPLACES
|
|
||||||
FOS_HIDEPINNEDPLACES
|
|
||||||
FOS_DEFAULTNOMINIMODE
|
|
||||||
FOS_FORCEPREVIEWPANEON}
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if ofAllowMultiSelect in Options then Result := Result or FOS_ALLOWMULTISELECT;
|
if ofAllowMultiSelect in Options then Result := Result or FOS_ALLOWMULTISELECT;
|
||||||
if ofCreatePrompt in Options then Result := Result or FOS_CREATEPROMPT;
|
if ofCreatePrompt in Options then Result := Result or FOS_CREATEPROMPT;
|
||||||
if ofExtensionDifferent in Options then Result := Result or FOS_STRICTFILETYPES;
|
//if ofExtensionDifferent in Options then Result := Result or FOS_STRICTFILETYPES; //that's just wrong
|
||||||
if ofFileMustExist in Options then Result := Result or FOS_FILEMUSTEXIST;
|
if ofFileMustExist in Options then Result := Result or FOS_FILEMUSTEXIST;
|
||||||
if ofNoChangeDir in Options then Result := Result or FOS_NOCHANGEDIR;
|
if ofNoChangeDir in Options then Result := Result or FOS_NOCHANGEDIR;
|
||||||
if ofNoDereferenceLinks in Options then Result := Result or FOS_NODEREFERENCELINKS;
|
if ofNoDereferenceLinks in Options then Result := Result or FOS_NODEREFERENCELINKS;
|
||||||
@ -856,7 +850,7 @@ begin
|
|||||||
if ofPathMustExist in Options then Result := Result or FOS_PATHMUSTEXIST;
|
if ofPathMustExist in Options then Result := Result or FOS_PATHMUSTEXIST;
|
||||||
if ofShareAware in Options then Result := Result or FOS_SHAREAWARE;
|
if ofShareAware in Options then Result := Result or FOS_SHAREAWARE;
|
||||||
if ofDontAddToRecent in Options then Result := Result or FOS_DONTADDTORECENT;
|
if ofDontAddToRecent in Options then Result := Result or FOS_DONTADDTORECENT;
|
||||||
if SelectFolder then Result := Result or FOS_PICKFOLDERS;
|
if SelectFolder or (ofPickFolders in OptionsEx) then Result := Result or FOS_PICKFOLDERS;
|
||||||
if ofForceShowHidden in Options then Result := Result or FOS_FORCESHOWHIDDEN;
|
if ofForceShowHidden in Options then Result := Result or FOS_FORCESHOWHIDDEN;
|
||||||
{ unavailable options:
|
{ unavailable options:
|
||||||
ofHideReadOnly
|
ofHideReadOnly
|
||||||
@ -866,6 +860,16 @@ begin
|
|||||||
ofReadOnly
|
ofReadOnly
|
||||||
ofShowHelp
|
ofShowHelp
|
||||||
}
|
}
|
||||||
|
{ non-used flags:
|
||||||
|
FOS_HIDEMRUPLACES, FOS_DEFAULTNOMINIMODE: both of them are unsupported as of Win7
|
||||||
|
FOS_SUPPORTSTREAMABLEITEMS
|
||||||
|
}
|
||||||
|
if ofHidePinnedPlaces in OptionsEx then Result := Result or FOS_HIDEPINNEDPLACES;
|
||||||
|
if ofForcePreviewPaneOn in OptionsEx then Result := Result or FOS_FORCEPREVIEWPANEON;
|
||||||
|
if ofStrictFileTypes in OptionsEx then Result := Result or FOS_STRICTFILETYPES;
|
||||||
|
if ofOkButtonNeedsInteraction in OptionsEx then Result := Result or FOS_OKBUTTONNEEDSINTERACTION;
|
||||||
|
if ofForceFileSystem in OptionsEx then Result := Result or FOS_FORCEFILESYSTEM;
|
||||||
|
if ofAllNonStorageItems in OptionsEx then Result := Result or FOS_ALLNONSTORAGEITEMS;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWin32WSOpenDialog.ProcessVistaDialogResult(ADialog: IFileDialog; const AOpenDialog: TOpenDialog): HResult;
|
class function TWin32WSOpenDialog.ProcessVistaDialogResult(ADialog: IFileDialog; const AOpenDialog: TOpenDialog): HResult;
|
||||||
|
Loading…
Reference in New Issue
Block a user