1package body agar.gui.widget.socket is 2 3 package cbinds is 4 function from_bitmap 5 (parent : widget_access_t; 6 flags : flags_t; 7 file : cs.chars_ptr) return socket_access_t; 8 pragma import (c, from_bitmap, "AG_SocketFromBMP"); 9 10 procedure set_padding 11 (socket : socket_access_t; 12 left : c.int; 13 right : c.int; 14 top : c.int; 15 bottom : c.int); 16 pragma import (c, set_padding, "AG_SocketSetPadding"); 17 18 procedure shape_rectangle 19 (socket : socket_access_t; 20 width : c.unsigned; 21 height : c.unsigned); 22 pragma import (c, shape_rectangle, "AG_SocketBgRect"); 23 24 procedure shape_circle 25 (socket : socket_access_t; 26 radius : c.unsigned); 27 pragma import (c, shape_circle, "AG_SocketBgCircle"); 28 end cbinds; 29 30 function from_bitmap 31 (parent : widget_access_t; 32 flags : flags_t; 33 file : string) return socket_access_t 34 is 35 ca_file : aliased c.char_array := c.to_c (file); 36 begin 37 return cbinds.from_bitmap 38 (parent => parent, 39 flags => flags, 40 file => cs.to_chars_ptr (ca_file'unchecked_access)); 41 end from_bitmap; 42 43 procedure set_padding 44 (socket : socket_access_t; 45 left : natural; 46 right : natural; 47 top : natural; 48 bottom : natural) is 49 begin 50 cbinds.set_padding 51 (socket => socket, 52 left => c.int (left), 53 right => c.int (right), 54 top => c.int (top), 55 bottom => c.int (bottom)); 56 end set_padding; 57 58 procedure shape_rectangle 59 (socket : socket_access_t; 60 width : natural; 61 height : natural) is 62 begin 63 cbinds.shape_rectangle 64 (socket => socket, 65 width => c.unsigned (width), 66 height => c.unsigned (height)); 67 end shape_rectangle; 68 69 procedure shape_circle 70 (socket : socket_access_t; 71 radius : natural) is 72 begin 73 cbinds.shape_circle 74 (socket => socket, 75 radius => c.unsigned (radius)); 76 end shape_circle; 77 78 function widget (socket : socket_access_t) return widget_access_t is 79 begin 80 return socket.widget'access; 81 end widget; 82 83 function icon (socket : socket_access_t) return agar.gui.widget.icon.icon_access_t is 84 begin 85 return socket.icon; 86 end icon; 87 88end agar.gui.widget.socket; 89