summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2012-11-09 16:25:44 +0000
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2012-11-09 16:30:52 +0000
commit67fc39dcec69bad14ee422c404a21f4854a552f5 (patch)
tree805ba46395f16c72c0ccd24d529f97c0ecdbaa84
parent7647df9e7d2778d05a5af538ec1fd2e2c12b5b3c (diff)
downloadfpGUI-67fc39dcec69bad14ee422c404a21f4854a552f5.tar.xz
Moved Menu-key press handling up the class hierarchy to TfpgWidget.
No need for so much code duplication. This also means that widgets like TfpgStringGrid now have keyMenu keypress behaviour. Basically any widget that supports a PopupMenu.
-rw-r--r--src/corelib/fpg_widget.pas5
-rw-r--r--src/gui/fpg_edit.pas11
-rw-r--r--src/gui/fpg_editcombo.pas13
-rw-r--r--src/gui/fpg_memo.pas12
4 files changed, 6 insertions, 35 deletions
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas
index 108c9238..67206557 100644
--- a/src/corelib/fpg_widget.pas
+++ b/src/corelib/fpg_widget.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -1103,6 +1103,9 @@ procedure TfpgWidget.HandleRMouseDown(x, y: integer; shiftstate: TShiftState);
begin
if FShowHint then
fpgApplication.HideHint;
+ // keyMenu was pressed
+ if shiftstate = [ssExtra1] then
+ HandleRMouseUp(x, y, []);
end;
procedure TfpgWidget.HandleLMouseUp(x, y: integer; shiftstate: TShiftState);
diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas
index 89f5cdce..dce1fda8 100644
--- a/src/gui/fpg_edit.pas
+++ b/src/gui/fpg_edit.pas
@@ -103,7 +103,6 @@ type
procedure HandleKeyChar(var AText: TfpgChar; var shiftstate: TShiftState; var consumed: Boolean); override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: Boolean); override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
- procedure HandleRMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleRMouseUp(x, y: integer; shiftstate: TShiftState); override;
procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
procedure HandleDoubleClick(x, y: integer; button: word; shiftstate: TShiftState); override;
@@ -932,16 +931,6 @@ begin
RePaint;
end;
-procedure TfpgBaseEdit.HandleRMouseDown(x, y: integer;
- shiftstate: TShiftState);
-begin
- // keyMenu was pressed
- if shiftstate = [ssExtra1] then
- HandleRMouseUp(x, y, [])
- else
- inherited HandleRMouseDown(x, y, shiftstate);
-end;
-
procedure TfpgBaseEdit.HandleRMouseUp(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleRMouseUp(x, y, shiftstate);
diff --git a/src/gui/fpg_editcombo.pas b/src/gui/fpg_editcombo.pas
index 626f02b1..3887cd13 100644
--- a/src/gui/fpg_editcombo.pas
+++ b/src/gui/fpg_editcombo.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -97,7 +97,6 @@ type
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: Boolean); override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override;
- procedure HandleRMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleRMouseUp(x, y: integer; shiftstate: TShiftState); override;
procedure HandlePaint; override;
property AutoCompletion: Boolean read FAutocompletion write FAutoCompletion default False;
@@ -706,16 +705,6 @@ begin
PaintInternalButton;
end;
-procedure TfpgBaseEditCombo.HandleRMouseDown(x, y: integer;
- shiftstate: TShiftState);
-begin
- // keyMenu was pressed
- if shiftstate = [ssExtra1] then
- HandleRMouseUp(x, y, [])
- else
- inherited HandleRMouseDown(x, y, shiftstate);
-end;
-
procedure TfpgBaseEditCombo.HandleRMouseUp(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleRMouseUp(x, y, shiftstate);
diff --git a/src/gui/fpg_memo.pas b/src/gui/fpg_memo.pas
index c96555c1..bd3e974b 100644
--- a/src/gui/fpg_memo.pas
+++ b/src/gui/fpg_memo.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -100,7 +100,6 @@ type
procedure HandleKeyChar(var AText: TfpgChar; var shiftstate: TShiftState; var consumed: boolean); override;
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
- procedure HandleRMouseDown(x, y: integer; shiftstate: TShiftState); override;
procedure HandleRMouseUp(x, y: integer; shiftstate: TShiftState); override;
procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
procedure HandleResize(dwidth, dheight: integer); override;
@@ -1397,15 +1396,6 @@ begin
Repaint;
end;
-procedure TfpgMemo.HandleRMouseDown(x, y: integer; shiftstate: TShiftState);
-begin
- // keyMenu was pressed
- if shiftstate = [ssExtra1] then
- HandleRMouseUp(x, y, [])
- else
- inherited HandleRMouseDown(x, y, shiftstate);
-end;
-
procedure TfpgMemo.HandleRMouseUp(x, y: integer; shiftstate: TShiftState);
begin
inherited HandleRMouseUp(x, y, shiftstate);