summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-12-14 07:07:18 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-12-14 07:07:18 +0000
commitfcb239976a2acb067511c25c8f020668883341f7 (patch)
tree4dac201f1274d833dd58c7b184f2d5f2eec5c7df /src
parent2f927a6acb4a28145ce1c32a4f4b24cdcdaf0d98 (diff)
downloadfpGUI-fcb239976a2acb067511c25c8f020668883341f7.tar.xz
* Implemented a OnClick event in TfpgWidget.
* published OnClick and OnDoubleClick in TfpgLabel, TfpgButton, TfpgBevel.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/gfx_widget.pas7
-rw-r--r--src/gui/gui_bevel.pas2
-rw-r--r--src/gui/gui_button.pas2
-rw-r--r--src/gui/gui_label.pas2
4 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index d881bd1a..49ece1f8 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -17,6 +17,7 @@ type
TfpgWidget = class(TfpgWindow)
private
FAlignRect: TfpgRect;
+ FOnClick: TNotifyEvent;
FOnDoubleClick: TMouseButtonEvent;
FOnMouseDown: TMouseButtonEvent;
FOnMouseEnter: TNotifyEvent;
@@ -87,6 +88,7 @@ type
property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
property OnMouseDown: TMouseButtonEvent read FOnMouseDown write FOnMouseDown;
property OnMouseUp: TMouseButtonEvent read FOnMouseUp write FOnMouseUp;
+ property OnClick: TNotifyEvent read FOnClick write FOnClick;
property OnDoubleClick: TMouseButtonEvent read FOnDoubleClick write FOnDoubleClick;
property OnKeyPress: TKeyPressEvent read FOnKeyPress write FOnKeyPress;
public
@@ -384,7 +386,10 @@ begin
if Assigned(FOnDoubleClick) then
FOnDoubleClick(self, mb, msg.Params.mouse.shiftstate,
Point(msg.Params.mouse.x, msg.Params.mouse.y));
- end;
+ end
+ else
+ if Assigned(FOnClick) then
+ FOnClick(self);
// The mouse up must still be handled even if we had a double click event.
HandleLMouseUp(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.shiftstate);
end;
diff --git a/src/gui/gui_bevel.pas b/src/gui/gui_bevel.pas
index faad992e..ee773819 100644
--- a/src/gui/gui_bevel.pas
+++ b/src/gui/gui_bevel.pas
@@ -51,6 +51,8 @@ type
property Shape: TBevelShape read FBevelShape write SetBevelShape default bsBox;
property Style: TBevelStyle read FBevelStyle write SetBevelStyle default bsRaised;
property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property OnClick;
+ property OnDoubleClick;
end;
diff --git a/src/gui/gui_button.pas b/src/gui/gui_button.pas
index ee7e835d..e6973177 100644
--- a/src/gui/gui_button.pas
+++ b/src/gui/gui_button.pas
@@ -71,7 +71,6 @@ type
procedure HandleMouseExit; override;
procedure HandleMouseEnter; override;
public
- OnClick: TNotifyEvent;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DoPush;
@@ -96,6 +95,7 @@ type
property ShowImage: Boolean read FShowImage write SetShowImage default True;
property OnMouseExit;
property OnMouseEnter;
+ property OnClick;
end;
diff --git a/src/gui/gui_label.pas b/src/gui/gui_label.pas
index efdb9bdb..6f4786b5 100644
--- a/src/gui/gui_label.pas
+++ b/src/gui/gui_label.pas
@@ -65,6 +65,8 @@ type
property Color;
property FontDesc;
property Text;
+ property OnClick;
+ property OnDoubleClick;
property OnMouseEnter;
property OnMouseExit;
property OnMouseDown;