diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fltk-events.ads (renamed from spec/fltk-event.ads) | 92 | ||||
-rw-r--r-- | spec/fltk-screen.ads | 37 | ||||
-rw-r--r-- | spec/fltk-static.ads | 15 | ||||
-rw-r--r-- | spec/fltk.ads | 90 |
4 files changed, 162 insertions, 72 deletions
diff --git a/spec/fltk-event.ads b/spec/fltk-events.ads index 483f317..6a556ff 100644 --- a/spec/fltk-event.ads +++ b/spec/fltk-events.ads @@ -14,17 +14,17 @@ private with System.Address_To_Access_Conversions; -package FLTK.Event is +package FLTK.Events is type Event_Handler is access function (Event : in Event_Kind) return Event_Outcome; - -- type Event_Dispatch is access function - -- (Event : in Event_Kind; - -- Win : access FLTK.Widgets.Groups.Windows.Window'Class) - -- return Event_Outcome; + type Event_Dispatch is access function + (Event : in Event_Kind; + Win : access FLTK.Widgets.Groups.Windows.Window'Class) + return Event_Outcome; @@ -37,16 +37,23 @@ package FLTK.Event is procedure Remove_Handler (Func : in Event_Handler); - -- function Get_Dispatch - -- return Event_Dispatch; + function Get_Dispatch + return Event_Dispatch; + + -- Any Event_Dispatch function set must call Handle + -- if you want the Event to actually be acknowledged. + procedure Set_Dispatch + (Func : in Event_Dispatch); - -- procedure Set_Dispatch - -- (Func : in Event_Dispatch); + function Handle_Dispatch + (Event : in Event_Kind; + Origin : in out FLTK.Widgets.Groups.Windows.Window'Class) + return Event_Outcome; - -- function Default_Dispatch - -- (Event : in Event_Kind; - -- Win : access FLTK.Widgets.Groups.Windows.Window'Class) - -- return Event_Outcome; + function Handle + (Event : in Event_Kind; + Origin : in out FLTK.Widgets.Groups.Windows.Window'Class) + return Event_Outcome; @@ -88,6 +95,17 @@ package FLTK.Event is + -- Clipboard -- + + function Clipboard_Text + return String; + + function Clipboard_Kind + return String; + + + + -- Multikey -- function Compose @@ -102,6 +120,10 @@ package FLTK.Event is function Text_Length return Natural; + function Test_Shortcut + (Shortcut : in Key_Combo) + return Boolean; + @@ -110,9 +132,11 @@ package FLTK.Event is function Last return Event_Kind; + -- Focuses on keyboard modifiers only, not mouse buttons function Last_Modifier return Modifier; + -- Focuses on keyboard modifiers only, not mouse buttons function Last_Modifier (Had : in Modifier) return Boolean; @@ -146,9 +170,18 @@ package FLTK.Event is function Is_Click return Boolean; + procedure Clear_Click; + function Is_Multi_Click return Boolean; + -- Returns the actual number of clicks. + -- So no clicks is 0, a single click is 1, a double click is 2, etc. + function Get_Clicks + return Natural; + + -- Will set the actual number of clicks. + -- This means setting it to 0 will make Is_Click return False. procedure Set_Clicks (To : in Natural); @@ -164,6 +197,19 @@ package FLTK.Event is function Mouse_Right return Boolean; + function Mouse_Back + return Boolean; + + function Mouse_Forward + return Boolean; + + procedure Mouse_Buttons + (Left, Middle, Right, Back, Forward : out Boolean); + + function Is_Inside + (Child : in FLTK.Widgets.Widget'Class) + return Boolean; + function Is_Inside (X, Y, W, H : in Integer) return Boolean; @@ -214,7 +260,7 @@ private Handlers : Handler_Vectors.Vector := Handler_Vectors.Empty_Vector; - -- Current_Dispatch : Event_Dispatch := null; + Current_Dispatch : Event_Dispatch := null; function fl_widget_get_user_data @@ -229,9 +275,10 @@ private pragma Inline (Add_Handler); pragma Inline (Remove_Handler); - -- pragma Inline (Get_Dispatch); - -- pragma Inline (Set_Dispatch); - -- pragma Inline (Default_Dispatch); + pragma Inline (Get_Dispatch); + pragma Inline (Set_Dispatch); + pragma Inline (Handle_Dispatch); + pragma Inline (Handle); pragma Inline (Get_Grab); pragma Inline (Set_Grab); @@ -245,10 +292,14 @@ private pragma Inline (Has_Visible_Focus); pragma Inline (Set_Visible_Focus); + pragma Inline (Clipboard_Text); + pragma Inline (Clipboard_Kind); + pragma Inline (Compose); pragma Inline (Compose_Reset); pragma Inline (Text); pragma Inline (Text_Length); + pragma Inline (Test_Shortcut); pragma Inline (Last); pragma Inline (Last_Modifier); @@ -261,12 +312,15 @@ private pragma Inline (Mouse_DY); pragma Inline (Get_Mouse); pragma Inline (Is_Click); + pragma Inline (Clear_Click); pragma Inline (Is_Multi_Click); + pragma Inline (Get_Clicks); pragma Inline (Set_Clicks); - pragma Inline (Last_Button); pragma Inline (Mouse_Left); pragma Inline (Mouse_Middle); pragma Inline (Mouse_Right); + pragma Inline (Mouse_Back); + pragma Inline (Mouse_Forward); pragma Inline (Is_Inside); pragma Inline (Last_Key); @@ -279,6 +333,6 @@ private pragma Inline (Key_Shift); -end FLTK.Event; +end FLTK.Events; diff --git a/spec/fltk-screen.ads b/spec/fltk-screen.ads index ccfd224..38db9aa 100644 --- a/spec/fltk-screen.ads +++ b/spec/fltk-screen.ads @@ -7,11 +7,23 @@ package FLTK.Screen is + type Visual_Mode is (RGB, RGB_24bit, Double_Buffer, Double_RGB, Double_RGB_24bit); + + + + -- Environment -- procedure Set_Display_String (Value : in String); + procedure Set_Visual_Mode + (Value : in Visual_Mode); + + function Set_Visual_Mode + (Value : in Visual_Mode) + return Boolean; + @@ -87,10 +99,30 @@ package FLTK.Screen is PX, PY, PW, PH : in Integer); + + + -- Drawing -- + + function Is_Damaged + return Boolean; + + procedure Set_Damaged + (To : in Boolean); + + procedure Flush; + + procedure Redraw; + + private + pragma Import (C, Flush, "fl_screen_flush"); + pragma Import (C, Redraw, "fl_screen_redraw"); + + pragma Inline (Set_Display_String); + pragma Inline (Set_Visual_Mode); pragma Inline (Get_X); pragma Inline (Get_Y); @@ -104,6 +136,11 @@ private pragma Inline (Work_Area); pragma Inline (Bounding_Rect); + pragma Inline (Is_Damaged); + pragma Inline (Set_Damaged); + pragma Inline (Flush); + pragma Inline (Redraw); + end FLTK.Screen; diff --git a/spec/fltk-static.ads b/spec/fltk-static.ads index a2a9ff4..6b54878 100644 --- a/spec/fltk-static.ads +++ b/spec/fltk-static.ads @@ -53,7 +53,7 @@ package FLTK.Static is - -- Interthread Notify -- + -- Thread Notify -- procedure Add_Awake_Handler (Func : in Awake_Handler); @@ -61,6 +61,12 @@ package FLTK.Static is function Get_Awake_Handler return Awake_Handler; + procedure Awake; + + procedure Lock; + + procedure Unlock; + @@ -350,6 +356,10 @@ private (Read => 1, Write => 4, Except => 8); + pragma Import (C, Awake, "fl_static_awake"); + pragma Import (C, Lock, "fl_static_lock"); + pragma Import (C, Unlock, "fl_static_unlock"); + pragma Import (C, Own_Colormap, "fl_static_own_colormap"); pragma Import (C, System_Colors, "fl_static_get_system_colors"); @@ -363,6 +373,9 @@ private pragma Inline (Add_Awake_Handler); pragma Inline (Get_Awake_Handler); + pragma Inline (Awake); + pragma Inline (Lock); + pragma Inline (Unlock); pragma Inline (Add_Check); pragma Inline (Has_Check); diff --git a/spec/fltk.ads b/spec/fltk.ads index ddac9b2..2a38434 100644 --- a/spec/fltk.ads +++ b/spec/fltk.ads @@ -11,7 +11,7 @@ with private with Ada.Unchecked_Conversion, - Interfaces.C, + Interfaces.C.Strings, System.Storage_Elements; @@ -228,7 +228,14 @@ package FLTK is Tab_Key : constant Keypress; - type Mouse_Button is (No_Button, Left_Button, Middle_Button, Right_Button); + type Mouse_Button is + (No_Button, + Left_Button, + Middle_Button, + Right_Button, + Back_Button, + Forward_Button, + Any_Button); type Key_Combo is private; @@ -496,6 +503,14 @@ package FLTK is + -- Clipboard Attributes -- + + Clipboard_Image : constant String; + Clipboard_Plain_Text : constant String; + + + + -- Versioning -- type Version_Number is new Natural; @@ -516,35 +531,10 @@ package FLTK is - -- Threads -- - - procedure Awake; - - procedure Lock; - - procedure Unlock; - - - - - -- Drawing -- - - -- Need to check/revise these damage bits... - function Is_Damaged - return Boolean; - - procedure Set_Damaged - (To : in Boolean); - - procedure Flush; - - procedure Redraw; - - - - -- Event Loop -- + procedure Check; + function Check return Boolean; @@ -681,34 +671,34 @@ private function To_C (Key : in Key_Combo) - return Interfaces.C.int; + return Interfaces.C.unsigned; function To_Ada - (Key : in Interfaces.C.int) + (Key : in Interfaces.C.unsigned) return Key_Combo; function To_C (Key : in Keypress) - return Interfaces.C.int; + return Interfaces.C.unsigned; function To_Ada - (Key : in Interfaces.C.int) + (Key : in Interfaces.C.unsigned) return Keypress; function To_C (Modi : in Modifier) - return Interfaces.C.int; + return Interfaces.C.unsigned; function To_Ada - (Modi : in Interfaces.C.int) + (Modi : in Interfaces.C.unsigned) return Modifier; function To_C (Button : in Mouse_Button) - return Interfaces.C.int; + return Interfaces.C.unsigned; function To_Ada - (Button : in Interfaces.C.int) + (Button : in Interfaces.C.unsigned) return Mouse_Button; -- these values designed to align with FLTK enumeration types @@ -839,19 +829,20 @@ private - pragma Import (C, Awake, "fl_awake"); - pragma Import (C, Lock, "fl_lock"); - pragma Import (C, Unlock, "fl_unlock"); + clip_image_char_ptr : Interfaces.C.Strings.chars_ptr; + pragma Import (C, clip_image_char_ptr, "fl_clip_image_char_ptr"); + + clip_plain_text_char_ptr : Interfaces.C.Strings.chars_ptr; + pragma Import (C, clip_plain_text_char_ptr, "fl_clip_plain_text_char_ptr"); - pragma Import (C, Flush, "fl_flush"); - pragma Import (C, Redraw, "fl_redraw"); + Clipboard_Image : constant String := Interfaces.C.Strings.Value (clip_image_char_ptr); + Clipboard_Plain_Text : constant String := Interfaces.C.Strings.Value (clip_plain_text_char_ptr); pragma Inline (RGB_Color); pragma Inline (Color_Cube); - pragma Inline (Contrast); pragma Inline (Grey_Ramp); pragma Inline (Darker); pragma Inline (Lighter); @@ -859,20 +850,15 @@ private pragma Inline (Inactive); pragma Inline (Color_Average); + pragma Inline (Filled); + pragma Inline (Frame); + pragma Inline (Down); + pragma Inline (ABI_Check); pragma Inline (ABI_Version); pragma Inline (API_Version); pragma Inline (Version); - pragma Inline (Awake); - pragma Inline (Lock); - pragma Inline (Unlock); - - pragma Inline (Is_Damaged); - pragma Inline (Set_Damaged); - pragma Inline (Flush); - pragma Inline (Redraw); - pragma Inline (Check); pragma Inline (Ready); pragma Inline (Wait); |