indexing description: "[ A delegate of an EM_WIDGET which can draw the widget and handle layout requests. Custom subclasses of EM_WIDGET should provide their own delegate to draw the widget. ]" date: "$Date$" revision: "$Revision$" deferred class EM_WIDGET_DELEGATE inherit EM_SHARED_STANDARD_FONTS export {NONE} all end EM_SHARED_THEME export {NONE} all end feature -- Initialisation install (widget: EM_WIDGET) is -- Install style on `widget'. -- Set up all default values for background, border, font and colors. require widget_not_void: widget /= Void do widget.set_font (theme_fonts.default_text_font) widget.set_foreground_color (theme_colors.standard_text) widget.set_background_color (theme_colors.window_background) if widget.surface /= Void then install_surface (widget) end end install_surface (widget: EM_WIDGET) is -- Install style on `widget's surface -- This will be called for every resize of the widget. require a_widget_not_void: widget /= Void do end feature -- Measurement contains (widget: EM_WIDGET; a_x, a_y: INTEGER): BOOLEAN is -- Does `widget' contain `a_x' `a_y'. require widget_not_void: widget /= Void a_x_in_bounds: 0 <= a_x and a_x <= widget.width a_y_in_bounds: 0 <= a_y and a_y <= widget.height do Result := True end optimal_width (widget: EM_WIDGET): INTEGER is -- Optimal width of `widget' require widget_not_void: widget /= Void do Result := 0 ensure result_not_negative: Result >= 0 end optimal_height (widget: EM_WIDGET): INTEGER is -- Optimal height of `widget' require widget_not_void: widget /= Void do Result := 0 ensure result_not_negative: Result >= 0 end feature -- Drawing draw_body (widget: EM_WIDGET) is -- Draw body of `widget'. require widget_not_void: widget /= Void do end end