mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-23 16:52:44 +02:00
added beforerender+afterrender events
This commit is contained in:
parent
bfddbdb20a
commit
72a0f3c3ff
@ -53,6 +53,9 @@ class ExtJS_API PageRenderer: public Poco::WebWidgets::Renderer
|
|||||||
/// PageRenderer renders an html page
|
/// PageRenderer renders an html page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static const std::string EV_BEFORERENDER;
|
||||||
|
static const std::string EV_AFTERRENDER;
|
||||||
|
|
||||||
PageRenderer();
|
PageRenderer();
|
||||||
/// Creates the PageRenderer.
|
/// Creates the PageRenderer.
|
||||||
|
|
||||||
|
@ -47,6 +47,10 @@ namespace WebWidgets {
|
|||||||
namespace ExtJS {
|
namespace ExtJS {
|
||||||
|
|
||||||
|
|
||||||
|
const std::string PageRenderer::EV_BEFORERENDER("beforerender");
|
||||||
|
const std::string PageRenderer::EV_AFTERRENDER("afterrender");
|
||||||
|
|
||||||
|
|
||||||
PageRenderer::PageRenderer()
|
PageRenderer::PageRenderer()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -89,6 +93,19 @@ void PageRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
|||||||
ostr << "Ext.QuickTips.init();";
|
ostr << "Ext.QuickTips.init();";
|
||||||
// always nest a panel around, so we can get rid of dynamic casts to check for parent type
|
// always nest a panel around, so we can get rid of dynamic casts to check for parent type
|
||||||
ostr << "new Ext.Panel({renderTo:'p" << pPage->id() << "',border:false,bodyBorder:false";
|
ostr << "new Ext.Panel({renderTo:'p" << pPage->id() << "',border:false,bodyBorder:false";
|
||||||
|
if (!pPage->beforeRender.jsDelegates().empty() || !pPage->afterRender.jsDelegates().empty())
|
||||||
|
{
|
||||||
|
ostr << ",listeners:{";
|
||||||
|
bool written = Utility::writeJSEvent(ostr, EV_BEFORERENDER, pPage->beforeRender.jsDelegates());
|
||||||
|
JavaScriptEvent<Page*>::JSDelegates js = pPage->afterRender.jsDelegates();
|
||||||
|
js.push_front(jsDelegate("function(){Ext.WindowMgr.each( function(w) {w.show(this);});}"));
|
||||||
|
if (written && !js.empty())
|
||||||
|
{
|
||||||
|
ostr << ",";
|
||||||
|
}
|
||||||
|
Utility::writeJSEvent(ostr, EV_AFTERRENDER, js);
|
||||||
|
ostr << "}";
|
||||||
|
}
|
||||||
if (pPage->getHeight() > 0)
|
if (pPage->getHeight() > 0)
|
||||||
ostr << ",height:" << pPage->getHeight();
|
ostr << ",height:" << pPage->getHeight();
|
||||||
else
|
else
|
||||||
@ -113,7 +130,7 @@ void PageRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
|||||||
//close the panel
|
//close the panel
|
||||||
ostr << "]});";
|
ostr << "]});";
|
||||||
//auto-show all windows
|
//auto-show all windows
|
||||||
ostr << "Ext.WindowMgr.each( function(w) {w.show(this);});";
|
//ostr << "Ext.WindowMgr.each( function(w) {w.show(this);});";
|
||||||
//close onReady
|
//close onReady
|
||||||
ostr << "});";
|
ostr << "});";
|
||||||
//close inline JS block
|
//close inline JS block
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/WebWidgets/ContainerView.h"
|
#include "Poco/WebWidgets/ContainerView.h"
|
||||||
|
#include "Poco/WebWidgets/JavaScriptEvent.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
@ -53,6 +54,12 @@ class WebWidgets_API Page: public ContainerView
|
|||||||
public:
|
public:
|
||||||
typedef Poco::AutoPtr<Page> Ptr;
|
typedef Poco::AutoPtr<Page> Ptr;
|
||||||
|
|
||||||
|
JavaScriptEvent<Page*> beforeRender;
|
||||||
|
/// event thrown before GUI rendering.
|
||||||
|
|
||||||
|
JavaScriptEvent<Page*> afterRender;
|
||||||
|
/// event thrown after GUI rendering.
|
||||||
|
|
||||||
Page();
|
Page();
|
||||||
/// Creates an anonymous Page.
|
/// Creates an anonymous Page.
|
||||||
|
|
||||||
@ -61,6 +68,7 @@ public:
|
|||||||
|
|
||||||
// View
|
// View
|
||||||
void setText(const std::string& text);
|
void setText(const std::string& text);
|
||||||
|
|
||||||
std::string getText() const;
|
std::string getText() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user