diff options
Diffstat (limited to 'src/fltk.ads')
-rw-r--r-- | src/fltk.ads | 154 |
1 files changed, 131 insertions, 23 deletions
diff --git a/src/fltk.ads b/src/fltk.ads index 81a3763..55ad126 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -13,14 +13,17 @@ private with package FLTK is - function Run return Integer; + -- Ugly implementation detail, never use this. + -- This is necessary so things like Text_Buffers and + -- Widgets can talk to each other behind the binding. + type Wrapper is new Ada.Finalization.Limited_Controlled with private; + -- with Type_Invariant => Is_Valid (Wrapper); + + function Is_Valid + (Object : in Wrapper) + return Boolean; - -- ugly implementation detail, never use this - -- just ignore the hand moving behind the curtain - -- (this is necessary so things like text_buffers and - -- widgets can talk to each other behind the binding) - type Wrapper is abstract new Ada.Finalization.Limited_Controlled with private; type Color is new Natural; @@ -28,6 +31,8 @@ package FLTK is No_Color : constant Color; + + type Alignment is private; Align_Center : constant Alignment; Align_Top : constant Alignment; @@ -36,6 +41,8 @@ package FLTK is Align_Right : constant Alignment; + + type Keypress is private; subtype Pressable_Key is Character range Character'Val (32) .. Character'Val (126); function Press (Key : in Pressable_Key) return Keypress; @@ -54,17 +61,14 @@ package FLTK is Up_Key : constant Keypress; Escape_Key : constant Keypress; - type Mouse_Button is (No_Button, Left_Button, Middle_Button, Right_Button); - type Key_Combo is private; function Press (Key : in Pressable_Key) return Key_Combo; function Press (Key : in Keypress) return Key_Combo; function Press (Key : in Mouse_Button) return Key_Combo; No_Key : constant Key_Combo; - type Modifier is private; function "+" (Left, Right : in Modifier) return Modifier; function "+" (Left : in Modifier; Right : in Pressable_Key) return Key_Combo; @@ -77,6 +81,8 @@ package FLTK is Mod_Alt : constant Modifier; + + type Box_Kind is (No_Box, Flat_Box, @@ -137,6 +143,8 @@ package FLTK is Free_Box); + + type Font_Kind is (Helvetica, Helvetica_Bold, @@ -156,10 +164,13 @@ package FLTK is Zapf_Dingbats, Free_Font); - type Font_Size is new Natural; Normal_Size : constant Font_Size := 14; + type Font_Size_Array is array (Positive range <>) of Font_Size; + + + type Label_Kind is (Normal_Label, @@ -173,6 +184,8 @@ package FLTK is Free_Label); + + type Event_Kind is (No_Event, Push, @@ -201,10 +214,11 @@ package FLTK is Screen_Config_Changed, Fullscreen); - type Event_Outcome is (Not_Handled, Handled); + + type Menu_Flag is private; function "+" (Left, Right : in Menu_Flag) return Menu_Flag; Flag_Normal : constant Menu_Flag; @@ -217,30 +231,88 @@ package FLTK is Flag_Divider : constant Menu_Flag; -private - function Has_Valid_Ptr - (This : in Wrapper) + type Version_Number is new Natural; + + + + + function ABI_Check + (ABI_Ver : in Version_Number) + return Boolean; + + function ABI_Version + return Version_Number; + + function API_Version + return Version_Number; + + function Version + return Version_Number; + + + + + procedure Awake; + + procedure Lock; + + procedure Unlock; + + + + + function Is_Damaged + return Boolean; + + procedure Set_Damaged + (To : in Boolean); + + procedure Flush; + + procedure Redraw; + + + + + function Check return Boolean; - type Wrapper is abstract new Ada.Finalization.Limited_Controlled with + function Ready + return Boolean; + + function Wait + return Integer; + + function Wait + (Seconds : in Long_Float) + return Integer; + + function Run + return Integer; + + +private + + + type Wrapper is new Ada.Finalization.Limited_Controlled with record Void_Ptr : System.Address; Needs_Dealloc : Boolean := True; end record; - -- with Type_Invariant => Has_Valid_Ptr (Wrapper); - - -- unsure if the above invariant is doing what I'm after - -- oh well, something to work on overriding procedure Initialize (This : in out Wrapper); + + No_Color : constant Color := 0; + + type Alignment is new Interfaces.Unsigned_16; Align_Center : constant Alignment := 0; Align_Top : constant Alignment := 1; @@ -249,6 +321,8 @@ private Align_Right : constant Alignment := 8; + + type Keypress is new Interfaces.Unsigned_16; type Modifier is new Interfaces.Unsigned_16; type Key_Combo is @@ -258,7 +332,6 @@ private Mousecode : Mouse_Button; end record; - function To_C (Key : in Key_Combo) return Interfaces.C.unsigned_long; @@ -291,17 +364,14 @@ private (Button : in Interfaces.C.unsigned_long) return Mouse_Button; - -- these values designed to align with FLTK enumeration types Mod_None : constant Modifier := 2#00000000#; Mod_Shift : constant Modifier := 2#00000001#; Mod_Ctrl : constant Modifier := 2#00000100#; Mod_Alt : constant Modifier := 2#00001000#; - No_Key : constant Key_Combo := (Modcode => Mod_None, Keycode => 0, Mousecode => No_Button); - -- these values correspond to constants defined in FLTK Enumerations.H Enter_Key : constant Keypress := 16#ff0d#; Keypad_Enter_Key : constant Keypress := 16#ff8d#; @@ -319,6 +389,8 @@ private Escape_Key : constant Keypress := 16#ff1b#; + + type Menu_Flag is new Interfaces.Unsigned_8; Flag_Normal : constant Menu_Flag := 2#00000000#; Flag_Inactive : constant Menu_Flag := 2#00000001#; @@ -331,5 +403,41 @@ private Flag_Divider : constant Menu_Flag := 2#10000000#; + + + pragma Import (C, Awake, "fl_awake"); + pragma Import (C, Lock, "fl_lock"); + pragma Import (C, Unlock, "fl_unlock"); + + + pragma Import (C, Flush, "fl_flush"); + pragma Import (C, Redraw, "fl_redraw"); + + + + + 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); + pragma Inline (Run); + + end FLTK; |