Changeset 204 for Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas
- Timestamp:
- Mar 17, 2011, 11:11:36 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas
r199 r204 7 7 uses 8 8 Classes, Controls, SysUtils, ComCtrls, ExtCtrls, UCDCommon, UCDManager, 9 UCDManagerTabs, Forms ;9 UCDManagerTabs, Forms, URectangle; 10 10 11 11 type … … 17 17 FStepCount: Integer; 18 18 FTabPosition: TTabPosition; 19 StartBounds: TRect; 19 ControlBounds: TRectangle; 20 HideBounds: TRectangle; 21 ShowBounds: TRectangle; 20 22 procedure SetDuration(const AValue: Real); 21 23 procedure SetStepCount(const AValue: Integer); … … 29 31 Control: TControl; 30 32 ControlVisible: Boolean; 33 DoShow: Boolean; 31 34 procedure Hide; 32 35 procedure Show; … … 81 84 begin 82 85 case TabPosition of 86 tpTop: begin 87 Control.SetBounds(ControlBounds.Left, ControlBounds.Top, 88 ControlBounds.Width, Round(ControlBounds.Height * Position)); 89 end; 90 tpLeft: begin 91 Control.SetBounds(ControlBounds.Left, ControlBounds.Top, 92 Round(ControlBounds.Width * Position), ControlBounds.Height); 93 end; 94 tpRight: begin 95 Control.SetBounds(ControlBounds.Right - 96 Round(ControlBounds.Width * Position), ControlBounds.Top, 97 Round(ControlBounds.Width * Position), ControlBounds.Height); 98 end; 83 99 tpBottom: begin 84 Control.Height := Round((StartBounds.Bottom - StartBounds.Top) * Position); 85 Control.Top := StartBounds.Bottom - Control.Height; 86 end; 87 tpTop: begin 88 Control.Height := Round((StartBounds.Bottom - StartBounds.Top) * Position); 89 end; 90 tpLeft: begin 91 Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position); 92 end; 93 tpRight: begin 94 Control.Width := Round((StartBounds.Right - StartBounds.Left) * Position); 95 Control.Left := StartBounds.Right - Control.Width; 100 Control.SetBounds(ControlBounds.Left, 101 ControlBounds.Bottom - Round(ControlBounds.Height * Position), 102 ControlBounds.Width, Round(ControlBounds.Height * Position)); 96 103 end; 97 104 end; … … 119 126 procedure TCDAutoHide.Hide; 120 127 begin 121 StartBounds := Control.BoundsRect; 128 HideBounds.AsTRect := Control.BoundsRect; 129 ControlBounds.Assign(HideBounds); 122 130 Control.Show; 123 131 Control.BringToFront; 132 Application.ProcessMessages; 124 133 Direction := -1; 125 134 Position := 1; … … 130 139 procedure TCDAutoHide.Show; 131 140 begin 132 StartBounds := Control.BoundsRect; 133 //StartBounds := Bounds(0, 0, Control.UndockWidth, Control.UndockHeight); 134 Control.Show; 135 Control.BringToFront; 136 Control.Align := alClient; 137 Direction := 1; 138 Position := 0; 139 Timer.Enabled := True; 140 UpdateBounds; 141 ShowBounds.AsTRect := Control.BoundsRect; 142 ControlBounds.Assign(HideBounds); 143 if Position > 0 then begin 144 DoShow := True; 145 Hide; 146 end else begin 147 //StartBounds := Bounds(0, 0, Control.UndockWidth, Control.UndockHeight); 148 Control.Show; 149 Control.BringToFront; 150 //Control.Align := alClient; 151 Direction := 1; 152 Position := 0; 153 Timer.Enabled := True; 154 UpdateBounds; 155 end; 141 156 end; 142 157 … … 144 159 begin 145 160 inherited; 161 ShowBounds := TRectangle.Create; 162 HideBounds := TRectangle.Create; 163 ControlBounds := TRectangle.Create; 146 164 Timer := TTimer.Create(nil); 147 165 Timer.Enabled := False; … … 149 167 StepCount := 10; 150 168 Duration := 0.05; 169 ShowBounds := TRectangle.Create; 151 170 end; 152 171 153 172 destructor TCDAutoHide.Destroy; 154 173 begin 174 ShowBounds.Free; 175 HideBounds.Free; 176 ControlBounds.Free; 155 177 Timer.Free; 156 178 inherited Destroy; … … 165 187 Timer.Enabled := False; 166 188 ControlVisible := True; 189 DoShow := False; 190 HideBounds := ShowBounds; 167 191 end; 168 192 end else … … 171 195 if Position < 0 then begin 172 196 Position := 0; 173 Timer.Enabled := False; 174 ControlVisible := False; 197 if DoShow then begin 198 Direction := 1; 199 ControlBounds.Assign(ShowBounds); 200 end else begin 201 Timer.Enabled := False; 202 ControlVisible := False; 203 end; 175 204 end; 176 205 end; … … 194 223 Pos: TPoint; 195 224 C: TControl; 225 TopParent: TWinControl; 196 226 begin 197 227 inherited TabControlChange(Sender); 198 228 MouseDownSkip := True; 199 if PopupForm.ControlCount > 0 then 200 PopupForm.Controls[0].Parent := nil; 201 AutoHide.Hide; 202 while AutoHide.Position > 0 do begin 203 Application.ProcessMessages; 204 Sleep(1); 205 end; 229 206 230 if PageControl.TabIndex >= 0 then begin 207 231 C := TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control; 232 C.Align := alClient; 208 233 C.Parent := PopupForm; 234 Pos := Point(PageControl.Left, PageControl.Top); 235 236 TopParent := DockSite; 237 while Assigned(TopParent.Parent) do begin 238 Pos.X := Pos.X + TopParent.Left;; 239 Pos.Y := Pos.Y + TopParent.Top; 240 TopParent := TopParent.Parent; 241 end; 242 PopupForm.Parent := TopParent; 209 243 //AutoHide.Control.Align := alCustom; 210 Pos := Point(PageControl.Left, PageControl.Top); 211 Pos := DockSite.ClientToScreen(Pos); 244 //Pos := DockSite.ClientToScreen(Pos); 245 C.TBDockHeight := 100; 246 C.LRDockWidth := 100; 212 247 with AutoHide.Control do 213 248 case AutoHide.TabPosition of … … 243 278 PopupForm.DockManager := TCDManagerRegions.Create(PopupForm); 244 279 PopupForm.Visible := True; 245 //PopupForm.Parent := ADockSite;246 280 PopupForm.BorderStyle := bsNone; 247 281 AutoHide := TCDAutoHide.Create;
Note:
See TracChangeset
for help on using the changeset viewer.