Name

Image — Pixmap image

Synopsis

Image ( string  imageFileName);

Parameters

string imageFileName

file name (with path) of the image to display

Options

animated

show an animated image (MNG, animated GIF)

scaleToFit

scale the pixmap so it fits the available space: zoom in or out as needed

zeroWidth

make widget report a preferred width of 0

zeroHeight

make widget report a preferred height of 0

Description

Displays an image if the respective UI is capable of that.

Use `opt( `zeroWidth ) and / or `opt( `zeroHeight ) if the real size of the image widget is determined by outside factors, e.g. by the size of neighboring widgets. With those options you can override the preferred size of the image widget and make it show just a part of the image. If more screen space is available, more of the image is shown, if not, the layout engine doesn't complain about the image widget not getting its preferred size.

`opt( `scaleToFit ) scales the image to fit into the available space, i.e. the image will be zoomed in or out as needed.

This option implicitly sets `opt( `zeroWidth ) and `opt( zeroHeight ), too since there is no useful default size for such an image. Use MinSize() or other layout helpers to explicitly set a size on such a widget.

Please note that setting both `opt( `tiled ) and `opt( `scaleToFit ) at once doesn't make any sense.

Examples

          // Simple image example
{
    
     UI::OpenDialog(
         `VBox(
             `Image (`id ("image"), "/usr/share/YaST2/theme/current/wallpapers/welcome.jpg", "fallback text"),
             `PushButton(`opt(`default), "&OK")
          )
     );
     UI::UserInput();
     if (UI::WidgetExists (`id ("image"))) {
         UI::ChangeWidget (`id ("image"), `Enabled, false);
         UI::UserInput();
         UI::ChangeWidget (`id ("image"), `Enabled, true);
         UI::UserInput();
     } else {
         y2error ("No such widget id");
     }
    UI::CloseDialog();
}

          
          // Animated image example
{
    
    UI::OpenDialog(
	       `VBox(
		     `MinSize( 30, 10, 
			       `Image(`opt(`animated), "/usr/lib/qt3/doc/examples/widgets/trolltech.gif", "fallback text" )
			       ),
		     `PushButton(`opt(`default), "&OK")
		     )
	       );

    UI::UserInput();
    UI::CloseDialog();
}

        
          // Animated image example
{
    
    UI::OpenDialog(
	       `VBox(
		     `MinSize( 30, 10, 
			       `Image(`opt(`scaleToFit ),
				      "/usr/share/wallpapers/alta-badia.jpg", "fallback text" )
			       ),
		     `PushButton(`opt(`default), "&OK")
		     )
	       );

    UI::UserInput();
    UI::CloseDialog();
}