indexing description: "[ Prototype exhibit box for all other exhibit boxes in this example. Subclasses need to implement `title', `description', `go_to_time', and `create_exhibit' ]" author: "" date: "$Date$" revision: "$Revision$" deferred class EXHIBIT_BOX inherit EM_ANIMATABLE EM_VIZ_BACKGROUND_BOX [EM_VIZ_BOX] rename make as make_background export {NONE} make_background end feature -- Initialization make is -- local vbox: EM_VIZ_VERTICAL_BOX [EM_VIZ_BOX] padding: EM_VIZ_BORDER_BOX [EM_VIZ_BOX] title_box, desc_box: EM_VIZ_TEXT_BOX exhibit_border: EM_VIZ_BORDER_BOX [EM_VIZ_BOX] do make_background ([exhibit_width, exhibit_height, 0.0]) exhibit_inner_width := exhibit_width - 2*exhibit_padding_size exhibit_inner_height := exhibit_height - 2*exhibit_padding_size -- Add some space around everything create padding.make ([exhibit_padding_size, exhibit_padding_size, 0.0]) padding.set_border_hidden (True) -- Group boxes vertically create vbox.make -- Title create title_box.make_auto_sized (title, Viz_options.title_font_format) -- Update to have meaningful height title_box.update exhibit_inner_height := exhibit_inner_height - title_box.height -- Description create desc_box.make ([exhibit_inner_width, 0.0, 0.0], description, Viz_options.text_font_format) -- Update to have meaningful height desc_box.update exhibit_inner_height := exhibit_inner_height - desc_box.height -- Exhibit with background exhibit_inner_width := exhibit_inner_width - 2*exhibit_border_size exhibit_inner_height := exhibit_inner_height - 2*exhibit_border_size -- Exhibit background and border create exhibit_background.make([exhibit_inner_width, exhibit_inner_height, 0.0]) create exhibit_border.make ([exhibit_border_size, exhibit_border_size, 0.0]) exhibit_background.set_depth_alignment (Align_front) -- Create exhibit create_exhibit -- Assemble put (padding) padding.put (vbox) vbox.put_last (title_box) vbox.put_last (desc_box) vbox.put_last (exhibit_border) exhibit_border.put (exhibit_background) exhibit_background.put (exhibit) end feature -- Access exhibit_width: DOUBLE is 640.0 -- Width of this box exhibit_height: DOUBLE is 480.0 -- Height of this box exhibit_inner_width: DOUBLE -- Inner width exhibit_inner_height: DOUBLE -- Inner height exhibit_padding_size: DOUBLE is 10.0 -- Size of border around everything exhibit_border_size: DOUBLE is 5.0 -- Size of border around exhibit title: STRING is -- Title of exhibit deferred ensure exists: Result /= Void end description: STRING is -- Description for exhibit deferred ensure exists: Result /= Void end feature -- Manufacturing column_layout: EM_VIZ_TABLE_BOX [EM_VIZ_BOX] -- Use `create_column_layout' to create columns create_column_layout (column_count: INTEGER) is -- Create columns which can be used to layout contents do create column_layout.make ( [exhibit_inner_width, 0.0, 0.0], [column_count, 3] ) column_layout.set_horizontal_alignment (Align_center) column_layout.set_vertical_alignment (Align_center) column_layout.set_row_height (1, 0.0) column_layout.set_row_height (2, 10.0) column_layout.set_row_height (3, exhibit_inner_height/2) column_layout.set_border_hidden (True) end put_column_title (text: STRING; column: INTEGER) is -- local tbox: EM_VIZ_TEXT_BOX do create tbox.make ( [column_layout.column_width (column) - 10.0, 0.0, 0.0], text, Viz_options.text_font_format ) tbox.set_horizontal_alignment (Align_center) column_layout.put (tbox, [column,1]) end put_column_content (content: EM_VIZ_BOX; column: INTEGER) is -- Put `content' into `column'-th column do column_layout.put (content, [column,3]) end exhibit_background: EM_VIZ_BACKGROUND_BOX [EM_VIZ_BOX] -- Background for exhibit exhibit: EM_VIZ_BOX -- Exhibit box create_exhibit is -- Create exhibit. deferred ensure exhibit_exists: exhibit /= Void end end