# CEGUI::StaticImage Class Reference

Static image widget class. More...

Inheritance diagram for CEGUI::StaticImage:

[legend]
Collaboration diagram for CEGUI::StaticImage:

[legend]
List of all members.

## Public Types

enum | HorzFormatting { LeftAligned, RightAligned, HorzCentred, HorzStretched, HorzTiled }
| Enumeration of horizontal formatting options for static image widgets. More...
enum | VertFormatting { TopAligned, BottomAligned, VertCentred, VertStretched, VertTiled }
| Enumeration of vertical formatting options for a static image widgets. More...

## Public Member Functions

| StaticImage (const String &type, const String &name)
| Constructor for StaticImage widgets.
virtual | ~StaticImage (void)
| Destructor for StaticImage widgets.
const Image * | getImage (void) const
| Return a pointer to the current image displayed by this static image widget.
ColourRect | getImageColours (void) const
| Return a ColourRect object containing the colours used when rendering this widget.
HorzFormatting | getHorizontalFormatting (void) const
| Return the current horizontal formatting option set for this widget.
VertFormatting | getVerticalFormatting (void) const
| Return the current vertical formatting option set for this widget.
void | setImage (const Image *image)
| Set the Image object to be drawn by this widget.
void | setImage (const String &imageset, const String &image)
| Set the Image object to be drawn by this widget.
void | setImageColours (const ColourRect &colours)
| Sets the colours to be applied when rendering the image.
void | setImageColours (const colour &top_left_colour, const colour &top_right_colour, const colour &bottom_left_colour, const colour &bottom_right_colour)
| Sets the colours to be applied when rendering the image.
void | setImageColours (const colour &col)
| Sets the colour to be applied when rendering the image.
void | setFormatting (HorzFormatting h_fmt, VertFormatting v_fmt)
| Set the formatting required for the image.
void | setVerticalFormatting (VertFormatting v_fmt)
| Set the formatting required for the image.
void | setHorizontalFormatting (HorzFormatting h_fmt)
| Set the formatting required for the image.

## Static Public Attributes

static const String | EventNamespace
| Namespace for global events.

## Protected Member Functions

virtual void | populateRenderCache ()
| Update the rendering cache.
virtual void | onSized (WindowEventArgs &e)
| Handler called when the window's size changes.
virtual void | onAlphaChanged (WindowEventArgs &e)
| Handler called when the window's alpha blend value is changed.
virtual void | onStaticFrameChanged (WindowEventArgs &e)
| This is used internally to indicate that the frame for the static widget has been modified, and as such derived classes may need to adjust their layouts or reconfigure their rendering somehow.
void | updateRenderableImageColours (void)
| update the internal RenderableImage with currently set colours and alpha settings.
virtual bool | testClassName_impl (const String &class_name) const
| Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.

## Protected Attributes

RenderableImage | d_image
| RenderableImage that does most of the work for us.
ColourRect | d_imageCols
| Colours to use for the image.

## Detailed Description

Static image widget class.

This base class performs it's own rendering. There is no need to override this widget to perform rendering of static images.

## Member Enumeration Documentation

enum CEGUI::StaticImage::HorzFormatting

Enumeration of horizontal formatting options for static image widgets.

Enumerator:

  LeftAligned | Image will be rendered at it's natural width, with it's left edge aligned with the left edge of the widget.
  RightAligned | Image will be rendered at it's natural width, with it's right edge aligned with the right edge of the widget.
  HorzCentred | Image will be rendered at it's natural width, horizontally centred within the widget.
  HorzStretched | Image will be horizontally stretched to cover the entire width of the widget.
  HorzTiled | Image will be tiled horizontally across the width of the widget. The rightmost tile may be clipped.

enum CEGUI::StaticImage::VertFormatting

Enumeration of vertical formatting options for a static image widgets.

Enumerator:

  TopAligned | Image will be rendered at it's natural height, with it's top edge aligned with the top edge of the widget.
  BottomAligned | Image will be rendered at it's natural height, with it's bottom edge aligned with the bottom edge of the widget.
  VertCentred | Image will be rendered at it's natural height, vertically centred within the widget.
  VertStretched | Image will be vertically stretched to cover the entire height of the widget.
  VertTiled | Image will be tiled vertically down the height of the widget. The bottommost tile may be clipped.

## Member Function Documentation

HorzFormatting CEGUI::StaticImage::getHorizontalFormatting | ( | void |  | ) | const`[inline]`

Return the current horizontal formatting option set for this widget.

Returns:
  One of the StaticImage::HorzFormatting enumerated values specifying the horizontal formatting currently set.

