#include <image.hh>
The dw::core::Imgbuf is automatically scaled, when needed, but dw::Image does not keep a reference on the root buffer.
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.
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.
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.
| dw::Image::Image | ( | const char * | altText | ) |
References altTextWidth, buffer, CLASS_ID, clicking, currLink, isMap, mapKey, mapList, and lout::identity::IdentifiableObject::registerName().
| dw::Image::~Image | ( | ) |
References altText, buffer, mapKey, and dw::core::Imgbuf::unref().
| bool dw::Image::buttonPressImpl | ( | core::EventButton * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References dw::core::EventButton::button, clicking, contentX(), contentY(), currLink, dw::core::Widget::getStyle(), dw::core::Widget::layout, dw::ImageMapsList::link(), mapKey, and mapList.
| bool dw::Image::buttonReleaseImpl | ( | core::EventButton * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References clicking, contentX(), contentY(), currLink, dw::core::Widget::getStyle(), isMap, dw::core::Widget::layout, dw::ImageMapsList::link(), mapKey, and mapList.
| int dw::Image::contentX | ( | core::MousePositionEvent * | event | ) | [protected] |
References dw::core::Widget::getContentWidth(), dw::core::Widget::getStyle(), lout::misc::max(), and lout::misc::min().
Referenced by buttonPressImpl(), buttonReleaseImpl(), and motionNotifyImpl().
| int dw::Image::contentY | ( | core::MousePositionEvent * | event | ) | [protected] |
References dw::core::Widget::getContentHeight(), dw::core::Widget::getStyle(), lout::misc::max(), and lout::misc::min().
Referenced by buttonPressImpl(), buttonReleaseImpl(), and motionNotifyImpl().
| void dw::Image::draw | ( | core::View * | view, | |
| core::Rectangle * | area | |||
| ) | [protected, virtual] |
Area is given in widget coordinates.
TODO: draw selection
Implements dw::core::Widget.
References dw::core::Widget::allocation, altText, altTextWidth, buffer, dw::core::View::drawImage(), dw::ImageMapsList::drawMap(), dw::core::View::drawSimpleWrappedText(), dw::core::Widget::drawWidgetBox(), dw::core::View::getClippingView(), dw::core::Widget::getContentHeight(), dw::core::Widget::getContentWidth(), dw::core::Widget::getStyle(), dw::core::Rectangle::height, dw::core::Rectangle::intersectsWith(), dw::core::Widget::layout, mapKey, mapList, dw::core::View::mergeClippingView(), dw::core::style::Color::SHADING_NORMAL, dw::core::Rectangle::width, dw::core::Rectangle::x, and dw::core::Rectangle::y.
| void dw::Image::drawRow | ( | int | row | ) |
| void dw::Image::enterNotifyImpl | ( | core::EventCrossing * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References currLink, dw::core::Widget::getStyle(), and dw::core::Widget::layout.
| void dw::Image::forceMapRedraw | ( | ) | [inline] |
References buffer, mapKey, and dw::core::Widget::queueDraw().
| 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.
Implements dw::core::Widget.
| void dw::Image::leaveNotifyImpl | ( | core::EventCrossing * | event | ) | [protected, virtual] |
| bool dw::Image::motionNotifyImpl | ( | core::EventMotion * | event | ) | [protected, virtual] |
Reimplemented from dw::core::Widget.
References clicking, contentX(), contentY(), currLink, dw::core::style::CURSOR_POINTER, dw::core::Widget::getStyle(), isMap, dw::core::Widget::layout, dw::ImageMapsList::link(), mapKey, mapList, and dw::core::Widget::setCursor().
| void dw::Image::setBuffer | ( | core::Imgbuf * | buffer, | |
| bool | resize = false | |||
| ) |
| void dw::Image::setIsMap | ( | ) |
| void dw::Image::setUseMap | ( | ImageMapsList * | list, | |
| object::Object * | key | |||
| ) |
| void dw::Image::sizeAllocateImpl | ( | core::Allocation * | allocation | ) | [protected, virtual] |
| void dw::Image::sizeRequestImpl | ( | core::Requisition * | requisition | ) | [protected, virtual] |
Implements dw::core::Widget.
References dw::core::style::absLengthVal(), altText, altTextWidth, dw::core::Requisition::ascent, buffer, dw::core::Requisition::descent, dw::core::Imgbuf::getRootHeight(), dw::core::Imgbuf::getRootWidth(), dw::core::Widget::getStyle(), dw::core::style::isAbsLength(), dw::core::Widget::layout, dw::core::style::LENGTH_AUTO, and dw::core::Requisition::width.
char* dw::Image::altText [private] |
Referenced by draw(), sizeRequestImpl(), and ~Image().
int dw::Image::altTextWidth [private] |
Referenced by draw(), Image(), and sizeRequestImpl().
core::Imgbuf* dw::Image::buffer [private] |
Referenced by draw(), drawRow(), forceMapRedraw(), getBuffer(), Image(), sizeAllocateImpl(), sizeRequestImpl(), and ~Image().
int dw::Image::CLASS_ID = -1 [static] |
bool dw::Image::clicking [private] |
Referenced by buttonPressImpl(), buttonReleaseImpl(), Image(), leaveNotifyImpl(), and motionNotifyImpl().
int dw::Image::currLink [private] |
Referenced by buttonPressImpl(), buttonReleaseImpl(), enterNotifyImpl(), Image(), leaveNotifyImpl(), and motionNotifyImpl().
bool dw::Image::isMap [private] |
Referenced by buttonReleaseImpl(), Image(), motionNotifyImpl(), and setIsMap().
Object* dw::Image::mapKey [private] |
Referenced by buttonPressImpl(), buttonReleaseImpl(), draw(), forceMapRedraw(), Image(), motionNotifyImpl(), setUseMap(), and ~Image().
ImageMapsList* dw::Image::mapList [private] |
Referenced by buttonPressImpl(), buttonReleaseImpl(), draw(), Image(), motionNotifyImpl(), and setUseMap().
1.5.9