Changeset 180 for Docking/CoolDocking/UCoolDockCustomize.pas
- Timestamp:
- Mar 8, 2011, 1:57:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCoolDockCustomize.pas
r97 r180 7 7 uses 8 8 Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, 9 ComCtrls, StdCtrls, Spin ;9 ComCtrls, StdCtrls, Spin, UCoolDockLayout; 10 10 11 11 type … … 14 14 15 15 TCoolDockCustomizeForm = class(TForm) 16 published 17 ButtonLayoutDelete: TButton; 18 ButtonLayoutApply: TButton; 19 ButtonLayoutRename: TButton; 20 ButtonLayoutNew: TButton; 21 ButtonLayoutSave: TButton; 16 22 ButtonClose: TButton; 17 23 ComboBox1: TComboBox; … … 27 33 TabSheetLayouts: TTabSheet; 28 34 procedure ButtonCloseClick(Sender: TObject); 35 procedure ButtonLayoutApplyClick(Sender: TObject); 36 procedure ButtonLayoutDeleteClick(Sender: TObject); 37 procedure ButtonLayoutNewClick(Sender: TObject); 38 procedure ButtonLayoutRenameClick(Sender: TObject); 29 39 procedure FormShow(Sender: TObject); 40 procedure ListBox1SelectionChange(Sender: TObject; User: boolean); 30 41 private 31 42 { private declarations } 32 43 public 44 LayoutList: TCoolDockLayoutList; 33 45 end; 34 46 35 47 implementation 36 48 49 resourcestring 50 SNewLayout = 'New Layout'; 51 SEnterNewName = 'Enter new name'; 37 52 38 53 { TCoolDockCustomizeForm } … … 43 58 end; 44 59 60 procedure TCoolDockCustomizeForm.ButtonLayoutApplyClick(Sender: TObject); 61 begin 62 if ListBox1.ItemIndex <> - 1 then 63 TCoolDockLayout(LayoutList.Items[ListBox1.ItemIndex]).Restore; 64 end; 65 66 procedure TCoolDockCustomizeForm.ButtonLayoutDeleteClick(Sender: TObject); 67 begin 68 if ListBox1.ItemIndex <> - 1 then begin 69 LayoutList.Items.Delete(ListBox1.ItemIndex); 70 LayoutList.PopulateStringList(ListBox1.Items); 71 end; 72 end; 73 74 procedure TCoolDockCustomizeForm.ButtonLayoutNewClick(Sender: TObject); 75 var 76 NewLayout: TCoolDockLayout; 77 NewName: string; 78 begin 79 NewName := SNewLayout; 80 if InputQuery(SNewLayout, SEnterNewName, NewName) then 81 if not Assigned(LayoutList.FindByName(NewName)) then begin 82 NewLayout := TCoolDockLayout.Create; 83 NewLayout.Name := NewName; 84 NewLayout.Store; 85 LayoutList.Items.Add(NewLayout); 86 LayoutList.PopulateStringList(ListBox1.Items); 87 end; 88 end; 89 90 procedure TCoolDockCustomizeForm.ButtonLayoutRenameClick(Sender: TObject); 91 var 92 NewName: string; 93 begin 94 NewName := TCoolDockLayout(LayoutList.Items[ListBox1.ItemIndex]).Name; 95 if InputQuery(SNewLayout, SEnterNewName, NewName) then begin 96 TCoolDockLayout(LayoutList.Items[ListBox1.ItemIndex]).Name := NewName; 97 LayoutList.PopulateStringList(ListBox1.Items); 98 end; 99 end; 100 45 101 procedure TCoolDockCustomizeForm.FormShow(Sender: TObject); 46 102 begin 103 if Assigned(LayoutList) then begin 104 LayoutList.PopulateStringList(ListBox1.Items); 105 end; 106 end; 47 107 108 procedure TCoolDockCustomizeForm.ListBox1SelectionChange(Sender: TObject; 109 User: boolean); 110 begin 111 ButtonLayoutRename.Enabled := ListBox1.ItemIndex <> -1; 112 ButtonLayoutDelete.Enabled := ListBox1.ItemIndex <> -1; 113 ButtonLayoutApply.Enabled := ListBox1.ItemIndex <> -1; 114 ButtonLayoutSave.Enabled := ListBox1.ItemIndex <> -1; 48 115 end; 49 116
Note:
See TracChangeset
for help on using the changeset viewer.