const Image* CEGUI::StaticImage::getImage | ( | void |  | ) | const`[inline]`

Return a pointer to the current image displayed by this static image widget.

Returns:
  Pointer to the Image object that is used to render this widget, or NULL for none.

ColourRect CEGUI::StaticImage::getImageColours | ( | void |  | ) | const`[inline]`

Return a ColourRect object containing the colours used when rendering this widget.

Returns:
  ColourRect object initialised with the colours used when rendering the image for this widget.

VertFormatting CEGUI::StaticImage::getVerticalFormatting | ( | void |  | ) | const`[inline]`

Return the current vertical formatting option set for this widget.

Returns:
  One of the StaticImage::VertFormatting enumerated values specifying the vertical formatting currently set.

void CEGUI::StaticImage::onAlphaChanged | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

Handler called when the window's alpha blend value is changed.

Parameters:

  | e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Static.

void CEGUI::StaticImage::onSized | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

Handler called when the window's size changes.

Parameters:

  | e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.

Reimplemented from CEGUI::Static.

void CEGUI::StaticImage::onStaticFrameChanged | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

This is used internally to indicate that the frame for the static widget has been modified, and as such derived classes may need to adjust their layouts or reconfigure their rendering somehow.

Note:
  This does not currently fire an external event.

Reimplemented from CEGUI::Static.

void CEGUI::StaticImage::populateRenderCache | ( |  | ) | `[protected, virtual]`

| Update the rendering cache. Populates the Window's RenderCache with imagery to be sent to the renderer. Reimplemented from CEGUI::Static.

void CEGUI::StaticImage::setFormatting | ( | HorzFormatting | h_fmt,
|  | VertFormatting | v_fmt
| ) |

Set the formatting required for the image.

Parameters:

  | h_fmt | One of the HorzFormatting enumerated values specifying the formatting required.
  | v_fmt | One of the VertFormatting enumerated values specifying the formatting required.

Returns:
  Nothing

void CEGUI::StaticImage::setHorizontalFormatting | ( | HorzFormatting | h_fmt | ) |

Set the formatting required for the image.

Parameters:

  | h_fmt | One of the HorzFormatting enumerated values specifying the formatting required.

Returns:
  Nothing

void CEGUI::StaticImage::setImage | ( | const String & | imageset,
|  | const String & | image
| ) |

Set the Image object to be drawn by this widget.

Parameters:

  | imageset | String object specifying the name of the Imageset that holds the required image.
  | image | Name of the Image on the specified Imageset that is to be used.

Returns:
  Nothing.

Exceptions:

  | UnknownObjectException | thrown if Imageset imageset does not exist in the system or if imageset contains no Image named image.

void CEGUI::StaticImage::setImage | ( | const Image * | image | ) |

Set the Image object to be drawn by this widget.

Parameters:

  | image | Pointer to the Image object to be rendered. Can be NULL to specify no image is to be rendered.

Returns:
  Nothing.

void CEGUI::StaticImage::setImageColours | ( | const colour & | col | ) | `[inline]`

Sets the colour to be applied when rendering the image.

Parameters:

  | col | colour value to be used when rendering.

Returns:
  Nothing.

void CEGUI::StaticImage::setImageColours | ( | const colour & | top_left_colour,
|  | const colour & | top_right_colour,
|  | const colour & | bottom_left_colour,
|  | const colour & | bottom_right_colour
| ) |

Sets the colours to be applied when rendering the image.

Parameters:

  | top_left_colour | Colour to be applied to the top-left corner of each Image used in the image.
  | top_right_colour | Colour to be applied to the top-right corner of each Image used in the image.
  | bottom_left_colour | Colour to be applied to the bottom-left corner of each Image used in the image.
  | bottom_right_colour | Colour to be applied to the bottom-right corner of each Image used in the image.

Returns:
  Nothing.

void CEGUI::StaticImage::setImageColours | ( | const ColourRect & | colours | ) |

Sets the colours to be applied when rendering the image.

Parameters:

  | colours | ColourRect object describing the colours to be used.

Returns:
  Nothing.

void CEGUI::StaticImage::setVerticalFormatting | ( | VertFormatting | v_fmt | ) |

Set the formatting required for the image.

Parameters:

  | v_fmt | One of the VertFormatting enumerated values specifying the formatting required.

Returns:
  Nothing

virtual bool CEGUI::StaticImage::testClassName_impl | ( | const String & | class_name | ) | const`[inline, protected, virtual]`

Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.

Parameters:

  | class_name | The class name that is to be checked.

Returns:
  true if this window was inherited from class_name. false if not.

Reimplemented from CEGUI::Static.