mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 15:19:19 +02:00
LCL-CustomDrawn: Implements FocusRect
git-svn-id: trunk@36610 -
This commit is contained in:
parent
8ef9333cd8
commit
b2d4e3fd19
@ -36,7 +36,7 @@ type
|
|||||||
AState: TCDControlState; AStateEx: TCDControlStateEx): TRect; override;
|
AState: TCDControlState; AStateEx: TCDControlStateEx): TRect; override;
|
||||||
function DPIAdjustment(const AValue: Integer): Integer;
|
function DPIAdjustment(const AValue: Integer): Integer;
|
||||||
// General drawing routines
|
// General drawing routines
|
||||||
procedure DrawFocusRect(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;
|
procedure DrawFocusRect(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize); override;
|
||||||
procedure DrawRaisedFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;
|
procedure DrawRaisedFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); override;
|
||||||
procedure DrawFrame3D(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize;
|
procedure DrawFrame3D(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize;
|
||||||
const FrameWidth : integer; const Style : TBevelCut); override;
|
const FrameWidth : integer; const Style : TBevelCut); override;
|
||||||
@ -324,14 +324,14 @@ begin
|
|||||||
else Result := Round(AValue * Screen.PixelsPerInch / 125);
|
else Result := Round(AValue * Screen.PixelsPerInch / 125);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCDDrawerCommon.DrawFocusRect(ADest: TCanvas; ADestPos: TPoint;
|
procedure TCDDrawerCommon.DrawFocusRect(ADest: TFPCustomCanvas; ADestPos: TPoint;
|
||||||
ASize: TSize);
|
ASize: TSize);
|
||||||
begin
|
begin
|
||||||
ADest.Pen.Color := clWhite;
|
ADest.Pen.FPColor := colWhite;
|
||||||
ADest.Pen.Style := psSolid;
|
ADest.Pen.Style := psSolid;
|
||||||
ADest.Brush.Style := bsClear;
|
ADest.Brush.Style := bsClear;
|
||||||
ADest.Rectangle(ADestPos.X, ADestPos.Y, ADestPos.X + ASize.CX, ADestPos.Y + ASize.CY);
|
ADest.Rectangle(ADestPos.X, ADestPos.Y, ADestPos.X + ASize.CX, ADestPos.Y + ASize.CY);
|
||||||
ADest.Pen.Color := clBlack;
|
ADest.Pen.FPColor := colBlack;
|
||||||
ADest.Pen.Style := psDot;
|
ADest.Pen.Style := psDot;
|
||||||
ADest.Rectangle(ADestPos.X, ADestPos.Y, ADestPos.X + ASize.CX, ADestPos.Y + ASize.CY);
|
ADest.Rectangle(ADestPos.X, ADestPos.Y, ADestPos.X + ASize.CX, ADestPos.Y + ASize.CY);
|
||||||
end;
|
end;
|
||||||
|
@ -298,7 +298,7 @@ type
|
|||||||
procedure DrawControl(ADest: TCanvas; ASize: TSize;
|
procedure DrawControl(ADest: TCanvas; ASize: TSize;
|
||||||
AControl: TCDControlID; AState: TCDControlState; AStateEx: TCDControlStateEx);
|
AControl: TCDControlID; AState: TCDControlState; AStateEx: TCDControlStateEx);
|
||||||
// General drawing routines. The ones using TFPCustomCanvas are reusable in LCL-CustomDrawn
|
// General drawing routines. The ones using TFPCustomCanvas are reusable in LCL-CustomDrawn
|
||||||
procedure DrawFocusRect(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); virtual; abstract;
|
procedure DrawFocusRect(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize); virtual; abstract;
|
||||||
procedure DrawRaisedFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); virtual; abstract;
|
procedure DrawRaisedFrame(ADest: TCanvas; ADestPos: TPoint; ASize: TSize); virtual; abstract;
|
||||||
procedure DrawFrame3D(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize;
|
procedure DrawFrame3D(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize;
|
||||||
const FrameWidth : integer; const Style : TBevelCut); virtual; abstract;
|
const FrameWidth : integer; const Style : TBevelCut); virtual; abstract;
|
||||||
|
@ -1039,39 +1039,27 @@ begin
|
|||||||
QtDC.Restore;
|
QtDC.Restore;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: DrawFocusRect
|
Method: DrawFocusRect
|
||||||
Params: DC: HDC; const Rect: TRect
|
Params: DC: HDC; const Rect: TRect
|
||||||
Returns: Boolean
|
Returns: Boolean
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TQtWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
|
function TCDWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
|
||||||
var
|
var
|
||||||
StyleOption: QStyleOptionFocusRectH;
|
LazDC: TLazCanvas absolute DC;
|
||||||
QtDC: TQtDeviceContext;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseCDWinAPI}
|
||||||
WriteLn('[TQtWidgetSet.DrawFocusRect] Handle: ', dbghex(DC));
|
DebugLn(Format('[DrawFocusRect] DC: %x', [PtrUInt(DC)]));
|
||||||
{$endif}
|
{$endif}
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
if not IsValidDC(DC) then exit;
|
if not IsValidDC(DC) then exit;
|
||||||
|
|
||||||
QtDC := TQtDeviceContext(DC);
|
GetDefaultDrawer().DrawFocusRect(LazDC, Point(Rect.Left, Rect.Top),
|
||||||
StyleOption := QStyleOptionFocusRect_create;
|
Size(Rect.Right - Rect.Left, Rect.Bottom - Rect.Top));
|
||||||
QtDC.save;
|
end;
|
||||||
try
|
|
||||||
QStyleOption_setRect(StyleOption, @Rect);
|
|
||||||
if not QtDC.getClipping then
|
|
||||||
QtDC.setClipRect(Rect);
|
|
||||||
QStyle_drawPrimitive(QApplication_style, QStylePE_FrameFocusRect, StyleOption, QtDC.Widget, QtDC.Parent);
|
|
||||||
Result := True;
|
|
||||||
finally
|
|
||||||
QStyleOptionFocusRect_destroy(StyleOption);
|
|
||||||
QtDC.restore;
|
|
||||||
end;
|
|
||||||
end;*)
|
|
||||||
|
|
||||||
function TCDWidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; uType,
|
function TCDWidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; uType,
|
||||||
uState: Cardinal): Boolean;
|
uState: Cardinal): Boolean;
|
||||||
|
@ -79,8 +79,8 @@ function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
|
|||||||
(*function DestroyCaret(Handle : HWND): Boolean; override;
|
(*function DestroyCaret(Handle : HWND): Boolean; override;
|
||||||
function DestroyIcon(Handle: HICON): Boolean; override;
|
function DestroyIcon(Handle: HICON): Boolean; override;
|
||||||
function DPtoLP(DC: HDC; var Points; Count: Integer): BOOL; override;
|
function DPtoLP(DC: HDC; var Points; Count: Integer): BOOL; override;
|
||||||
function DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal; grfFlags: Cardinal): Boolean; override;
|
function DrawEdge(DC: HDC; var Rect: TRect; edge: Cardinal; grfFlags: Cardinal): Boolean; override;*)
|
||||||
function DrawFocusRect(DC: HDC; const Rect: TRect): boolean; override;*)
|
function DrawFocusRect(DC: HDC; const Rect: TRect): boolean; override;
|
||||||
function DrawFrameControl(DC: HDC; const Rect : TRect; uType, uState : Cardinal) : Boolean; override;
|
function DrawFrameControl(DC: HDC; const Rect : TRect; uType, uState : Cardinal) : Boolean; override;
|
||||||
//function DrawText(DC: HDC; Str: PChar; Count: Integer; var ARect: TRect; Flags: Cardinal): Integer; override;
|
//function DrawText(DC: HDC; Str: PChar; Count: Integer; var ARect: TRect; Flags: Cardinal): Integer; override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user