1with agar.gui.widget.box; 2with agar.gui.widget.button; 3 4package agar.gui.widget.toolbar is 5 6 type type_t is (TOOLBAR_HORIZ, TOOLBAR_VERT); 7 for type_t use (TOOLBAR_HORIZ => 0, TOOLBAR_VERT => 1); 8 for type_t'size use c.unsigned'size; 9 pragma convention (c, type_t); 10 11 type flags_t is new c.unsigned; 12 TOOLBAR_HOMOGENOUS : constant flags_t := 16#01#; 13 TOOLBAR_STICKY : constant flags_t := 16#02#; 14 TOOLBAR_MULTI_STICKY : constant flags_t := 16#04#; 15 16 type toolbar_t is limited private; 17 type toolbar_access_t is access all toolbar_t; 18 pragma convention (c, toolbar_access_t); 19 20 -- API 21 22 function allocate 23 (parent : widget_access_t; 24 bar_type : type_t; 25 num_rows : natural; 26 flags : flags_t) return toolbar_access_t; 27 pragma inline (allocate); 28 29 procedure row 30 (toolbar : toolbar_access_t; 31 row_name : natural); 32 pragma inline (row); 33 34 procedure separator (toolbar : toolbar_access_t); 35 pragma import (c, separator, "AG_ToolbarSeparator"); 36 37 procedure bar_select 38 (toolbar : toolbar_access_t; 39 button : agar.gui.widget.button.button_access_t); 40 pragma import (c, bar_select, "AG_ToolbarSelect"); 41 42 procedure bar_deselect 43 (toolbar : toolbar_access_t; 44 button : agar.gui.widget.button.button_access_t); 45 pragma import (c, bar_deselect, "AG_ToolbarDeselect"); 46 47 procedure bar_select_only 48 (toolbar : toolbar_access_t; 49 button : agar.gui.widget.button.button_access_t); 50 pragma import (c, bar_select_only, "AG_ToolbarSelectOnly"); 51 52 procedure bar_select_all (toolbar : toolbar_access_t); 53 pragma import (c, bar_select_all, "AG_ToolbarSelectAll"); 54 55 procedure bar_deselect_all (toolbar : toolbar_access_t); 56 pragma import (c, bar_deselect_all, "AG_ToolbarDeselectAll"); 57 58 -- 59 60 function widget (toolbar : toolbar_access_t) return widget_access_t; 61 pragma inline (widget); 62 63private 64 65 type rows_t is array (1 .. 8) of aliased agar.gui.widget.box.box_access_t; 66 pragma convention (c, rows_t); 67 68 type toolbar_t is record 69 box : aliased agar.gui.widget.box.box_t; 70 rows : rows_t; 71 toolbar_type : type_t; 72 num_rows : c.int; 73 num_buttons : c.int; 74 row_current : c.int; 75 flags : flags_t; 76 end record; 77 pragma convention (c, toolbar_t); 78 79end agar.gui.widget.toolbar; 80