mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-04 07:27:23 +01:00
mouseup, mousedown events
This commit is contained in:
parent
05a1f5dcdd
commit
11cd2c2eab
@ -67,6 +67,8 @@ public:
|
||||
static const std::string EV_AFTEREDIT;
|
||||
static const std::string EV_AFTERLOAD;
|
||||
static const std::string EV_RENDER;
|
||||
static const std::string EV_MOUSEUP;
|
||||
static const std::string EV_MOUSEDOWN;
|
||||
static const std::string HIDDEN_INDEX_ROW;
|
||||
|
||||
TableRenderer();
|
||||
@ -102,6 +104,14 @@ public:
|
||||
static Poco::WebWidgets::JSDelegate createRenderServerCallback(const Table* pTable);
|
||||
/// Adds a javascript callback to inform the WebServer that the client has finished rendering
|
||||
/// Method signature is ( Grid this, config)
|
||||
|
||||
static Poco::WebWidgets::JSDelegate createMouseUpServerCallback(const Table* pTable);
|
||||
/// Adds a javascript callback to inform the WebServer that the client has release a mouse button
|
||||
/// Method signature is ( Ext.EventObject e)
|
||||
|
||||
static Poco::WebWidgets::JSDelegate createMouseDownServerCallback(const Table* pTable);
|
||||
/// Adds a javascript callback to inform the WebServer that the client has pressed a mouse button
|
||||
/// Method signature is ( Ext.EventObject e)
|
||||
|
||||
protected:
|
||||
static void renderProperties(const Table* pTable, const RenderContext& context, std::ostream& ostr);
|
||||
|
@ -113,12 +113,13 @@ void PageRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
||||
}
|
||||
// extra css for label
|
||||
ostr << "<style type=\"text/css\">.lbl {font:normal 12px tahoma, verdana, helvetica}</style>";
|
||||
ostr << "<style type=\"text/css\">.x-form-cb-label {font:normal 12px tahoma, verdana, helvetica}</style>";
|
||||
|
||||
if (!pPage->empty())
|
||||
{
|
||||
//start inline javascript block
|
||||
ostr << "<script type=\"text/javascript\">";
|
||||
|
||||
ostr << "var global={};"; //global var to store values!
|
||||
ostr << "Ext.onReady(function() {";
|
||||
ostr << "var " << VAR_LOCALTMP << ";"; // tmp variable needed for table renderer
|
||||
ostr << "Ext.QuickTips.init();";
|
||||
|
@ -59,6 +59,8 @@ const std::string TableRenderer::EV_ROWCLICKED("rowselect");
|
||||
const std::string TableRenderer::EV_AFTEREDIT("afteredit");
|
||||
const std::string TableRenderer::EV_AFTERLOAD("load");
|
||||
const std::string TableRenderer::EV_RENDER("render");
|
||||
const std::string TableRenderer::EV_MOUSEUP("mouseup");
|
||||
const std::string TableRenderer::EV_MOUSEDOWN("mousedown");
|
||||
const std::string TableRenderer::HIDDEN_INDEX_ROW("hidIdx");
|
||||
|
||||
|
||||
@ -177,6 +179,26 @@ Poco::WebWidgets::JSDelegate TableRenderer::createRowClickedServerCallback(const
|
||||
}
|
||||
|
||||
|
||||
Poco::WebWidgets::JSDelegate TableRenderer::createMouseUpServerCallback(const Table* pTable)
|
||||
{
|
||||
poco_check_ptr (pTable);
|
||||
static const std::string signature("function(e)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, Table::EV_MOUSEUP));
|
||||
return Utility::createServerCallback(signature, addParams, pTable->id(), pTable->mouseUp.getOnSuccess(), pTable->mouseUp.getOnFailure());
|
||||
}
|
||||
|
||||
|
||||
Poco::WebWidgets::JSDelegate TableRenderer::createMouseDownServerCallback(const Table* pTable)
|
||||
{
|
||||
poco_check_ptr (pTable);
|
||||
static const std::string signature("function(e)");
|
||||
std::map<std::string, std::string> addParams;
|
||||
addParams.insert(std::make_pair(RequestHandler::KEY_EVID, Table::EV_MOUSEDOWN));
|
||||
return Utility::createServerCallback(signature, addParams, pTable->id(), pTable->mouseDown.getOnSuccess(), pTable->mouseDown.getOnFailure());
|
||||
}
|
||||
|
||||
|
||||
void TableRenderer::renderProperties(const Table* pTable, const RenderContext& context, std::ostream& ostr)
|
||||
{
|
||||
WebApplication& app = WebApplication::instance();
|
||||
@ -228,6 +250,30 @@ void TableRenderer::renderProperties(const Table* pTable, const RenderContext& c
|
||||
written = Utility::writeJSEvent(ostr, EV_RENDER, pTable->afterRender.jsDelegates());
|
||||
}
|
||||
|
||||
if (pTable->mouseUp.hasJavaScriptCode())
|
||||
{
|
||||
if (written)
|
||||
ostr << ",";
|
||||
if (pTable->mouseUp.willDoServerCallback())
|
||||
written = Utility::writeJSEvent(ostr, EV_MOUSEUP, pTable->mouseUp.jsDelegates(),
|
||||
TableRenderer::createMouseUpServerCallback(pTable),
|
||||
pTable->mouseUp.getServerCallbackPos());
|
||||
else
|
||||
written = Utility::writeJSEvent(ostr, EV_MOUSEUP, pTable->mouseUp.jsDelegates());
|
||||
}
|
||||
|
||||
if (pTable->mouseDown.hasJavaScriptCode())
|
||||
{
|
||||
if (written)
|
||||
ostr << ",";
|
||||
if (pTable->mouseDown.willDoServerCallback())
|
||||
written = Utility::writeJSEvent(ostr, EV_MOUSEDOWN, pTable->mouseDown.jsDelegates(),
|
||||
TableRenderer::createMouseDownServerCallback(pTable),
|
||||
pTable->mouseDown.getServerCallbackPos());
|
||||
else
|
||||
written = Utility::writeJSEvent(ostr, EV_MOUSEDOWN, pTable->mouseDown.jsDelegates());
|
||||
}
|
||||
|
||||
ostr << "},"; //close listeners
|
||||
|
||||
renderColumns(pTable, context, ostr);
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
static const std::string EV_LOADDATA;
|
||||
static const std::string EV_AFTERLOAD;
|
||||
static const std::string EV_RENDER;
|
||||
static const std::string EV_MOUSEUP;
|
||||
static const std::string EV_MOUSEDOWN;
|
||||
|
||||
struct WebWidgets_API CellClick
|
||||
{
|
||||
@ -110,6 +112,10 @@ public:
|
||||
|
||||
JavaScriptEvent<Table*> afterRender; // thrown after rendering
|
||||
|
||||
JavaScriptEvent<Table*> mouseUp; // thrown after mouse was released over the table
|
||||
|
||||
JavaScriptEvent<Table*> mouseDown; // thrown when mouse was pressed over the table
|
||||
|
||||
FIFOEvent<LoadData> beforeLoad; /// thrown whenever a load is requested, internal event to which the TableRenderer must register
|
||||
|
||||
enum SelectionModel
|
||||
|
@ -54,6 +54,8 @@ const std::string Table::EV_CELLVALUECHANGED("edit");
|
||||
const std::string Table::EV_LOADDATA("load");
|
||||
const std::string Table::EV_AFTERLOAD("afterload");
|
||||
const std::string Table::EV_RENDER("render");
|
||||
const std::string Table::EV_MOUSEUP("mouseup");
|
||||
const std::string Table::EV_MOUSEDOWN("mousedown");
|
||||
|
||||
|
||||
Table::Table(const TableColumns& tc, TableModel::Ptr pModel):
|
||||
@ -204,6 +206,16 @@ void Table::handleAjaxRequest(const Poco::Net::NameValueCollection& args, Poco::
|
||||
Table* pTable = this;
|
||||
afterRender(this, pTable);
|
||||
}
|
||||
else if (ev == EV_MOUSEUP)
|
||||
{
|
||||
Table* pTable = this;
|
||||
mouseUp(this, pTable);
|
||||
}
|
||||
else if (ev == EV_MOUSEDOWN)
|
||||
{
|
||||
Table* pTable = this;
|
||||
mouseDown(this, pTable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user