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; APoint: TQtPoint;
begin begin
//Drag&Dock support TCustomForm => Start BeginDrag() //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 begin
APoint := QMouseEvent_globalPos(QMouseEventH(Event))^; APoint := QMouseEvent_globalPos(QMouseEventH(Event))^;
AHeader := getGeometry; AHeader := getGeometry;
with getFrameGeometry do with getFrameGeometry do
AHeader.Top := Top; AHeader.Top := Top;
// remove various buttons from header (how to request their pos cross platform?): // remove various buttons from header (how to request their pos cross platform?):
Inc(AHeader.Left, 20); // system menu Inc(AHeader.Left, 20); // system menu
Dec(AHeader.Right, 80); // close, min, max buttons Dec(AHeader.Right, 80); // close, min, max buttons
if AHeader.Right < AHeader.Left then if AHeader.Right < AHeader.Left then
AHeader.Right := AHeader.Left + 1; AHeader.Right := AHeader.Left + 1;
// we can skip translation of coords to global since we already working with window // we can skip translation of coords to global since we already working with window
// check for title // 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); LCLObject.BeginDrag(true);
end; end;
end; end;

View File

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