From f356f87a7e1d50ca80dbd7f151b5a98ecdfd2d24 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 26 Aug 2008 23:00:28 +0200 Subject: Connection Manager UI improvements --- UConnectionManager.pas | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/UConnectionManager.pas b/UConnectionManager.pas index 1c1a057..a730026 100644 --- a/UConnectionManager.pas +++ b/UConnectionManager.pas @@ -1,21 +1,21 @@ (* Tux Commander - UConnectionManager - Connection manager dialog - Copyright (C) 2004 Tomas Bzatek - Check for updates on tuxcmd.sourceforge.net - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 2004 Tomas Bzatek + Check for updates on tuxcmd.sourceforge.net + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *) unit UConnectionManager; @@ -37,6 +37,7 @@ type ListViewScrolledWindow: TGTKScrolledWindow; ListViewTable: TGTKTable; AddConnectionButton, EditButton, RemoveButton: TGTKImageButton; + ButtonBox: TGTKVButtonBox; procedure FormCreate(Sender: TObject); override; procedure ListViewSelectionChanged(Sender: TObject); procedure FormKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean); @@ -44,6 +45,7 @@ type procedure EditButtonClick(Sender: TObject); procedure RemoveButtonClick(Sender: TObject); procedure ListViewDblClick(Sender: TObject; Button: TGDKMouseButton; Shift: TShiftState; X, Y: Integer; var Accept: boolean); + procedure ListViewKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean); private procedure FillList; end; @@ -92,6 +94,7 @@ begin ClientArea.AddControlEx(ListViewTable, True, True, 0); ListView := TGTKListView.CreateTyped(Self, False, [lcPointer, lcText, lcText]); + ListView.OnKeyDown := ListViewKeyDown; ListView.RulesHint := True; ListView.ShowHeaders := True; @@ -130,11 +133,18 @@ begin RemoveButton.Caption := LANGConnMgr_RemoveButtonCaption; RemoveButton.UseUnderline := True; RemoveButton.Tooltip := LANGConnMgr_RemoveButtonTooltip; + + ButtonBox := TGTKVButtonBox.Create(Self); + ButtonBox.Spacing := 10; + ButtonBox.AddControl(AddConnectionButton); + ButtonBox.AddControl(EditButton); + ButtonBox.AddControl(RemoveButton); ListViewTable.AddControlEx(0, 1, 3, 5, ListViewScrolledWindow, [taoExpand, taoFill], [taoExpand, taoFill], 0, 5); - ListViewTable.AddControlEx(3, 2, 1, 1, AddConnectionButton, [taoShrink, taoFill], [taoShrink], 5, 5); + ListViewTable.AddControlEx(3, 2, 1, 3, ButtonBox, [taoShrink, taoFill], [taoShrink], 5, 5); +{ ListViewTable.AddControlEx(3, 2, 1, 1, AddConnectionButton, [taoShrink, taoFill], [taoShrink], 5, 5); ListViewTable.AddControlEx(3, 3, 1, 1, EditButton, [taoShrink, taoFill], [taoShrink], 5, 5); - ListViewTable.AddControlEx(3, 4, 1, 1, RemoveButton, [taoShrink, taoFill], [taoShrink], 5, 5); + ListViewTable.AddControlEx(3, 4, 1, 1, RemoveButton, [taoShrink, taoFill], [taoShrink], 5, 5); } // ListViewTable.AddControlEx(3, 1, 1, 1, TGTKLabel.Create(Self), [taoShrink, taoFill], [taoExpand, taoFill], 0, 2); ListViewTable.AddControlEx(3, 5, 1, 1, TGTKLabel.Create(Self), [taoShrink, taoFill], [taoExpand, taoFill], 0, 2); @@ -172,7 +182,14 @@ procedure TFConnectionManager.ListViewDblClick(Sender: TObject; Button: TGDKMous begin if Assigned(ListView.Selected) then ModalResult := mbOK; end; - + +procedure TFConnectionManager.ListViewKeyDown(Sender: TObject; Key: Word; Shift: TShiftState; var Accept: boolean); +begin + case Key of + GDK_Delete_Key: RemoveButtonClick(Sender); + end; +end; + (********************************************************************************************************************************) (********************************************************************************************************************************) procedure TFConnectionManager.AddConnectionButtonClick(Sender: TObject); -- cgit v1.2.3