From 8fbff94a54d3374a4c890663ee66d897a748ba99 Mon Sep 17 00:00:00 2001 From: Peter Schojer Date: Fri, 17 Oct 2008 08:54:06 +0000 Subject: [PATCH] fixes to img class --- WebWidgets/ExtJS/src/ImageButtonCellRenderer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/WebWidgets/ExtJS/src/ImageButtonCellRenderer.cpp b/WebWidgets/ExtJS/src/ImageButtonCellRenderer.cpp index d5fd8d438..fcedc7a1b 100644 --- a/WebWidgets/ExtJS/src/ImageButtonCellRenderer.cpp +++ b/WebWidgets/ExtJS/src/ImageButtonCellRenderer.cpp @@ -39,6 +39,7 @@ #include "Poco/WebWidgets/ExtJS/Utility.h" #include "Poco/WebWidgets/ImageButtonCell.h" #include "Poco/WebWidgets/ImageButton.h" +#include namespace Poco { @@ -88,18 +89,22 @@ void ImageButtonCellRenderer::renderHead(const Renderable* pRenderable, const Re void ImageButtonCellRenderer::writeHTML(const ImageButtonCell* pButtonCell, bool showTxt, std::ostream& ostr) { - Image::Ptr ptrImg = pButtonCell->getImage(); + Image::Ptr pImg = pButtonCell->getImage(); const Poco::WebWidgets::ImageButton* pOwner = static_cast(pButtonCell->getOwner()); poco_check_ptr (pOwner); + if (pOwner->hasClass()) + ostr << "'
getClass()) << "\">"; ostr << "'
"; ostr << "
"; - ostr << "getURI().toString()) << "\""; + ostr << "getURI().toString()) << "\""; if (!pOwner->getName().empty()) ostr << " name=\"" << pOwner->getName() << "\""; if (pOwner->getWidth() > 0) ostr << " width=\"" << pOwner->getWidth() << "\""; if (pOwner->getHeight() > 0) ostr << " height=\"" << pOwner->getHeight() << "\""; + if (pImg->hasClass()) + ostr << " class=\"" << pImg->getClass() << "\""; std::string tooltip = pOwner->getToolTip(); if (!tooltip.empty()) ostr << " alt=\"" << Utility::safe(tooltip) << "\""; @@ -107,8 +112,10 @@ void ImageButtonCellRenderer::writeHTML(const ImageButtonCell* pButtonCell, bool if (pOwner->buttonClicked.hasJavaScriptCode()) { ostr << " onclick=\""; + std::ostringstream str; //FIXME: this will only work without params! - Utility::writeFunctionCode(ostr, "fct", pOwner->buttonClicked, &ButtonCellRenderer::createClickServerCallback, pOwner); + Utility::writeFunctionCode(str, "fct", pOwner->buttonClicked, &ButtonCellRenderer::createClickServerCallback, pOwner); + ostr << Utility::safe(str.str()); ostr << "\""; } ostr << " type=\"image\"/>";