1with agar.gui.widget.box; 2 3package agar.gui.widget.pane is 4 5 use type c.unsigned; 6 7 type type_t is (PANE_HORIZ, PANE_VERT); 8 for type_t use (PANE_HORIZ => 0, PANE_VERT => 1); 9 for type_t'size use c.unsigned'size; 10 pragma convention (c, type_t); 11 12 type pane_t is limited private; 13 type pane_access_t is access all pane_t; 14 pragma convention (c, pane_access_t); 15 16 type flags_t is new c.unsigned; 17 PANE_HFILL : constant flags_t := 16#001#; 18 PANE_VFILL : constant flags_t := 16#002#; 19 PANE_DIV1FILL : constant flags_t := 16#004#; 20 PANE_FRAME : constant flags_t := 16#008#; 21 PANE_FORCE_DIV1FILL : constant flags_t := 16#010#; 22 PANE_FORCE_DIV2FILL : constant flags_t := 16#020#; 23 PANE_DIV : constant flags_t := 16#040#; 24 PANE_FORCE_DIV : constant flags_t := 16#080#; 25 PANE_INITSCALE : constant flags_t := 16#100#; 26 PANE_EXPAND : constant flags_t := PANE_HFILL or PANE_VFILL; 27 28 type partition_t is (NONE, FIRST, SECOND); 29 for partition_t use (NONE => -1, FIRST => 0, SECOND => 1); 30 for partition_t'size use c.int'size; 31 pragma convention (c, partition_t); 32 33 -- API 34 35 function allocate 36 (parent : widget_access_t; 37 pane_type : type_t; 38 flags : flags_t) return pane_access_t; 39 pragma import (c, allocate, "AG_PaneNew"); 40 41 function allocate_horizontal 42 (parent : widget_access_t; 43 flags : flags_t) return pane_access_t; 44 pragma import (c, allocate_horizontal, "AG_PaneNewHoriz"); 45 46 function allocate_vertical 47 (parent : widget_access_t; 48 flags : flags_t) return pane_access_t; 49 pragma import (c, allocate_vertical, "AG_PaneNewVert"); 50 51 procedure attach_box 52 (pane : pane_access_t; 53 which : partition_t; 54 box : agar.gui.widget.box.box_access_t); 55 pragma import (c, attach_box, "AG_PaneAttachBox"); 56 57 procedure attach_boxes 58 (pane : pane_access_t; 59 box1 : agar.gui.widget.box.box_access_t; 60 box2 : agar.gui.widget.box.box_access_t); 61 pragma import (c, attach_boxes, "AG_PaneAttachBoxes"); 62 63 procedure set_divider_width 64 (pane : pane_access_t; 65 pixels : positive); 66 pragma inline (set_divider_width); 67 68 procedure set_division_minimum 69 (pane : pane_access_t; 70 which : partition_t; 71 min_width : positive; 72 max_width : positive); 73 pragma inline (set_division_minimum); 74 75 function move_divider 76 (pane : pane_access_t; 77 x : positive) return positive; 78 pragma inline (move_divider); 79 80 function widget (pane : pane_access_t) return widget_access_t; 81 pragma inline (widget); 82 83private 84 85 type pane_div_t is array (1 .. 2) of aliased agar.gui.widget.box.box_access_t; 86 pragma convention (c, pane_div_t); 87 type pane_geom_t is array (1 .. 2) of aliased c.int; 88 pragma convention (c, pane_geom_t); 89 90 type pane_t is record 91 widget : aliased widget_t; 92 pane_type : type_t; 93 flags : flags_t; 94 div : pane_div_t; 95 minw : pane_geom_t; 96 minh : pane_geom_t; 97 dmoving : c.int; 98 dx : c.int; 99 rx : c.int; 100 wdiv : c.int; 101 end record; 102 pragma convention (c, pane_t); 103 104end agar.gui.widget.pane; 105