|A widget displaying an image|
The Image widget displays an image. Various kinds of object can be displayed as an image; most typically, you would load a Pixbuf ("pixel buffer") from a file, and then display that. There's a convenience function to do this, imageNewFromFile, used as follows: If the file isn't loaded successfully, the image will contain a "broken image" icon similar to that used in many web browsers. If you want to handle errors in loading the file yourself, for example by displaying an error message, then load the image with pixbufNewFromFile, then create the Image with imageNewFromPixbuf.
image <- imageNewFromFile "myfile.png"
The image file may contain an animation, if so the Image will display an animation (PixbufAnimation) instead of a static image.
Image is a "no window" widget (has no DrawWindow of its own), so by default does not receive events. If you want to receive events on the image, such as button clicks, place the image inside a EventBox, then connect to the event signals on the event box.
When handling events on the event box, keep in mind that coordinates in the image may be different from event box coordinates due to the alignment and padding settings on the image (see Misc). The simplest way to solve this is to set the alignment to 0.0 (left/top), and set the padding to zero. Then the origin of the image will be the same as the origin of the event box.
Sometimes an application will want to avoid depending on external data files, such as image files. Gtk+ comes with a program to avoid this, called gdk-pixbuf-csource. This program allows you to convert an image into a C variable declaration, which can then be loaded into a Pixbuf using pixbufNewFromInline.
|class MiscClass o => ImageClass o|
|castToImage :: GObjectClass obj => obj -> Image|
|toImage :: ImageClass o => o -> Image|
|imageNewFromFile :: FilePath -> IO Image|
If the file contains an animation, the image will contain an animation.
The storage type (imageGetStorageType) of the returned image is not defined, it will be whatever is appropriate for displaying the file.
|imageNewFromPixbuf :: Pixbuf -> IO Image|
|imageNew :: IO Image|
|Creates a new empty Image widget.|
|imageGetPixbuf :: Image -> IO Pixbuf|
|Gets the Pixbuf being displayed by the Image. The storage type of the image must be ImageEmpty or ImagePixbuf (see imageGetStorageType).|
|imageSetFromPixbuf :: Image -> Pixbuf -> IO ()|
|Overwrite the current content of the Image with a new Pixbuf.|
|imageSetFromFile :: Image -> FilePath -> IO ()|
|See imageNewFromFile for details.|
|imageGetPixelSize :: Image -> IO Int|
Gets the pixel size used for named icons.
|imageClear :: Image -> IO ()|
Resets the image to be empty.
|type IconSize = Int|
|The size of an icon in pixels.|
|iconSizeMenu :: IconSize|
|Icon size to use in next to menu items in drop-down menus.|
|iconSizeSmallToolbar :: IconSize|
|Icon size for small toolbars.|
|iconSizeLargeToolbar :: IconSize|
|Icon size for larger toolbars.|
|iconSizeButton :: IconSize|
|Icon size for icons in buttons, next to the label.|
|iconSizeDialog :: IconSize|
|Icon size for icons next to dialog text.|
|imagePixbuf :: PixbufClass pixbuf => ReadWriteAttr Image Pixbuf pixbuf|
|A Pixbuf to display.|
|imagePixmap :: PixmapClass pixmap => ReadWriteAttr Image Pixmap pixmap|
|A Pixmap to display.|
|imageImage :: ImageClass image => ReadWriteAttr Image Image image|
|A Image to display.|
|imageMask :: PixmapClass pixmap => ReadWriteAttr Image Pixmap pixmap|
|Mask bitmap to use with Image or Pixmap.|
|imageFile :: Attr Image String|
Filename to load and display.
Default value: ""
|imageStock :: Attr Image String|
Stock ID for a stock image to display.
Default value: ""
|imageIconSize :: Attr Image Int|
Symbolic size to use for stock icon, icon set or named icon.
Allowed values: >= 0
Default value: 4
|imagePixelSize :: Attr Image Int|
The pixel-size property can be used to specify a fixed size overriding the icon-size property for images of type ImageIconName.
Allowed values: >= -1
Default value: -1
|imageIconName :: Attr Image String|
The name of the icon in the icon theme. If the icon theme is changed, the image will be updated automatically.
Default value: ""
|imageStorageType :: ReadAttr Image ImageType|
The representation being used for image data.
Default value: ImageEmpty
|Produced by Haddock version 0.8|