ADD: Some code for drive context menu

This commit is contained in:
Alexander Koblov 2008-07-09 15:14:02 +00:00
commit 250144ddf8
4 changed files with 49 additions and 0 deletions

View file

@ -61,6 +61,7 @@ object frmMain: TfrmMain
BevelOuter = bvNone
ParentColor = False
TabOrder = 0
OnMouseUp = dskToolBarMouseUp
OnToolButtonClick = dskToolButtonClick
CheckToolButton = True
FlatButtons = True
@ -77,6 +78,7 @@ object frmMain: TfrmMain
Anchors = [akTop, akLeft, akBottom]
BevelOuter = bvNone
TabOrder = 1
OnMouseUp = dskToolBarMouseUp
OnToolButtonClick = dskToolButtonClick
OnChangeLineCount = dskRightChangeLineCount
CheckToolButton = True

View file

@ -242,6 +242,8 @@ type
procedure btnRightClick(Sender: TObject);
procedure btnRightDirectoryHotlistClick(Sender: TObject);
procedure DeleteClick(Sender: TObject);
procedure dskToolBarMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure dskRightChangeLineCount(AddSize: Integer);
procedure dskToolButtonClick(Sender: TObject; NumberOfButton: Integer);
procedure FormCreate(Sender: TObject);
@ -732,6 +734,22 @@ if pmToolBar.Tag >= 0 then
end;
end;
procedure TfrmMain.dskToolBarMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
sPath: String;
begin
if Sender is TSpeedButton then
with Sender as TSpeedButton do
begin
if Tag < DrivesList.Count then
begin
sPath:= PDrive(DrivesList.Items[Tag])^.Path;
Actions.cm_DriveContextMenu(sPath);
end;
end;
end;
procedure TfrmMain.dskRightChangeLineCount(AddSize: Integer);
begin
pnlSyncSize.Height := pnlSyncSize.Height + AddSize;
@ -2324,6 +2342,8 @@ begin
dskPanel.Buttons[I].Transparent := True;
{/Set Buttons Transparent}
dskPanel.Buttons[I].Layout := blGlyphLeft;
// save in tag button index
dskPanel.Buttons[I].Tag:= I;
end; // with
end; // for

View file

@ -37,6 +37,7 @@ const cf_Null=0;
//---------------------
procedure cm_AddPathToCmdLine(param: string='');
procedure cm_ContextMenu(param: string='');
procedure cm_DriveContextMenu(param: string='');
procedure cm_CopyFullNamesToClip(param: string='');
procedure cm_Exchange(param:string='');
procedure cm_LeftOpenDrives(param:string='');
@ -295,6 +296,14 @@ with frmMain do
end;
end;
procedure TActs.cm_DriveContextMenu(param: string);
begin
if param <> '' then
begin
ShowDriveContextMenu(frmMain, param, Mouse.CursorPos.x, Mouse.CursorPos.y);
end;
end;
procedure TActs.cm_CopyFullNamesToClip(param:string);
var
I: Integer;

View file

@ -66,6 +66,7 @@ procedure ShowFilePropertiesDialog(FileList:TFileList; const aPath:String);
@param(Y Y coordinate)
}
procedure ShowContextMenu(Handle : THandle; FileList : TFileList; X, Y : Integer);
procedure ShowDriveContextMenu(Owner: TWinControl; sPath: String; X, Y : Integer);
{en
Show open icon dialog
@param(Owner Owner)
@ -469,6 +470,23 @@ end;
end;
{$ENDIF}
procedure ShowDriveContextMenu(Owner: TWinControl; sPath: String; X, Y : Integer);
{$IFDEF MSWINDOWS}
var
fri: TFileRecItem;
FileList: TFileList;
begin
fri.sName:= sPath;
FileList:= TFileList.Create;
FileList.AddItem(@fri);
ShowContextMenu(Owner.Handle, FileList, X, Y);
end;
{$ELSE}
begin
end;
{$ENDIF}
(* Show file properties dialog *)
procedure ShowFilePropertiesDialog(FileList:TFileList; const aPath:String);
{$IFDEF UNIX}