dw::Image Class Reference

Displays an instance of dw::core::Imgbuf. More...

#include <image.hh>

List of all members.

Public Member Functions

 Image (const char *altText)
 ~Image ()
core::Iteratoriterator (core::Content::Type mask, bool atEnd)
 Return an iterator for this widget.
core::ImgbufgetBuffer ()
void setBuffer (core::Imgbuf *buffer, bool resize=false)
void drawRow (int row)
void setIsMap ()
 Sets image as server side image map.
void setUseMap (ImageMapsList *list, Object *key)
 Sets image as client side image map.
void forceMapRedraw ()

Static Public Attributes

static int CLASS_ID = -1

Protected Member Functions

void sizeRequestImpl (core::Requisition *requisition)
 See Sizes of Dillo Widgets.
void sizeAllocateImpl (core::Allocation *allocation)
 See Sizes of Dillo Widgets.
void draw (core::View *view, core::Rectangle *area)
bool buttonPressImpl (core::EventButton *event)
bool buttonReleaseImpl (core::EventButton *event)
void enterNotifyImpl (core::EventCrossing *event)
void leaveNotifyImpl (core::EventCrossing *event)
bool motionNotifyImpl (core::EventMotion *event)
int contentX (core::MousePositionEvent *event)
int contentY (core::MousePositionEvent *event)

Private Attributes

char * altText
core::Imgbufbuffer
int altTextWidth
bool clicking
int currLink
ImageMapsListmapList
ObjectmapKey
bool isMap


Detailed Description

Displays an instance of dw::core::Imgbuf.

The dw::core::Imgbuf is automatically scaled, when needed, but dw::Image does not keep a reference on the root buffer.

Signals

For image maps, dw::Image uses the signals defined in dw::core::Layout::LinkReceiver. For client side image maps, -1 is passed for the coordinates, for server side image maps, the respective coordinates are used. See section "Image Maps" below.

Image Maps

Client Side Image Maps

You must first create a list of image maps (dw::ImageMapList), which can be used for multiple images. The caller is responsible for freeing the dw::ImageMapList.

Adding a map is done by dw::ImageMapsList::startNewMap. The key is an instance of a sub class of object::Object. In the context of HTML, this is a URL, which defines this map globally, by combining the URL of the document, this map is defined in, with the value of the attribute "name" of the <MAP> element, as a fragment.

dw::ImageMapsList::addShapeToCurrentMap adds a shape to the current map. The link argument is a number, which is later passed to the dw::core::Layout::LinkReceiver.

This map list is then, together with the key for the image, passed to dw::Image::setUseMap. For HTML, a URL with the value of the "ismap" attribute of <IMG> should be used.

dw::Image will search the correct map, when needed. If it is not found at this time, but later defined, it will be found and used later. This is the case, when an HTML <MAP> is defined below the <IMG> in the document.

Currently, only maps defined in the same document as the image may be used, since the dw::ImageMapsList is stored in the HTML link block, and contains only the image maps defined in the document.

Server Side Image Maps

To use images for server side image maps, you must call dw::Image::setIsMap, and the dw::Image::style must contain a valid link (dw::core::style::Style::x_link). After this, motions and clicks are delegated to dw::core::Layout::LinkReceiver.

See also:
Images and Backgrounds in Dw

Constructor & Destructor Documentation

dw::Image::Image ( const char *  altText  ) 

dw::Image::~Image (  ) 


Member Function Documentation

bool dw::Image::buttonPressImpl ( core::EventButton event  )  [protected, virtual]

bool dw::Image::buttonReleaseImpl ( core::EventButton event  )  [protected, virtual]

int dw::Image::contentX ( core::MousePositionEvent event  )  [protected]

int dw::Image::contentY ( core::MousePositionEvent event  )  [protected]

void dw::Image::draw ( core::View view,
core::Rectangle area 
) [protected, virtual]

void dw::Image::drawRow ( int  row  ) 

void dw::Image::enterNotifyImpl ( core::EventCrossing event  )  [protected, virtual]

void dw::Image::forceMapRedraw (  )  [inline]

core::Imgbuf* dw::Image::getBuffer (  )  [inline]

References buffer.

core::Iterator * dw::Image::iterator ( core::Content::Type  mask,
bool  atEnd 
) [virtual]

Return an iterator for this widget.

mask can narrow the types returned by the iterator, this can enhance performance quite much, e.g. when only searching for child widgets.

With atEnd == false, the iterator starts before the beginning, i.e. the first call of dw::core::Iterator::next will let the iterator point on the first piece of contents. Likewise, With atEnd == true, the iterator starts after the last piece of contents, call dw::core::Iterator::prev in this case.

Bug:
Not implemented.

Implements dw::core::Widget.

void dw::Image::leaveNotifyImpl ( core::EventCrossing event  )  [protected, virtual]

Reimplemented from dw::core::Widget.

References clicking, currLink, and dw::core::Widget::layout.

bool dw::Image::motionNotifyImpl ( core::EventMotion event  )  [protected, virtual]

void dw::Image::setBuffer ( core::Imgbuf buffer,
bool  resize = false 
)

void dw::Image::setIsMap (  ) 

Sets image as server side image map.

References isMap.

void dw::Image::setUseMap ( ImageMapsList list,
object::Object key 
)

Sets image as client side image map.

"list" is not owned by the image, the caller has to free it. "key" is owned by the image, if it is used by the caller afterwards, a copy should be passed.

References mapKey, and mapList.

void dw::Image::sizeAllocateImpl ( core::Allocation allocation  )  [protected, virtual]

void dw::Image::sizeRequestImpl ( core::Requisition requisition  )  [protected, virtual]


Member Data Documentation

char* dw::Image::altText [private]

Referenced by draw(), sizeRequestImpl(), and ~Image().

int dw::Image::altTextWidth [private]

Referenced by draw(), Image(), and sizeRequestImpl().

int dw::Image::CLASS_ID = -1 [static]

Reimplemented from dw::core::Widget.

Referenced by Image().

bool dw::Image::clicking [private]

int dw::Image::currLink [private]

bool dw::Image::isMap [private]


The documentation for this class was generated from the following files:

Generated on Wed Sep 7 02:00:37 2011 for Dillo by  doxygen 1.5.9