mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:19:24 +02:00
- rethink DrawDefaultDockImage: add 3 dock image operation: show, hide and move
- implement qt DrawDefaultDockImage git-svn-id: trunk@13608 -
This commit is contained in:
parent
1c8516a77f
commit
0f9be635f0
@ -60,7 +60,7 @@ type
|
|||||||
TDockPerformer = class(TDragDockComon)
|
TDockPerformer = class(TDragDockComon)
|
||||||
private
|
private
|
||||||
FDockObject: TDragDockObject;
|
FDockObject: TDragDockObject;
|
||||||
procedure DefaultDockImage(ADrawRect: TRect; Erase: Boolean);
|
procedure DefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation);
|
||||||
protected
|
protected
|
||||||
function Dragging(AControl: TControl): boolean; override;
|
function Dragging(AControl: TControl): boolean; override;
|
||||||
procedure DragStarted(APosition: TPoint); override;
|
procedure DragStarted(APosition: TPoint); override;
|
||||||
@ -304,7 +304,7 @@ begin
|
|||||||
FDragImageList := FDockObject.GetDragImages;
|
FDragImageList := FDockObject.GetDragImages;
|
||||||
if FDragImageList <> nil then
|
if FDragImageList <> nil then
|
||||||
FDragImageList.BeginDrag(0, APosition.X, APosition.Y);
|
FDragImageList.BeginDrag(0, APosition.X, APosition.Y);
|
||||||
DefaultDockImage(FDockObject.DockRect, False);
|
DefaultDockImage(FDockObject.EraseDockRect, FDockObject.DockRect, disShow);
|
||||||
FDockObject.EraseDockRect := FDockObject.DockRect;
|
FDockObject.EraseDockRect := FDockObject.DockRect;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -467,9 +467,7 @@ begin
|
|||||||
//Draw the form outlines when the position has changed
|
//Draw the form outlines when the position has changed
|
||||||
if not CompareMem(@DockRect, @EraseDockRect, SizeOf(TRect)) then
|
if not CompareMem(@DockRect, @EraseDockRect, SizeOf(TRect)) then
|
||||||
begin
|
begin
|
||||||
if EraseDockRect.Left <> Maxint then
|
DefaultDockImage(FDockObject.EraseDockRect, FDockObject.DockRect, disMove);
|
||||||
DefaultDockImage(FDockObject.EraseDockRect, True);
|
|
||||||
DefaultDockImage(FDockObject.DockRect, False);
|
|
||||||
EraseDockRect := DockRect;
|
EraseDockRect := DockRect;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -489,7 +487,7 @@ begin
|
|||||||
FDockObject := nil;
|
FDockObject := nil;
|
||||||
SetCaptureControl(nil);
|
SetCaptureControl(nil);
|
||||||
|
|
||||||
DefaultDockImage(ADockObjectCopy.EraseDockRect, True);
|
DefaultDockImage(ADockObjectCopy.EraseDockRect, ADockObjectCopy.DockRect, disHide);
|
||||||
ADockObjectCopy.Floating := ADockObjectCopy.DragTarget = nil;
|
ADockObjectCopy.Floating := ADockObjectCopy.DragTarget = nil;
|
||||||
|
|
||||||
Accepted := ADockObjectCopy.DragTarget <> nil;
|
Accepted := ADockObjectCopy.DragTarget <> nil;
|
||||||
@ -545,9 +543,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TDockPerformer.DefaultDockImage(ADrawRect: TRect; Erase: Boolean);
|
procedure TDockPerformer.DefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation);
|
||||||
begin
|
begin
|
||||||
WidgetSet.DrawDefaultDockImage(ADrawRect, Erase);
|
WidgetSet.DrawDefaultDockImage(AOldRect, ANewRect, AOperation);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDragManagerDefault }
|
{ TDragManagerDefault }
|
||||||
|
@ -140,36 +140,45 @@ procedure TWidgetSet.DrawArrow(Arrow: TComponent; Canvas: TPersistent);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWidgetSet.DrawDefaultDockImage(ARect: TRect; Erase: Boolean);
|
procedure TWidgetSet.DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation);
|
||||||
const
|
|
||||||
PenSize=4;
|
procedure DefaultDockImage(ARect: TRect);
|
||||||
var
|
const
|
||||||
DC: HDC;
|
PenSize=4;
|
||||||
OldPen, NewPen: HPen;
|
var
|
||||||
OldRop: Integer;
|
DC: HDC;
|
||||||
LogPen: TLogPen;
|
OldPen, NewPen: HPen;
|
||||||
begin
|
OldRop: Integer;
|
||||||
LogPen.lopnColor := $00FFFFFF;
|
LogPen: TLogPen;
|
||||||
LogPen.lopnWidth := Point(PenSize, 0);
|
begin
|
||||||
LogPen.lopnStyle := PS_SOLID;
|
LogPen.lopnColor := $00FFFFFF;
|
||||||
DC := GetDC(0);
|
LogPen.lopnWidth := Point(PenSize, 0);
|
||||||
try
|
LogPen.lopnStyle := PS_SOLID;
|
||||||
NewPen := CreatePenIndirect(LogPen);
|
DC := GetDC(0);
|
||||||
OldPen := SelectObject(DC, NewPen);
|
try
|
||||||
OldRop := SetROP2(DC, R2_XORPEN);
|
NewPen := CreatePenIndirect(LogPen);
|
||||||
with ARect do
|
OldPen := SelectObject(DC, NewPen);
|
||||||
begin
|
OldRop := SetROP2(DC, R2_XORPEN);
|
||||||
MoveToEx(DC, Left+PenSize, Top+PenSize, nil);
|
with ARect do
|
||||||
LineTo(DC, Right-PenSize,Top+PenSize);
|
begin
|
||||||
LineTo(DC, Right-PenSize, Bottom-PenSize);
|
MoveToEx(DC, Left+PenSize, Top+PenSize, nil);
|
||||||
LineTo(DC, Left+PenSize,Bottom-PenSize);
|
LineTo(DC, Right-PenSize,Top+PenSize);
|
||||||
LineTo(DC, Left+PenSize, Top+PenSize);
|
LineTo(DC, Right-PenSize, Bottom-PenSize);
|
||||||
|
LineTo(DC, Left+PenSize,Bottom-PenSize);
|
||||||
|
LineTo(DC, Left+PenSize, Top+PenSize);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
SetROP2(DC, OldRop);
|
||||||
|
DeleteObject(SelectObject(DC, OldPen));
|
||||||
|
ReleaseDC(0, DC);
|
||||||
end;
|
end;
|
||||||
finally
|
|
||||||
SetROP2(DC, OldRop);
|
|
||||||
DeleteObject(SelectObject(DC, OldPen));
|
|
||||||
ReleaseDC(0, DC);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if AOperation in [disMove, disHide] then
|
||||||
|
DefaultDockImage(AOldRect);
|
||||||
|
if AOperation in [disMove, disShow] then
|
||||||
|
DefaultDockImage(ANewRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWidgetSet.ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint;
|
function TWidgetSet.ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint;
|
||||||
|
@ -149,9 +149,9 @@ begin
|
|||||||
WidgetSet.DrawArrow(Arrow, Canvas);
|
WidgetSet.DrawArrow(Arrow, Canvas);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawDefaultDockImage(ARect: TRect; Erase: Boolean);
|
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation);
|
||||||
begin
|
begin
|
||||||
WidgetSet.DrawDefaultDockImage(ARect, Erase);
|
WidgetSet.DrawDefaultDockImage(AOldRect, ANewRect, AOperation);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
|
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect;
|
||||||
|
@ -66,7 +66,7 @@ function CreateStandardCursor(ACursor: SmallInt): hCursor; {$IFDEF IF_BASE_MEMBE
|
|||||||
function DCClipRegionValid(DC: HDC): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function DCClipRegionValid(DC: HDC): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
procedure DeallocateHWnd(Wnd: HWND); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
procedure DeallocateHWnd(Wnd: HWND); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
procedure DrawDefaultDockImage(ARect: TRect; Erase: Boolean); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
|
||||||
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function ExtUTF8Out(DC: HDC; X, Y: Integer; Options: Longint; Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ type
|
|||||||
App: QApplicationH;
|
App: QApplicationH;
|
||||||
SavedDCList: TList;
|
SavedDCList: TList;
|
||||||
FOldFocusWidget: QWidgetH;
|
FOldFocusWidget: QWidgetH;
|
||||||
|
FDockImage: QRubberBandH;
|
||||||
protected
|
protected
|
||||||
FStockNullBrush: HBRUSH;
|
FStockNullBrush: HBRUSH;
|
||||||
FStockBlackBrush: HBRUSH;
|
FStockBlackBrush: HBRUSH;
|
||||||
|
@ -114,6 +114,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TQtWidgetSet.DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation);
|
||||||
|
begin
|
||||||
|
if FDockImage = nil then
|
||||||
|
FDockImage := QRubberBand_create(QRubberBandRectangle);
|
||||||
|
|
||||||
|
QRubberBand_setGeometry(FDockImage, @ANewRect);
|
||||||
|
case AOperation of
|
||||||
|
disShow: QWidget_show(FDockImage);
|
||||||
|
disHide: QWidget_hide(FDockImage);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: FontCanUTF8
|
Function: FontCanUTF8
|
||||||
@ -129,7 +141,7 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
{$endif}
|
{$endif}
|
||||||
{$else}
|
{$else}
|
||||||
Result := IsValidGDIObject(Font);
|
Result := IsValidGDIObject(Font);
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
function CreateStandardCursor(ACursor: SmallInt): hCursor; override;
|
function CreateStandardCursor(ACursor: SmallInt): hCursor; override;
|
||||||
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;
|
procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;
|
||||||
|
procedure DrawDefaultDockImage(AOldRect, ANewRect: TRect; AOperation: TDockImageOperation); override;
|
||||||
|
|
||||||
function FontCanUTF8(Font: HFont): boolean; override;
|
function FontCanUTF8(Font: HFont): boolean; override;
|
||||||
function FontIsMonoSpace(Font: HFont): boolean; override;
|
function FontIsMonoSpace(Font: HFont): boolean; override;
|
||||||
|
@ -29,6 +29,7 @@ begin
|
|||||||
InitStockItems;
|
InitStockItems;
|
||||||
|
|
||||||
QtWidgetSet := Self;
|
QtWidgetSet := Self;
|
||||||
|
FDockImage := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -40,6 +41,8 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
destructor TQtWidgetSet.Destroy;
|
destructor TQtWidgetSet.Destroy;
|
||||||
begin
|
begin
|
||||||
|
if FDockImage <> nil then
|
||||||
|
QRubberBand_destroy(FDockImage);
|
||||||
DestroyGlobalCaret;
|
DestroyGlobalCaret;
|
||||||
Clipboard.Free;
|
Clipboard.Free;
|
||||||
FreeStockItems;
|
FreeStockItems;
|
||||||
|
@ -67,6 +67,8 @@ type
|
|||||||
TCriticalSection = PtrUInt;
|
TCriticalSection = PtrUInt;
|
||||||
PCriticalSection = ^TCriticalSection;
|
PCriticalSection = ^TCriticalSection;
|
||||||
|
|
||||||
|
TDockImageOperation = (disShow, disMove, disHide);
|
||||||
|
|
||||||
{$ifndef WINDOWS}
|
{$ifndef WINDOWS}
|
||||||
{$IFDEF CPU64}
|
{$IFDEF CPU64}
|
||||||
// temp solution for 32bit system.Thandle
|
// temp solution for 32bit system.Thandle
|
||||||
|
Loading…
Reference in New Issue
Block a user