indexing description: "[ Basic delegate of an EM_PROGRESS_BAR. ]" date: "$Date$" revision: "$Revision$" class EM_BASIC_PROGRESS_BAR_DELEGATE inherit EM_WIDGET_DELEGATE redefine install, optimal_width, optimal_height, draw_body end feature -- Initialisation install (progress_bar: EM_PROGRESS_BAR) is -- Install style on `progress_bar'. -- Set up all default values for background, border, font and colors. do Precursor {EM_WIDGET_DELEGATE} (progress_bar) progress_bar.set_border (create {EM_LINE_BORDER}.make (create {EM_COLOR}.make_black, 1)) progress_bar.set_foreground_color (theme_colors.progress_bar_color) end feature -- Layout optimal_width (progress_bar: EM_PROGRESS_BAR): INTEGER is -- Optimal width of `progress_bar' do Result := progress_bar.steps + progress_bar.border.left + progress_bar.border.right end optimal_height (progress_bar: EM_PROGRESS_BAR): INTEGER is -- Optimal height of `progress_bar' do Result := 10 + progress_bar.border.top + progress_bar.border.bottom end feature -- Drawing draw_body (progress_bar: EM_PROGRESS_BAR) is -- Draw body of `progress_bar'. local x: INTEGER do if progress_bar.current_step > 0 then x := progress_bar.border.left + (progress_bar.current_step / progress_bar.steps * (progress_bar.width-progress_bar.border.left-progress_bar.border.right)).floor progress_bar.surface.put_rectangle_filled (progress_bar.border.left, progress_bar.border.top, x, progress_bar.height-progress_bar.border.bottom, progress_bar.foreground_color) end end end