From 3395631986e1bac0a25a19167ea8b2de5579eb96 Mon Sep 17 00:00:00 2001 From: Peter Schojer Date: Fri, 19 Sep 2008 10:34:12 +0000 Subject: [PATCH] added cls --- WebWidgets/ExtJS/src/Utility.cpp | 2 ++ WebWidgets/include/Poco/WebWidgets/Cell.h | 28 ++++++++++++++++++++ WebWidgets/include/Poco/WebWidgets/Control.h | 27 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/WebWidgets/ExtJS/src/Utility.cpp b/WebWidgets/ExtJS/src/Utility.cpp index 7886e1fd3..a10d6f477 100644 --- a/WebWidgets/ExtJS/src/Utility.cpp +++ b/WebWidgets/ExtJS/src/Utility.cpp @@ -198,6 +198,8 @@ void Utility::writeCellProperties(const Cell* pCell, std::ostream& ostr, bool wr if (!pCell->isEnabled()) ostr << ",disabled:true"; + if (pCell->hasClass()) + ostr << ",cls:'" << pCell->getClass() << "'"; View* pOwner = pCell->getOwner(); if (pOwner) { diff --git a/WebWidgets/include/Poco/WebWidgets/Cell.h b/WebWidgets/include/Poco/WebWidgets/Cell.h index 3be70f903..79bd48f7c 100644 --- a/WebWidgets/include/Poco/WebWidgets/Cell.h +++ b/WebWidgets/include/Poco/WebWidgets/Cell.h @@ -169,6 +169,15 @@ public: Cell::EditMode getEditMode() const; /// Returns the edit mode + + void setClass(const std::string cls); + /// Sets css class + + const std::string& getClass() const; + /// Returns css class + + bool hasClass() const; + /// Checks if a css value is set // RequestProcessor virtual void handleForm(const std::string& field, const std::string& value); @@ -203,6 +212,7 @@ private: Poco::Any _value; Formatter::Ptr _pFormatter; int _rowIndex; + std::string _class; }; @@ -289,6 +299,24 @@ inline bool Cell::hasValue() const } +inline void Cell::setClass(const std::string cls) +{ + _class = cls; +} + + +inline const std::string& Cell::getClass() const +{ + return _class; +} + + +inline bool Cell::hasClass() const +{ + return !getClass().empty(); +} + + } } // namespace Poco::WebWidgets diff --git a/WebWidgets/include/Poco/WebWidgets/Control.h b/WebWidgets/include/Poco/WebWidgets/Control.h index c94d8e256..dd3814107 100644 --- a/WebWidgets/include/Poco/WebWidgets/Control.h +++ b/WebWidgets/include/Poco/WebWidgets/Control.h @@ -129,6 +129,15 @@ public: bool isEditable() const; /// Returns true iff the Cell is editable. + + void setClass(const std::string cls); + /// Sets css class + + const std::string& getClass() const; + /// Returns css class + + bool hasClass() const; + /// Checks if a css value is set // View @@ -246,6 +255,24 @@ inline Formatter::Ptr Control::getFormatter() const } +inline void Control::setClass(const std::string cls) +{ + _pCell->setClass(cls); +} + + +inline const std::string& Control::getClass() const +{ + return _pCell->getClass(); +} + + +inline bool Control::hasClass() const +{ + return _pCell->hasClass(); +} + + } } // namespace Poco::WebWidgets