summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-09-01 16:03:58 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-09-01 16:03:58 +0200
commit605e1e2e9b2ae1b36c51d9bdd6958b3e7233cd51 (patch)
tree5458d738d9ecca973c8519c352b0d3b2d2ec591a /docview/components/richtext
parentcf73058f61566c366977a7bfa24bb7a742e13bab (diff)
downloadfpGUI-605e1e2e9b2ae1b36c51d9bdd6958b3e7233cd51.tar.xz
docview: Implemented mouse cursor changes when moved over links.
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/RichTextView.pas48
1 files changed, 40 insertions, 8 deletions
diff --git a/docview/components/richtext/RichTextView.pas b/docview/components/richtext/RichTextView.pas
index 9ebfcc46..f611ab2f 100644
--- a/docview/components/richtext/RichTextView.pas
+++ b/docview/components/richtext/RichTextView.pas
@@ -139,6 +139,7 @@ Type
procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
//procedure ScanEvent( Var KeyCode: TKeyCode;
// RepeatCount: Byte ); override;
@@ -762,7 +763,7 @@ procedure TRichTextView.HandleLMouseDown(x, y: integer; shiftstate: TShiftState)
var
Line: longint;
Offset: longint;
- Link: string;
+ Link: TfpgString;
Position: TTextPosition;
Shift: boolean;
begin
@@ -781,6 +782,41 @@ begin
FClickedLink := ''; // reset link
end;
+procedure TRichTextView.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState);
+var
+ Line: longint;
+ Offset: longint;
+ Link: TfpgString;
+ Position: TTextPosition;
+begin
+ inherited HandleMouseMove(x, y, btnstate, shiftstate);
+ Position := FindPoint(X, Y, Line, Offset, Link);
+
+// if not MouseCapture then // TODO: Introduce a IsMouseCaptured in TfpgWindow
+ begin
+ if Link <> FLastLinkOver then
+ begin
+ if Link <> '' then
+ begin
+ if Assigned(FOnOverLink) then
+ FOnOverLink(Self, Link)
+ end
+ else
+ begin
+ if Assigned(FOnNotOverLink) then
+ FOnNotOverLink(Self, FLastLinkOver);
+ end;
+ FLastLinkOver := Link;
+ end;
+
+ if Link <> '' then
+ MouseCursor := mcHand
+ else
+ MouseCursor := mcDefault; // TODO: later this should be IBeam when RichView supports editing
+ exit;
+ end;
+end;
+
Destructor TRichTextView.Destroy;
Begin
FDefaultMenu.Free;
@@ -1061,13 +1097,9 @@ begin
TextHeight := GetTextAreaHeight;
-// YToFind := Height - YToFind;
-
- //if FBorderStyle = bsSingle then
- //begin
- // dec( YToFind, 2 );
- // dec( XToFind, 2 );
- //end;
+ // Should we take into account Border Styles?
+ XToFind := XToFind - FRichTextSettings.Margins.Left;
+ YToFind := YToFind - FRichTextSettings.Margins.Top;
if YToFind < 3 then
begin