diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-22 20:27:55 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-22 20:27:55 +1000 |
commit | bc87503ae6879d76c579828f2f90de0383239373 (patch) | |
tree | f55947488a437a06eeb4bc404bf10dfdb936cc03 /src | |
parent | a466cb205885576087f40df28dd0680d66aebbc9 (diff) |
Moved FLTK.Enums to FLTK
Diffstat (limited to 'src')
-rw-r--r-- | src/fltk-enum_values.ads | 7 | ||||
-rw-r--r-- | src/fltk-enums.adb | 71 | ||||
-rw-r--r-- | src/fltk-enums.ads | 178 | ||||
-rw-r--r-- | src/fltk-images.ads | 3 | ||||
-rw-r--r-- | src/fltk-widgets-groups-text_displays-text_editors.ads | 3 | ||||
-rw-r--r-- | src/fltk-widgets-groups-text_displays.ads | 1 | ||||
-rw-r--r-- | src/fltk-widgets-menus.adb | 1 | ||||
-rw-r--r-- | src/fltk-widgets-menus.ads | 1 | ||||
-rw-r--r-- | src/fltk-widgets.ads | 1 | ||||
-rw-r--r-- | src/fltk.adb | 64 | ||||
-rw-r--r-- | src/fltk.ads | 170 |
11 files changed, 234 insertions, 266 deletions
diff --git a/src/fltk-enum_values.ads b/src/fltk-enum_values.ads deleted file mode 100644 index 068d5c1..0000000 --- a/src/fltk-enum_values.ads +++ /dev/null @@ -1,7 +0,0 @@ - - -private package FLTK.Enum_Values is - - -end FLTK.Enum_Values; - diff --git a/src/fltk-enums.adb b/src/fltk-enums.adb deleted file mode 100644 index 292e5ff..0000000 --- a/src/fltk-enums.adb +++ /dev/null @@ -1,71 +0,0 @@ - - -with Interfaces.C; -use type Interfaces.C.unsigned_long; - - -package body FLTK.Enums is - - - function Shortcut - (Key : Pressable_Key) - return Shortcut_Key is - begin - return This : Shortcut_Key do - This.Modifier := Mod_None; - This.Keypress := Key; - end return; - end Shortcut; - - - - - function Key_To_C - (Key : Shortcut_Key) - return Interfaces.C.unsigned_long is - begin - return Interfaces.C.unsigned_long (Key.Modifier) * - 65536 + Character'Pos (Key.Keypress); - end Key_To_C; - - - - - function "+" - (Left, Right : in Modifier_Key) - return Modifier_Key is - begin - return Left or Right; - end "+"; - - - - - function "+" - (Left : in Modifier_Key; - Right : in Pressable_Key) - return Shortcut_Key is - begin - return This : Shortcut_Key do - This.Modifier := Left; - This.Keypress := Right; - end return; - end "+"; - - - - - function "+" - (Left : in Modifier_Key; - Right : in Shortcut_Key) - return Shortcut_Key is - begin - return This : Shortcut_Key do - This.Modifier := Left or Right.Modifier; - This.Keypress := Right.Keypress; - end return; - end "+"; - - -end FLTK.Enums; - diff --git a/src/fltk-enums.ads b/src/fltk-enums.ads deleted file mode 100644 index ff8e69a..0000000 --- a/src/fltk-enums.ads +++ /dev/null @@ -1,178 +0,0 @@ - - -with Interfaces.C; -private with FLTK.Enum_Values; - - -package FLTK.Enums is - - - type Box_Kind is - (No_Box, - Flat_Box, - Up_Box, - Down_Box, - Up_Frame, - Down_Frame, - Thin_Up_Box, - Thin_Down_Box, - Thin_Up_Frame, - Thin_Down_Frame, - Engraved_Box, - Embossed_Box, - Engraved_Frame, - Embossed_Frame, - Border_Box, - Shadow_Box, - Border_Frame, - Shadow_Frame, - Rounded_Box, - RShadow_Box, - Rounded_Frame, - RFlat_Box, - Round_Up_Box, - Round_Down_Box, - Diamond_Up_Box, - Diamond_Down_Box, - Oval_Box, - OShadow_Box, - Oval_Frame, - OFlat_Box, - Plastic_Up_Box, - Plastic_Down_Box, - Plastic_Up_Frame, - Plastic_Down_Frame, - Plastic_Thin_Up_Box, - Plastic_Thin_Down_Box, - Plastic_Round_Up_Box, - Plastic_Round_Down_Box, - Gtk_Up_Box, - Gtk_Down_Box, - Gtk_Up_Frame, - Gtk_Down_Frame, - Gtk_Thin_Up_Box, - Gtk_Thin_Down_Box, - Gtk_Thin_Up_Frame, - Gtk_Thin_Down_Frame, - Gtk_Round_Up_Box, - Gtk_Round_Down_Box, - Gleam_Up_Box, - Gleam_Down_Box, - Gleam_Up_Frame, - Gleam_Down_Frame, - Gleam_Thin_Up_Box, - Gleam_Thin_Down_Box, - Gleam_Round_Up_Box, - Gleam_Round_Down_Box, - Free_Box); - - - type Font_Kind is - (Helvetica, - Helvetica_Bold, - Helvetica_Italic, - Helvetica_Bold_Italic, - Courier, - Courier_Bold, - Courier_Italic, - Courier_Bold_Italic, - Times, - Times_Bold, - Times_Italic, - Times_Bold_Italic, - Symbol, - Screen, - Screen_Bold, - Zapf_Dingbats, - Free_Font); - - - type Label_Kind is - (Normal_Label, - No_Label, - Shadow_Label, - Engraved_Label, - Embossed_Label, - Multi_Label, - Icon_Label, - Image_Label, - Free_Label); - - - type Event_Kind is - (No_Event, - Push, - Release, - Enter, - Leave, - Drag, - Focus, - Unfocus, - Keydown, - Keyup, - Close, - Move, - Shortcut, - Deactivate, - Activate, - Hide, - Show, - Paste, - Selection_Clear, - Mouse_Wheel, - DnD_Enter, - DnD_Drag, - DnD_Leave, - DnD_Release, - Screen_Config_Changed, - Fullscreen); - - - type Color is new Natural; - - - -- type Modifier_Key is private; - type Modifier_Key is new Interfaces.Unsigned_8; - - -- type Shortcut_Key is private; - type Shortcut_Key is - record - Modifier : Modifier_Key; - Keypress : Character; - end record; - - subtype Pressable_Key is Character range Character'Val (32) .. Character'Val (126); - function Shortcut (Key : Pressable_Key) return Shortcut_Key; - No_Key : constant Shortcut_Key; - - - function "+" (Left, Right : in Modifier_Key) return Modifier_Key; - function "+" (Left : in Modifier_Key; Right : in Pressable_Key) return Shortcut_Key; - function "+" (Left : in Modifier_Key; Right : in Shortcut_Key) return Shortcut_Key; - Mod_None : constant Modifier_Key; - Mod_Shift : constant Modifier_Key; - Mod_Ctrl : constant Modifier_Key; - Mod_Alt : constant Modifier_Key; - - - function Key_To_C - (Key : Shortcut_Key) - return Interfaces.C.unsigned_long; - - -private - - - -- these values designed to align with FLTK enumeration types - Mod_None : constant Modifier_Key := 2#00000000#; - Mod_Shift : constant Modifier_Key := 2#00000001#; - Mod_Ctrl : constant Modifier_Key := 2#00000100#; - Mod_Alt : constant Modifier_Key := 2#00001000#; - - - No_Key : constant Shortcut_Key := - (Modifier => Mod_None, Keypress => Character'Val (0)); - - -end FLTK.Enums; - diff --git a/src/fltk-images.ads b/src/fltk-images.ads index 980eb23..d2cb9f2 100644 --- a/src/fltk-images.ads +++ b/src/fltk-images.ads @@ -1,8 +1,5 @@ -with FLTK.Enums; use FLTK.Enums; - - package FLTK.Images is diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads index 63d154f..8d88642 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.ads +++ b/src/fltk-widgets-groups-text_displays-text_editors.ads @@ -1,8 +1,5 @@ -with FLTK.Enums; use FLTK.Enums; - - package FLTK.Widgets.Groups.Text_Displays.Text_Editors is diff --git a/src/fltk-widgets-groups-text_displays.ads b/src/fltk-widgets-groups-text_displays.ads index 0d05c2e..2a6d50d 100644 --- a/src/fltk-widgets-groups-text_displays.ads +++ b/src/fltk-widgets-groups-text_displays.ads @@ -1,7 +1,6 @@ with FLTK.Text_Buffers; -with FLTK.Enums; use FLTK.Enums; package FLTK.Widgets.Groups.Text_Displays is diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb index 67a2cd9..b97c966 100644 --- a/src/fltk-widgets-menus.adb +++ b/src/fltk-widgets-menus.adb @@ -1,6 +1,5 @@ -with FLTK.Enums; use FLTK.Enums; with Interfaces.C; with System; use type System.Address; diff --git a/src/fltk-widgets-menus.ads b/src/fltk-widgets-menus.ads index a9f957f..ec2c979 100644 --- a/src/fltk-widgets-menus.ads +++ b/src/fltk-widgets-menus.ads @@ -1,6 +1,5 @@ -with FLTK.Enums; use FLTK.Enums; private with Interfaces; private with System; diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index 36598bf..46e0c4c 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -1,6 +1,5 @@ -with FLTK.Enums; use FLTK.Enums; with FLTK.Images; limited with FLTK.Widgets.Groups; private with System; diff --git a/src/fltk.adb b/src/fltk.adb index 983f308..8591ac2 100644 --- a/src/fltk.adb +++ b/src/fltk.adb @@ -3,6 +3,7 @@ with Interfaces.C; with System; use type System.Address; +use type Interfaces.C.unsigned_long; package body FLTK is @@ -40,5 +41,68 @@ package body FLTK is end Initialize; + + + + function Shortcut + (Key : Pressable_Key) + return Shortcut_Key is + begin + return This : Shortcut_Key do + This.Modifier := Mod_None; + This.Keypress := Key; + end return; + end Shortcut; + + + + + function "+" + (Left, Right : in Modifier_Key) + return Modifier_Key is + begin + return Left or Right; + end "+"; + + + + + function "+" + (Left : in Modifier_Key; + Right : in Pressable_Key) + return Shortcut_Key is + begin + return This : Shortcut_Key do + This.Modifier := Left; + This.Keypress := Right; + end return; + end "+"; + + + + + function "+" + (Left : in Modifier_Key; + Right : in Shortcut_Key) + return Shortcut_Key is + begin + return This : Shortcut_Key do + This.Modifier := Left or Right.Modifier; + This.Keypress := Right.Keypress; + end return; + end "+"; + + + + + function Key_To_C + (Key : Shortcut_Key) + return Interfaces.C.unsigned_long is + begin + return Interfaces.C.unsigned_long (Key.Modifier) * + 65536 + Character'Pos (Key.Keypress); + end Key_To_C; + + end FLTK; diff --git a/src/fltk.ads b/src/fltk.ads index 490050d..d825f5e 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -1,6 +1,7 @@ with Ada.Finalization; +private with Interfaces.C; private with System; @@ -17,6 +18,149 @@ package FLTK is type Wrapper is abstract new Ada.Finalization.Limited_Controlled with private; + type Color is new Natural; + + + type Alignment is new Natural; + + + type Shortcut_Key is private; + subtype Pressable_Key is Character range Character'Val (32) .. Character'Val (126); + function Shortcut (Key : Pressable_Key) return Shortcut_Key; + No_Key : constant Shortcut_Key; + + + type Modifier_Key is private; + function "+" (Left, Right : in Modifier_Key) return Modifier_Key; + function "+" (Left : in Modifier_Key; Right : in Pressable_Key) return Shortcut_Key; + function "+" (Left : in Modifier_Key; Right : in Shortcut_Key) return Shortcut_Key; + Mod_None : constant Modifier_Key; + Mod_Shift : constant Modifier_Key; + Mod_Ctrl : constant Modifier_Key; + Mod_Alt : constant Modifier_Key; + + + type Box_Kind is + (No_Box, + Flat_Box, + Up_Box, + Down_Box, + Up_Frame, + Down_Frame, + Thin_Up_Box, + Thin_Down_Box, + Thin_Up_Frame, + Thin_Down_Frame, + Engraved_Box, + Embossed_Box, + Engraved_Frame, + Embossed_Frame, + Border_Box, + Shadow_Box, + Border_Frame, + Shadow_Frame, + Rounded_Box, + RShadow_Box, + Rounded_Frame, + RFlat_Box, + Round_Up_Box, + Round_Down_Box, + Diamond_Up_Box, + Diamond_Down_Box, + Oval_Box, + OShadow_Box, + Oval_Frame, + OFlat_Box, + Plastic_Up_Box, + Plastic_Down_Box, + Plastic_Up_Frame, + Plastic_Down_Frame, + Plastic_Thin_Up_Box, + Plastic_Thin_Down_Box, + Plastic_Round_Up_Box, + Plastic_Round_Down_Box, + Gtk_Up_Box, + Gtk_Down_Box, + Gtk_Up_Frame, + Gtk_Down_Frame, + Gtk_Thin_Up_Box, + Gtk_Thin_Down_Box, + Gtk_Thin_Up_Frame, + Gtk_Thin_Down_Frame, + Gtk_Round_Up_Box, + Gtk_Round_Down_Box, + Gleam_Up_Box, + Gleam_Down_Box, + Gleam_Up_Frame, + Gleam_Down_Frame, + Gleam_Thin_Up_Box, + Gleam_Thin_Down_Box, + Gleam_Round_Up_Box, + Gleam_Round_Down_Box, + Free_Box); + + + type Font_Kind is + (Helvetica, + Helvetica_Bold, + Helvetica_Italic, + Helvetica_Bold_Italic, + Courier, + Courier_Bold, + Courier_Italic, + Courier_Bold_Italic, + Times, + Times_Bold, + Times_Italic, + Times_Bold_Italic, + Symbol, + Screen, + Screen_Bold, + Zapf_Dingbats, + Free_Font); + + + type Label_Kind is + (Normal_Label, + No_Label, + Shadow_Label, + Engraved_Label, + Embossed_Label, + Multi_Label, + Icon_Label, + Image_Label, + Free_Label); + + + type Event_Kind is + (No_Event, + Push, + Release, + Enter, + Leave, + Drag, + Focus, + Unfocus, + Keydown, + Keyup, + Close, + Move, + Shortcut, + Deactivate, + Activate, + Hide, + Show, + Paste, + Selection_Clear, + Mouse_Wheel, + DnD_Enter, + DnD_Drag, + DnD_Leave, + DnD_Release, + Screen_Config_Changed, + Fullscreen); + + private @@ -39,5 +183,31 @@ private (This : in out Wrapper); + type Modifier_Key is new Interfaces.Unsigned_8; + + + type Shortcut_Key is + record + Modifier : Modifier_Key; + Keypress : Character; + end record; + + + function Key_To_C + (Key : Shortcut_Key) + return Interfaces.C.unsigned_long; + + + -- these values designed to align with FLTK enumeration types + Mod_None : constant Modifier_Key := 2#00000000#; + Mod_Shift : constant Modifier_Key := 2#00000001#; + Mod_Ctrl : constant Modifier_Key := 2#00000100#; + Mod_Alt : constant Modifier_Key := 2#00001000#; + + + No_Key : constant Shortcut_Key := + (Modifier => Mod_None, Keypress => Character'Val (0)); + + end FLTK; |