]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/ada_include/terminal_interface-curses-menus-item_user_data.adb
ncurses 4.1
[ncurses.git] / Ada95 / ada_include / terminal_interface-curses-menus-item_user_data.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                           GNAT ncurses Binding                           --
4 --                                                                          --
5 --               Terminal_Interface.Curses.Menus.Item_User_Data             --
6 --                                                                          --
7 --                                 B O D Y                                  --
8 --                                                                          --
9 --  Version 00.92                                                           --
10 --                                                                          --
11 --  The ncurses Ada95 binding is copyrighted 1996 by                        --
12 --  Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                     --
13 --                                                                          --
14 --  Permission is hereby granted to reproduce and distribute this           --
15 --  binding by any means and for any fee, whether alone or as part          --
16 --  of a larger distribution, in source or in binary form, PROVIDED         --
17 --  this notice is included with any such distribution, and is not          --
18 --  removed from any of its header files. Mention of ncurses and the        --
19 --  author of this binding in any applications linked with it is            --
20 --  highly appreciated.                                                     --
21 --                                                                          --
22 --  This binding comes AS IS with no warranty, implied or expressed.        --
23 ------------------------------------------------------------------------------
24 --  Version Control:
25 --  $Revision: 1.3 $
26 ------------------------------------------------------------------------------
27 with Interfaces.C;
28 with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
29
30 package body Terminal_Interface.Curses.Menus.Item_User_Data is
31
32    use type Interfaces.C.int;
33
34    procedure Set_User_Data (Itm  : in Item;
35                             Data : in User_Access)
36    is
37       function Set_Item_Userptr (Itm  : Item;
38                                  Addr : User_Access)  return C_Int;
39       pragma Import (C, Set_Item_Userptr, "set_item_userptr");
40
41       Res : constant Eti_Error := Set_Item_Userptr (Itm, Data);
42    begin
43       if  Res /= E_Ok then
44          Eti_Exception (Res);
45       end if;
46    end Set_User_Data;
47
48    procedure Get_User_Data (Itm  : in  Item;
49                             Data : out User_Access)
50    is
51       function Item_Userptr (Itm : Item) return User_Access;
52       pragma Import (C, Item_Userptr, "item_userptr");
53    begin
54       Data := Item_Userptr (Itm);
55    end Get_User_Data;
56
57 end Terminal_Interface.Curses.Menus.Item_User_Data;