mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 23:18:01 +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;
|
||||
function DPIAdjustment(const AValue: Integer): Integer;
|
||||
// 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 DrawFrame3D(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
const FrameWidth : integer; const Style : TBevelCut); override;
|
||||
@ -324,14 +324,14 @@ begin
|
||||
else Result := Round(AValue * Screen.PixelsPerInch / 125);
|
||||
end;
|
||||
|
||||
procedure TCDDrawerCommon.DrawFocusRect(ADest: TCanvas; ADestPos: TPoint;
|
||||
procedure TCDDrawerCommon.DrawFocusRect(ADest: TFPCustomCanvas; ADestPos: TPoint;
|
||||
ASize: TSize);
|
||||
begin
|
||||
ADest.Pen.Color := clWhite;
|
||||
ADest.Pen.FPColor := colWhite;
|
||||
ADest.Pen.Style := psSolid;
|
||||
ADest.Brush.Style := bsClear;
|
||||
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.Rectangle(ADestPos.X, ADestPos.Y, ADestPos.X + ASize.CX, ADestPos.Y + ASize.CY);
|
||||
end;
|
||||
|
@ -298,7 +298,7 @@ type
|
||||
procedure DrawControl(ADest: TCanvas; ASize: TSize;
|
||||
AControl: TCDControlID; AState: TCDControlState; AStateEx: TCDControlStateEx);
|
||||
// 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 DrawFrame3D(ADest: TFPCustomCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
const FrameWidth : integer; const Style : TBevelCut); virtual; abstract;
|
||||
|
@ -1039,39 +1039,27 @@ begin
|
||||
QtDC.Restore;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: DrawFocusRect
|
||||
Params: DC: HDC; const Rect: TRect
|
||||
Returns: Boolean
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
|
||||
function TCDWidgetSet.DrawFocusRect(DC: HDC; const Rect: TRect): boolean;
|
||||
var
|
||||
StyleOption: QStyleOptionFocusRectH;
|
||||
QtDC: TQtDeviceContext;
|
||||
LazDC: TLazCanvas absolute DC;
|
||||
begin
|
||||
{$ifdef VerboseQtWinAPI}
|
||||
WriteLn('[TQtWidgetSet.DrawFocusRect] Handle: ', dbghex(DC));
|
||||
{$ifdef VerboseCDWinAPI}
|
||||
DebugLn(Format('[DrawFocusRect] DC: %x', [PtrUInt(DC)]));
|
||||
{$endif}
|
||||
Result := False;
|
||||
|
||||
if not IsValidDC(DC) then exit;
|
||||
|
||||
QtDC := TQtDeviceContext(DC);
|
||||
StyleOption := QStyleOptionFocusRect_create;
|
||||
QtDC.save;
|
||||
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;*)
|
||||
GetDefaultDrawer().DrawFocusRect(LazDC, Point(Rect.Left, Rect.Top),
|
||||
Size(Rect.Right - Rect.Left, Rect.Bottom - Rect.Top));
|
||||
end;
|
||||
|
||||
function TCDWidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; uType,
|
||||
uState: Cardinal): Boolean;
|
||||
|
@ -79,8 +79,8 @@ function DeleteObject(GDIObject: HGDIOBJ): Boolean; override;
|
||||
(*function DestroyCaret(Handle : HWND): Boolean; override;
|
||||
function DestroyIcon(Handle: HICON): Boolean; 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 DrawFocusRect(DC: HDC; const Rect: TRect): 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 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user