mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-01 07:29:30 +01:00
dockmanager example: improved auto-expand sites
git-svn-id: trunk@25569 -
This commit is contained in:
parent
8aeeea4e28
commit
c74fe9edbd
@ -9,6 +9,7 @@ object ViewWindow: TViewWindow
|
||||
DragKind = dkDock
|
||||
DragMode = dmAutomatic
|
||||
OnEndDock = FormEndDock
|
||||
OnStartDock = FormStartDock
|
||||
LCLVersion = '0.9.29'
|
||||
Visible = True
|
||||
object Label1: TLabel
|
||||
|
||||
@ -17,6 +17,7 @@ type
|
||||
TViewWindow = class(TForm)
|
||||
Label1: TLabel;
|
||||
procedure FormEndDock(Sender, Target: TObject; X, Y: Integer);
|
||||
procedure FormStartDock(Sender: TObject; var DragObject: TDragDockObject);
|
||||
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState;
|
||||
X, Y: Integer);
|
||||
private
|
||||
@ -51,6 +52,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TViewWindow.FormStartDock(Sender: TObject;
|
||||
var DragObject: TDragDockObject);
|
||||
begin
|
||||
(* remember current size, for DockRect
|
||||
*)
|
||||
UndockHeight := Height;
|
||||
UndockWidth := Width;
|
||||
end;
|
||||
|
||||
procedure TViewWindow.Image1MouseMove(Sender: TObject; Shift: TShiftState;
|
||||
X, Y: Integer);
|
||||
begin
|
||||
|
||||
@ -874,6 +874,7 @@ begin
|
||||
if Width < w then begin
|
||||
//enlarge docksite
|
||||
Parent.DisableAlign; //form(?)
|
||||
//w := Source.Control.Width;
|
||||
Width := w;
|
||||
if Align = alRight then begin
|
||||
if AutoExpand then begin
|
||||
@ -900,6 +901,9 @@ begin
|
||||
Height := w;
|
||||
if Align = alBottom then begin
|
||||
if AutoExpand then begin
|
||||
//w := Source.Control.Height;
|
||||
w := Source.DockRect.Bottom - Source.DockRect.Top;
|
||||
Height := w;
|
||||
r := Parent.BoundsRect;
|
||||
inc(r.Bottom, w);
|
||||
Parent.BoundsRect := r;
|
||||
@ -943,6 +947,7 @@ var
|
||||
|
||||
var
|
||||
dw, dh: integer;
|
||||
ctl: TControl;
|
||||
const
|
||||
d = 2; //shift mousepos slightly outside container
|
||||
begin
|
||||
@ -976,7 +981,9 @@ begin
|
||||
alBottom:
|
||||
begin
|
||||
AutoExpand := Source.DragPos.y + d > r.Top;
|
||||
if AutoExpand then Adjust(0, dh) else Adjust(0, -dh);
|
||||
{ TODO : for all modes... }
|
||||
//if AutoExpand then Adjust(0, dh) else Adjust(0, -dh);
|
||||
if AutoExpand then Adjust(0, Source.Control.TBDockHeight) else Adjust(0, -dh);
|
||||
end
|
||||
else
|
||||
exit;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user