docking: before start auto docking check if DragMode = dmAutomatic

git-svn-id: trunk@14049 -
This commit is contained in:
paul 2008-02-09 14:51:51 +00:00
parent 6a8326732d
commit 6ecc6cd943
2 changed files with 12 additions and 8 deletions

View File

@ -2050,22 +2050,25 @@ var
APoint: TQtPoint;
begin
//Drag&Dock support TCustomForm => Start BeginDrag()
if (LCLObject is TCustomForm) and (QMouseEvent_button(QMouseEventH(Event)) = QtLeftButton) then
if (LCLObject is TCustomForm) and
(TWinControlAccess(LCLObject).DragKind = dkDock) and
(TWinControlAccess(LCLObject).DragMode = dmAutomatic) and
(QMouseEvent_button(QMouseEventH(Event)) = QtLeftButton) then
begin
APoint := QMouseEvent_globalPos(QMouseEventH(Event))^;
AHeader := getGeometry;
with getFrameGeometry do
AHeader.Top := Top;
// remove various buttons from header (how to request their pos cross platform?):
Inc(AHeader.Left, 20); // system menu
Dec(AHeader.Right, 80); // close, min, max buttons
if AHeader.Right < AHeader.Left then
AHeader.Right := AHeader.Left + 1;
// remove various buttons from header (how to request their pos cross platform?):
Inc(AHeader.Left, 20); // system menu
Dec(AHeader.Right, 80); // close, min, max buttons
if AHeader.Right < AHeader.Left then
AHeader.Right := AHeader.Left + 1;
// we can skip translation of coords to global since we already working with window
// check for title
if PtInRect(AHeader, Point(APoint.x, APoint.y)) and (TWinControlAccess(LCLObject).DragKind = dkDock) then
if PtInRect(AHeader, Point(APoint.x, APoint.y)) then
LCLObject.BeginDrag(true);
end;
end;

View File

@ -1825,7 +1825,8 @@ begin
begin
if lWinControl is TCustomForm then
begin
if TWinControlAccess(lWinControl).DragKind = dkDock then
if (TWinControlAccess(lWinControl).DragKind = dkDock) and
(TWinControlAccess(lWinControl).DragMode = dmAutomatic) then
lWinControl.BeginDrag(true);
end;
end;