diff options
Diffstat (limited to 'src/displays.adb')
-rw-r--r-- | src/displays.adb | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/displays.adb b/src/displays.adb index 4f3da3d..6931db9 100644 --- a/src/displays.adb +++ b/src/displays.adb @@ -46,7 +46,8 @@ package body Displays is Move_Box => B.Box'(B.Create (Stat_Box_Width, Message_Box_Height, Stat_Box_Width, Stat_Box_Height, "")), Current_Grid => null, - Key_Func => null) do + Key_Func => null, + Mouse_Func => null) do This.Add (This.Message_Box); This.Add (This.Level_Box); @@ -58,8 +59,6 @@ package body Displays is end Create; - - function Create (W, H : in Integer) return Display is @@ -68,8 +67,6 @@ package body Displays is end Create; - - function Create return Display is begin @@ -92,8 +89,6 @@ package body Displays is end Set_Grid; - - procedure Adjust_Grid (This : in out Display; Cols, Rows : in Natural) is @@ -104,8 +99,6 @@ package body Displays is end Adjust_Grid; - - procedure Ensure_Correct_Size (This : in out Display) is @@ -127,8 +120,6 @@ package body Displays is end Ensure_Correct_Size; - - procedure Centre_On_Screen (This : in out Display) is @@ -150,8 +141,6 @@ package body Displays is end Set_Message; - - procedure Set_Level_Number (This : in out Display; To : in Natural) is @@ -160,8 +149,6 @@ package body Displays is end Set_Level_Number; - - procedure Set_Move_Number (This : in out Display; To : in Natural) is @@ -180,6 +167,14 @@ package body Displays is end Set_Keyboard_Callback; + procedure Set_Mouse_Callback + (This : in out Display; + Func : in Mouse_Callback) is + begin + This.Mouse_Func := Func; + end Set_Mouse_Callback; + + function Handle @@ -187,10 +182,18 @@ package body Displays is Event : in FLTK.Event_Kind) return FLTK.Event_Outcome is - use type FLTK.Event_Kind; + use type FLTK.Event_Kind, FLTK.Event_Outcome; begin - if This.Key_Func /= null and Event = FLTK.Keydown then - return This.Key_Func (FLTK.Event.Last_Keypress); + if This.Key_Func /= null and then Event = FLTK.Keydown and then + This.Key_Func (FLTK.Event.Last_Keypress) = FLTK.Handled + then + return FLTK.Handled; + + elsif This.Mouse_Func /= null and then Event = FLTK.Release and then + This.Mouse_Func (FLTK.Event.Mouse_X, FLTK.Event.Mouse_Y) = FLTK.Handled + then + return FLTK.Handled; + else return WD.Double_Window (This).Handle (Event); end if; |