ADD: implement IKASPathEditMate in TFileViewHeader, autocomplete is supported on various file sources

This commit is contained in:
rich2014 2026-05-31 22:58:21 +08:00
commit 5267c3387f

View file

@ -5,14 +5,14 @@ unit uFileViewHeader;
interface
uses
Classes, SysUtils, Controls, ExtCtrls, ComCtrls, LCLVersion,
Classes, SysUtils, Controls, ExtCtrls, ComCtrls, ShellCtrls, LCLVersion,
uPathLabel, uFileView, KASPathEdit, uFileSorting;
type
{ TFileViewHeader }
TFileViewHeader = class(TPanel)
TFileViewHeader = class(TPanel, IKASPathEditMate)
private
FFileView: TFileView;
FAddressLabel: TPathLabel;
@ -36,6 +36,11 @@ type
procedure EachViewUpdateHeader(AFileView: TFileView; {%H-}UserData: Pointer);
function getFilesAtPath(
const path: String;
const types: TObjectTypes;
const sort: TFileSortType ): TStringList;
protected
tmViewHistoryMenu: TTimer;
procedure PathLabelSetColor(APathLabel: TPathLabel);
@ -89,7 +94,7 @@ type
implementation
uses
LCLType, ShellCtrls, Graphics, uOSUtils, uDCUtils, DCOSUtils, DCStrUtils, uKeyboard,
LCLType, Graphics, uDCUtils, DCOSUtils, DCStrUtils, uKeyboard,
fMain, uFileSourceUtil, uGlobs, uPixMapManager, uLng, uFileFunctions,
uArchiveFileSource, uFileViewWithPanels, uVfsModule;
@ -218,6 +223,14 @@ begin
TFileViewWithPanels(AFileView).Header.UpdateFont;
end;
function TFileViewHeader.getFilesAtPath(
const path: String;
const types: TObjectTypes;
const sort: TFileSortType ): TStringList;
begin
Result:= FFileView.FileSource.GetFilesForPathAndType( path, types, sort );
end;
procedure TFileViewHeader.PathLabelSetColor(APathLabel: TPathLabel);
begin
with gColors.Path^ do
@ -287,6 +300,7 @@ begin
FPathEdit:= TKASPathEdit.Create(FPathLabel);
FPathEdit.Parent:= Self;
FPathEdit.Mate:= Self;
FPathEdit.Align:= alCustom;
FPathEdit.AutoSize:= False;
FPathEdit.Visible:= False;
@ -377,10 +391,6 @@ procedure TFileViewHeader.ShowPathEdit;
begin
with FPathLabel do
begin
if FFileView.FileSource.ClassName = 'TFileSystemFileSource' then
FPathEdit.GetFilesFunc:= @GetFilesInDir
else
FPathEdit.GetFilesFunc:= nil;
FPathEdit.SetBounds(Left, Top, Width, Height);
FPathEdit.Text := FFileView.CurrentPath;
FPathEdit.Visible := True;