mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 14:42:51 +01:00
added absolute layout support, added css to views ,layout fixes
This commit is contained in:
parent
0cd0f4cacf
commit
e9cdfc6247
@ -209,6 +209,10 @@
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\ExtJS\AbsoluteLayoutRenderer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\ExtJS\AbstractTableCellHandler.h"
|
||||
>
|
||||
@ -369,6 +373,10 @@
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\AbsoluteLayoutRenderer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractTableCellHandler.cpp"
|
||||
>
|
||||
|
@ -208,6 +208,10 @@
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\ExtJS\AbsoluteLayoutRenderer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\ExtJS\AbstractTableCellHandler.h"
|
||||
>
|
||||
@ -368,6 +372,10 @@
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\AbsoluteLayoutRenderer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\AbstractTableCellHandler.cpp"
|
||||
>
|
||||
|
@ -0,0 +1,70 @@
|
||||
//
|
||||
// AbsoluteLayoutRenderer.h
|
||||
//
|
||||
// $Id: //poco/Main/WebWidgets/ExtJS/include/Poco/WebWidgets/ExtJS/AbsoluteLayoutRenderer.h#2 $
|
||||
//
|
||||
// Library: ExtJS
|
||||
// Package: Core
|
||||
// Module: AbsoluteLayoutRenderer
|
||||
//
|
||||
// Definition of the AbsoluteLayoutRenderer class.
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef ExtJS_AbsoluteLayoutRenderer_INCLUDED
|
||||
#define ExtJS_AbsoluteLayoutRenderer_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/ExtJS/LayoutRenderer.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace WebWidgets {
|
||||
class AbsoluteLayout;
|
||||
namespace ExtJS {
|
||||
|
||||
|
||||
class ExtJS_API AbsoluteLayoutRenderer: public LayoutRenderer
|
||||
/// AbsoluteLayoutRenderer renders HorizontalLayout
|
||||
{
|
||||
public:
|
||||
AbsoluteLayoutRenderer();
|
||||
/// Creates the AbsoluteLayoutRenderer.
|
||||
|
||||
virtual ~AbsoluteLayoutRenderer();
|
||||
/// Destroys the AbsoluteLayoutRenderer.
|
||||
|
||||
void renderHead(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr);
|
||||
/// Emits code for the page header to the given output stream.
|
||||
};
|
||||
|
||||
|
||||
} } } // namespace Poco::WebWidgets::ExtJS
|
||||
|
||||
|
||||
#endif // ExtJS_AbsoluteLayoutRenderer_INCLUDED
|
121
WebWidgets/ExtJS/src/AbsoluteLayoutRenderer.cpp
Normal file
121
WebWidgets/ExtJS/src/AbsoluteLayoutRenderer.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
//
|
||||
// AbsoluteLayoutRenderer.cpp
|
||||
//
|
||||
// $Id: //poco/Main/WebWidgets/ExtJS/src/AbsoluteLayoutRenderer.cpp#1 $
|
||||
//
|
||||
// Library: ExtJS
|
||||
// Package: Core
|
||||
// Module: AbsoluteLayoutRenderer
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/ExtJS/AbsoluteLayoutRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/Utility.h"
|
||||
#include "Poco/WebWidgets/AbsoluteLayout.h"
|
||||
#include "Poco/WebWidgets/Frame.h"
|
||||
#include "Poco/WebWidgets/Panel.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace WebWidgets {
|
||||
namespace ExtJS {
|
||||
|
||||
|
||||
AbsoluteLayoutRenderer::AbsoluteLayoutRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
AbsoluteLayoutRenderer::~AbsoluteLayoutRenderer()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AbsoluteLayoutRenderer::renderHead(const Renderable* pRenderable, const RenderContext& context, std::ostream& ostr)
|
||||
{
|
||||
poco_assert_dbg (pRenderable != 0);
|
||||
poco_assert_dbg (pRenderable->type() == typeid(Poco::WebWidgets::AbsoluteLayout));
|
||||
const AbsoluteLayout* pLayout = static_cast<const Poco::WebWidgets::AbsoluteLayout*>(pRenderable);
|
||||
|
||||
Renderable::ID id(0);
|
||||
View::Ptr ptrParent = pLayout->parent();
|
||||
bool parentIsFrame = (ptrParent && ptrParent->type() == typeid(Frame));
|
||||
bool parentIsPanel = (ptrParent && ptrParent->type() == typeid(Panel));
|
||||
bool parentIsNotPanel = !(parentIsFrame || parentIsPanel);
|
||||
Poco::UInt32 width = pLayout->getWidth();
|
||||
Poco::UInt32 height = pLayout->getHeight();
|
||||
if (parentIsNotPanel)
|
||||
{
|
||||
// the parent is not a panel
|
||||
// fake the the direct parent to be a panel
|
||||
ostr << "new Ext.Panel({border:false,bodyBorder:false,";
|
||||
ostr << "id:'" << pLayout->id() << "',";
|
||||
if (!pLayout->isVisible())
|
||||
ostr << "hidden:true,";
|
||||
|
||||
if (width == 0)
|
||||
width = ptrParent->getWidth();
|
||||
if (height == 0)
|
||||
height = ptrParent->getHeight();
|
||||
}
|
||||
|
||||
if (width == 0)
|
||||
width = 100;
|
||||
if (height == 0)
|
||||
height = 100;
|
||||
ostr << "width:" << width;
|
||||
ostr << ",height:" << height;
|
||||
|
||||
|
||||
ostr << ",layout:'absolute'";
|
||||
if (pLayout->hasPosition())
|
||||
ostr << ",x:" << pLayout->getPosition().posX << ",y:" << pLayout->getPosition().posY;
|
||||
ostr << ",items:[";
|
||||
|
||||
ContainerView::ConstIterator it = pLayout->begin();
|
||||
int cnt(0);
|
||||
for (; it != pLayout->end(); ++it)
|
||||
{
|
||||
if (it != pLayout->begin())
|
||||
ostr << ",";
|
||||
if (*it)
|
||||
{
|
||||
(*it)->renderHead(context, ostr);
|
||||
}
|
||||
else
|
||||
ostr << "{}";
|
||||
}
|
||||
ostr << "]";
|
||||
|
||||
if (parentIsNotPanel)
|
||||
ostr << "})";
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::WebWidgets::ExtJS
|
@ -107,6 +107,8 @@ void ButtonCellRenderer::renderProperties(const ButtonCell* pButtonCell, const s
|
||||
ostr << ",minWidth:" << pOwner->getWidth();
|
||||
if (!pView->isVisible())
|
||||
ostr << ",hidden:true";
|
||||
if (pView->hasPosition())
|
||||
ostr << ",x:" << pView->getPosition().posX << ",y:" << pView->getPosition().posY;
|
||||
|
||||
if (pOwner)
|
||||
{
|
||||
|
@ -112,6 +112,8 @@ void ComboBoxCellRenderer::renderHead(const Renderable* pRenderable, const Rende
|
||||
ostr << "new Ext.form.ComboBox({";
|
||||
|
||||
TextFieldCellRenderer::writeCellProperties(pCell, ostr, true, false);
|
||||
if (pOwner->hasPosition())
|
||||
ostr << ",x:" << pOwner->getPosition().posX << ",y:" << pOwner->getPosition().posY;
|
||||
ostr << ",store:new Ext.data.SimpleStore({fields:['d'],"; //autoLoad:true,
|
||||
ostr << "proxy:new Ext.data.HttpProxy({url:";
|
||||
std::map<std::string, std::string> addParams;
|
||||
|
@ -70,6 +70,8 @@ void FormRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
||||
//ostr << "onSubmit:Ext.emptyFn,submit:function(){this.getEl().dom.submit();},";
|
||||
if (pForm->getMethod() == Form::METHOD_POST)
|
||||
ostr << "method:'POST',";
|
||||
if (pForm->hasPosition())
|
||||
ostr << "x:" << pForm->getPosition().posX << ",y:" << pForm->getPosition().posY << ",";
|
||||
ostr << "title:'" << pForm->getName() << "',autoHeight:true,autoWidth:true,autoScroll:true,url:'" << pForm->getURI().toString() << "',frame:true,items:[";
|
||||
//we need to add a hidden entry that contains the Form::FORM_ID plus its id
|
||||
ostr << "new Ext.form.Hidden({name:'" << Form::FORM_ID << "', value:" << pForm->id() << "})";
|
||||
|
@ -105,6 +105,10 @@ void FrameRenderer::writeProperties(const Frame* pFrame, std::ostream& ostr)
|
||||
ostr << ",collapsed:true";
|
||||
if (!pFrame->isVisible())
|
||||
ostr << ",hidden:true";
|
||||
if (pFrame->hasPosition())
|
||||
ostr << ",x:" << pFrame->getPosition().posX << ",y:" << pFrame->getPosition().posY;
|
||||
if (pFrame->hasClass())
|
||||
ostr << ",cls:'" << pFrame->getClass() << "'";
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,6 +61,9 @@ void HTMLRenderer::renderHead(const Renderable* pRenderable, const RenderContext
|
||||
poco_assert_dbg (pRenderable->type() == typeid(Poco::WebWidgets::HTML));
|
||||
const HTML* pHTML = static_cast<const Poco::WebWidgets::HTML*>(pRenderable);
|
||||
ostr << "new Ext.Panel({border:false,bodyBorder:false,";
|
||||
ostr << "id:'" << pHTML->id() << "',";
|
||||
if (pHTML->hasPosition())
|
||||
ostr << "x:" << pHTML->getPosition().posX << ",y:" << pHTML->getPosition().posY << ",";
|
||||
ostr << "html:'" << pHTML->getText() << "'})";
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,12 @@ void ImageButtonCellRenderer::renderHead(const Renderable* pRenderable, const Re
|
||||
ButtonCellRenderer::renderHead(pButtonCell, context, ostr);
|
||||
else
|
||||
{
|
||||
ostr << "html:";
|
||||
const View* pOwner = pButtonCell->getOwner();
|
||||
poco_check_ptr (pOwner);
|
||||
ostr << "id:'" << pOwner->id() << "'";
|
||||
if (pOwner->hasPosition())
|
||||
ostr << ",x:" << pOwner->getPosition().posX << ",y:" << pOwner->getPosition().posY;
|
||||
ostr << ",html:";
|
||||
bool showTxt = pButtonCell->getShowText() || !hasImg;
|
||||
writeHTML(pButtonCell, showTxt, ostr);
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ void ImageRenderer::renderHead(const Renderable* pRenderable, const RenderContex
|
||||
const Image* pImage = static_cast<const Poco::WebWidgets::Image*>(pRenderable);
|
||||
ostr << "new Ext.Panel({border:false,bodyBorder:false,";
|
||||
ostr << "id:'" << pImage->id() << "',";
|
||||
if (pImage->hasPosition())
|
||||
ostr << ",x:" << pImage->getPosition().posX << ",y:" << pImage->getPosition().posY;
|
||||
ostr << "html:";
|
||||
writeHTML(pImage, ostr);
|
||||
ostr << ",closeAction:'hide'";
|
||||
|
@ -62,9 +62,14 @@ void LabelRenderer::renderHead(const Renderable* pRenderable, const RenderContex
|
||||
const Label* pLabel = static_cast<const Poco::WebWidgets::Label*>(pRenderable);
|
||||
|
||||
//ostr << "{xtype:'label', text:'" << Utility::safe(pLabel->getText()) << "'}";
|
||||
ostr << "new Ext.form.Label({text:'" << Utility::safe(pLabel->getText()) << "',cls:'lbl'," << "id:'" << pLabel->id() << "'";
|
||||
if (pLabel->hasClass())
|
||||
ostr << "new Ext.form.Label({text:'" << Utility::safe(pLabel->getText()) << "',cls:'" << pLabel->getClass() << "'," << "id:'" << pLabel->id() << "'";
|
||||
else
|
||||
ostr << "new Ext.form.Label({text:'" << Utility::safe(pLabel->getText()) << "',cls:'lbl'," << "id:'" << pLabel->id() << "'";
|
||||
if (pLabel->getWidth() > 0)
|
||||
ostr << ",width:" << pLabel->getWidth();
|
||||
if (pLabel->hasPosition())
|
||||
ostr << ",x:" << pLabel->getPosition().posX << ",y:" << pLabel->getPosition().posY;
|
||||
ostr << "})";
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "Poco/WebWidgets/ExtJS/Utility.h"
|
||||
#include "Poco/WebWidgets/Layout.h"
|
||||
#include "Poco/WebWidgets/VerticalLayout.h"
|
||||
#include "Poco/WebWidgets/AbsoluteLayout.h"
|
||||
#include "Poco/WebWidgets/Frame.h"
|
||||
#include "Poco/WebWidgets/Panel.h"
|
||||
#include <sstream>
|
||||
@ -81,7 +82,7 @@ void LayoutRenderer::renderLayout(const Layout* pLayout, const RenderContext& co
|
||||
if (parentIsNotPanel)
|
||||
{
|
||||
// the parent is not a panel
|
||||
// assume that the direct parent is a panel
|
||||
// fake the the direct parent to be a panel
|
||||
ostr << "new Ext.Panel({border:false,bodyBorder:false,";
|
||||
ostr << "id:'" << pLayout->id() << "',";
|
||||
if (!pLayout->isVisible())
|
||||
@ -108,6 +109,8 @@ void LayoutRenderer::renderParameters(const Layout* pLayout, const RenderContext
|
||||
|
||||
ostr << "layout:'table'";
|
||||
ostr << ",layoutConfig:" << "{columns:" << cols << "}";
|
||||
if (pLayout->hasPosition())
|
||||
ostr << ",x:" << pLayout->getPosition().posX << ",y:" << pLayout->getPosition().posY;
|
||||
|
||||
if (padHorVal > 0 || padVertVal > 0)
|
||||
{
|
||||
@ -128,11 +131,13 @@ void LayoutRenderer::renderParameters(const Layout* pLayout, const RenderContext
|
||||
ostr << ",";
|
||||
if (*it)
|
||||
{
|
||||
|
||||
//horizontallayout works only when children are panels
|
||||
ostr << "new Ext.Panel({border:false,bodyBorder:false,items:[";
|
||||
bool writePanel = ((*it)->type() != typeid(AbsoluteLayout) && (*it)->type() != typeid(Panel) && (*it)->type() != typeid(Frame));
|
||||
if (writePanel)
|
||||
ostr << "new Ext.Panel({border:false,bodyBorder:false,items:[";
|
||||
(*it)->renderHead(context, ostr);
|
||||
ostr << "]})";
|
||||
if (writePanel)
|
||||
ostr << "]})";
|
||||
}
|
||||
else
|
||||
ostr << "{}";
|
||||
|
@ -83,7 +83,11 @@ void ListBoxCellRenderer::renderProperties(const ListBoxCell* pListBoxCell, std:
|
||||
ostr << ",height:" << pListBoxCell->getHeight();
|
||||
if (pListBoxCell->getWidth() > 0)
|
||||
ostr << ",width:" << pListBoxCell->getWidth();
|
||||
|
||||
const View* pOwner = pListBoxCell->getOwner();
|
||||
poco_check_ptr (pOwner);
|
||||
if (pOwner->hasPosition())
|
||||
ostr << ",x:" << pOwner->getPosition().posX << ",y:" << pOwner->getPosition().posY;
|
||||
|
||||
ostr << ",dataFields:['i','d'],data:[";
|
||||
|
||||
//now serialize data, use cached content for that
|
||||
|
@ -64,6 +64,8 @@ void PanelRenderer::renderHead(const Renderable* pRenderable, const RenderContex
|
||||
|
||||
Utility::writeRenderableProperties(pRenderable, ostr);
|
||||
ostr << ",manager: winGrp";
|
||||
if (pPanel->hasPosition())
|
||||
ostr << ",x:" << pPanel->getPosition().posX << ",y:" << pPanel->getPosition().posY;
|
||||
if (!pPanel->getName().empty() && pPanel->showHeader())
|
||||
ostr << ",title:'" << pPanel->getTitle() << "'";
|
||||
if (pPanel->getWidth() > 0)
|
||||
@ -124,6 +126,8 @@ void PanelRenderer::renderHeadWithoutChildren(const Panel* pPanel, const RenderC
|
||||
ostr << ",manager: winGrp";
|
||||
if (!pPanel->getName().empty() && pPanel->showHeader())
|
||||
ostr << ",title:'" << pPanel->getTitle() << "'";
|
||||
if (pPanel->hasPosition())
|
||||
ostr << ",x:" << pPanel->getPosition().posX << ",y:" << pPanel->getPosition().posY;
|
||||
if (pPanel->getWidth() > 0)
|
||||
ostr << ",width:" << pPanel->getWidth();
|
||||
else
|
||||
|
@ -66,6 +66,10 @@ void ProgressIndicatorRenderer::renderHead(const Renderable* pRenderable, const
|
||||
std::string txt(pProgressIndicator->getText());
|
||||
if (!txt.empty())
|
||||
ostr << ",text:'" << txt << "'";
|
||||
|
||||
if (pProgressIndicator->hasPosition())
|
||||
ostr << ",x:" << pProgressIndicator->getPosition().posX << ",y:" << pProgressIndicator->getPosition().posY;
|
||||
|
||||
if (pProgressIndicator->getHeight() > 0)
|
||||
ostr << ",height:" << pProgressIndicator->getHeight();
|
||||
if (pProgressIndicator->getWidth() > 0)
|
||||
|
@ -75,7 +75,8 @@ void TabViewRenderer::renderHead(const Renderable* pRenderable, const RenderCont
|
||||
void TabViewRenderer::renderParameters(const TabView* pTabView, const RenderContext& context, std::ostream& ostr)
|
||||
{
|
||||
poco_assert_dbg(pTabView != 0);
|
||||
|
||||
if (pTabView->hasPosition())
|
||||
ostr << ",x:" << pTabView->getPosition().posX << ",y:" << pTabView->getPosition().posY;
|
||||
ostr << "items:[";
|
||||
visitChildren(pTabView, context, ostr);
|
||||
ostr << "]";
|
||||
|
@ -450,6 +450,8 @@ void TableRenderer::renderProperties(const Table* pTable, const RenderContext& c
|
||||
// forbid reordering of columns, otherwise col index will not match the col index at the server
|
||||
// sorting is allowed though, i.e row matching is active
|
||||
ostr << ",clicksToEdit:1,stripeRows:true,enableColumnHide:false,enableColumnMove:false,loadMask:true";
|
||||
if (pTable->hasPosition())
|
||||
ostr << ",x:" << pTable->getPosition().posX << ",y:" << pTable->getPosition().posY;
|
||||
if (pTable->getDragAndDrop())
|
||||
ostr << ",enableDragDrop:true,ddGroup:'" << createDnDGroupName(pTable) << "'";
|
||||
|
||||
@ -564,7 +566,7 @@ void TableRenderer::renderColumn(const Table* pTable, const TableColumn& tc, int
|
||||
static LookAndFeel& laf = Utility::getDefaultRenderers();
|
||||
|
||||
// {id:'company', header: "Company", width: 200, sortable: true, dataIndex: 'company'}
|
||||
// {header: "Last Updated", width: 135, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
|
||||
// {header: "Last updated", width: 135, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
|
||||
ostr << "{";
|
||||
std::string hdr(Utility::safe(tc.getHeader()));
|
||||
|
||||
|
@ -99,6 +99,11 @@ void TextEditCellRenderer::writeCellProperties(const TextEditCell* pCell, std::o
|
||||
if (!pCell->getPlaceHolder().empty())
|
||||
ostr << ", emptyText:'" << Utility::safe(pCell->getPlaceHolder()) << "'";
|
||||
|
||||
const View* pOwner = pCell->getOwner();
|
||||
poco_check_ptr (pOwner);
|
||||
if (pOwner->hasPosition())
|
||||
ostr << ",x:" << pOwner->getPosition().posX << ",y:" << pOwner->getPosition().posY;
|
||||
|
||||
//tooltip is not supported by textEdit, add listeners
|
||||
std::string tooltip (pCell->getToolTip());
|
||||
if (!tooltip.empty())
|
||||
|
@ -87,6 +87,7 @@ void TextFieldCellRenderer::renderBody(const Renderable* pRenderable, const Rend
|
||||
|
||||
void TextFieldCellRenderer::writeCellProperties(const TextFieldCell* pCell, std::ostream& ostr, bool writeValue, bool writeListeners)
|
||||
{
|
||||
View* pOwner = pCell->getOwner();
|
||||
Utility::writeCellProperties(pCell, ostr);
|
||||
if (pCell->getEditMode() == Cell::EM_SELECTCONTENT)
|
||||
ostr << ",selectOnFocus:true";
|
||||
@ -109,7 +110,7 @@ void TextFieldCellRenderer::writeCellProperties(const TextFieldCell* pCell, std:
|
||||
{
|
||||
//tooltip is not supported by textField, add listeners
|
||||
std::string tooltip (pCell->getToolTip());
|
||||
View* pOwner = pCell->getOwner();
|
||||
|
||||
TextField* pText = dynamic_cast<TextField*>(pOwner);
|
||||
|
||||
if (!tooltip.empty() || (pText && pText->textChanged.hasJavaScriptCode()))
|
||||
|
@ -68,18 +68,23 @@ void ToggleButtonCellRenderer::renderBody(const Renderable* pRenderable, const R
|
||||
|
||||
void ToggleButtonCellRenderer::renderProperties(const ToggleButtonCell* pToggleButtonCell, std::ostream& ostr)
|
||||
{
|
||||
View* pOwner = pToggleButtonCell->getOwner();
|
||||
ToggleButton* pButton = dynamic_cast<ToggleButton*>(pOwner);
|
||||
if (!pToggleButtonCell->getLabel().empty())
|
||||
ostr << "boxLabel:'" << Utility::safe(pToggleButtonCell->getLabel()) << "',";
|
||||
ostr << "checked:" << (pToggleButtonCell->isChecked()?"true":"false") << ",";
|
||||
if (!pToggleButtonCell->isEditable())
|
||||
ostr << "readOnly:true,";
|
||||
|
||||
if (pOwner->hasPosition())
|
||||
ostr << "x:" << pOwner->getPosition().posX << ",y:" << pOwner->getPosition().posY << ",";
|
||||
|
||||
Utility::writeCellProperties(pToggleButtonCell, ostr);
|
||||
|
||||
//tooltip is not supported by togglebutton
|
||||
std::string tooltip (pToggleButtonCell->getToolTip());
|
||||
View* pOwner = pToggleButtonCell->getOwner();
|
||||
ToggleButton* pButton = dynamic_cast<ToggleButton*>(pOwner);
|
||||
|
||||
|
||||
|
||||
|
||||
if (!tooltip.empty() || (pButton && pButton->checked.hasJavaScriptCode()))
|
||||
{
|
||||
ostr << ",listeners:{";
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "Poco/WebWidgets/ExtJS/RadioButtonCellRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/GridLayoutRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/PanelRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/AbsoluteLayoutRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/HorizontalLayoutRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/VerticalLayoutRenderer.h"
|
||||
#include "Poco/WebWidgets/ExtJS/ImageRenderer.h"
|
||||
@ -76,6 +77,7 @@
|
||||
#include "Poco/WebWidgets/Cell.h"
|
||||
#include "Poco/WebWidgets/View.h"
|
||||
#include "Poco/WebWidgets/GridLayout.h"
|
||||
#include "Poco/WebWidgets/AbsoluteLayout.h"
|
||||
#include "Poco/WebWidgets/TextFieldCell.h"
|
||||
#include "Poco/WebWidgets/TimeFieldCell.h"
|
||||
#include "Poco/WebWidgets/DateFieldCell.h"
|
||||
@ -134,6 +136,7 @@ void Utility::initialize(LookAndFeel::Ptr ptr)
|
||||
ptr->registerRenderer(typeid(ListBoxCell), new ListBoxCellRenderer());
|
||||
ptr->registerRenderer(typeid(GridLayout), new GridLayoutRenderer());
|
||||
ptr->registerRenderer(typeid(Panel), new PanelRenderer());
|
||||
ptr->registerRenderer(typeid(AbsoluteLayout), new AbsoluteLayoutRenderer());
|
||||
ptr->registerRenderer(typeid(HorizontalLayout), new HorizontalLayoutRenderer());
|
||||
ptr->registerRenderer(typeid(VerticalLayout), new VerticalLayoutRenderer());
|
||||
ptr->registerRenderer(typeid(Image), new ImageRenderer());
|
||||
@ -246,6 +249,8 @@ std::string Utility::safe(const std::string& str)
|
||||
{
|
||||
std::string safe(Poco::replace(str, "\\", "\\\\"));
|
||||
Poco::replaceInPlace(safe, "'", "\\'");
|
||||
Poco::replaceInPlace(safe, "\n", "\\n");
|
||||
Poco::replaceInPlace(safe, "\r", "\\r");
|
||||
return safe;
|
||||
}
|
||||
|
||||
|
@ -829,6 +829,10 @@
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\AbsoluteLayout.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\GridLayout.h"
|
||||
>
|
||||
@ -849,6 +853,10 @@
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\AbsoluteLayout.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\GridLayout.cpp"
|
||||
>
|
||||
|
@ -828,6 +828,10 @@
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\AbsoluteLayout.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\Poco\WebWidgets\GridLayout.h"
|
||||
>
|
||||
@ -848,6 +852,10 @@
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\AbsoluteLayout.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\GridLayout.cpp"
|
||||
>
|
||||
|
68
WebWidgets/include/Poco/WebWidgets/AbsoluteLayout.h
Normal file
68
WebWidgets/include/Poco/WebWidgets/AbsoluteLayout.h
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// AbsoluteLayout.h
|
||||
//
|
||||
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/AbsoluteLayout.h#2 $
|
||||
//
|
||||
// Library: WebWidgets
|
||||
// Package: Layouts
|
||||
// Module: AbsoluteLayout
|
||||
//
|
||||
// Definition of the AbsoluteLayout class.
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef WebWidgets_AbsoluteLayout_INCLUDED
|
||||
#define WebWidgets_AbsoluteLayout_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/Layout.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace WebWidgets {
|
||||
|
||||
|
||||
class WebWidgets_API AbsoluteLayout: public Layout
|
||||
/// AbsoluteLayout arranges views according to their positions
|
||||
{
|
||||
public:
|
||||
typedef Poco::AutoPtr<AbsoluteLayout> Ptr;
|
||||
|
||||
AbsoluteLayout();
|
||||
/// Creates the AbsoluteLayout.
|
||||
|
||||
protected:
|
||||
~AbsoluteLayout();
|
||||
/// Destroys the AbsoluteLayout.
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
|
||||
#endif // WebWidgets_AbsoluteLayout_INCLUDED
|
@ -66,7 +66,11 @@ public:
|
||||
void setText(const std::string& text);
|
||||
|
||||
std::string getText() const;
|
||||
|
||||
|
||||
const std::string& getLabelText() const;
|
||||
/// Same as getText but instead of getText which must return a copy
|
||||
/// due to the View interface this returns a reference
|
||||
|
||||
protected:
|
||||
Label(const std::string& name, const std::type_info& type);
|
||||
/// Creates a Label and assigns it the given name.
|
||||
@ -82,6 +86,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
inline const std::string& Label::getLabelText() const
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
|
||||
|
@ -60,6 +60,17 @@ class WebWidgets_API View: public Renderable
|
||||
public:
|
||||
typedef Poco::AutoPtr<View> Ptr;
|
||||
|
||||
struct WebWidgets_API Pos
|
||||
{
|
||||
int posX;
|
||||
int posY;
|
||||
|
||||
Pos();
|
||||
/// Creates a default position (posX = posY = -1)
|
||||
|
||||
Pos(int posX, int posY);
|
||||
};
|
||||
|
||||
const std::string& getName() const;
|
||||
/// Returns the View's name.
|
||||
|
||||
@ -139,6 +150,27 @@ public:
|
||||
|
||||
Poco::UInt32 getHeight() const;
|
||||
/// Returns the height of the view
|
||||
|
||||
bool hasPosition() const;
|
||||
/// Returns true if the view has a position not equal to the default one
|
||||
|
||||
const View::Pos& getPosition() const;
|
||||
/// Returns the position
|
||||
|
||||
void setPosition(int posX, int posY);
|
||||
/// Updates the position
|
||||
|
||||
void setPosition(const View::Pos& pos);
|
||||
/// Updates the position
|
||||
|
||||
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
|
||||
|
||||
protected:
|
||||
View(const std::string& name, const std::type_info& type);
|
||||
@ -168,11 +200,13 @@ protected:
|
||||
/// by subclasses to perform subclass-specific tasks.
|
||||
|
||||
private:
|
||||
std::string _name;
|
||||
View* _pParent;
|
||||
bool _visible;
|
||||
std::string _name;
|
||||
View* _pParent;
|
||||
bool _visible;
|
||||
Poco::UInt32 _width;
|
||||
Poco::UInt32 _height;
|
||||
Pos _pos;
|
||||
std::string _class;
|
||||
|
||||
};
|
||||
|
||||
@ -248,6 +282,49 @@ inline Poco::UInt32 View::getHeight() const
|
||||
}
|
||||
|
||||
|
||||
inline bool View::hasPosition() const
|
||||
{
|
||||
return !(_pos.posX == -1 && _pos.posY == -1);
|
||||
}
|
||||
|
||||
|
||||
inline const View::Pos& View::getPosition() const
|
||||
{
|
||||
return _pos;
|
||||
}
|
||||
|
||||
|
||||
inline void View::setPosition(int posX, int posY)
|
||||
{
|
||||
_pos.posX = posX;
|
||||
_pos.posY = posY;
|
||||
}
|
||||
|
||||
|
||||
inline void View::setPosition(const View::Pos& pos)
|
||||
{
|
||||
_pos = pos;
|
||||
}
|
||||
|
||||
|
||||
inline void View::setClass(const std::string cls)
|
||||
{
|
||||
_class = cls;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& View::getClass() const
|
||||
{
|
||||
return _class;
|
||||
}
|
||||
|
||||
|
||||
inline bool View::hasClass() const
|
||||
{
|
||||
return !getClass().empty();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
|
||||
|
55
WebWidgets/src/AbsoluteLayout.cpp
Normal file
55
WebWidgets/src/AbsoluteLayout.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// AbsoluteLayout.cpp
|
||||
//
|
||||
// $Id: //poco/Main/WebWidgets/src/AbsoluteLayout.cpp#2 $
|
||||
//
|
||||
// Library: WebWidgets
|
||||
// Package: Layouts
|
||||
// Module: AbsoluteLayout
|
||||
//
|
||||
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/AbsoluteLayout.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace WebWidgets {
|
||||
|
||||
|
||||
AbsoluteLayout::AbsoluteLayout():
|
||||
Layout(typeid(AbsoluteLayout))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
AbsoluteLayout::~AbsoluteLayout()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
@ -175,4 +175,18 @@ void View::onHide()
|
||||
}
|
||||
|
||||
|
||||
View::Pos::Pos():
|
||||
posX(-1),
|
||||
posY(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
View::Pos::Pos(int x, int y):
|
||||
posX(x),
|
||||
posY(y)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
Loading…
x
Reference in New Issue
Block a user