Changeset 198 for Docking/CoolDocking/UCDPopupMenu.pas
- Timestamp:
- Mar 16, 2011, 12:32:41 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/UCDPopupMenu.pas
r194 r198 14 14 15 15 TCDPopupMenu = class(TPopupMenu) 16 private 17 procedure PopupExecute(Sender: TObject); 16 18 public 17 19 Manager: TCDManagerBase; 20 PositionMenu: TMenuItem; 21 StyleMenu: TMenuItem; 22 LockedMenu: TMenuItem; 18 23 constructor Create(AManager: TCDManagerBase); 24 procedure UncheckMenuGroup(Item: TMenuItem); 19 25 procedure PopupMenuListClick(Sender: TObject); 20 26 procedure PopupMenuTabsClick(Sender: TObject); … … 30 36 procedure PopupMenuUndockClick(Sender: TObject); 31 37 procedure PopupMenuCustomizeClick(Sender: TObject); 38 procedure PopupMenuLockedClick(Sender: TObject); 32 39 end; 33 40 … … 55 62 SEnterNewWindowName = 'Enter new window name'; 56 63 SRenameWindow = 'Rename window'; 64 SLocked = 'Locked'; 57 65 58 66 59 67 { TCDPopupMenu } 68 69 procedure TCDPopupMenu.UncheckMenuGroup(Item: TMenuItem); 70 var 71 I: Integer; 72 begin 73 for I := 0 to Item.Count - 1 do 74 Item.Items[I].Checked := False; 75 end; 76 77 procedure TCDPopupMenu.PopupExecute(Sender: TObject); 78 begin 79 UncheckMenuGroup(StyleMenu); 80 StyleMenu.Items[Integer(TCDManager(Manager).DockStyle)].Checked := True; 81 UncheckMenuGroup(PositionMenu); 82 PositionMenu.Items[Integer(TCDManager(Manager).HeaderPos)].Checked := True;; 83 LockedMenu.Checked := TCDManager(Manager).Locked; 84 end; 60 85 61 86 constructor TCDPopupMenu.Create(AManager: TCDManagerBase); … … 68 93 Manager := AManager; 69 94 70 Name := TCDManager(AManager).DockSite.Name + '_' + 'PopupMenu'; 71 72 NewMenuItem := TMenuItem.Create(Self); 73 NewMenuItem.Caption := SDockStyle; 74 Items.Add(NewMenuItem); 75 76 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 95 Name := GetUniqueName(TCDManager(AManager).DockSite.Name + 'PopupMenu'); 96 OnPopup := PopupExecute; 97 98 StyleMenu := TMenuItem.Create(Self); 99 StyleMenu.Caption := SDockStyle; 100 Items.Add(StyleMenu); 101 102 NewMenuItem2 := TMenuItem.Create(StyleMenu); 77 103 NewMenuItem2.Caption := SDockList; 78 104 NewMenuItem2.OnClick := PopupMenuListClick; 79 NewMenuItem.Add(NewMenuItem2);80 81 NewMenuItem2 := TMenuItem.Create( NewMenuItem);105 StyleMenu.Add(NewMenuItem2); 106 107 NewMenuItem2 := TMenuItem.Create(StyleMenu); 82 108 NewMenuItem2.Caption := SDockTabs; 83 109 NewMenuItem2.OnClick := PopupMenuTabsClick; 84 NewMenuItem.Add(NewMenuItem2); 85 86 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 110 StyleMenu.Add(NewMenuItem2); 111 112 NewMenuItem2 := TMenuItem.Create(StyleMenu); 113 NewMenuItem2.Caption := SDockPopupTabs; 114 NewMenuItem2.OnClick := PopupMenuPopupTabsClick; 115 StyleMenu.Add(NewMenuItem2); 116 117 NewMenuItem2 := TMenuItem.Create(StyleMenu); 87 118 NewMenuItem2.Caption := SDockPopupList; 88 119 NewMenuItem2.OnClick := PopupMenuPopupListClick; 89 NewMenuItem.Add(NewMenuItem2); 90 91 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 92 NewMenuItem2.Caption := SDockPopupTabs; 93 NewMenuItem2.OnClick := PopupMenuPopupTabsClick; 94 NewMenuItem.Add(NewMenuItem2); 95 96 NewMenuItem := TMenuItem.Create(Self); 97 NewMenuItem.Caption := SPosition; 98 Items.Add(NewMenuItem); 99 100 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 120 StyleMenu.Add(NewMenuItem2); 121 122 PositionMenu := TMenuItem.Create(Self); 123 PositionMenu.Caption := SPosition; 124 Items.Add(PositionMenu); 125 126 NewMenuItem2 := TMenuItem.Create(PositionMenu); 101 127 NewMenuItem2.Caption := SPositionAuto; 102 128 NewMenuItem2.OnClick := PopupMenuPositionAutoClick; 103 NewMenuItem.Add(NewMenuItem2); 104 105 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 129 PositionMenu.Add(NewMenuItem2); 130 131 NewMenuItem2 := TMenuItem.Create(PositionMenu); 132 NewMenuItem2.Caption := SPositionLeft; 133 NewMenuItem2.OnClick := PopupMenuPositionLeftClick; 134 PositionMenu.Add(NewMenuItem2); 135 136 NewMenuItem2 := TMenuItem.Create(PositionMenu); 106 137 NewMenuItem2.Caption := SPositionTop; 107 138 NewMenuItem2.OnClick := PopupMenuPositionTopClick; 108 NewMenuItem.Add(NewMenuItem2);109 110 NewMenuItem2 := TMenuItem.Create( NewMenuItem);111 NewMenuItem2.Caption := SPosition Left;112 NewMenuItem2.OnClick := PopupMenuPosition LeftClick;113 NewMenuItem.Add(NewMenuItem2);114 115 NewMenuItem2 := TMenuItem.Create( NewMenuItem);139 PositionMenu.Add(NewMenuItem2); 140 141 NewMenuItem2 := TMenuItem.Create(PositionMenu); 142 NewMenuItem2.Caption := SPositionRight; 143 NewMenuItem2.OnClick := PopupMenuPositionRightClick; 144 PositionMenu.Add(NewMenuItem2); 145 146 NewMenuItem2 := TMenuItem.Create(PositionMenu); 116 147 NewMenuItem2.Caption := SPositionBottom; 117 148 NewMenuItem2.OnClick := PopupMenuPositionBottomClick; 118 NewMenuItem.Add(NewMenuItem2); 119 120 NewMenuItem2 := TMenuItem.Create(NewMenuItem); 121 NewMenuItem2.Caption := SPositionRight; 122 NewMenuItem2.OnClick := PopupMenuPositionRightClick; 123 NewMenuItem.Add(NewMenuItem2); 149 PositionMenu.Add(NewMenuItem2); 124 150 125 151 NewMenuItem := TMenuItem.Create(Self); … … 142 168 NewMenuItem.OnClick := PopupMenuCustomizeClick; 143 169 Items.Add(NewMenuItem); 170 171 LockedMenu := TMenuItem.Create(Self); 172 LockedMenu.Caption := SLocked; 173 LockedMenu.OnClick := PopupMenuLockedClick; 174 Items.Add(LockedMenu); 144 175 end; 145 176 … … 200 231 if PopupComponent is TPageControl then 201 232 with TPageControl(PopupComponent) do begin 202 TCDManagerTabs(Manager). TabsPos := hpAuto;233 TCDManagerTabs(Manager).HeaderPos := hpAuto; 203 234 end else 204 235 if PopupComponent is TCDHeader then … … 212 243 if PopupComponent is TPageControl then 213 244 with TPageControl(PopupComponent) do begin 214 TCDManagerTabs(Manager). TabsPos := hpLeft;245 TCDManagerTabs(Manager).HeaderPos := hpLeft; 215 246 end else 216 247 if PopupComponent is TCDHeader then … … 224 255 if PopupComponent is TPageControl then 225 256 with TPageControl(PopupComponent) do begin 226 TCDManagerTabs(Manager). TabsPos := hpRight;257 TCDManagerTabs(Manager).HeaderPos := hpRight; 227 258 end else 228 259 if PopupComponent is TCDHeader then … … 236 267 if PopupComponent is TPageControl then 237 268 with TPageControl(PopupComponent) do begin 238 TCDManagerTabs(Manager). TabsPos := hpTop;269 TCDManagerTabs(Manager).HeaderPos := hpTop; 239 270 end else 240 271 if PopupComponent is TCDHeader then … … 248 279 if PopupComponent is TPageControl then 249 280 with TPageControl(PopupComponent) do begin 250 TCDManagerTabs(Manager). TabsPos := hpBottom;281 TCDManagerTabs(Manager).HeaderPos := hpBottom; 251 282 end else 252 283 if PopupComponent is TCDHeader then … … 280 311 end; 281 312 313 procedure TCDPopupMenu.PopupMenuLockedClick(Sender: TObject); 314 begin 315 if PopupComponent is TPageControl then 316 with TPageControl(PopupComponent) do begin 317 TCDManagerTabs(Manager).Locked := not TCDManagerTabs(Manager).Locked; 318 end else 319 if PopupComponent is TCDHeader then 320 with TCDHeader(PopupComponent) do begin 321 TCDManagerTabs(Manager).Locked := not TCDManagerTabs(Manager).Locked; 322 end; 323 end; 324 282 325 procedure TCDPopupMenu.PopupMenuListClick(Sender: TObject); 283 326 begin
Note:
See TracChangeset
for help on using the changeset viewer.