summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-02-17 22:32:41 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-02-17 22:32:41 +0000
commit80edb8c64ec1ce85e4ffdd90c9302ea4bd97855b (patch)
treeb018a154058a06daa50e0b7d0001a486e72505ec
parente89e5d40ae6546b01fb346965e8a383d705f48d5 (diff)
downloadfpGUI-80edb8c64ec1ce85e4ffdd90c9302ea4bd97855b.tar.xz
* Minor fixes to the mouse and menu handling.
-rw-r--r--src/gui/gui_menu.pas18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/gui_menu.pas b/src/gui/gui_menu.pas
index a9a3cfbe..65fdd209 100644
--- a/src/gui/gui_menu.pas
+++ b/src/gui/gui_menu.pas
@@ -87,7 +87,6 @@ type
// Actual Menu Items are stored in TComponent's Components property
// Visible only items are stored in FItems just before a paint
-
TfpgPopupMenu = class(TfpgPopupWindow)
private
FBeforeShow: TNotifyEvent;
@@ -108,6 +107,7 @@ type
FSymbolWidth: integer;
FItems: TList;
FFocusItem: integer;
+ procedure HandleMouseEnter; override;
procedure HandleMouseExit; override;
procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override;
procedure HandleLMouseDown(x, y: integer; shiftstate: TShiftState); override;
@@ -115,6 +115,7 @@ type
procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override;
procedure HandlePaint; override;
procedure HandleShow; override;
+ procedure HandleClose; override;
procedure DrawItem(mi: TfpgMenuItem; rect: TfpgRect); virtual;
procedure DrawRow(line: integer; focus: boolean); virtual;
function ItemHeight(mi: TfpgMenuItem): integer; virtual;
@@ -945,7 +946,12 @@ procedure TfpgPopupMenu.HandleShow;
begin
PrepareToShow;
inherited HandleShow;
- CaptureMouse;
+end;
+
+procedure TfpgPopupMenu.HandleClose;
+begin
+ ReleaseMouse;
+ inherited HandleClose;
end;
function TfpgPopupMenu.VisibleCount: integer;
@@ -1084,8 +1090,15 @@ begin
end;
end;
+procedure TfpgPopupMenu.HandleMouseEnter;
+begin
+ inherited HandleMouseEnter;
+ CaptureMouse;
+end;
+
procedure TfpgPopupMenu.HandleMouseExit;
begin
+ ReleaseMouse;
inherited HandleMouseExit;
FFocusItem := 0;
Repaint;
@@ -1192,7 +1205,6 @@ end;
destructor TfpgPopupMenu.Destroy;
begin
- ReleaseMouse;
FItems.Free;
inherited Destroy;
end;