From 8ff2f8f7e4503d9fff21c115c06ad09eaf1bd5f5 Mon Sep 17 00:00:00 2001 From: Peter Schojer Date: Thu, 11 Sep 2008 12:15:11 +0000 Subject: [PATCH] added enable switch --- WebWidgets/ExtJS/src/PanelRenderer.cpp | 3 +++ WebWidgets/include/Poco/WebWidgets/Panel.h | 17 ++++++++++++++++- WebWidgets/src/Panel.cpp | 18 ++++++++++++------ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/WebWidgets/ExtJS/src/PanelRenderer.cpp b/WebWidgets/ExtJS/src/PanelRenderer.cpp index 964a29552..28dc315ee 100644 --- a/WebWidgets/ExtJS/src/PanelRenderer.cpp +++ b/WebWidgets/ExtJS/src/PanelRenderer.cpp @@ -88,6 +88,9 @@ void PanelRenderer::renderHead(const Renderable* pRenderable, const RenderContex ostr << ",header:true,maximizable:true,collapsible:true"; else ostr << ",header:false"; + + if (!pPanel->enabled()) + ostr << ",disabled:true"; // a panel has exactly one child // if this child is a layout we are fine otherwise we have to generate the items array diff --git a/WebWidgets/include/Poco/WebWidgets/Panel.h b/WebWidgets/include/Poco/WebWidgets/Panel.h index dc24ff149..72e6db2fa 100644 --- a/WebWidgets/include/Poco/WebWidgets/Panel.h +++ b/WebWidgets/include/Poco/WebWidgets/Panel.h @@ -111,7 +111,9 @@ public: bool showHeader() const; /// Returns if the header of the Panel is shown - + void enable(bool val); + + bool enabled() const; protected: ~Panel(); /// Destroys the Panel. @@ -122,6 +124,7 @@ private: bool _modal; bool _showCloseIcon; bool _showHeader; + bool _enabled; }; @@ -195,6 +198,18 @@ inline bool Panel::showHeader() const } +inline void Panel::enable(bool val) +{ + _enabled = val; +} + + +inline bool Panel::enabled() const +{ + return _enabled; +} + + } } // namespace Poco::WebWidgets diff --git a/WebWidgets/src/Panel.cpp b/WebWidgets/src/Panel.cpp index 5acf0c3bb..105632876 100644 --- a/WebWidgets/src/Panel.cpp +++ b/WebWidgets/src/Panel.cpp @@ -47,7 +47,8 @@ Panel::Panel(): _title(), _modal(false), _showCloseIcon(true), - _showHeader(true) + _showHeader(true), + _enabled(true) { } @@ -58,7 +59,8 @@ Panel::Panel(const std::string& name): _title(), _modal(false), _showCloseIcon(true), - _showHeader(true) + _showHeader(true), + _enabled(true) { } @@ -69,7 +71,8 @@ Panel::Panel(const std::string& name, const std::string& title): _title(title), _modal(false), _showCloseIcon(true), - _showHeader(true) + _showHeader(true), + _enabled(true) { } @@ -80,7 +83,8 @@ Panel::Panel(View::Ptr pChild): _title(), _modal(false), _showCloseIcon(true), - _showHeader(true) + _showHeader(true), + _enabled(true) { setChild(pChild); } @@ -92,7 +96,8 @@ Panel::Panel(const std::string& name, View::Ptr pChild): _title(), _modal(false), _showCloseIcon(true), - _showHeader(true) + _showHeader(true), + _enabled(true) { setChild(pChild); } @@ -104,7 +109,8 @@ Panel::Panel(const std::string& name, const std::string& title, View::Ptr pChild _title(title), _modal(false), _showCloseIcon(true), - _showHeader(true) + _showHeader(true), + _enabled(true) { setChild(pChild); }