mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: UI infrastructure related to FileSource
This commit is contained in:
parent
a769421642
commit
ace08aa36d
2 changed files with 33 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ uses
|
|||
uFileSourceOperationTypes,
|
||||
uFileSourceProperty,
|
||||
uFileProperty,
|
||||
uFile;
|
||||
uFile, uDisplayFile;
|
||||
|
||||
type
|
||||
|
||||
|
|
@ -45,6 +45,11 @@ type
|
|||
procedure confirmOperation( var params: TFileSourceConsultParams ); virtual; abstract;
|
||||
end;
|
||||
|
||||
TFileSourceUIHandler = class
|
||||
procedure draw(Sender: TObject; aCol, aRow: Integer;
|
||||
aRect: TRect; focused: Boolean; aFile: TDisplayFile); virtual; abstract;
|
||||
end;
|
||||
|
||||
TFileSourceField = record
|
||||
Content: String;
|
||||
Header: String;
|
||||
|
|
@ -67,6 +72,7 @@ type
|
|||
['{B7F0C4C8-59F6-4A35-A54C-E8242F4AD809}']
|
||||
|
||||
function GetProcessor: TFileSourceProcessor;
|
||||
function GetUIHandler: TFileSourceUIHandler;
|
||||
|
||||
function Equals(aFileSource: IFileSource): Boolean;
|
||||
function IsInterface(InterfaceGuid: TGuid): Boolean;
|
||||
|
|
@ -246,6 +252,7 @@ type
|
|||
destructor Destroy; override;
|
||||
|
||||
function GetProcessor: TFileSourceProcessor; virtual;
|
||||
function GetUIHandler: TFileSourceUIHandler; virtual;
|
||||
|
||||
function Equals(aFileSource: IFileSource): Boolean; overload;
|
||||
function IsInterface(InterfaceGuid: TGuid): Boolean;
|
||||
|
|
@ -497,6 +504,11 @@ begin
|
|||
Result:= defaultFileSourceProcessor;
|
||||
end;
|
||||
|
||||
function TFileSource.GetUIHandler: TFileSourceUIHandler;
|
||||
begin
|
||||
Result:= nil;
|
||||
end;
|
||||
|
||||
function TFileSource.Equals(aFileSource: IFileSource): Boolean;
|
||||
begin
|
||||
// Both interface variables must be brought to the same interface.
|
||||
|
|
|
|||
|
|
@ -1957,6 +1957,23 @@ var
|
|||
aCol := CCell.Col;
|
||||
aRect := CCell.Rect;
|
||||
end;
|
||||
|
||||
procedure callFileSourceDrawCell;
|
||||
var
|
||||
handler: TFileSourceUIHandler;
|
||||
begin
|
||||
handler:= ColumnsView.FileSource.GetUIHandler;
|
||||
if handler = nil then
|
||||
Exit;
|
||||
handler.draw(Self.ColumnsView,aCol,aRow,aRect,onDrawCellFocused,AFile);
|
||||
end;
|
||||
|
||||
procedure callOnDrawCell;
|
||||
begin
|
||||
if Assigned(OnDrawCell) and not(CsDesigning in ComponentState) then
|
||||
OnDrawCell(Self.ColumnsView,aCol,aRow,aRect,onDrawCellFocused,AFile);
|
||||
end;
|
||||
|
||||
//------------------------------------------------------
|
||||
//end of subprocedures
|
||||
//------------------------------------------------------
|
||||
|
|
@ -1995,10 +2012,9 @@ begin
|
|||
DrawOtherCell;
|
||||
end;
|
||||
|
||||
if Assigned(OnDrawCell) and not(CsDesigning in ComponentState) then begin
|
||||
onDrawCellFocused:= (gdSelected in aState) and ColumnsView.Active;
|
||||
OnDrawCell(Self.ColumnsView,aCol,aRow,aRect,onDrawCellFocused,AFile);
|
||||
end;
|
||||
onDrawCellFocused:= (gdSelected in aState) and ColumnsView.Active;
|
||||
callFileSourceDrawCell;
|
||||
callOnDrawCell;
|
||||
|
||||
DrawCellGrid(aCol,aRow,aRect,aState);
|
||||
DrawLines;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue