mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:11:59 +02:00
LCL: Revert some of THintWindow changes because of Delphi compatibility. Issue #26516
git-svn-id: trunk@45973 -
This commit is contained in:
parent
d9c5dee4f6
commit
b189500498
@ -327,10 +327,10 @@ var
|
||||
var
|
||||
HintWinRect: TRect;
|
||||
begin
|
||||
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint);
|
||||
HintWinRect := HintTextWindow.CalcHintRect(Screen.Width, TheHint, Nil);
|
||||
HintTextWindow.HintRectAdjust := HintWinRect; // Adds borders.
|
||||
HintTextWindow.OffsetHintRect(ScreenPos);
|
||||
HintTextWindow.ActivateText(TheHint);
|
||||
HintTextWindow.ActivateHint(TheHint);
|
||||
end;
|
||||
|
||||
procedure DoHtml;
|
||||
|
@ -77,7 +77,8 @@ type
|
||||
FIndex: Integer;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function CalcHintRect(MaxWidth: Integer; const AHint: string): TRect; override;
|
||||
function CalcHintRect(MaxWidth: Integer; const AHint: string;
|
||||
AData: pointer): TRect; override;
|
||||
procedure Paint; override;
|
||||
property Index: Integer read FIndex write FIndex;
|
||||
end;
|
||||
@ -685,7 +686,7 @@ begin
|
||||
// CalcHintRect uses the current index
|
||||
FHint.Index := AIndex;
|
||||
// calculate the size
|
||||
R := FHint.CalcHintRect(Monitor.Width, ItemList[AIndex]);
|
||||
R := FHint.CalcHintRect(Monitor.Width, ItemList[AIndex], nil);
|
||||
|
||||
if (R.Right <= Scroll.Left) then begin
|
||||
FHint.Hide;
|
||||
@ -726,7 +727,7 @@ end;
|
||||
procedure TSynBaseCompletionForm.OnHintTimer(Sender: TObject);
|
||||
begin
|
||||
FHintTimer.Enabled := False;
|
||||
FHint.ActivateText(ItemList[FHint.Index]);
|
||||
FHint.ActivateHint(ItemList[FHint.Index]);
|
||||
end;
|
||||
|
||||
procedure TSynBaseCompletionForm.KeyDown(var Key: Word; Shift: TShiftState);
|
||||
@ -2154,7 +2155,8 @@ begin
|
||||
Visible := False;
|
||||
end;
|
||||
|
||||
function TSynBaseCompletionHint.CalcHintRect(MaxWidth: Integer; const AHint: string): TRect;
|
||||
function TSynBaseCompletionHint.CalcHintRect(MaxWidth: Integer; const AHint: string;
|
||||
AData: pointer): TRect;
|
||||
var
|
||||
P: TPoint;
|
||||
begin
|
||||
|
@ -4747,7 +4747,7 @@ begin
|
||||
ScrollHint.Visible := TRUE;
|
||||
end;
|
||||
s := Format('line %d', [TopLine]);
|
||||
rc := ScrollHint.CalcHintRect(200, s);
|
||||
rc := ScrollHint.CalcHintRect(200, s, Nil);
|
||||
pt := ClientToScreen(Point(ClientWidth-ScrollBarWidth - rc.Right - 4, 10));
|
||||
if eoScrollHintFollows in fOptions then
|
||||
pt.y := Mouse.CursorPos.y - (rc.Bottom div 2);
|
||||
|
@ -1799,7 +1799,7 @@ begin
|
||||
if FHintWindow = nil then
|
||||
FHintWindow := THintWindow.Create(nil);
|
||||
if h = '' then exit;
|
||||
r := FHintWindow.CalcHintRect(FChart.Width, h);
|
||||
r := FHintWindow.CalcHintRect(FChart.Width, h, Nil);
|
||||
OffsetRect(r, APoint.X, APoint.Y);
|
||||
FHintWindow.ActivateWithBounds(r, h);
|
||||
end;
|
||||
|
@ -4244,14 +4244,14 @@ begin
|
||||
AHint := GetSelectionPosHintText;
|
||||
end;
|
||||
|
||||
Rect := FHintWindow.CalcHintRect(0, AHint); //no maxwidth
|
||||
Rect := FHintWindow.CalcHintRect(0, AHint, Nil); //no maxwidth
|
||||
Rect.Left := Position.X + 15;
|
||||
Rect.Top := Position.Y + 15;
|
||||
Rect.Right := Rect.Left + Rect.Right;
|
||||
Rect.Bottom := Rect.Top + Rect.Bottom;
|
||||
|
||||
FHintWindow.HintRectAdjust := Rect;
|
||||
FHintWindow.ActivateText(AHint);
|
||||
FHintWindow.ActivateHint(AHint);
|
||||
end;
|
||||
|
||||
procedure TDesigner.SetSnapToGrid(const AValue: boolean);
|
||||
|
@ -1678,7 +1678,7 @@ begin
|
||||
HintWinRect := Rect(0, 0, NewWidth, NewHeight);
|
||||
TheHint:='';
|
||||
end else begin
|
||||
HintWinRect := aHintWindow.CalcHintRect(Screen.Width, TheHint);
|
||||
HintWinRect := aHintWindow.CalcHintRect(Screen.Width, TheHint, Nil);
|
||||
aHintWindow.HintRectAdjust := HintWinRect; // Adds borders.
|
||||
end;
|
||||
OffsetRect(HintWinRect, ScreenPos.X, ScreenPos.Y+30);
|
||||
|
10
lcl/forms.pp
10
lcl/forms.pp
@ -860,11 +860,13 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure ActivateText(const AHint: String);
|
||||
procedure ActivateHint(const AHint: String);
|
||||
procedure ActivateHint(ARect: TRect; const AHint: String); virtual;
|
||||
procedure ActivateWithBounds(ARect: TRect; const AHint: String);
|
||||
procedure ActivateWithData(ARect: TRect; const AHint: String; AData: pointer);
|
||||
deprecated 'Set HintData explicitly';
|
||||
function CalcHintRect(MaxWidth: Integer; const AHint: String): TRect; virtual;
|
||||
procedure ActivateHintData(ARect: TRect; const AHint: String;
|
||||
AData: pointer); virtual;
|
||||
function CalcHintRect(MaxWidth: Integer; const AHint: String;
|
||||
AData: pointer): TRect; virtual;
|
||||
function OffsetHintRect(NewPos: TPoint; dy: Integer = 30): Boolean;
|
||||
procedure InitializeWnd; override;
|
||||
procedure ReleaseHandle;
|
||||
|
@ -847,7 +847,8 @@ begin
|
||||
// make the hint have the same BiDiMode as the activating control
|
||||
FHintWindow.BiDiMode := FHintControl.BiDiMode;
|
||||
// calculate the width of the hint based on HintStr and MaxWidth
|
||||
HintWinRect := FHintWindow.CalcHintRect(HintInfo.HintMaxWidth, HintInfo.HintStr);
|
||||
with HintInfo do
|
||||
HintWinRect := FHintWindow.CalcHintRect(HintMaxWidth, HintStr, HintData);
|
||||
//Position HintWindow depending on LTR/RTL
|
||||
if FHintWindow.UseRightToLeftAlignment then
|
||||
OffsetRect(HintWinRect, HintInfo.HintPos.X - (HintWinRect.Right - HintWinRect.Left), HintInfo.HintPos.Y)
|
||||
@ -860,7 +861,7 @@ begin
|
||||
|
||||
//debugln('TApplication.ShowHintWindow B HintWinRect=',dbgs(HintWinRect),' HintStr="',DbgStr(HintInfo.HintStr),'"');
|
||||
FHintWindow.HintRectAdjust := HintWinRect;
|
||||
FHintWindow.ActivateText(HintInfo.HintStr);
|
||||
FHintWindow.ActivateHint(HintInfo.HintStr);
|
||||
FHintRect := HintInfo.CursorRect;
|
||||
// start hide timer
|
||||
StartHintTimer(HintInfo.HideTimeout,ahttHideHint);
|
||||
|
@ -213,7 +213,7 @@ begin
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure THintWindow.ActivateText(const AHint: String);
|
||||
procedure THintWindow.ActivateHint(const AHint: String);
|
||||
// Shows simple text hint.
|
||||
begin
|
||||
if FActivating then exit;
|
||||
@ -227,19 +227,27 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure THintWindow.ActivateHint(ARect: TRect; const AHint: String);
|
||||
begin
|
||||
HintRect := ARect;
|
||||
AdjustBoundsForMonitor;
|
||||
ActivateHint(AHint);
|
||||
end;
|
||||
|
||||
procedure THintWindow.ActivateWithBounds(ARect: TRect; const AHint: String);
|
||||
begin
|
||||
HintRect := ARect;
|
||||
ActivateText(AHint);
|
||||
ActivateHint(AHint);
|
||||
end;
|
||||
|
||||
procedure THintWindow.ActivateWithData(ARect: TRect; const AHint: String; AData: pointer);
|
||||
procedure THintWindow.ActivateHintData(ARect: TRect; const AHint: String; AData: pointer);
|
||||
begin
|
||||
HintRectAdjust := ARect;
|
||||
ActivateText(AHint); // AData is not used now.
|
||||
ActivateHint(AHint); // AData is not used now.
|
||||
end;
|
||||
|
||||
function THintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String): TRect;
|
||||
function THintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String;
|
||||
AData: pointer): TRect;
|
||||
var
|
||||
Flags: Cardinal;
|
||||
uh: HDC;
|
||||
|
Loading…
Reference in New Issue
Block a user