indexing description: "[ A list box that contains other boxes from front to back. The size of the box is such that it tightly encloses all its children. Chlild boxes can be aligned in horizontal and vertical direction. Do not use Align_user_specified as it might give unexpected results. Children are rendered back-to-front. ]" author: "" date: "$Date$" revision: "$Revision$" class EM_VIZ_DEPTH_BOX [B -> EM_VIZ_BOX] inherit EM_VIZ_LIST_BOX [B] EM_VIZ_ALIGNABLE export {NONE} depth_alignment, set_depth_alignment end create make feature -- Initialization make is -- Initialize with default values do make_list make_alignable end feature {NONE} -- Implementation vz_render (viewing_direction: EM_VECTOR3D) is -- Render children from back to front do setup_local_coordinate_frame render_contents (viewing_direction, viewing_direction.z > 0.0) revert_local_coordinate_frame end resize_container is -- Resize container to fit contents local l: DS_LINEAR [B] b: B w, h, d: DOUBLE do from w := 0.0 h := 0.0 d := 0.0 l := as_linear l.start until l.off loop b := l.item_for_iteration if b /= Void then w := b.width.max (w) h := b.height.max (h) d := d + b.depth end l.forth end set_size_internal ([w, h, d]) end realign_contents is -- Realign contents after resize local l: DS_LINEAR [B] b: B bwin: like bounds zmin, zmax: DOUBLE do from l := as_linear l.start zmin := 0.0 until l.off loop b := l.item_for_iteration if b /= Void then zmax := zmin + b.depth bwin.set ([0.0, 0.0, zmin], [width, height, zmax]) b.realign (bwin, alignment) zmin := zmax end l.forth end end end