Changeset 205 for Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas
- Timestamp:
- Mar 17, 2011, 2:17:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Docking/CoolDocking/Managers/UCDManagerTabsPopup.pas
r204 r205 7 7 uses 8 8 Classes, Controls, SysUtils, ComCtrls, ExtCtrls, UCDCommon, UCDManager, 9 UCDManagerTabs, Forms, URectangle ;9 UCDManagerTabs, Forms, URectangle, UCDConjoinForm; 10 10 11 11 type … … 53 53 TCDManagerTabsPopup = class(TCDManagerTabs) 54 54 private 55 SplitterMouseDrag: Boolean; 56 SplitterMousePos: TPoint; 55 57 procedure InsertControlNoUpdate(Control: TControl; InsertAt: TAlign); override; 58 procedure SplitterMouseDown(Sender: TObject; Button: TMouseButton; 59 Shift: TShiftState; X, Y: Integer); 60 procedure SplitterMouseMove(Sender: TObject; Shift: TShiftState; 61 X, Y: Integer); 62 procedure SplitterMouseUp(Sender: TObject; Button: TMouseButton; 63 Shift: TShiftState; X, Y: Integer); 56 64 public 57 65 AutoHideEnabled: Boolean; 58 66 AutoHide: TCDAutoHide; 59 67 PopupForm: TForm; 68 HeaderPanel: TCDPanelHeader; 69 Splitter: TPanel; 60 70 procedure SetHeaderPos(const AValue: THeaderPos); override; 61 71 procedure PinShowButtonClick(Sender: TObject); … … 188 198 ControlVisible := True; 189 199 DoShow := False; 190 HideBounds := ShowBounds;200 HideBounds.Assign(ShowBounds); 191 201 end; 192 202 end else … … 231 241 C := TCDManagerTabsPopupItem(DockItems[PageControl.TabIndex]).Control; 232 242 C.Align := alClient; 233 C.Parent := PopupForm; 243 C.Parent := HeaderPanel.ControlPanel; 244 HeaderPanel.Header.Title.Caption := C.Caption; 234 245 Pos := Point(PageControl.Left, PageControl.Top); 235 246 … … 279 290 PopupForm.Visible := True; 280 291 PopupForm.BorderStyle := bsNone; 292 HeaderPanel := TCDPanelHeader.Create(nil); 293 HeaderPanel.Parent := PopupForm; 294 HeaderPanel.Align := alClient; 295 HeaderPanel.Visible := True; 296 Splitter := TPanel.Create(nil); 297 Splitter.Visible := True; 298 Splitter.Parent := PopupForm; 299 Splitter.OnMouseDown := SplitterMouseDown; 300 Splitter.OnMouseMove := SplitterMouseMove; 301 Splitter.OnMouseUp := SplitterMouseUp; 281 302 AutoHide := TCDAutoHide.Create; 282 303 AutoHide.Control := PopupForm; … … 293 314 AutoHide.Free; 294 315 PopupForm.Free; 316 HeaderPanel.Free; 295 317 inherited Destroy; 296 318 end; … … 339 361 end; 340 362 363 procedure TCDManagerTabsPopup.SplitterMouseDown(Sender: TObject; 364 Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 365 begin 366 if Button = mbLeft then begin 367 SplitterMousePos := Point(X, Y); 368 SplitterMouseDrag := True; 369 end; 370 end; 371 372 procedure TCDManagerTabsPopup.SplitterMouseMove(Sender: TObject; Shift: TShiftState; 373 X, Y: Integer); 374 begin 375 if SplitterMouseDrag then begin 376 case Splitter.Align of 377 alLeft: begin 378 PopupForm.SetBounds(PopupForm.Left - (X - SplitterMousePos.X), 379 PopupForm.Top, PopupForm.Width - (X - SplitterMousePos.X), 380 PopupForm.Height); 381 end; 382 alRight: begin 383 PopupForm.SetBounds(PopupForm.Left, PopupForm.Top, 384 PopupForm.Width + (X - SplitterMousePos.X), PopupForm.Height); 385 end; 386 alTop: begin 387 PopupForm.SetBounds(PopupForm.Left,PopupForm.Top + (Y - SplitterMousePos.Y), 388 PopupForm.Width, PopupForm.Height + (Y - SplitterMousePos.Y)); 389 end; 390 alBottom: begin 391 PopupForm.SetBounds(PopupForm.Left, PopupForm.Top, 392 PopupForm.Width, PopupForm.Height + (Y - SplitterMousePos.Y)); 393 end; 394 end; 395 end; 396 end; 397 398 procedure TCDManagerTabsPopup.SplitterMouseUp(Sender: TObject; 399 Button: TMouseButton; Shift: TShiftState; X, Y: Integer); 400 begin 401 SplitterMouseDrag := False; 402 end; 403 341 404 procedure TCDManagerTabsPopup.SetHeaderPos(const AValue: THeaderPos); 405 const 406 SplitterSize: Integer = 4; 342 407 begin 343 408 inherited SetHeaderPos(AValue); … … 348 413 Align := alTop; 349 414 Height := 24; 415 Splitter.Align := alBottom; 416 Splitter.Height := SplitterSize; 417 Splitter.Cursor := crSizeNS; 350 418 end; 351 419 hpBottom: begin 352 420 Align := alBottom; 353 421 Height := 24; 422 Splitter.Align := alTop; 423 Splitter.Height := SplitterSize; 424 Splitter.Cursor := crSizeNS; 354 425 end; 355 426 hpLeft: begin 356 427 Align := alLeft; 357 428 Width := 24; 429 Splitter.Align := alRight; 430 Splitter.Width := SplitterSize; 431 Splitter.Cursor := crSizeWE; 358 432 end; 359 433 hpRight: begin 360 434 Align := alRight; 361 435 Width := 24; 436 Splitter.Align := alLeft; 437 Splitter.Width := SplitterSize; 438 Splitter.Cursor := crSizeWE; 362 439 end; 363 440 end;
Note:
See TracChangeset
for help on using the changeset viewer.