summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2009-06-23 22:36:23 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2009-06-23 22:36:23 +0200
commit25f4d2e55c036e1280d322233ed8598102dda4c7 (patch)
tree6f6860d40cdfe0865b440fd88d58f7552d43667a
parent308d0f1188ef0f26498ec3d89dcf93439363aa8d (diff)
downloadfpGUI-25f4d2e55c036e1280d322233ed8598102dda4c7.tar.xz
TextEdit: Mouse wheel support has been fully implemented.
-rw-r--r--prototypes/textedit/fpg_textedit.pas32
1 files changed, 31 insertions, 1 deletions
diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas
index d9c4bf9b..5fad2d05 100644
--- a/prototypes/textedit/fpg_textedit.pas
+++ b/prototypes/textedit/fpg_textedit.pas
@@ -26,7 +26,7 @@ unit fpg_textedit;
interface
uses
- Classes, SysUtils, fpg_base, fpg_main, fpg_widget, fpg_panel,
+ Classes, SysUtils, fpg_base, fpg_main, fpg_widget,
fpg_scrollbar;
type
@@ -48,6 +48,7 @@ type
procedure SetZeroStart(const AValue: Boolean);
protected
procedure HandlePaint; override;
+ procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override;
public
constructor CreateGutter(AOwner: TfpgBaseTextEdit);
function GetClientRect: TfpgRect; override;
@@ -114,6 +115,7 @@ type
procedure HandleMouseEnter; override;
procedure HandleMouseExit; override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
+ procedure HandleMouseScroll(x, y: integer; shiftstate: TShiftState; delta: smallint); override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure HandleKeyChar(var AText: TfpgChar; var shiftstate: TShiftState; var consumed: boolean); override;
{ -- local widget functions -- }
@@ -239,6 +241,20 @@ begin
DrawLineNums;
end;
+procedure TfpgGutter.HandleMouseScroll(x, y: integer; shiftstate: TShiftState;
+ delta: smallint);
+var
+ msg: TfpgMessageParams;
+begin
+ inherited HandleMouseScroll(x, y, shiftstate, delta);
+ fillchar(msg, sizeof(msg), 0); // zero out the record - initialize it
+ msg.mouse.x := x;
+ msg.mouse.y := y;
+ msg.mouse.shiftstate := shiftstate;
+ msg.mouse.delta := delta;
+ fpgPostMessage(self, (Owner as TfpgBaseTextEdit).FVScrollBar, FPGM_SCROLL, msg);
+end;
+
constructor TfpgGutter.CreateGutter(AOwner: TfpgBaseTextEdit);
begin
inherited Create(AOwner);
@@ -802,6 +818,20 @@ writeln(' shiftstate not detected');
Invalidate;
end;
+procedure TfpgBaseTextEdit.HandleMouseScroll(x, y: integer; shiftstate: TShiftState;
+ delta: smallint);
+var
+ msg: TfpgMessageParams;
+begin
+ inherited HandleMouseScroll(x, y, shiftstate, delta);
+ fillchar(msg, sizeof(msg), 0); // zero out the record - initialize it
+ msg.mouse.x := x;
+ msg.mouse.y := y;
+ msg.mouse.shiftstate := shiftstate;
+ msg.mouse.delta := delta;
+ fpgPostMessage(self, FVScrollBar, FPGM_SCROLL, msg);
+end;
+
procedure TfpgBaseTextEdit.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
var