diff options
Diffstat (limited to 'dw/image.cc')
-rw-r--r-- | dw/image.cc | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/dw/image.cc b/dw/image.cc index 457fe8d8..13212cdc 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -38,6 +38,18 @@ ImageMapsList::ImageMap::~ImageMap () delete shapesAndLinks; } +void ImageMapsList::ImageMap::draw (core::View *view,core::style::Style *style, + int x, int y) +{ + container::typed::Iterator <ShapeAndLink> it; + + for (it = shapesAndLinks->iterator (); it.hasNext (); ) { + ShapeAndLink *shapeAndLink = it.getNext (); + + shapeAndLink->shape->draw(view, style, x, y); + } +} + void ImageMapsList::ImageMap::add (core::Shape *shape, int link) { ShapeAndLink *shapeAndLink = new ShapeAndLink (); shapeAndLink->shape = shape; @@ -105,6 +117,15 @@ void ImageMapsList::setCurrentMapDefaultLink (int link) currentMap->setDefaultLink (link); } +void ImageMapsList::drawMap (lout::object::Object *key, core::View *view, + core::style::Style *style, int x, int y) +{ + ImageMap *map = imageMaps->get (key); + + if (map) + map->draw(view, style, x, y); +} + int ImageMapsList::link (object::Object *key, int x, int y) { int link = -1; @@ -348,12 +369,17 @@ void Image::draw (core::View *view, core::Rectangle *area) intersection.x - dx, intersection.y - dy, intersection.width, intersection.height); } else { + core::View *clippingView; + if (altText && altText[0]) { + core::View *usedView = view; + + clippingView = NULL; + if (altTextWidth == -1) altTextWidth = layout->textWidth (getStyle()->font, altText, strlen (altText)); - core::View *clippingView = NULL, *usedView = view; if ((getContentWidth() < altTextWidth) || (getContentHeight() < getStyle()->font->ascent + getStyle()->font->descent)) { @@ -374,6 +400,18 @@ void Image::draw (core::View *view, core::Rectangle *area) if (clippingView) view->mergeClippingView (clippingView); } + if (mapKey) { + clippingView = view->getClippingView (allocation.x + + getStyle()->boxOffsetX (), + allocation.y + + getStyle()->boxOffsetY (), + getContentWidth(), + getContentHeight()); + mapList->drawMap(mapKey, clippingView, getStyle(), + allocation.x + getStyle()->boxOffsetX (), + allocation.y + getStyle()->boxOffsetY ()); + view->mergeClippingView (clippingView); + } } /** TODO: draw selection */ |