mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-26 05:07:12 +01:00
(Qt): Implemented GetCaretRespondToFocus(), SetCaretRespondToFocus(). Improved qtCaret response.
git-svn-id: trunk@12050 -
This commit is contained in:
parent
98dc3ac6bd
commit
c3bcc5db17
@ -56,6 +56,7 @@ type
|
|||||||
FPos: TQtPoint;
|
FPos: TQtPoint;
|
||||||
FVisible: Boolean;
|
FVisible: Boolean;
|
||||||
FVisibleState: Boolean;
|
FVisibleState: Boolean;
|
||||||
|
FRespondToFocus: Boolean;
|
||||||
FCritSect: TCriticalSection;
|
FCritSect: TCriticalSection;
|
||||||
procedure SetPos(const Value: TQtPoint);
|
procedure SetPos(const Value: TQtPoint);
|
||||||
protected
|
protected
|
||||||
@ -81,6 +82,7 @@ type
|
|||||||
|
|
||||||
property Timer: TTimer read FTimer;
|
property Timer: TTimer read FTimer;
|
||||||
property Pos: TQtPoint read FPos write SetPos;
|
property Pos: TQtPoint read FPos write SetPos;
|
||||||
|
property RespondToFocus: Boolean read FRespondToFocus write FRespondToFocus;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CreateCaret(Widget: TQtWidget; Pixmap: QPixmapH; Width, Height: Integer): Boolean; overload;
|
function CreateCaret(Widget: TQtWidget; Pixmap: QPixmapH; Width, Height: Integer): Boolean; overload;
|
||||||
@ -89,6 +91,8 @@ function HideCaret(Widget: TQtWidget): Boolean;
|
|||||||
function ShowCaret(Widget: TQtWidget): Boolean;
|
function ShowCaret(Widget: TQtWidget): Boolean;
|
||||||
function SetCaretPos(X, Y: Integer): Boolean;
|
function SetCaretPos(X, Y: Integer): Boolean;
|
||||||
function GetCaretPos(var Pt: TPoint): Boolean;
|
function GetCaretPos(var Pt: TPoint): Boolean;
|
||||||
|
function GetQtCaretRespondToFocus: Boolean;
|
||||||
|
procedure SetQtCaretRespondToFocus(Value: Boolean);
|
||||||
function DestroyCaret: Boolean;
|
function DestroyCaret: Boolean;
|
||||||
procedure DrawCaret;
|
procedure DrawCaret;
|
||||||
procedure DestroyGlobalCaret;
|
procedure DestroyGlobalCaret;
|
||||||
@ -224,6 +228,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetQtCaretRespondToFocus: Boolean;
|
||||||
|
begin
|
||||||
|
Result := GlobalCaret.RespondToFocus;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure SetQtCaretRespondToFocus(Value: Boolean);
|
||||||
|
begin
|
||||||
|
GlobalCaret.RespondToFocus := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
function DestroyCaret: Boolean;
|
function DestroyCaret: Boolean;
|
||||||
begin
|
begin
|
||||||
if Assigned(GlobalCaret) then
|
if Assigned(GlobalCaret) then
|
||||||
@ -250,6 +264,8 @@ begin
|
|||||||
FTimer.Enabled := False;
|
FTimer.Enabled := False;
|
||||||
FTimer.Interval := GetCaretBlinkTime;
|
FTimer.Interval := GetCaretBlinkTime;
|
||||||
FTimer.OnTimer := @DoTimer;
|
FTimer.OnTimer := @DoTimer;
|
||||||
|
|
||||||
|
FRespondToFocus := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TEmulatedCaret.Destroy;
|
destructor TEmulatedCaret.Destroy;
|
||||||
@ -327,6 +343,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEmulatedCaret.SetPos(const Value: TQtPoint);
|
procedure TEmulatedCaret.SetPos(const Value: TQtPoint);
|
||||||
|
begin
|
||||||
|
if RespondToFocus and
|
||||||
|
((FPos.x <> Value.x) or (FPos.y <> Value.y)) then
|
||||||
|
begin
|
||||||
|
Timer.Enabled := False;
|
||||||
|
Hide;
|
||||||
|
try
|
||||||
|
FPos := Value;
|
||||||
|
FVisible := True;
|
||||||
|
FVisibleState := False;
|
||||||
|
DoTimer(Timer);
|
||||||
|
finally
|
||||||
|
Timer.Enabled := True;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
begin
|
begin
|
||||||
if FVisible and ((FPos.x <> Value.x) or (FPos.y <> Value.y)) then
|
if FVisible and ((FPos.x <> Value.x) or (FPos.y <> Value.y)) then
|
||||||
begin
|
begin
|
||||||
@ -340,6 +371,7 @@ begin
|
|||||||
else
|
else
|
||||||
FPos := Value;
|
FPos := Value;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TEmulatedCaret.DoTimer(Sender: TObject);
|
procedure TEmulatedCaret.DoTimer(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -1688,11 +1688,8 @@ end;
|
|||||||
|
|
||||||
function TQtWidgetSet.GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean;
|
function TQtWidgetSet.GetCaretRespondToFocus(handle: HWND; var ShowHideOnFocus: boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
{$note implement}
|
ShowHideOnFocus := QtCaret.GetQtCaretRespondToFocus;
|
||||||
{$ifdef VerboseQtWinAPI_MISSING_IMPLEMENTATION}
|
Result := True;
|
||||||
WriteLn('***** [WinAPI TQtWidgetSet.GetCaretRespondToFocus] missing implementation ');
|
|
||||||
{$endif}
|
|
||||||
Result := False;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -3764,11 +3761,8 @@ end;
|
|||||||
function TQtWidgetSet.SetCaretRespondToFocus(handle: HWND;
|
function TQtWidgetSet.SetCaretRespondToFocus(handle: HWND;
|
||||||
ShowHideOnFocus: boolean): Boolean;
|
ShowHideOnFocus: boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
{$note implement}
|
Result := True;
|
||||||
Result := False;
|
QtCaret.SetQtCaretRespondToFocus(ShowHideOnFocus);
|
||||||
{$ifdef VerboseQtWinAPI_MISSING_IMPLEMENTATION}
|
|
||||||
WriteLn('***** [WinAPI TQtWidgetSet.SetCaretRespondToFocus] missing implementation ');
|
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user