indexing description: "[ A widget displaying a bitmap. The bitmap is not repeated if the widget is larger than the bitmap. This widget can be used to place other widget's on it using `add_widget'. ]" date: "$Date$" revision: "$Revision$" class EM_IMAGEPANEL inherit EM_WIDGET EM_SHARED_BITMAP_FACTORY export {NONE} all end create make_from_file, make_from_bitmap, make_void_surface feature {NONE} -- Initialisation make_from_file (a_filename: STRING) is -- Initialise panel with bitmap denoted by `a_filename'. require a_filename_not_void: a_filename /= Void do Bitmap_factory.create_bitmap_from_image (a_filename) make_from_bitmap (Bitmap_factory.last_bitmap) ensure bitmap_created: bitmap /= Void end make_from_bitmap (a_bitmap: EM_BITMAP) is -- Initialise panel with `a_bitmap'. require a_bitmap_not_void: a_bitmap /= Void do bitmap := a_bitmap make_from_dimension (a_bitmap.width, a_bitmap.height) ensure bitmap_set: bitmap = a_bitmap end delegate_factory: FUNCTION [ANY, TUPLE [], like delegate] is -- Factory to create default delegate do Result := theme_delegates.imagepanel_delegate_factory end feature -- Access bitmap: EM_BITMAP -- The bitmap to be displayed feature -- Element change set_bitmap (a_bitmap: like bitmap) is -- Set `bitmap' to `a_bitmap'. require a_bitmap_not_void: a_bitmap /= Void do bitmap := a_bitmap set_changed ensure bitmap_set: bitmap = a_bitmap changed: is_changed end feature -- Transformation strech (x_factor, y_factor: DOUBLE) is -- Strech `bitmap' with factors `x_factor' `y_factor'. -- This will set the dimension of `Current' to the new bitmap-size. require x_factor_positive: x_factor>0 y_factor_positive: y_factor>0 do Bitmap_factory.create_stretched_bitmap (bitmap, x_factor, y_factor) set_bitmap (Bitmap_factory.last_bitmap) set_dimension (bitmap.width, bitmap.height) end invariant bitmap_not_void: bitmap /= Void end