move WebWidgets into sandbox where it belongs

This commit is contained in:
Guenter Obiltschnig 2007-08-10 13:45:34 +00:00
parent e1b2ca26c0
commit 2ef3a4f9d2
174 changed files with 0 additions and 15741 deletions

View File

@ -1,28 +0,0 @@
#
# Makefile
#
# $Id: //poco/Main/WebWidgets/Makefile#7 $
#
# Makefile for Poco WebWidgets
#
include $(POCO_BASE)/build/rules/global
objects = AbstractButton Button CheckBox \
ComboBox ComplexPanel FlowPanel Form \
FormHandler GUIObject HTML HTMLVisitor \
HyperLink Image ImageButton IndexedPanel \
InputField Label ListView Panel Parser \
ParserFactory RadioButton RootPanel \
SimplePanel StackPanel Table TextArea \
TextField Visitable Visitor Widget \
WidgetHandler WidgetHandlerFactory XMLUtil \
NamedWidget HidablePanel MouseEventArgs \
JSDelegate JSEventHandler FileHandler \
MouseMovementArgs KeyEventArgs PwdField
target = PocoWebWidgets
target_version = $(LIBVERSION)
target_libs = PocoNet PocoXML PocoFoundation
include $(POCO_BASE)/build/rules/lib

View File

@ -1,30 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebWidgets", "WebWidgets_VS71.vcproj", "{8AF41214-5398-4B9B-BD80-D4910704A8FD}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS71.vcproj", "{90E72549-3DE3-4274-B744-238AC717FC2E}"
ProjectSection(ProjectDependencies) = postProject
{8AF41214-5398-4B9B-BD80-D4910704A8FD} = {8AF41214-5398-4B9B-BD80-D4910704A8FD}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
debug_shared = debug_shared
release_shared = release_shared
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.debug_shared.ActiveCfg = debug_shared|Win32
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.debug_shared.Build.0 = debug_shared|Win32
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.release_shared.ActiveCfg = release_shared|Win32
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.release_shared.Build.0 = release_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.debug_shared.ActiveCfg = debug_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.debug_shared.Build.0 = debug_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.release_shared.ActiveCfg = release_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.release_shared.Build.0 = release_shared|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -1,475 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="WebWidgets"
ProjectGUID="{8af41214-5398-4b9b-bd80-d4910704a8fd}"
RootNamespace="WebWidgets"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include;..\Net\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;WebWidgets_EXPORTS"
StringPooling="TRUE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib"
OutputFile="..\bin\PocoWebWidgetsd.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="..\bin\PocoWebWidgetsd.pdb"
SubSystem="1"
OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoWebWidgetsd.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForProcessor="3"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include;..\Net\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;WebWidgets_EXPORTS"
GeneratePreprocessedFile="0"
KeepComments="FALSE"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib"
OutputFile="..\bin\PocoWebWidgets.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoWebWidgets.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="WebGUI"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\WebWidgets\AbstractButton.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Button.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\CheckBox.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ComboBox.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ComplexPanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\FlowPanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Form.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\GUIObject.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\HidablePanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\HTML.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\HyperLink.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Image.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ImageButton.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\IndexedPanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\InputField.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Label.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ListView.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\NamedWidget.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Panel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\PwdField.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\RadioButton.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\RootPanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\SimplePanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\StackPanel.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Table.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\TextArea.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\TextField.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\WebWidgets.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Widget.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\AbstractButton.cpp">
</File>
<File
RelativePath=".\src\Button.cpp">
</File>
<File
RelativePath=".\src\CheckBox.cpp">
</File>
<File
RelativePath=".\src\ComboBox.cpp">
</File>
<File
RelativePath=".\src\ComplexPanel.cpp">
</File>
<File
RelativePath=".\src\FlowPanel.cpp">
</File>
<File
RelativePath=".\src\Form.cpp">
</File>
<File
RelativePath=".\src\GUIObject.cpp">
</File>
<File
RelativePath=".\src\HidablePanel.cpp">
</File>
<File
RelativePath=".\src\HTML.cpp">
</File>
<File
RelativePath=".\src\HyperLink.cpp">
</File>
<File
RelativePath=".\src\Image.cpp">
</File>
<File
RelativePath=".\src\ImageButton.cpp">
</File>
<File
RelativePath=".\src\IndexedPanel.cpp">
</File>
<File
RelativePath=".\src\InputField.cpp">
</File>
<File
RelativePath=".\src\Label.cpp">
</File>
<File
RelativePath=".\src\ListView.cpp">
</File>
<File
RelativePath=".\src\NamedWidget.cpp">
</File>
<File
RelativePath=".\src\Panel.cpp">
</File>
<File
RelativePath=".\src\PwdField.cpp">
</File>
<File
RelativePath=".\src\RadioButton.cpp">
</File>
<File
RelativePath=".\src\RootPanel.cpp">
</File>
<File
RelativePath=".\src\SimplePanel.cpp">
</File>
<File
RelativePath=".\src\StackPanel.cpp">
</File>
<File
RelativePath=".\src\Table.cpp">
</File>
<File
RelativePath=".\src\TextArea.cpp">
</File>
<File
RelativePath=".\src\TextField.cpp">
</File>
<File
RelativePath=".\src\Widget.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="HTTPHandler"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\WebWidgets\FileHandler.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\FormHandler.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\WidgetHandler.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\WidgetHandlerFactory.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\FileHandler.cpp">
</File>
<File
RelativePath=".\src\FormHandler.cpp">
</File>
<File
RelativePath=".\src\WidgetHandler.cpp">
</File>
<File
RelativePath=".\src\WidgetHandlerFactory.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="WebParser"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\WebWidgets\Parser.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ParserFactory.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\XMLUtil.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\Parser.cpp">
</File>
<File
RelativePath=".\src\ParserFactory.cpp">
</File>
<File
RelativePath=".\src\XMLUtil.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="WebVisitor"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\WebWidgets\HTMLVisitor.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Visitable.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Visitor.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\HTMLVisitor.cpp">
</File>
<File
RelativePath=".\src\Visitable.cpp">
</File>
<File
RelativePath=".\src\Visitor.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="WebEvents"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\WebWidgets\JavaScriptEvent.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\JSDelegate.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\JSEventHandler.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\KeyboardFocusArgs.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\KeyEventArgs.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\MouseEventArgs.h">
</File>
<File
RelativePath=".\include\Poco\WebWidgets\MouseMovementArgs.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\JSDelegate.cpp">
</File>
<File
RelativePath=".\src\JSEventHandler.cpp">
</File>
<File
RelativePath=".\src\KeyEventArgs.cpp">
</File>
<File
RelativePath=".\src\MouseEventArgs.cpp">
</File>
<File
RelativePath=".\src\MouseMovementArgs.cpp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,28 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebWidgets", "WebWidgets_VS80.vcproj", "{8AF41214-5398-4B9B-BD80-D4910704A8FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS80.vcproj", "{90E72549-3DE3-4274-B744-238AC717FC2E}"
ProjectSection(ProjectDependencies) = postProject
{8AF41214-5398-4B9B-BD80-D4910704A8FD} = {8AF41214-5398-4B9B-BD80-D4910704A8FD}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.debug_shared|Win32.Build.0 = debug_shared|Win32
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.release_shared|Win32.ActiveCfg = release_shared|Win32
{8AF41214-5398-4B9B-BD80-D4910704A8FD}.release_shared|Win32.Build.0 = release_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.debug_shared|Win32.Build.0 = debug_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.release_shared|Win32.ActiveCfg = release_shared|Win32
{90E72549-3DE3-4274-B744-238AC717FC2E}.release_shared|Win32.Build.0 = release_shared|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,625 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="WebWidgets"
ProjectGUID="{8AF41214-5398-4B9B-BD80-D4910704A8FD}"
RootNamespace="WebWidgets"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include;..\Net\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;WebWidgets_EXPORTS"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib"
OutputFile="..\bin\PocoWebWidgetsd.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="..\bin\PocoWebWidgetsd.pdb"
SubSystem="1"
OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoWebWidgetsd.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\Foundation\include;..\XML\include;..\Net\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;WebWidgets_EXPORTS"
GeneratePreprocessedFile="0"
KeepComments="false"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib"
OutputFile="..\bin\PocoWebWidgets.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="false"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoWebWidgets.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="WebGUI"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\WebWidgets\AbstractButton.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Button.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\CheckBox.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ComboBox.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ComplexPanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\FlowPanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Form.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\GUIObject.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\HidablePanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\HTML.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\HyperLink.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Image.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ImageButton.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\IndexedPanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\InputField.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Label.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ListView.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\NamedWidget.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Panel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\PwdField.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\RadioButton.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\RootPanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\SimplePanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\StackPanel.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Table.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\TextArea.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\TextField.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\WebWidgets.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Widget.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\AbstractButton.cpp"
>
</File>
<File
RelativePath=".\src\Button.cpp"
>
</File>
<File
RelativePath=".\src\CheckBox.cpp"
>
</File>
<File
RelativePath=".\src\ComboBox.cpp"
>
</File>
<File
RelativePath=".\src\ComplexPanel.cpp"
>
</File>
<File
RelativePath=".\src\FlowPanel.cpp"
>
</File>
<File
RelativePath=".\src\Form.cpp"
>
</File>
<File
RelativePath=".\src\GUIObject.cpp"
>
</File>
<File
RelativePath=".\src\HidablePanel.cpp"
>
</File>
<File
RelativePath=".\src\HTML.cpp"
>
</File>
<File
RelativePath=".\src\HyperLink.cpp"
>
</File>
<File
RelativePath=".\src\Image.cpp"
>
</File>
<File
RelativePath=".\src\ImageButton.cpp"
>
</File>
<File
RelativePath=".\src\IndexedPanel.cpp"
>
</File>
<File
RelativePath=".\src\InputField.cpp"
>
</File>
<File
RelativePath=".\src\Label.cpp"
>
</File>
<File
RelativePath=".\src\ListView.cpp"
>
</File>
<File
RelativePath=".\src\NamedWidget.cpp"
>
</File>
<File
RelativePath=".\src\Panel.cpp"
>
</File>
<File
RelativePath=".\src\PwdField.cpp"
>
</File>
<File
RelativePath=".\src\RadioButton.cpp"
>
</File>
<File
RelativePath=".\src\RootPanel.cpp"
>
</File>
<File
RelativePath=".\src\SimplePanel.cpp"
>
</File>
<File
RelativePath=".\src\StackPanel.cpp"
>
</File>
<File
RelativePath=".\src\Table.cpp"
>
</File>
<File
RelativePath=".\src\TextArea.cpp"
>
</File>
<File
RelativePath=".\src\TextField.cpp"
>
</File>
<File
RelativePath=".\src\Widget.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="WebEvents"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\WebWidgets\JavaScriptEvent.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\JSDelegate.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\JSEventHandler.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\KeyboardFocusArgs.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\KeyEventArgs.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\MouseEventArgs.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\MouseMovementArgs.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\JSDelegate.cpp"
>
</File>
<File
RelativePath=".\src\JSEventHandler.cpp"
>
</File>
<File
RelativePath=".\src\KeyEventArgs.cpp"
>
</File>
<File
RelativePath=".\src\MouseEventArgs.cpp"
>
</File>
<File
RelativePath=".\src\MouseMovementArgs.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="HTTPHandler"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\WebWidgets\FileHandler.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\FormHandler.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\WidgetHandler.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\WidgetHandlerFactory.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\FileHandler.cpp"
>
</File>
<File
RelativePath=".\src\FormHandler.cpp"
>
</File>
<File
RelativePath=".\src\WidgetHandler.cpp"
>
</File>
<File
RelativePath=".\src\WidgetHandlerFactory.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="WebVisitor"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\WebWidgets\HTMLVisitor.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Visitable.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\Visitor.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\HTMLVisitor.cpp"
>
</File>
<File
RelativePath=".\src\Visitable.cpp"
>
</File>
<File
RelativePath=".\src\Visitor.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="WebParser"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\WebWidgets\Parser.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\ParserFactory.h"
>
</File>
<File
RelativePath=".\include\Poco\WebWidgets\XMLUtil.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\Parser.cpp"
>
</File>
<File
RelativePath=".\src\ParserFactory.cpp"
>
</File>
<File
RelativePath=".\src\XMLUtil.cpp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,242 +0,0 @@
function $(id) {
return document.getElementById(id);
}
function getIDFromEventArgs(ev) {
var elem = ev.target || ev.srcElement;
return elem.id;
}
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
function createXMLHttpRequest() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(ex) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(ex) {}
try { return new XMLHttpRequest(); } catch(ex) {}
alert ("XMLHttpRequest not supported");
return null;
}
// This function returns an integer telling which buttons were pressed (IEStyle):
// 1 ... left
// 2 ... right
// 4 ... middle
// Values can be summed up to identify multiple buttons were pressed
function buttonsPressed(ev)
{
var button = 0;
if (typeof(ev.which) == "number")
{
button = ev.which;
// Netscape: left = 1, middle = 2, right = 3,
if (button == 2)
{
button = 4;
}
else if (button == 3)
{
button = 2;
}
}
else if (typeof(ev.button) == "number")
{
button = ev.button;
if (BrowserDetect.browser == "Opera" && BrowserDetect.version < "8") {
// can't detect if two buttons were pressed
if (button == 3) {
button = 4;
}
else if (button > 3) {
button = button + 1;
}
}
}
if (button == 0)
{
// assume left click
button = 1;
}
return button;
}
// returns an object containing members
// scrollLeft, scrollTop: the position inside the Document
// left, top,: position inside the Window
function mousePos(evt)
{
if(!evt) evt = window.event;
var pos = new Object();
pos.left = evt.clientX;
pos.top = evt.clientY;
var b = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?
window.document.documentElement : window.document.body || null;
if (b)
{
pos.scrollLeft= pos.left + b.scrollLeft;
pos.scrollTop = pos.top + b.scrollTop;
}
else if(document.layers)
{
// Netscape 4.
pos.scrollLeft = evt.pageX;
pos.scrollTop = evt.pageY;
pos.left = evt.pageX - window.pageXOffset;
pos.top = evt.pageY - window.pageYOffset;
}
return pos;
}
function getSelectedText() {
if (window.getSelection) {
return window.getSelection();
}
else if (document.getSelection) {
return document.getSelection();
}
else if (document.selection) {
return document.selection.createRange().text;
}
return "";
}
// expects no return data from the server
function eventCallBack(ev, callbackAddress) {
var req = createXMLHttpRequest();
req.open("GET", callbackAddress+"?id="+getIDFromEventArgs(ev)+"&type="+ev.type, false);
req.send(null);
}
function mouseEventCallBack(ev, callbackAddress) {
var req = createXMLHttpRequest();
var pos = mousePos(ev);
req.open("GET", callbackAddress+"?id="+getIDFromEventArgs(ev)+"&type="+ev.type+"&buttons="+buttonsPressed(ev)+"&posX="+pos.scrollLeft+"&posY="+pos.scrollTop, false);
req.send(null);
}
function mouseMoveEventCallBack(ev, callbackAddress) {
var req = createXMLHttpRequest();
var pos = mousePos(ev);
req.open("GET", callbackAddress+"?id="+getIDFromEventArgs(ev)+"&type="+ev.type+"&posX="+pos.scrollLeft+"&posY="+pos.scrollTop+"&windowPosX="+pos.left+"&windowPosY="+pos.top, false);
req.send(null);
}
function keyboardEventCallBack(ev, callbackAddress) {
var req = createXMLHttpRequest();
var key = ev.which;
if (!key) key = ev.keyCode;
req.open("GET", callbackAddress+"?id="+getIDFromEventArgs(ev)+"&type="+ev.type+"&key="+key+"&alt="+ev.altKey+"&shift="+ev.shiftKey+"&ctrl="+ev.ctrlKey, false);
req.send(null);
}

View File

@ -1,926 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>POCO WebWidgets Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics"/>
<meta name="publisher" content="Applied Informatics"/>
<meta name="copyright" content="Copyright (c) 2007, Applied Informatics"/>
<meta name="language" content="en"/>
<meta name="date" content="2007-06-27"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="category">WebWidgets</h1>
<h1 class="title">POCO WebWidgets Documentation</h1>
</div>
<div class="body">
<div class="description">
<p></p><h2>Introduction</h2><p>
</p>
<p>POCO WebWidgets is a library combining HTML generation with Javascript usage. WebPages can be easily created either in C++ code or via XML configuration loading. Each GUI element offers events as known from the HTML standard and supports registration of client-side callbacks (i.e. Javascript function calls) and server-side callbacks (i.e. for each event a HTTPRequest is sent to the server). This documentation will present in detail the available GUI elements and their usage. </p>
<p></p>
<p></p><h2>GUI Elements</h2><p>
</p>
<p></p><h3>Widget</h3><p>
</p>
<p>The root class for all GUI elements is <i>Widget</i>. A Widget supports via the methods <i> preVisit</i> and <i> visit </i> a two-step visitor pattern. A Widget can be searched for other Widgets via the <i>find</i> method. All Widgets offer events and are creatable by loading and parsing an XML file. </p>
<p></p><h4>Common XML Attributes</h4><p>
</p>
<p>Each Widget can be loaded via an XML configuration. A simple example for a text label would be: </p>
<pre>&lt;label&gt;Test Label&lt;/label&gt;
</pre>
<p> </p>
<p>Furthermore, all widgets share a common set of attributes: </p>
<ul>
<li>id: a unique identifier. Each Widget should have one. When the HTML generator encounters a Widget without an <tt>id</tt>, it auto-assigns one. </li>
<li>class: CSS information of the class. Each different Widget type comes with a default value which can be overwritten. </li>
<li>lang: language information (see HTML docu for more info) </li>
<li>style: style information (see HTML docu for more info) </li>
<li>title: (see HTML docu for more info) </li>
</ul>
<p>Thus, a label with an <tt>id</tt> and a <tt>class</tt> will look like this: </p>
<pre>&lt;label id=&quot;lbl1&quot; class=&quot;label&quot;&gt;Test Label&lt;/label&gt;
</pre>
<p> </p>
<p></p><h4>Finding Children</h4><p>
</p>
<p>A GUI is a tree of GUI elements. Suppose you have created a GUI which contains a child named <tt>c1</tt> and you want to retrieve it: </p>
<pre>using Poco::WebWidgets::Widget;
using Poco::WebWidgets::XMLUtil;
std::ifstream in(&quot;mygui.xml&quot;);
if (!in)
throw Poco::FileNotFoundException(&quot;mygui.xml&quot;);
Poco::AutoPtr&lt;Widget&gt; ptrRoot = XMLUtil::loadWidget(in);
Poco::AutoPtr&lt;Widget&gt; ptrChild = Widget::find(ptrRoot, &quot;c1&quot;);
poco_assert (ptrChild);
[...]; // continue using ptrChild, like registering delegates,...
</pre>
<p> </p>
<p>Note that finding a child is an expensive operation which in the worst case requires full tree traversal. </p>
<p></p>
<p></p><h4>Events</h4><p>
Widgets come with their own event flavor called <tt>JavaScriptEvent</tt>. A JavaScriptEvent can be seen as a sort of extended <tt>Poco::BasicEvent</tt>. Thus, all the methods known from BasicEvent work: </p>
<p></p>
<pre>using Poco::WebWidgets::Widget;
Poco::AutoPtr&lt;Widget&gt; ptrWidget = [...];
ptrWidget-&gt;ESingleClick += delegate(this, &amp;MyClass::onSingleClickMethod);
[...]
ptrWidget-&gt;ESingleClick -= delegate(this, &amp;MyClass::onSingleClickMethod);
</pre>
<p> </p>
<p>JavaScriptEvents were extended in two different ways: </p>
<ul>
<li>first, we can now detect if any (server) delegate is registered at it. The HTML generator uses that information to decide if it needs to generate a callback to the server. A callback is only generated for an event if at least one server delegate is registered. This optimization is needed to keep GUI response times acceptable. </li>
<li>second, we can now add <i> JSDelegates </i> to the event. A JSDelegate is basically a JavaScript function name plus the JavaScript file we need to load on the client-side. If more than one JSDelegate is registered, the HTML generator will generate a wrapper method that calls the JSDelegates sequentially. </li>
</ul>
<p>An example for JSDelegate would be: </p>
<pre>using Poco::WebWidgets::JSDelegate;
using Poco::WebWidgets::jsDelegate;
using Poco::WebWidgets::Widget;
Poco::AutoPtr&lt;Widget&gt; ptrWidget = [...];
ptrWidget-&gt;ESingleClick += JSDelegate(&quot;onSingleClick&quot;, &quot;appinf.js&quot;);
ptrWidget-&gt;ESingleClick += jsDelegate(&quot;onSingleClick2&quot;, &quot;additional.js&quot;);
</pre>
<p> </p>
<p>The HTML generator will generate the following code for that. Note that we assume that the widget has the id <tt>i2</tt>: </p>
<pre>&lt;script src=&quot;additional.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;appinf.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function multiEventHandleronclicki2(ev) {
if (!ev) {
ev = window.event;
}
onSingleClick(ev);
onSingleClick2(ev);
}
&lt;/script&gt;
</pre>
<p> </p>
<p>Method signatures of JSDelegates must take as input a JavaScript event object. </p>
<p>The Widget class offers for each different event type a JavaScriptEvent: </p>
<pre>JavaScriptEvent&lt;MouseEventArgs&gt; ESingleClick;
JavaScriptEvent&lt;MouseEventArgs&gt; EDoubleClick;
JavaScriptEvent&lt;MouseEventArgs&gt; EMouseDown;
JavaScriptEvent&lt;MouseEventArgs&gt; EMouseUp;
JavaScriptEvent&lt;MouseMovementArgs&gt; EMouseOver;
JavaScriptEvent&lt;MouseMovementArgs&gt; EMouseOut;
JavaScriptEvent&lt;MouseMovementArgs&gt; EMouseMove;
JavaScriptEvent&lt;KeyboardFocusArgs&gt; EFocusEnter;
JavaScriptEvent&lt;KeyboardFocusArgs&gt; EFocusLost;
JavaScriptEvent&lt;KeyEventArgs&gt; EKeyUp;
JavaScriptEvent&lt;KeyEventArgs&gt; EKeyDown;
JavaScriptEvent&lt;KeyEventArgs&gt; EKeyPressed;
</pre>
<p> </p>
<p>Note that not all events are meaningful for all widgets! Some will never fire, some might behave differently with different browsers. There is still a lot of work to do in that area! </p>
<p></p><h4>JSDelegates in XML</h4><p>
</p>
<p>JSDelegates can be configured via the XML file. Simply add to the Widget node a child named <i>events</i> and create for each different event type a child element with the name of the event. Then add your jsDelegates via the keyword <i>delegate</i>. The mapping of <i>JavaScriptEvent</i> to XML element name is as given: </p>
<ul>
<li>ESingleClick: onclick </li>
<li>EDoubleClick: ondblclick </li>
<li>EMouseDown: onmousedown </li>
<li>EMouseUp: onmouseup </li>
<li>EMouseOver: onmouseover </li>
<li>EMouseOut: onmouseout </li>
<li>EMouseMove: onmousemove </li>
<li>EFocusEnter: onfocus </li>
<li>EFocusLost: onblur </li>
<li>EKeyUp: onkeyup </li>
<li>EKeyDown: onkeydown </li>
<li>EKeyPressed: onkeypressed </li>
</ul>
<p>Assume that we have a label where we want to find out whenever someone is moving the mouse over it: </p>
<pre>&lt;label&gt;
Test Label
&lt;events&gt;
&lt;onmouseover&gt;
&lt;delegate function=&quot;printMessage&quot; file=&quot;appinf.js&quot;/&gt;
&lt;/onmouseover&gt;
&lt;/events&gt;
&lt;/label&gt;
</pre>
<p> </p>
<p></p><h3>InputField</h3><p>
An InputField extends Widget and is the abstract root class for all form members that can send data back to the server. </p>
<p></p><h4>Events</h4><p>
In addition to the events inherited from Widget, an InputField has the following JavaScriptEvents: </p>
<pre>JavaScriptEvent&lt;InputField*&gt; EChange;
JavaScriptEvent&lt;InputField*&gt; ESelect;
</pre>
<p> </p>
<p>which maps to the following XML keywords: </p>
<ul>
<li>EChange: onchange </li>
<li>ESelect: onselect </li>
</ul>
<p>Additionally, an InputField comes with a BasicEvent which works without JavaScript being enabled: </p>
<ul>
<li>Poco::BasicEvent&lt;const std::string&gt; NewText: thrown, whenever a new text is sent back from the client </li>
</ul>
<p>This event will be fired whenever the value of the input field is updated at the server. This typically happens when the client clicks on a submit <tt>Button</tt>. </p>
<p></p>
<p></p><h3>RootPanel</h3><p>
A RootPanel is the root widget for each GUI. Each Web page MUST have a RootPanel as its root element. It allows to set header specific information (by adding a HTML widget to the header element) and it takes <tt>n</tt> Widgets as children. The HTML code generated by a RootPanel is always a complete web page. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>RootPanel(const std::string&amp; name,
const std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;&amp; children = std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>rootPanel
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;rootPanel name=&quot;Test Document&quot;&gt;
&lt;header&gt;
&lt;html&gt;
&lt;![CDATA[
[...]
]]&gt;
&lt;/html&gt;
&lt;/header&gt;
&lt;children&gt;
&lt;!-- set of widgets --&gt;
&lt;/children&gt;
</pre>
<p>&lt;/rootPanel&gt; </p>
<p></p><h3>Button</h3><p>
</p>
<p>A standard click button, can be of type <i>reset</i> or <i>submit</i>. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>Button(const std::string&amp; text,
Type t = TYPE_SUBMIT); // TYPE_RESET
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>button
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>text: mandatory </li>
<li>type: optional, values = [submit|reset], default = submit </li>
<li>class: optional, when not set <i> button </i> is used. </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;button text=&quot;Click&quot; type=&quot;submit&quot;/&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;input class=&quot;button&quot; id=&quot;i8&quot; type=&quot;submit&quot; value=&quot;Click&quot;/&gt;
</pre>
<p> </p> <input class="button" id="i8" type="submit" value="Click"/> <p> </p>
<p></p><h3>CheckBox</h3><p>
A CheckBox is an InputField, checkBoxes can be grouped together by assigning them identical names. Multiple selection inside a group is possible. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>CheckBox(const std::string&amp; name, const std::string&amp; text, bool checked = false);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>checkBox
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory, must not be empty, must be unique inside the used form </li>
<li>checked: optional, values = [true|false], default = false </li>
<li>class: optional, when not set <i> checkbox </i> is used </li>
</ul>
<p></p>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;checkBox id=&quot;c1&quot; name=&quot;check&quot; checked=&quot;true&quot;&gt;Check This&lt;/checkBox&gt;
&lt;checkBox id=&quot;c2&quot; name=&quot;check&quot;&gt;Check That&lt;/checkBox&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;input checked=&quot;checked&quot; class=&quot;checkbox&quot; id=&quot;c1&quot; name=&quot;check&quot; type=&quot;checkbox&quot; value=&quot;Check This&quot;/&gt;Check This&lt;br&gt;
&lt;input class=&quot;checkbox&quot; id=&quot;c2&quot; name=&quot;check&quot; type=&quot;checkbox&quot; value=&quot;Check That&quot;/&gt;Check That
</pre>
<p> </p> <input checked="checked" class="checkbox" id="c1" name="check" type="checkbox" value="Check This"/>Check This<br> <input class="checkbox" id="c2" name="check" type="checkbox" value="Check That"/>Check That <p> </p>
<p></p>
<p></p><h3>ComboBox</h3><p>
A ComboBox offers a drop-down menu that can only contain labels. When created from an XML file, all children not equal to <i>label</i> are simply ignored. A ComboBox only allows to select one single element. If multi-selection is required, consider using a <tt>ListView</tt>. Note that a selection of -1 means nothing is selected, indices start with 0. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>ComboBox(const std::string&amp; uniqueName,
const std::vector&lt;Poco::AutoPtr&lt;Label&gt; &gt;&amp; children = std::vector&lt;Poco::AutoPtr&lt;Label&gt; &gt;(),
int selected = -1);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>comboBox
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory </li>
<li>selected: optional, which element should be pre-selected, type = integer, default = -1 </li>
<li>class: optional, when not set <i> combobox </i> is used </li>
</ul>
<p></p>
<p></p><h4>XML Example</h4><p>
The following example will pre-select the 3rd label (indizes start with 0!). </p>
<pre>&lt;comboBox name=&quot;combo&quot; select=&quot;2&quot; id=&quot;c1&quot;&gt;
&lt;label&gt;1st&lt;/label&gt;
&lt;label&gt;2nd&lt;/label&gt;
&lt;label&gt;3rd&lt;/label&gt;
&lt;label&gt;4th&lt;/label&gt;
&lt;/comboBox&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;select class=&quot;combobox&quot; id=&quot;c1&quot; name=&quot;combo&quot; size=&quot;1&quot;&gt;
&lt;option&gt;1st&lt;/option&gt;
&lt;option&gt;2nd&lt;/option&gt;
&lt;option selected=&quot;selected&quot;&gt;3rd&lt;/option&gt;
&lt;option&gt;4th&lt;/option&gt;
&lt;/select&gt;
</pre>
<p> </p> <select class="combobox" id="c1" name="combo" size="1"> <option>1st</option> <option>2nd</option> <option selected="selected">3rd</option> <option>4th</option> </select> <p> </p>
<p></p><h3>FlowPanel</h3><p>
A FlowPanel stores widgets next to each other as long as the page is wide enough. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>FlowPanel(const std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;&amp; children = std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>flow
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
No attributes. </p>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;flow&gt;
&lt;label&gt;Test Label&lt;/label&gt;
&lt;label&gt;2nd Label&lt;/label&gt;
&lt;label&gt;3rd Label&lt;/label&gt;
&lt;/flow&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;a&gt;Test Label&lt;/a&gt;&lt;a&gt;2nd Label&lt;/a&gt;&lt;a&gt;3rd Label&lt;/a&gt;
</pre>
<p> </p> <a>Test Label</a><a>2nd Label</a><a>3rd Label</a> <p> </p>
<p></p>
<p></p><h3>Form</h3><p>
A HTML form object contains multiple other widgets, mostly InputField objects. A Form contains two urls: one allows to specify the action that should be executed e.g. the url of a CGI script, and the 2nd optional URL is a redirect to a page that should be shown after processing has finished. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>Form(const Poco::URI&amp; action,
const Poco::URI&amp; redirect,
Method m = M_GET|, //M_POST
const std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;&amp; children = std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>form
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>action: mandatory, URL </li>
<li>redirect: optional, URL, if empty, action is used </li>
<li>method: optional, value = [get|post], default = get </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;form id=&quot;f1&quot; action=&quot;/test.xml&quot; method=&quot;post&quot;&gt;
[...]
&lt;/form&gt;
</pre>
<p> </p>
<p></p>
<p></p><h3>HidablePanel</h3><p>
A HidablePanel decorates a single widget with a text and a minimize button. If you want to add more than one Widget, use a <tt>StackPanel</tt>, a <tt>FlowPanel</tt> or a <tt>Table</tt> to organize these widgets, and add that single Widget. Minimizing/maximizing requires JavaScript to be enabled. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>HidablePanel(Poco::AutoPtr&lt;Widget&gt; ptr,
const Poco::URI&amp; onImage,
const Poco::URI&amp; offImage,
const std::string&amp; text,
bool inlineMode = false);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>hidablePanel
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>on: mandatory, the URL of the image to be shown when the Widget is maximized </li>
<li>off: mandatory, the URL of the image to be shown when the Widget is minimized </li>
<li>text: mandatory, the Text to write next to the image </li>
<li>inline: optional, value=[true|false], default = false, if true we allow text to flow around the maximized element, otherwise whole page width is used </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;hidablePanel id=&quot;h1&quot; on=&quot;images/on.gif&quot; off=&quot;images/off.gif&quot; text=&quot;Extended Settings&quot;&gt;
&lt;flow&gt;
&lt;label&gt;First Name&lt;/label&gt;
&lt;textField id=&quot;t1&quot; size=&quot;20&quot; maxLength=&quot;40&quot; name=&quot;first&quot;/&gt;
&lt;/flow&gt;
&lt;/hidablePanel&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>function onClickh1() {
var child = $(&quot;hpt1&quot;);
var imgBut = $(&quot;hpi1&quot;);
if (child.style.display == &quot;none&quot;) {
child.style.display = &quot;block&quot;;
imgBut.src = &quot;images/on.gif&quot;;
} else {
child.style.display = &quot;none&quot;;
imgBut.src = &quot;images/off.gif&quot;;
}
}
&lt;input class=&quot;imagebutton&quot; id=&quot;hpi1&quot; onclick=&quot;onClickh1()&quot; src=&quot;images/on.gif&quot; type=&quot;image&quot;/&gt;Extended Settings&lt;br/&gt;
&lt;input class=&quot;textfield&quot; id=&quot;hpt1&quot; maxlength=&quot;40&quot; name=&quot;first&quot; size=&quot;20&quot; type=&quot;text&quot;/&gt;
</pre>
<p> </p>
<p></p> <script type="text/javascript"> function $(id) { return document.getElementById(id); } function onClickh1() { var child = $("hpt1"); var imgBut = $("hpi1"); if (child.style.display == "none") { child.style.display = "block"; imgBut.src = "images/on.gif"; } else { child.style.display = "none"; imgBut.src = "images/off.gif"; } } </script> <input class="imagebutton" id="hpi1" onclick="onClickh1()" src="images/on.gif" type="image"/>Extended Settings<br/> <input class="textfield" id="hpt1" maxlength="40" name="first" size="20" type="text"/> <p> </p>
<p></p><h3>HTML</h3><p>
Use this class to inject raw HTML into a GUI. When defined in an XML file, wrap <tt>CDATA</tt> around the HTML code. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>HTML(const std::string&amp; txt);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>html
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
No attributes. </p>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;html&gt;
&lt;![CDATA[
&lt;meta name=&quot;Date&quot; content=&quot;2005-11-15T23:31:20+01:00&quot;&gt;
&lt;meta name=&quot;Identifier&quot; content=&quot;http://appinf.com/html/test.htm&quot;&gt;
&lt;meta name=&quot;Language&quot; content=&quot;de&quot;&gt;
]]&gt;
&lt;/html&gt;
</pre>
<p> </p>
<p></p><h3>HyperLink</h3><p>
The HyperLink object simplifies link insertion. It can contain either a label or an image as child. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>HyperLink(const Poco::URI&amp; uri, Poco::AutoPtr&lt;Widget&gt; ptrWidget=Poco::AutoPtr&lt;Widget&gt;());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>hyperLink
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>ref: mandatory, the target URL of the link. </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;hyperLink ref=&quot;http://pocoproject.org&quot;&gt;
&lt;image&gt;...&lt;/image&gt;
&lt;/hyperLink&gt;
&lt;hyperLink ref=&quot;http://pocoproject.org&quot;&gt;
&lt;label&gt;The POCO Project&lt;/label&gt;
&lt;/hyperLink&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;a href=&quot;http://pocoproject.org&quot; id=&quot;l1&quot;&gt;The POCO Project&lt;/a&gt;
</pre>
<p> </p> <a href="http://pocoproject.org" id="l1">The POCO Project</a> <p> </p>
<p></p><h3>Image</h3><p>
Used to embed an image into a web page. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>Image(const Poco::URI&amp; uri, const std::string&amp; text, Poco::UInt32 width = 0, Poco::UInt32 height = 0);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>image
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>alt: mandatory, alternative text to display when image is not found </li>
<li>src: mandatory, URL of the image </li>
<li>width: optional, width in pixel, default = 0, if set to 0, the original size of the image is used </li>
<li>height: optional, height in pixel, default = 0, if set to 0, the original size of the image is used </li>
<li>class: optional, if not set <i>image</i> is used </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;image id=&quot;i1&quot; alt=&quot;Micro Image&quot; title=&quot;Micro sized Image&quot; src=&quot;http://appinf.com/poco/images/PocoLayers.jpg&quot; width=&quot;20&quot; height=&quot;16&quot;/&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;img alt=&quot;Micro Image&quot; class=&quot;image&quot; height=&quot;16&quot; id=&quot;i1&quot; src=&quot;http://appinf.com/poco/images/PocoLayers.jpg&quot; title=&quot;Micro sized Image&quot; width=&quot;20&quot;/&gt;
</pre>
<p> </p> <img alt="Micro Image" class="image" height="16" id="i1" src="http://appinf.com/poco/images/PocoLayers.jpg" title="Micro sized Image" width="20"/> <p> </p>
<p></p><h3>ImageButton</h3><p>
An Imagebutton is basically a standard Button displaying an image instead of a text. </p>
<p></p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>ImageButton(const Poco::URI&amp; img, const std::string&amp; alternativeText, Poco::UInt32 width = 0, Poco::UInt32 height = 0);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>imageButton
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>text: mandatory, alternative text to display when image is not found </li>
<li>img: mandatory, URL of the image </li>
<li>width: optional, width in pixel, default = 0, if set to 0, the original size of the image is used </li>
<li>height: optional, height in pixel, default = 0, if set to 0, the original size of the image is used </li>
<li>class: optional, if not set <i>imagebutton</i> is used </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;imageButton id=&quot;i1&quot; text=&quot;Micro Image&quot; img=&quot;http://appinf.com/poco/images/PocoLayers.jpg&quot; width=&quot;30&quot; height=&quot;30&quot;/&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;input alt=&quot;Micro Image&quot; class=&quot;imagebutton&quot; height=&quot;30&quot; id=&quot;i1&quot; src=&quot;http://appinf.com/poco/images/PocoLayers.jpg&quot; type=&quot;image&quot; width=&quot;30&quot;/&gt;
</pre>
<p> </p> <input alt="Micro Image" class="imagebutton" height="30" id="i1" src="http://appinf.com/poco/images/PocoLayers.jpg" type="image" width="30"/> <p> </p>
<p></p>
<p></p><h3>Label</h3><p>
Use this class to add text to your GUI. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>Label(const std::string&amp; txt);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>label
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
No attributes. </p>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;label&gt;Hello&lt;/label&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>Hello
</pre>
<p> Hello </p>
<p></p><h3>ListView</h3><p>
A ListView offers a scrollable list of selectable targets. As targets only labels are valid, non-labels are ignored. Multi-selection is possible. Indices start with 0. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>ListView(const std::string&amp; uniqueName,
int viewSize,
bool multiple,
const std::vector&lt;Poco::AutoPtr&lt;Label&gt; &gt;&amp; children = std::vector&lt;Poco::AutoPtr&lt;Label&gt; &gt;());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>listView
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory, the name of the ListView </li>
<li>multiple: optional, value=[true|false], default = false, determines if multiple selection is allowed </li>
<li>select: optional, a space separated list of item positions </li>
<li>size: mandatory, how many items are displayed </li>
<li>class: optional, if not set, <i>listview</i> is used. </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;listView id=&quot;v1&quot; name=&quot;list&quot; size=&quot;3&quot; multiple=&quot;true&quot; select=&quot;0 2 4&quot;&gt;
&lt;label&gt;1st&lt;/label&gt;
&lt;label&gt;2nd&lt;/label&gt;
&lt;label&gt;3rd&lt;/label&gt;
&lt;label&gt;4th&lt;/label&gt;
&lt;label&gt;5th&lt;/label&gt;
&lt;label&gt;6th&lt;/label&gt;
&lt;/listView&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;select class=&quot;listview&quot; id=&quot;v1&quot; multiple=&quot;multiple&quot; name=&quot;list&quot; size=&quot;3&quot;&gt;
&lt;option selected=&quot;selected&quot;&gt;1st&lt;/option&gt;
&lt;option&gt;2nd&lt;/option&gt;
&lt;option selected=&quot;selected&quot;&gt;3rd&lt;/option&gt;
&lt;option&gt;4th&lt;/option&gt;
&lt;option selected=&quot;selected&quot;&gt;5th&lt;/option&gt;
&lt;option&gt;6th&lt;/option&gt;
&lt;/select&gt;
</pre>
<p> </p>
<p></p> <select class="listview" id="v1" multiple="multiple" name="list" size="3"> <option selected="selected">1st</option> <option>2nd</option> <option selected="selected">3rd</option> <option>4th</option> <option selected="selected">5th</option> <option>6th</option> </select> <p> </p>
<p></p><h3>PwdField</h3><p>
A text field to read passwords. </p>
<p></p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>PwdField(const std::string&amp; uniqueName, Poco::UInt32 size, Poco::UInt32 maxLength);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>pwdField
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory, the name of the PwdField </li>
<li>maxLength: optional, the maximum size of the typed in string </li>
<li>size: optional, the size of the GUI element in characters </li>
<li>class: optional, if not set, <i>password</i> is used. </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;pwdField id=&quot;i1&quot; size=&quot;20&quot; maxLength=&quot;40&quot; name=&quot;pwdField&quot;/&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;input class=&quot;password&quot; id=&quot;i1&quot; maxlength=&quot;40&quot; name=&quot;pwdField&quot; size=&quot;20&quot; type=&quot;password&quot;/&gt;
</pre>
<p> </p>
<p></p> <input class="password" id="i1" maxlength="40" name="pwdField" size="20" type="password"/> <p> </p>
<p></p><h3>RadioButton</h3><p>
A RadioButton is a member of a button group. Only one can be selected of a group. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>RadioButton(const std::string&amp; group, const std::string&amp; text, bool checked=false);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>radioButton
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory, must not be empty, must be unique inside the used form </li>
<li>checked: optional, values = [true|false], default = false </li>
<li>class: optional, when not set <i> checkbox </i> is used </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;radioButton id=&quot;b1&quot; name=&quot;radio&quot; checked=&quot;false&quot;&gt;Click me&lt;/radioButton&gt;
&lt;radioButton id=&quot;b2&quot; name=&quot;radio&quot; checked=&quot;true&quot;&gt;No! Click Me!&lt;/radioButton&gt;
</pre>
<p> </p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;input class=&quot;radiobutton&quot; id=&quot;b1&quot; name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;Click me&quot;/&gt;Click me&lt;br&gt;
&lt;input checked=&quot;checked&quot; class=&quot;radiobutton&quot; id=&quot;b2&quot; name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;No! Click Me!&quot;/&gt;No! Click Me!
</pre>
<p> </p>
<p></p> <input class="radiobutton" id="b1" name="radio" type="radio" value="Click me"/>Click me<br> <input checked="checked" class="radiobutton" id="b2" name="radio" type="radio" value="No! Click Me!"/>No! Click Me! <p> </p>
<p></p>
<p></p><h3>StackPanel</h3><p>
A StackPanel contains a list of Widgets which are rendered on top of each other </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>StackPanel(const std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;&amp; children = std::vector&lt;Poco::AutoPtr&lt;Widget&gt; &gt;());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>stack
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
No attributes. </p>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;stack&gt;
&lt;label&gt;Test Label&lt;/label&gt;
&lt;label&gt;2nd label&lt;/label&gt;
&lt;label&gt;3rd label&lt;/label&gt;
&lt;/stack&gt;
</pre>
<p> </p>
<p></p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>Test Label&lt;br&gt;2nd label&lt;br&gt;3rd label
</pre>
<p> </p>
<p></p> Test Label<br>2nd label<br>3rd label <p> </p>
<p></p><h3>Table</h3><p>
A Table stores a matrix of Widgets. A Table must have a column size, can have a maximum row count, can have a <i>header</i>, a <i>footer</i> and a <i>body</i>. For each of the last three elements separate attributes can be set. </p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>Table(Poco::UInt32 numRows,
Poco::UInt32 numCols,
bool tableHasFooter,
bool tableHasHeader = true,
Poco::UInt32 borderStrength = 0,
Poco::UInt32 width = 0);
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>table
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>cols: mandatory, how many columns has the table </li>
<li>rows: optional, if set will truncate/resize the table to that size </li>
<li>border: optional, size of the border around the table in pixel, default = 0 </li>
<li>header: optional, value=[true|false], should the very first line of the table be treated as a header, default = true </li>
<li>footer: optional, value=[true|false], should the last line of the table be treated as a footer, default = false </li>
<li>width: optional, the width of the table in pixel, currently UNSUPPORTED </li>
</ul>
<p></p>
<p></p><h4>XML Example</h4><p>
Note that a table consists of cells. Each cell can have a row and col index. Indices start with 0. If one of these values is not present, the last value will be taken and incremented if necessary. </p>
<p></p>
<pre>&lt;table id=&quot;i1&quot; border=&quot;1&quot; cols=&quot;3&quot;&gt;
&lt;cell&gt;
&lt;stack&gt;
&lt;radioButton id=&quot;i2&quot; name=&quot;radio&quot;&gt;Click me&lt;/radioButton&gt;
&lt;radioButton id=&quot;i3&quot; name=&quot;radio&quot;&gt;&lt;![CDATA[&lt;b&gt;No! Click Me!&lt;/b&gt;]]&gt;&lt;/radioButton&gt;
&lt;/stack&gt;
&lt;/cell&gt;
&lt;cell&gt;
&lt;stack&gt;
&lt;checkBox id=&quot;i4&quot; name=&quot;check&quot;&gt;Check This&lt;/checkBox&gt;
&lt;checkBox id=&quot;i5&quot; name=&quot;check&quot;&gt;Check That&lt;/checkBox&gt;
&lt;/stack&gt;
&lt;/cell&gt;
&lt;!-- the third column has no value --&gt;
&lt;cell row=&quot;1&quot;&gt;
&lt;stack&gt;
&lt;label&gt;A Text Area&lt;/label&gt;
&lt;textArea id=&quot;i6&quot; rows=&quot;10&quot; cols=&quot;30&quot; name=&quot;textArea&quot;/&gt;
&lt;/stack&gt;
&lt;/cell&gt;
&lt;cell col=&quot;2&quot;&gt;
&lt;flow&gt;
&lt;label&gt;A Text Field:&lt;/label&gt;
&lt;textField id=&quot;i7&quot; size=&quot;20&quot; maxLength=&quot;40&quot; name=&quot;textField&quot;/&gt;
&lt;/flow&gt;
&lt;/cell&gt;
&lt;/table&gt;
</pre>
<p> </p>
<p></p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;table border=&quot;1&quot; class=&quot;table&quot; id=&quot;i1&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
&lt;input class=&quot;radiobutton&quot; id=&quot;i2&quot; name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;Click me&quot;/&gt;Click me&lt;br&gt;
&lt;input class=&quot;radiobutton&quot; id=&quot;i3&quot; name=&quot;radio&quot; type=&quot;radio&quot; value=&quot;No! Click Me!&quot;/&gt;No! Click Me!
&lt;/th&gt;
&lt;th&gt;
&lt;input class=&quot;checkbox&quot; id=&quot;i4&quot; name=&quot;check&quot; type=&quot;checkbox&quot; value=&quot;Check This&quot;/&gt;Check This&lt;br&gt;
&lt;input class=&quot;checkbox&quot; id=&quot;i5&quot; name=&quot;check&quot; type=&quot;checkbox&quot; value=&quot;Check That&quot;/&gt;Check That&lt;/th&gt;
&lt;th&gt;
&amp;nbsp;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
A Text Area&lt;br&gt;
&lt;textarea class=&quot;textarea&quot; cols=&quot;30&quot; id=&quot;i6&quot; name=&quot;textArea&quot; rows=&quot;10&quot;&gt;&lt;/textarea&gt;
&lt;/td&gt;
&lt;td&gt;
&amp;nbsp;
&lt;/td&gt;
&lt;td&gt;
&lt;a&gt;A Text Field:&lt;/a&gt;
&lt;a&gt;&lt;input class=&quot;textfield&quot; id=&quot;i7&quot; maxlength=&quot;40&quot; name=&quot;textField&quot; size=&quot;20&quot; type=&quot;text&quot;/&gt;&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
</pre>
<p> </p>
<p></p> <table border="1" class="table" id="i1"> <thead> <tr> <th> <input class="radiobutton" id="i2" name="radio" type="radio" value="Click me"/>Click me<br> <input class="radiobutton" id="i3" name="radio" type="radio" value="No! Click Me!"/>No! Click Me! </th> <th> <input class="checkbox" id="i4" name="check" type="checkbox" value="Check This"/>Check This<br> <input class="checkbox" id="i5" name="check" type="checkbox" value="Check That"/>Check That</th> <th> &nbsp; </th> </tr> </thead> <tbody> <tr> <td> A Text Area<br> <textarea class="textarea" cols="30" id="i6" name="textArea" rows="10"></textarea> </td> <td> &nbsp; </td> <td> <a>A Text Field:</a> <a><input class="textfield" id="i7" maxlength="40" name="textField" size="20" type="text"/></a> </td> </tr> </tbody> </table> <p> </p>
<p></p><h3>TextArea</h3><p>
A TextArea is a multi-line text field. Note that any default text will show up in the TextArea as entered in the XML file, i.e. with line breaks and tabs. </p>
<p></p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>TextArea(const std::string&amp; uniqueName,
Poco::UInt32 rows,
Poco::UInt32 cols,
const std::string&amp; defTxt = std::string());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>textArea
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory </li>
<li>rows: mandatory, the width of the textfield in characters </li>
<li>cols: mandatory, the height of the textfield in characters </li>
<li>class: optional, if empty <i>textarea</i> will be used </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;textArea id=&quot;i6&quot; rows=&quot;10&quot; cols=&quot;30&quot; name=&quot;textArea&quot;&gt;default text&lt;/textArea&gt;
</pre>
<p> </p>
<p></p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;textarea class=&quot;textarea&quot; cols=&quot;30&quot; id=&quot;i6&quot; name=&quot;textArea&quot; rows=&quot;10&quot;&gt;default text&lt;/textarea&gt;
</pre>
<p> </p>
<p></p> <textarea class="textarea" cols="30" id="i6" name="textArea" rows="10">default text</textarea> <p> </p>
<p></p>
<p></p><h3>TextField</h3><p>
A TextField is a single-line text field. </p>
<p></p>
<p></p><h4>C++ Code</h4><p>
</p>
<pre>TextField(const std::string&amp; uniqueName,
Poco::UInt32 size,
Poco::UInt32 maxLength,
const std::string&amp; defTxt = std::string());
</pre>
<p> </p>
<p></p><h4>XML Keyword</h4><p>
</p>
<pre>textField
</pre>
<p> </p>
<p></p><h4>XML Attributes</h4><p>
</p>
<ul>
<li>name: mandatory </li>
<li>size: mandatory, the width of the textfield in characters </li>
<li>maxLength: optional, the maximum length of the string one can type </li>
<li>class: optional, if empty <i>textfield</i> will be used </li>
</ul>
<p></p><h4>XML Example</h4><p>
</p>
<pre>&lt;textField id=&quot;i7&quot; size=&quot;20&quot; maxLength=&quot;40&quot; name=&quot;textField&quot;&gt;default text&lt;/textField&gt;
</pre>
<p> </p>
<p></p>
<p></p><h4>HTML Code</h4><p>
</p>
<pre>&lt;input class=&quot;textfield&quot; id=&quot;i7&quot; maxlength=&quot;40&quot; name=&quot;textField&quot; size=&quot;20&quot; type=&quot;text&quot; value=&quot;default text&quot;/&gt;
</pre>
<p> </p>
<p></p> <input class="textfield" id="i7" maxlength="40" name="textField" size="20" type="text" value="default text"/> <p> </p>
<p></p><h2>Registering pages at URLs</h2><p>
The WebWidgets project comes with a pre-defined HTTPRequestHandlerFactory named Poco::WebWidgets::WidgetHandlerFactory. To get a WebWidgets application up and running follow these steps: </p>
<ul>
<li>create the WidgetHandlerFactory </li>
<li>load/create your widgets </li>
<li>register for events if required </li>
<li>register the widgets at the WidgetHandlerFactory </li>
<li>start a HTTPServer with the WidgetHandlerFactory </li>
<li>make sure that appinf.js is in the root dir of the server! </li>
</ul>
<p>Example: </p>
<pre>unsigned short port = (unsigned short) config().getInt(&quot;HTTPFormServer.port&quot;, 9980);
// set-up a server socket
ServerSocket svs(port);
// set-up a HTTPServer instance
Poco::URI root(&quot;/&quot;);
// create the WidgetHandlerFactory
WidgetHandlerFactory* pFac = new WidgetHandlerFactory();
// load/create your widgets
std::ifstream in(&quot;Order.xml&quot;);
Poco::AutoPtr&lt;Widget&gt; ptrWidget = XMLUtil::loadWidget(in);
// register for events if required
Poco::AutoPtr&lt;Widget&gt; ptrSubmitButton = ptrWidget-&gt;find(&quot;submit&quot;);
poco_assert (ptrSubmitButton);
ptrSubmitButton-&gt;ESingleClick += delegate(this, &amp;MyServerApp:onOrderClicked);
// register the widgets at the WidgetHandlerFactory
pFac-&gt;addWidget(root, ptrWidget);
HTTPServer srv(pFac, svs, new HTTPServerParams);
// start the HTTPServer
srv.start();
// wait for CTRL-C or kill
waitForTerminationRequest();
// Stop the HTTPServer
srv.stop();
return Application::EXIT_OK;
</pre>
<p> </p>
<p>Note that the WidgetHandlerFactory is still incomplete. At least a possibility to add ones own HTTPRequestHandler for a given URI is required! </p>
<p></p>
</div>
<p class="footer">C++ Portable Components 1.0<br />
Copyright &copy; 2007, <a href="http://www.appinf.com/" target="_blank">Applied Informatics</a></p>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

View File

@ -1,100 +0,0 @@
//
// AbstractButton.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/AbstractButton.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: AbstractButton
//
// Definition of the AbstractButton 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_AbstractButton_INCLUDED
#define WebWidgets_AbstractButton_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API AbstractButton: public Widget
/// An AbstractButton is the super class for all buttons.
{
public:
static const std::string XML_TEXT;
AbstractButton(const std::string& text);
/// Creates the AbstractButton.
AbstractButton(const Poco::XML::Element* pElem);
/// Creates the AbstractButton from the XML element.
virtual ~AbstractButton();
/// Destroys the AbstractButton.
void setText(const std::string& txt);
/// Sets the text shown on the button
const std::string& getText() const;
/// Returns the text shown on the button
Poco::AutoPtr<Widget> find(const std::string& id) const;
private:
std::string _text;
};
inline Poco::AutoPtr<Widget> AbstractButton::find(const std::string& id) const
{
return Poco::AutoPtr<Widget>();
}
inline void AbstractButton::setText(const std::string& txt)
{
_text = txt;
}
inline const std::string& AbstractButton::getText() const
{
return _text;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_AbstractButton_INCLUDED

View File

@ -1,105 +0,0 @@
//
// Button.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Button.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Button
//
// Definition of the Button 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_Button_INCLUDED
#define WebWidgets_Button_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/AbstractButton.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Button: public AbstractButton
/// A standard clickbutton.
/// <button text="ClickMe" type="submit|reset"/>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_TYPE;
static const std::string VAL_RESET;
enum Type
{
TYPE_SUBMIT,
TYPE_RESET
};
Button(const std::string& text, Type t = TYPE_SUBMIT);
/// Creates the Button.
Button(const Poco::XML::Element* pElem);
/// Creates the Button from the XML element.
virtual ~Button();
/// Destroys the Button.
Type getType() const;
/// Gets the type of the button
void setType(Type t);
/// Sets the type of the button
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
private:
Type _type;
};
inline Button::Type Button::getType() const
{
return _type;
}
inline void Button::setType(Button::Type t)
{
_type = t;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Button_INCLUDED

View File

@ -1,102 +0,0 @@
//
// CheckBox.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/CheckBox.h#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: CheckBox
//
// Definition of the CheckBox 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_CheckBox_INCLUDED
#define WebWidgets_CheckBox_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/InputField.h"
#include "Poco/BasicEvent.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API CheckBox: public InputField
/// A CheckBox class. CheckBoxes with the same name belong to the same group:
/// <checkBox name="check">Check This</checkBox>
/// <checkBox name="check" checked="true">Check That</checkBox>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_CHECKED;
Poco::BasicEvent<const bool> Checked;
CheckBox(const std::string& name, const std::string& text, bool checked = false);
/// Creates the CheckBox. The name defines the group to which the CheckBox belongs
CheckBox(const Poco::XML::Element* pElem);
/// Creates the CheckBox from XML
virtual ~CheckBox();
/// Destroys the CheckBox.
void accept(Visitor& v);
void setChecked(bool val);
bool getChecked() const;
Poco::AutoPtr<Widget> clone() const;
private:
std::string _group;
bool _checked;
};
inline void CheckBox::setChecked(bool val)
{
_checked = val;
Checked(this, _checked);
}
inline bool CheckBox::getChecked() const
{
return _checked;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_CheckBox_INCLUDED

View File

@ -1,127 +0,0 @@
//
// ComboBox.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/ComboBox.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ComboBox
//
// Definition of the ComboBox 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_ComboBox_INCLUDED
#define WebWidgets_ComboBox_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/IndexedPanel.h"
#include "Poco/WebWidgets/Label.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API ComboBox: public IndexedPanel
/// ComboBox class offers a drop-down menu.
/// It can only have children of type "label". All other entries are ignored. The select attribute can be used to
/// preselect an element. Note that the first element has index 0!
/// <comboBox name="combo" select="2">
/// <label>1st</label>
/// <label>2nd</label>
/// <label>3rd</label>
/// <label>4th</label>
/// </comboBox>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_SELECT;
ComboBox(const std::string& uniqueName, const std::vector<Poco::AutoPtr<Label> >& children = std::vector<Poco::AutoPtr<Label> >(), int selected = -1);
/// Creates the ComboBox.
ComboBox(const Poco::XML::Element* pElem);
/// Creates the ComboBox.
virtual ~ComboBox();
/// Destroys the ComboBox.
virtual int getSelectedIndex() const;
/// Returns the index of the selected element. Returns -1 if nothing is selected.
virtual void select(int idx);
/// Selects the element at pos idx
void accept(Visitor& v);
const std::string& getName() const;
void setName(const std::string& name);
Poco::AutoPtr<Widget> clone() const;
protected:
ComboBox(const std::string& uniqueName, const std::vector<Poco::AutoPtr<Widget> >& children = std::vector<Poco::AutoPtr<Widget> >(), int selected = -1);
/// Creates the ComboBox.
private:
std::string _name;
int _selected;
};
inline int ComboBox::getSelectedIndex() const
{
return _selected;
}
inline void ComboBox::select(int idx)
{
_selected = idx;
}
inline const std::string& ComboBox::getName() const
{
return _name;
}
inline void ComboBox::setName(const std::string& name)
{
_name = name;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_ComboBox_INCLUDED

View File

@ -1,73 +0,0 @@
//
// ComplexPanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/ComplexPanel.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ComplexPanel
//
// Definition of the ComplexPanel 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_ComplexPanel_INCLUDED
#define WebWidgets_ComplexPanel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Panel.h"
#include "Poco/AutoPtr.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API ComplexPanel: public Panel
/// A ComplexPanel is a panel storing more than one widget
{
public:
ComplexPanel();
/// Creates the ComplexPanel.
ComplexPanel(const Poco::XML::Element* pElem);
/// Creates the ComplexPanel from the XML.
virtual ~ComplexPanel();
/// Destroys the ComplexPanel.
virtual void add(Poco::AutoPtr<Widget> ptrWidget) = 0;
/// Adds a widget to the panel
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_ComplexPanel_INCLUDED

View File

@ -1,77 +0,0 @@
//
// FileHandler.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/FileHandler.h#1 $
//
// Library: WebWidgets
// Package: HTTPHandler
// Module: FileHandler
//
// Definition of the FileHandler 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_JSFileHandler_INCLUDED
#define WebWidgets_JSFileHandler_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API FileHandler: public Poco::Net::HTTPRequestHandler
/// FileHandler handles downloading of files
{
public:
FileHandler();
/// Creates the FileHandler.
virtual ~FileHandler();
/// Destroys the FileHandler.
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
private:
std::string mapUriToFile(const std::string& uri) const;
static std::map<std::string, std::string> initExtensions();
static std::map<std::string, std::string> EXTENSIONMAPPING;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_JSFileHandler_INCLUDED

View File

@ -1,82 +0,0 @@
//
// FlowPanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/FlowPanel.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: FlowPanel
//
// Definition of the FlowPanel 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_FlowPanel_INCLUDED
#define WebWidgets_FlowPanel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/IndexedPanel.h"
#include "Poco/AutoPtr.h"
#include <vector>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API FlowPanel: public IndexedPanel
/// A FlowPanel stores widgets next to each other as long the page offers enough place
/// <flow>
/// children
/// </flow>
{
public:
static const std::string FACTORY_ID;
typedef std::vector<Poco::AutoPtr<Widget> > Children;
FlowPanel(const std::vector<Poco::AutoPtr<Widget> >& children = std::vector<Poco::AutoPtr<Widget> >());
/// Creates the FlowPanel.
FlowPanel(const Poco::XML::Element* pElem);
/// Creates the FlowPanel from the XML element.
virtual ~FlowPanel();
/// Destroys the FlowPanel.
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_FlowPanel_INCLUDED

View File

@ -1,143 +0,0 @@
//
// Form.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Form.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Form
//
// Definition of the Form 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_Form_INCLUDED
#define WebWidgets_Form_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/IndexedPanel.h"
#include "Poco/URI.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Form: public IndexedPanel
/// A HTML form object containing multiple other widgets.
/// A Form contains two urls: one allows to specify the action that should be executed
/// e.g. the url of a CGI script, and the 2nd optional is a redirect URL to a page that
/// should be shown after processing has finished.
{
public:
static const std::string FACTORY_ID;
static const std::string XML_ACTION;
static const std::string XML_REDIRECT;
static const std::string XML_METHOD;
static const std::string VAL_GET;
static const std::string VAL_POST;
enum Method
{
M_GET,
M_POST
};
Form(const Poco::URI& action, const Poco::URI& redirect, Method m = M_GET, const std::vector<Poco::AutoPtr<Widget> >& children = std::vector<Poco::AutoPtr<Widget> >());
/// Creates the Form. If redirect is an empty URL, we assume to redirect to action.
Form(const Poco::XML::Element* pElem);
/// Creates the Form from the XML.
virtual ~Form();
/// Destroys the Form.
void accept(Visitor& v);
const Poco::URI& getAction() const;
/// Get the url to which the form will direct to.
const Poco::URI& getRedirect() const;
/// Get the url to which we will redirect after we have prcoessed the form elements
Form::Method getMethod() const;
/// Returns if we use a GET or POST HTML command
const std::string& getMethodStr() const;
/// Returns if we use a GET or POST HTML command as string
void setAction(const Poco::URI& action);
/// Sets the action
void setMethod(Form::Method method);
/// Sets the type of command method
Poco::AutoPtr<Widget> clone() const;
private:
Poco::URI _action;
Poco::URI _redirect;
Method _method;
};
inline const Poco::URI& Form::getAction() const
{
return _action;
}
inline const Poco::URI& Form::getRedirect() const
{
return _redirect;
}
inline Form::Method Form::getMethod() const
{
return _method;
}
inline void Form::setAction(const Poco::URI& action)
{
_action = action;
}
inline void Form::setMethod(Form::Method method)
{
_method = method;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Form_INCLUDED

View File

@ -1,80 +0,0 @@
//
// FormHandler.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/FormHandler.h#3 $
//
// Library: WebWidgets
// Package: HTTPHandler
// Module: FormHandler
//
// Definition of the FormHandler 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_FormHandler_INCLUDED
#define WebWidgets_FormHandler_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Form.h"
#include "Poco/WebWidgets/InputField.h"
#include "Poco/WebWidgets/CheckBox.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/AutoPtr.h"
#include <map>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API FormHandler: public Poco::Net::HTTPRequestHandler
/// A FormHandler is responsible for dispatching form data to the individual
/// InputFields
{
public:
FormHandler(Poco::AutoPtr<Form> ptrForm, const std::map<std::string, Poco::AutoPtr<InputField> >& inputs, const std::multimap<std::string, Poco::AutoPtr<CheckBox> >& checkBoxes);
/// Creates the FormHandler.
virtual ~FormHandler();
/// Destroys the FormHandler.
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
private:
Poco::AutoPtr<Form> _ptrForm;
std::map<std::string, Poco::AutoPtr<InputField> > _inputFields;
std::multimap<std::string, Poco::AutoPtr<CheckBox> > _checkBoxes;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_FormHandler_INCLUDED

View File

@ -1,76 +0,0 @@
//
// GUIObject.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/GUIObject.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: GUIObject
//
// Definition of the GUIObject 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_GUIObject_INCLUDED
#define WebWidgets_GUIObject_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Visitable.h"
namespace Poco {
namespace XML {
class Element;
}
}
namespace Poco {
namespace WebWidgets {
class WebWidgets_API GUIObject: public Visitable
/// A GUIObject is the root object of all elements used inside the GUI
{
public:
GUIObject();
/// Creates the GUIObject.
GUIObject(const Poco::XML::Element* pElem);
/// Creates the GUIObject by parsing the pElem. pElem must not be null.
virtual ~GUIObject();
/// Destroys the GUIObject.
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_GUIObject_INCLUDED

View File

@ -1,91 +0,0 @@
//
// HTML.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/HTML.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: HTML
//
// Definition of the HTML 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_HTML_INCLUDED
#define WebWidgets_HTML_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Label.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API HTML: public Label
/// HTML class contains raw HTML code
/// <html>
/// <![CDATA[
/// <i>some text</i>
/// ]]>
/// </html>
{
public:
static const std::string FACTORY_ID;
HTML();
/// Creates the HTML object without text
HTML(const std::string& txt);
/// Creates a HTML with the given html text
HTML(const Poco::XML::Element* pElem);
/// Creates a HTML from the given element
virtual ~HTML();
/// Destroys the HTML.
void accept(Visitor& v);
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
};
inline Poco::AutoPtr<Widget> HTML::find(const std::string& id) const
{
return Poco::AutoPtr<Widget>();
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_HTML_INCLUDED

View File

@ -1,444 +0,0 @@
//
// HTMLVisitor.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/HTMLVisitor.h#8 $
//
// Library: WebWidgets
// Package: WebVisitor
// Module: HTMLVisitor
//
// Definition of the HTMLVisitor 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_HTMLVisitor_INCLUDED
#define WebWidgets_HTMLVisitor_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/Form.h"
#include "Poco/WebWidgets/InputField.h"
#include "Poco/WebWidgets/JavaScriptEvent.h"
#include "Poco/WebWidgets/JSDelegate.h"
#include "Poco/AutoPtr.h"
#include "Poco/String.h"
#include "Poco/URI.h"
#include <vector>
#include <list>
#include <set>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API HTMLVisitor: public Visitor
/// HTMLVisitor converts a GUI description into HTML code
{
public:
static const std::string TAG_DIV;
static const std::string TAG_HTML;
static const std::string TAG_HEAD;
static const std::string TAG_TITLE;
static const std::string TAG_IMG;
static const std::string TAG_BODY;
static const std::string TAG_TABLE;
static const std::string TAG_THEAD;
static const std::string TAG_TBODY;
static const std::string TAG_TFOOT;
static const std::string TAG_PRE;
static const std::string TAG_A;
static const std::string TAG_INPUT;
static const std::string TAG_TEXTAREA;
static const std::string TAG_FORM;
static const std::string TAG_SELECT;
static const std::string TAG_OPTION;
static const std::string ATTR_ID;
static const std::string ATTR_HREF;
static const std::string ATTR_TYPE;
static const std::string ATTR_VALUE;
static const std::string ATTR_SRC;
static const std::string ATTR_ALT;
static const std::string ATTR_COLS;
static const std::string ATTR_ROWS;
static const std::string ATTR_SIZE;
static const std::string ATTR_MAXLENGTH;
static const std::string ATTR_NAME;
static const std::string ATTR_CHECKED;
static const std::string ATTR_ONCLICK;
static const std::string VAL_SPACE;
static const std::string VAL_TABLECELLEMPTY;
static const std::string VAL_SUBMIT;
static const std::string VAL_RESET;
static const std::string VAL_IMAGE;
static const std::string VAL_ONCLICK;
static const std::string VAL_TEXT;
static const std::string VAL_CHECKBOX;
static const std::string VAL_RADIO;
static const std::string VAL_SELECTED;
static const std::string VAL_MULTIPLE;
static const std::string VAL_PASSWORD;
static const std::string XML_BR;
static const std::string XML_A_OPEN;
static const std::string XML_A_CLOSE;
static const std::string XML_P_OPEN;
static const std::string XML_P_CLOSE;
static const std::string XML_TR_OPEN;
static const std::string XML_TR_CLOSE;
static const std::string XML_TH_OPEN;
static const std::string XML_TH_CLOSE;
static const std::string XML_TD_OPEN;
static const std::string XML_TD_CLOSE;
static const std::string PRE_OPEN;
static const std::string PRE_CLOSE;
static const std::string CLOSE;
static const std::string FULLCLOSE;
static const std::string ASSIGNQUOTE;
static const std::string QUOTE;
static const std::string CLASS_BUTTON;
static const std::string CLASS_CHECKBOX;
static const std::string CLASS_COMBOBOX;
static const std::string CLASS_IMAGE;
static const std::string CLASS_IMAGEBUTTON;
static const std::string CLASS_LISTVIEW;
static const std::string CLASS_RADIOBUTTON;
static const std::string CLASS_TABLE;
static const std::string CLASS_TEXTAREA;
static const std::string CLASS_TEXTFIELD;
static const std::string CLASS_PASSWORD;
static const std::string FILE_APPINF_JS;
static const std::string EVENT_SINGLECLICK;
static const std::string EVENT_DOUBLECLICK;
static const std::string EVENT_MOUSEDOWN;
static const std::string EVENT_MOUSEUP;
static const std::string EVENT_MOUSEOVER;
static const std::string EVENT_MOUSEOUT;
static const std::string EVENT_MOUSEMOVE;
static const std::string EVENT_FOCUSENTER;
static const std::string EVENT_FOCUSLOST;
static const std::string EVENT_KEYUP;
static const std::string EVENT_KEYDOWN;
static const std::string EVENT_KEYPRESSED;
static const std::string EVENT_SELECT;
static const std::string EVENT_CHANGE;
Poco::BasicEvent<std::pair<Poco::URI, Widget*> > EWidget;
///Event contains the owner (the uri) and the widget
Poco::BasicEvent<std::pair<Poco::URI, Form*> > EContainsForm;
///Event contains the owner (the uri) and the form object
Poco::BasicEvent<std::pair<Form*, InputField*> > EHasInputField;
/// Events contains the InputField and the form to which it belongs
Poco::BasicEvent<std::pair<Form*, CheckBox*> > EHasCheckBox;
/// Events contains the CheckBox and the form to which it belongs
HTMLVisitor(std::ostream& out, const Poco::URI& rootAddress);
/// Creates the HTMLVisitor.
virtual ~HTMLVisitor();
/// Destroys the HTMLVisitor.
void visit(Label& label);
/// Generates code for a label
void visit(HTML& raw);
/// Generates code for a raw HTML element
void visit(RootPanel& main);
/// Generates code for the RootPanel class
void visit(Image& img);
/// Generates code for an image
void visit(FlowPanel& flow);
/// Generates code for a FlowPanel
void visit(Table& table);
/// Generates code for a Table
void visit(HyperLink& link);
/// Generates code for a HyperLink
void visit(Button& but);
/// Generates code for a Button
void visit(ImageButton& but);
/// Generates code for a ImageButton
void visit(TextArea& txt);
/// Generates code for a TextArea
void visit(TextField& txt);
/// Generates code for a TextField
void visit(CheckBox& but);
/// Generates code for a CheckBox
void visit(RadioButton& but);
/// Generates code for a RadioButton
void visit(Form& f);
/// Generates code for a Form
void visit(IndexedPanel& p);
/// Generates code for a IndexedPanel
void visit(StackPanel& p);
/// Generates code for a StackPanel
void visit(ComboBox& p);
/// Generates code for a ComboBox
void visit(ListView& l);
/// Generates code for a ListView
void visit(HidablePanel& l);
/// Generates code for a HidablePanel
void visit(PwdField& l);
/// Generates code for a PwdField
void preVisit(Widget& widget);
void preVisit(SimplePanel& widget);
void preVisit(IndexedPanel& widget);
void preVisit(HidablePanel& l);
void preVisit(RootPanel& main);
void preVisit(InputField& input);
private:
void writeOpenTag(const std::string& tag);
/// Writes <tag>
void writeCloseTag(const std::string& tag);
/// Writes </tag>
void writeTag(const std::string& tag);
/// Writes <tag/>
void writeOpenWithAttributes(const std::string& tag, const Widget::Attributes& attr);
/// Writes <tag attr="a" attr2="ba">
void writeOpenWithAttributes(const std::string& tag, const Widget& widget);
/// Writes <tag attr="a" attr2="ba">
void writeTagWithAttributes(const std::string& tag, const Widget& widget);
/// Writes <tag attr="a" attr2="ba"/>
void writeTagWithAttributes(const std::string& tag, const Widget::Attributes& attr);
/// Writes <tag attr="a" attr2="ba"/>
void writeAttributes(const Widget::Attributes& attr);
void accept(const std::vector<Poco::AutoPtr<Widget> >& widgets);
/// calls accept on each member of the list
void preAccept(const std::vector<Poco::AutoPtr<Widget> >& widgets);
/// calls accept on each member of the list
void addJavaScript(const std::string& js);
void addToOnLoad(const std::string& js);
void writeJavaScript();
void writeSingleLine(const std::string& code, int& indentation);
void writeJSIncludes(int indent);
void writeIndent(int indent);
std::string onClickMethodName(const std::string& id);
void assertHasID(Widget& w);
void addJavaScriptInclude(const std::string& js);
template<typename TArgs>
void handleEvent(Widget& widget, JavaScriptEvent<TArgs>& ev, const std::string& eventType)
{
if (ev.hasJavaScriptHandlers() || ev.hasLocalHandlers())
{
// if we have exactly one delegate, it is simple but if we have more than one
// we need to generate a wrapper method that calls all delegates sequentially.
// we assume that the method signature of the delegates is correct
const std::set<JSDelegate>& del = ev.jsDelegates();
std::set<JSDelegate>::const_iterator it = del.begin();
std::set<JSDelegate>::const_iterator itEnd = del.end();
for (; it != itEnd; ++it)
{
addJavaScriptInclude(it->jsFile());
}
addJavaScript("function " + generateMultiEventHandlerName(widget, eventType) + "(ev) {");
addJavaScript("if (!ev) {");
addJavaScript("ev = window.event;");
addJavaScript("}");
it = del.begin();
itEnd = del.end();
for (; it != itEnd; ++it)
{
addJavaScript(it->functionName()+"(ev);");
}
if (ev.hasLocalHandlers())
{
// add a callback to the server
std::string addr = _rootAddress.toString() + "/events";
Poco::replaceInPlace(addr, "//", "/");
if (eventType == EVENT_SINGLECLICK ||
eventType == EVENT_DOUBLECLICK ||
eventType == EVENT_MOUSEDOWN ||
eventType == EVENT_MOUSEUP)
addJavaScript("mouseEventCallBack(ev, \"" + addr + "\");");
else if (eventType == EVENT_MOUSEOVER ||
eventType == EVENT_MOUSEOUT ||
eventType == EVENT_MOUSEMOVE ||
eventType == EVENT_FOCUSENTER ||
eventType == EVENT_FOCUSLOST)
addJavaScript("mouseMoveEventCallBack(ev, \"" + addr + "\");");
else if (eventType == EVENT_KEYUP ||
eventType == EVENT_KEYDOWN ||
eventType == EVENT_KEYPRESSED)
addJavaScript("keyboardEventCallBack(ev, \"" + addr + "\");");
else
addJavaScript("eventCallBack(ev, \"" + addr + "\");");
}
addJavaScript("}");
}
}
template<typename TArgs>
void handleCallbackGeneration(Widget& widget, JavaScriptEvent<TArgs>& ev, const std::string& eventType, Widget::Attributes& attr)
{
if (ev.hasJavaScriptHandlers() || ev.hasLocalHandlers())
{
std::string fctName = generateMultiEventHandlerName(widget, eventType);
attr.insert(std::make_pair(eventType, fctName+"(event)"));
}
}
void handleWidgetCallback(Widget& widget, Widget::Attributes& attr);
static std::string autoID();
/// Automatically generates an id
static std::string generateMultiEventHandlerName(const Widget& widget, const std::string& eventType);
static std::string generateServerEventHandlerName(const Widget& widget);
static void handleCallbackGeneration(Widget& widget, const std::string& eventType, Widget::Attributes& attr);
/// Adds the function attribute to attr
private:
std::ostream& _out;
Poco::URI _rootAddress;
Form* _pActiveForm;
std::list<std::string> _javaScriptHeader;
std::list<std::string> _javaScriptOnLoad;
std::set<std::string> _javaScriptIncludes;
};
inline void HTMLVisitor::writeOpenWithAttributes(const std::string& tag, const Widget& widget)
{
writeOpenWithAttributes(tag, widget.getAttributes());
}
inline void HTMLVisitor::writeTagWithAttributes(const std::string& tag, const Widget& widget)
{
writeTagWithAttributes(tag, widget.getAttributes());
}
inline void HTMLVisitor::writeOpenTag(const std::string& tag)
{
_out << PRE_OPEN << tag << CLOSE;
}
inline void HTMLVisitor::writeCloseTag(const std::string& tag)
{
_out << PRE_CLOSE << tag << CLOSE;
}
inline void HTMLVisitor::writeTag(const std::string& tag)
{
_out << PRE_OPEN << tag << FULLCLOSE;
}
inline void HTMLVisitor::addJavaScript(const std::string& js)
{
_javaScriptHeader.push_back(js);
}
inline void HTMLVisitor::addJavaScriptInclude(const std::string& js)
{
_javaScriptIncludes.insert(js);
}
inline void HTMLVisitor::addToOnLoad(const std::string& js)
{
_javaScriptOnLoad.push_back(js);
}
inline std::string HTMLVisitor::onClickMethodName(const std::string& id)
{
return VAL_ONCLICK + id;
}
inline void HTMLVisitor::assertHasID(Widget& w)
{
if (w.getAttrID().empty())
w.setAttrID(autoID());
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_HTMLVisitor_INCLUDED

View File

@ -1,126 +0,0 @@
//
// HidablePanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/HidablePanel.h#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: HidablePanel
//
// Definition of the HidablePanel 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_HidablePanel_INCLUDED
#define WebWidgets_HidablePanel_INCLUDED
#include "Poco/WebWidgets/SimplePanel.h"
#include "Poco/URI.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API HidablePanel: public SimplePanel
/// A HidablePanel decorates a panel and allows to hide it:
///
/// <hidablePanel on="on.png" off="off.png" text="Some text" inline="true|false">
/// <oneSingleChildWidget...>
/// </hidablePanel>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_ON;
static const std::string XML_OFF;
static const std::string XML_TEXT;
static const std::string ATTR_INLINE;
HidablePanel(Poco::AutoPtr<Widget> ptr, const Poco::URI& onImage, const Poco::URI& offImage, const std::string& text, bool inlineMode = false);
/// Creates the HidablePanel. inlineMode defines how the HidablePanel is rendered when visible. If true we allow text to flow
/// around it, otherwise it reserves the whole page length
HidablePanel(const Poco::XML::Element* pElem);
/// Creates the HidablePanel from XML.
virtual ~HidablePanel();
/// Destroys the HidablePanel.
const Poco::URI& onImg() const;
const Poco::URI& offImg() const;
const std::string& text() const;
bool inlineMode() const;
void accept(Visitor& v);
void preAccept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
private:
Poco::URI _onImg;
Poco::URI _offImg;
std::string _text;
bool _inlineMode;
};
inline const Poco::URI& HidablePanel::onImg() const
{
return _onImg;
}
inline const Poco::URI& HidablePanel::offImg() const
{
return _offImg;
}
inline const std::string& HidablePanel::text() const
{
return _text;
}
inline bool HidablePanel::inlineMode() const
{
return _inlineMode;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_HidablePanel_INCLUDED

View File

@ -1,128 +0,0 @@
//
// HyperLink.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/HyperLink.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: HyperLink
//
// Definition of the HyperLink 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_HyperLink_INCLUDED
#define WebWidgets_HyperLink_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/URI.h"
#include "Poco/AutoPtr.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API HyperLink: public Widget
/// A HyperLink points to another URI, can contain other inline elements like a Label or an Image
/// <hyperLink ref="http://...."><image>...</image></hyperLink>
/// <hyperLink ref="http://...."><label>Some Text</label></hyperLink>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_REF;
HyperLink(const Poco::URI& uri, Poco::AutoPtr<Widget> ptrWidget=Poco::AutoPtr<Widget>());
/// Creates the HyperLink.
HyperLink(const Poco::XML::Element* pElem);
/// Creates the HyperLink from the XML.
virtual ~HyperLink();
/// Destroys the HyperLink.
const Poco::URI& getURI() const;
Poco::AutoPtr<Widget> getInnerWidget() const;
void setURI(const Poco::URI& uri);
void setInnerWidget(Poco::AutoPtr<Widget> ptr);
void accept(Visitor& v);
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
private:
Poco::URI _uri;
Poco::AutoPtr<Widget> _ptrInner;
};
inline Poco::AutoPtr<Widget> HyperLink::find(const std::string& id) const
{
if (_ptrInner && _ptrInner->getAttrID() == id)
{
return _ptrInner;
}
return Poco::AutoPtr<Widget>();
}
inline const Poco::URI& HyperLink::getURI() const
{
return _uri;
}
inline Poco::AutoPtr<Widget> HyperLink::getInnerWidget() const
{
return _ptrInner;
}
inline void HyperLink::setURI(const Poco::URI& uri)
{
_uri = uri;
}
inline void HyperLink::setInnerWidget(Poco::AutoPtr<Widget> ptr)
{
_ptrInner = ptr;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_HyperLink_INCLUDED

View File

@ -1,165 +0,0 @@
//
// Image.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Image.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Image
//
// Definition of the Image 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_Image_INCLUDED
#define WebWidgets_Image_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/URI.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Image: public Widget
/// Image describes an HTML image. Width and height are per default 0 which equals to original size
///
/// <image alt="Some text" src="/image.png" width="23" height=23/>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_ALT;
static const std::string XML_SRC;
static const std::string XML_WIDTH;
static const std::string XML_HEIGHT;
Image(const Poco::URI& uri, const std::string& text, Poco::UInt32 width = 0, Poco::UInt32 height = 0);
/// Creates the Image.
Image(const Poco::XML::Element* pElem);
/// Creates the Image from the XML data.
virtual ~Image();
/// Destroys the Image.
void accept(Visitor& v);
const Poco::URI& getURI() const;
/// Returns the URI address
const std::string& getText() const;
/// Returns the alternative text
void setURI(const Poco::URI& uri);
void setText(const std::string& txt);
Poco::UInt32 getWidth() const;
Poco::UInt32 getHeight() const;
void setWidth(Poco::UInt32 width);
/// Set the width of the image, 0 means original size
void setHeight(Poco::UInt32 height);
/// Set the height of the image, 0 means original size
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
private:
Poco::URI _uri;
Poco::UInt32 _width;
Poco::UInt32 _height;
};
inline Poco::AutoPtr<Widget> Image::find(const std::string& id) const
{
return Poco::AutoPtr<Widget>();
}
inline const Poco::URI& Image::getURI() const
{
return _uri;
}
inline const std::string& Image::getText() const
{
return getValue(XML_ALT);
}
inline void Image::setURI(const Poco::URI& uri)
{
_uri = uri;
addAttribute(XML_SRC, uri.toString());
}
inline void Image::setText(const std::string& txt)
{
addAttribute(XML_ALT, txt);
}
inline Poco::UInt32 Image::getWidth() const
{
return _width;
}
inline Poco::UInt32 Image::getHeight() const
{
return _height;
}
inline void Image::setWidth(Poco::UInt32 width)
{
_width = width;
}
inline void Image::setHeight(Poco::UInt32 height)
{
_height = height;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Image_INCLUDED

View File

@ -1,135 +0,0 @@
//
// ImageButton.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/ImageButton.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ImageButton
//
// Definition of the ImageButton 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_ImageButton_INCLUDED
#define WebWidgets_ImageButton_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/AbstractButton.h"
#include "Poco/URI.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API ImageButton: public AbstractButton
/// A ImageButton is basically a submit button with an image
/// <imageButton id="someid" text="ClickMe" img="source.gif" width="30" height="30"/>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_IMG;
static const std::string XML_WIDTH;
static const std::string XML_HEIGHT;
ImageButton(const Poco::URI& img, const std::string& alternativeText, Poco::UInt32 width = 0, Poco::UInt32 height = 0);
/// Creates the ImageButton.
ImageButton(const Poco::XML::Element* pElem);
/// Creates the ImageButton from the XML element.
virtual ~ImageButton();
/// Destroys the ImageButton.
void setImage(const Poco::URI& img);
const Poco::URI& getImage() const;
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
Poco::UInt32 getWidth() const;
Poco::UInt32 getHeight() const;
void setWidth(Poco::UInt32 width);
/// Set the width of the image, 0 means original size
void setHeight(Poco::UInt32 height);
/// Set the height of the image, 0 means original size
private:
Poco::URI _img;
Poco::UInt32 _width;
Poco::UInt32 _height;
};
inline void ImageButton::setImage(const Poco::URI& img)
{
_img = img;
}
inline const Poco::URI& ImageButton::getImage() const
{
return _img;
}
inline Poco::UInt32 ImageButton::getWidth() const
{
return _width;
}
inline Poco::UInt32 ImageButton::getHeight() const
{
return _height;
}
inline void ImageButton::setWidth(Poco::UInt32 width)
{
_width = width;
}
inline void ImageButton::setHeight(Poco::UInt32 height)
{
_height = height;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_ImageButton_INCLUDED

View File

@ -1,115 +0,0 @@
//
// IndexedPanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/IndexedPanel.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: IndexedPanel
//
// Definition of the IndexedPanel 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_IndexedPanel_INCLUDED
#define WebWidgets_IndexedPanel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/ComplexPanel.h"
#include <vector>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API IndexedPanel: public ComplexPanel
/// An IndexedPanel stores a collection of Widgets
/// and allows access by position
{
public:
IndexedPanel(const std::vector<Poco::AutoPtr<Widget> >& children = std::vector<Poco::AutoPtr<Widget> >());
/// Creates the IndexedPanel.
IndexedPanel(const Poco::XML::Element* pElem);
/// Creates the IndexedPanel by loading all subelements from pElem and converting them to a Widget.
IndexedPanel(const Poco::XML::Element* pElem, const std::string& filter);
/// Creates the IndexedPanel by loading all subelements from pElem that have the same name as filter,
/// and by converting them to a Widget.
virtual ~IndexedPanel();
/// Destroys the IndexedPanel.
void add(Poco::AutoPtr<Widget> ptrWidget);
/// Adds a widget at the end of the panel
const std::vector<Poco::AutoPtr<Widget> >& children() const;
std::vector<Poco::AutoPtr<Widget> >& children();
void accept(Visitor& v);
void preAccept(Visitor& v);
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
protected:
std::vector<Poco::AutoPtr<Widget> > cloneChildren() const;
/// Returns a deep-copy of all children
private:
std::vector<Poco::AutoPtr<Widget> > _children;
};
inline void IndexedPanel::add(Poco::AutoPtr<Widget> ptrWidget)
{
_children.push_back(ptrWidget);
}
inline const std::vector<Poco::AutoPtr<Widget> >& IndexedPanel::children() const
{
return _children;
}
inline std::vector<Poco::AutoPtr<Widget> >& IndexedPanel::children()
{
return _children;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_IndexedPanel_INCLUDED

View File

@ -1,108 +0,0 @@
//
// InputField.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/InputField.h#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: InputField
//
// Definition of the InputField 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_InputField_INCLUDED
#define WebWidgets_InputField_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/NamedWidget.h"
#include "Poco/WebWidgets/JavaScriptEvent.h"
#include "Poco/BasicEvent.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API InputField: public NamedWidget
/// An InputField can be used to get/read data from the user
/// and send it back to the server
{
public:
JavaScriptEvent<InputField*> EChange;
JavaScriptEvent<InputField*> ESelect;
/// Note: Only TextArea and TextField actually support ESelect
Poco::BasicEvent<const std::string> NewText;
InputField(const std::string& uniqueName, const std::string& defTxt = std::string());
/// Creates the InputField. uniqueName is required for event handling.
InputField(const Poco::XML::Element* pElem);
/// Creates the InputField from the XML element
virtual ~InputField();
/// Destroys the InputField.
void setText(const std::string& text);
const std::string& getText() const;
void preAccept(Visitor& v);
Poco::AutoPtr<Widget> find(const std::string& id) const;
private:
std::string _lastText;
};
inline Poco::AutoPtr<Widget> InputField::find(const std::string& id) const
{
return Poco::AutoPtr<Widget>();
}
inline void InputField::setText(const std::string& text)
{
_lastText = text;
NewText.notify(this, text);
}
inline const std::string& InputField::getText() const
{
return _lastText;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_InputField_INCLUDED

View File

@ -1,100 +0,0 @@
//
// JSDelegate.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/JSDelegate.h#4 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: JSDelegate
//
// Definition of the JSDelegate 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_JSDelegate_INCLUDED
#define WebWidgets_JSDelegate_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API JSDelegate
/// A JSDelegate adds a javascript method call to a JavaScriptEvent
{
public:
JSDelegate(const std::string& fct, const std::string& file);
/// Creates the JSDelegate.
virtual ~JSDelegate();
/// Destroys the JSDelegate.
const std::string& functionName() const;
/// The JavaScript function to call. It is assumed that the
/// function takes one parameter, which is of type JavaScript EventArgs
const std::string& jsFile() const;
/// The javascript file we need to import so that
/// the function is available
bool operator<(const JSDelegate& del) const;
private:
std::string _functionName;
std::string _jsFile;
};
inline const std::string& JSDelegate::functionName() const
{
return _functionName;
}
inline const std::string& JSDelegate::jsFile() const
{
return _jsFile;
}
static JSDelegate jsDelegate(const std::string& fct, const std::string& file);
inline JSDelegate jsDelegate(const std::string& fct, const std::string& file)
{
return JSDelegate(fct, file);
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_JSDelegate_INCLUDED

View File

@ -1,129 +0,0 @@
//
// JSEventHandler.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/JSEventHandler.h#3 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: JSEventHandler
//
// Definition of the JSEventHandler 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_JSEventHandler_INCLUDED
#define WebWidgets_JSEventHandler_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/JavaScriptEvent.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/Net/HTMLForm.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API JSEventHandler: public Poco::Net::HTTPRequestHandler
/// A JSEventHandler delegates JS callbacks to the correct widget
{
public:
static const std::string FORM_ID;
static const std::string FORM_TYPE;
static const std::string FORM_BUTTONS;
static const std::string FORM_POSX;
static const std::string FORM_POSY;
static const std::string FORM_WINPOSX;
static const std::string FORM_WINPOSY;
static const std::string FORM_KEY;
static const std::string FORM_SHIFT;
static const std::string FORM_CTRL;
static const std::string FORM_ALT;
static const std::string VAL_CLICK;
static const std::string VAL_DBLCLICK;
static const std::string VAL_MOUSEUP;
static const std::string VAL_MOUSEDOWN;
static const std::string VAL_MOUSEOUT;
static const std::string VAL_MOUSEOVER;
static const std::string VAL_MOUSEMOVE;
static const std::string VAL_FOCUSENTER;
static const std::string VAL_FOCUSLOST;
static const std::string VAL_KEYUP;
static const std::string VAL_KEYDOWN;
static const std::string VAL_KEYPRESSED;
static const std::string VAL_SELECT;
static const std::string VAL_CHANGE;
JSEventHandler(std::map<std::string, Widget*>& children);
/// Creates the JSEventHandler.
virtual ~JSEventHandler();
/// Destroys the JSEventHandler.
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
private:
void handleClick(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleDblClick(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleMouseUp(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleMouseDown(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleMouseOut(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleMouseOver(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleMouseMove(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleFocusEnter(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleFocusLost(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleKeyUp(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleKeyDown(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleKeyPressed(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleSelect(const Poco::Net::HTMLForm& form, Widget* pWidget);
void handleChange(const Poco::Net::HTMLForm& form, Widget* pWidget);
MouseEventArgs createMouseClickArgs(const Poco::Net::HTMLForm& form, Widget* id) const;
MouseMovementArgs createMouseMovementArgs(const Poco::Net::HTMLForm& form, Widget* id) const;
KeyEventArgs createKeyEventArgs(const Poco::Net::HTMLForm& form, Widget* id) const;
typedef void (JSEventHandler::*HandleMethod)(const Poco::Net::HTMLForm& form, Widget* pWidget);
typedef std::map<std::string, HandleMethod> Handlers;
static Handlers createHandlers();
private:
typedef std::map<std::string, Widget*> IDToWidget;
IDToWidget& _widgets;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_JSEventHandler_INCLUDED

View File

@ -1,116 +0,0 @@
//
// JavaScriptEvent.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/JavaScriptEvent.h#5 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: JavaScriptEvent
//
// Definition of the JavaScriptEvent 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_JavaScriptEvent_INCLUDED
#define WebWidgets_JavaScriptEvent_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/JSDelegate.h"
#include "Poco/AbstractEvent.h"
#include "Poco/DefaultStrategy.h"
#include "Poco/AbstractDelegate.h"
#include "Poco/CompareFunctions.h"
namespace Poco {
namespace WebWidgets {
template <class TArgs>
class WebWidgets_API JavaScriptEvent: public Poco::AbstractEvent <
TArgs, Poco::DefaultStrategy<TArgs, Poco::AbstractDelegate<TArgs>, Poco::p_less<Poco::AbstractDelegate<TArgs> > >,
Poco::AbstractDelegate<TArgs>
>
/// Event class used to handle JavaScriptEvents. Allows to register two different types
/// of delegates. The standard delegates, as known from Poco::BasicEvent and JSDelegates
/// which will be embedded into the WebPage when the Parser generates the site.
{
public:
JavaScriptEvent()
/// Creates the JavaScriptEvent.
{
}
~JavaScriptEvent()
/// Destroys the JavaScriptEvent.
{
}
bool hasLocalHandlers () const
{
FastMutex::ScopedLock lock(this->_mutex);
return !this->_strategy.empty();
}
bool hasJavaScriptHandlers() const
{
FastMutex::ScopedLock lock(this->_mutex);
return !_jsHandlers.empty();
}
void add (const JSDelegate& aDelegate)
/// Adds a javascript delegate to the event.
{
FastMutex::ScopedLock lock(this->_mutex);
_jsHandlers.insert(aDelegate);
}
void remove (const JSDelegate& aDelegate)
/// Removes a javascript delegate from the event. If the delegate is equal to an
/// already existing one is determined by the < operator.
/// If the observer is not found, the unregister will be ignored
{
FastMutex::ScopedLock lock(this->_mutex);
_jsHandlers.erase(aDelegate);
}
const std::set<JSDelegate>& jsDelegates() const
/// Returns all delegates currently registered
{
return _jsHandlers;
}
private:
std::set<JSDelegate> _jsHandlers;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_JavaScriptEvent_INCLUDED

View File

@ -1,120 +0,0 @@
//
// KeyEventArgs.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/KeyEventArgs.h#2 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: KeyEventArgs
//
// Definition of the KeyEventArgs 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_KeyEventArgs_INCLUDED
#define WebWidgets_KeyEventArgs_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
namespace Poco {
namespace WebWidgets {
class Widget;
class WebWidgets_API KeyEventArgs
/// KeyEventArgs stores data related to a keyboard event
{
public:
KeyEventArgs(Widget* pTarget, int keyCode, bool alt, bool shift, bool ctrl);
/// Creates the KeyEventArgs.
virtual ~KeyEventArgs();
/// Destroys the KeyEventArgs.
Widget* target() const;
/// Returns the target
int keyPressed() const;
/// Returns the unicode value of the key pressed
bool altKeyPressed() const;
/// Returns true if the ALT key was pressed
bool shiftKeyPressed() const;
/// Returns true if the SHIFT key was pressed
bool ctrlKeyPressed() const;
/// Returns true if the CTRL key was pressed
private:
Widget* _pTarget;
int _keyCode;
bool _alt;
bool _shift;
bool _ctrl;
};
inline Widget* KeyEventArgs::target() const
{
return _pTarget;
}
inline int KeyEventArgs::keyPressed() const
{
return _keyCode;
}
inline bool KeyEventArgs::altKeyPressed() const
{
return _alt;
}
inline bool KeyEventArgs::shiftKeyPressed() const
{
return _shift;
}
inline bool KeyEventArgs::ctrlKeyPressed() const
{
return _ctrl;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_KeyEventArgs_INCLUDED

View File

@ -1,56 +0,0 @@
//
// KeyboardFocusArgs.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/KeyboardFocusArgs.h#3 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: KeyboardFocusArgs
//
// Definition of the KeyboardFocusArgs 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_KeyboardFocusArgs_INCLUDED
#define WebWidgets_KeyboardFocusArgs_INCLUDED
#include "Poco/WebWidgets/MouseMovementArgs.h"
namespace Poco {
namespace WebWidgets {
typedef MouseMovementArgs KeyboardFocusArgs;
} } // namespace Poco::WebWidgets
#endif // WebWidgets_KeyboardFocusArgs_INCLUDED

View File

@ -1,107 +0,0 @@
//
// Label.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Label.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Label
//
// Definition of the Label 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_Label_INCLUDED
#define WebWidgets_Label_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Label: public Widget
/// A Label holds an unformatted string
/// <label>some text</label>
{
public:
static const std::string FACTORY_ID;
Label();
/// Creates a Label without text
Label(const std::string& txt);
/// Creates a Label with the given text
Label(const Poco::XML::Element* pElem);
/// Creates a Label from the given element
virtual ~Label();
/// Destroys the Label.
void accept(Visitor& v);
const std::string& getText() const;
void setText(const std::string& text);
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
private:
std::string _text;
};
inline Poco::AutoPtr<Widget> Label::find(const std::string& id) const
{
return Poco::AutoPtr<Widget>();
}
inline const std::string& Label::getText() const
{
return _text;
}
inline void Label::setText(const std::string& text)
{
_text = text;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Label_INCLUDED

View File

@ -1,166 +0,0 @@
//
// ListView.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/ListView.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ListView
//
// Definition of the ListView 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_ListView_INCLUDED
#define WebWidgets_ListView_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/ComboBox.h"
#include <set>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API ListView: public ComboBox
/// A ListView shows a list of clickable label entries. multi-selection is possible by setting multiple to true.
/// Each listview must have a name and a size (ie. how any entries are shown), multiple is per default false
/// and nothing is selected. Note that the index of the first entry starts with 0, entries in the select attribute
/// can be komma or space seperated:
///.....<listView name="list" size="3" multiple="true" select="0 2 4">
///.........<label>1st</label>
///.........<label>2nd</label>
///.........<label>3rd</label>
///.........<label>4th</label>
///.........<label>5th</label>
///.........<label>6th</label>
///.....</listView>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_MULTIPLE;
static const std::string XML_SIZE;
ListView(const std::string& uniqueName, int viewSize, bool multiple, const std::vector<Poco::AutoPtr<Label> >& children = std::vector<Poco::AutoPtr<Label> >());
/// Creates the ListView.
ListView(const Poco::XML::Element* pElem);
/// Creates the ListView.
virtual ~ListView();
/// Destroys the ListView.
virtual int getSelectedIndex() const;
/// Returns the index of the first selected element. Returns -1 if nothing is selected.
virtual void select(int idx);
/// Selects an element if not yet selected. If multiple selection is turned off, it will
/// deselect all other entries.
int getViewSize() const;
/// Number of entries shown at once
void setViewSize(int size);
bool getMultiple() const;
void setMultiple(bool multiSelection);
const std::set<int>& getSelectedIndizes() const;
/// Returns all selected indizes
void deselect(int idx);
/// deselects an element
void deselectAll();
/// deselects all elements
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
protected:
ListView(const std::string& uniqueName, int viewSize, bool multiple, const std::vector<Poco::AutoPtr<Widget> >& children);
/// Creates the ListView.
private:
std::set<int> _selected;
bool _multiple;
int _size;
};
inline int ListView::getViewSize() const
{
return _size;
}
inline void ListView::setViewSize(int size)
{
_size = size;
}
inline bool ListView::getMultiple() const
{
return _multiple;
}
inline void ListView::setMultiple(bool multiSelection)
{
_multiple = multiSelection;
}
inline const std::set<int>& ListView::getSelectedIndizes() const
{
return _selected;
}
inline void ListView::deselect(int idx)
{
_selected.erase(idx);
}
inline void ListView::deselectAll()
{
_selected.clear();
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_ListView_INCLUDED

View File

@ -1,130 +0,0 @@
//
// MouseEventArgs.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/MouseEventArgs.h#4 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: MouseEventArgs
//
// Definition of the MouseEventArgs 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_MouseEventArgs_INCLUDED
#define WebWidgets_MouseEventArgs_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
namespace Poco {
namespace WebWidgets {
class Widget;
class WebWidgets_API MouseEventArgs
/// MouseEventArgs...
{
public:
MouseEventArgs(Widget* target, int posX, int posY, bool left, bool middle, bool right);
/// Creates the MouseEventArgs.
virtual ~MouseEventArgs();
/// Destroys the MouseEventArgs.
bool leftButton() const;
/// Returns if the left mouse button was clicked
bool rightButton() const;
/// Returns if the right mouse button was clicked
bool middleButton() const;
/// Returns if the middle mouse button was clicked
int posX() const;
/// The x position of the mouse pointer relative to the document
int posY() const;
/// The y position of the mouse pointer relative to the document
Widget* target() const;
/// The element that was clicked
private:
Widget* _pTarget;
int _posX;
int _posY;
bool _left;
bool _middle;
bool _right;
};
inline bool MouseEventArgs::leftButton() const
{
return _left;
}
inline bool MouseEventArgs::rightButton() const
{
return _right;
}
inline bool MouseEventArgs::middleButton() const
{
return _middle;
}
inline int MouseEventArgs::posX() const
{
return _posX;
}
inline int MouseEventArgs::posY() const
{
return _posY;
}
inline Widget* MouseEventArgs::target() const
{
return _pTarget;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_MouseEventArgs_INCLUDED

View File

@ -1,122 +0,0 @@
//
// MouseMovementArgs.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/MouseMovementArgs.h#3 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: MouseMovementArgs
//
// Definition of the MouseMovementArgs 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_MouseMovementArgs_INCLUDED
#define WebWidgets_MouseMovementArgs_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
namespace Poco {
namespace WebWidgets {
class Widget;
class WebWidgets_API MouseMovementArgs
/// MouseMovementArgs transports mouse movement information. It contains the absolute posX, posY value that is relative to
/// to the top left corner of the document, and the windowsPosX, windowsPosY information that is relative to top, left visible
/// corner of the window.
{
public:
MouseMovementArgs(Widget* p, int posX, int posY, int windowsPosX, int windowsPosY);
/// Creates the MouseMovementArgs.
virtual ~MouseMovementArgs();
/// Destroys the MouseMovementArgs.
int posX() const;
/// The x position of the mouse pointer relative to the document
int posY() const;
/// The y position of the mouse pointer relative to the document
int windowPosX() const;
/// The x position of the mouse pointer relative to the document
int windowPosY() const;
/// The y position of the mouse pointer relative to the document
Widget* target() const;
/// The target to which the event referrs to.
private:
Widget* _pTarget;
int _posX;
int _posY;
int _windowsPosX;
int _windowsPosY;
};
inline int MouseMovementArgs::posX() const
{
return _posX;
}
inline int MouseMovementArgs::posY() const
{
return _posY;
}
inline int MouseMovementArgs::windowPosX() const
{
return _windowsPosX;
}
inline int MouseMovementArgs::windowPosY() const
{
return _windowsPosY;
}
inline Widget* MouseMovementArgs::target() const
{
return _pTarget;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_MouseMovementArgs_INCLUDED

View File

@ -1,82 +0,0 @@
//
// NamedWidget.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/NamedWidget.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: NamedWidget
//
// Definition of the NamedWidget 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_NamedWidget_INCLUDED
#define WebWidgets_NamedWidget_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API NamedWidget: public Widget
/// A Widget with a unique name
{
public:
static const std::string XML_NAME;
NamedWidget(const std::string& name);
/// Creates the NamedWidget.
NamedWidget(const Poco::XML::Element* pElem);
/// Creates the NamedWidget.
virtual ~NamedWidget();
/// Destroys the NamedWidget.
const std::string& name() const;
private:
std::string _name;
};
inline const std::string& NamedWidget::name() const
{
return _name;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_NamedWidget_INCLUDED

View File

@ -1,69 +0,0 @@
//
// Panel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Panel.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Panel
//
// Definition of the Panel 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_Panel_INCLUDED
#define WebWidgets_Panel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Panel: public Widget
/// A Panel is the root element for formatting Widgets
{
public:
Panel();
/// Creates the Panel.
Panel(const Poco::XML::Element* pElem);
/// Creates the Panel from the XML element.
virtual ~Panel();
/// Destroys the Panel.
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Panel_INCLUDED

View File

@ -1,111 +0,0 @@
//
// Parser.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Parser.h#2 $
//
// Library: WebWidgets
// Package: WebParser
// Module: Parser
//
// Definition of the Parser 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_Parser_INCLUDED
#define WebWidgets_Parser_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/ParserFactory.h"
#include "Poco/AutoPtr.h"
#include "Poco/Exception.h"
#include "Poco/SharedPtr.h"
#include "Poco/SingletonHolder.h"
#include <map>
namespace Poco {
namespace XML {
class Element;
}
}
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Parser
/// The Parser parses an XML description of the GUI and invokes the visitor functions
{
public:
typedef Poco::SharedPtr<ParserFactory> ParserFactoryPtr;
static Parser& instance();
/// Returns the instance of the Parser singleton
void registerFactory(const std::string& id, ParserFactoryPtr pFac);
/// registers a factory for the given id. will fail if a factory already exists for that id,
/// takes always ownership of the pointer
void unregisterFactory(const std::string& id);
/// unregisters a factory for the given id.
Poco::AutoPtr<Widget> load(const Poco::XML::Element* pElem) const;
/// Loads a Widget from the given XML element
template <typename T>
Poco::AutoPtr<T> load(const Poco::XML::Element* pElem) const
/// Loads a Widget from a given type from the given XML element.
/// Will fail if the type doesn't match
{
Poco::AutoPtr<T> ptr = load(pElem).cast<T>();
if (!ptr)
throw Poco::BadCastException();
return ptr;
}
private:
Parser();
/// Creates the Parser.
virtual ~Parser();
/// Destroys the Parser.
private:
typedef std::map<std::string, ParserFactoryPtr> Factories;
Factories _factories;
friend class Poco::SingletonHolder<Parser>;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Parser_INCLUDED

View File

@ -1,103 +0,0 @@
//
// ParserFactory.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/ParserFactory.h#3 $
//
// Library: WebWidgets
// Package: WebParser
// Module: ParserFactory
//
// Definition of the ParserFactory 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_ParserFactory_INCLUDED
#define WebWidgets_ParserFactory_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/AutoPtr.h"
namespace Poco {
namespace XML {
class Element;
}
}
namespace Poco {
namespace WebWidgets {
class WebWidgets_API ParserFactory
/// ParserFactory creates a widget of a given type from an XML document
{
public:
ParserFactory();
/// Creates the ParserFactory.
virtual ~ParserFactory();
/// Destroys the ParserFactory.
virtual Poco::AutoPtr<Widget> load(const Poco::XML::Element* pElem) const = 0;
/// Loads a Widget from the given XML element
};
template <typename T>
class ParserFactoryImpl: public ParserFactory
/// ParserFactoryImpl acts as a template for fast ParserFactory creation
{
public:
ParserFactoryImpl()
/// Creates the ParserFactory.
{
}
~ParserFactoryImpl()
/// Destroys the ParserFactory.
{
}
Poco::AutoPtr<Widget> load(const Poco::XML::Element* pElem) const
{
Poco::AutoPtr<Widget> ptrWidget = Poco::AutoPtr<Widget>(new T(pElem));
return ptrWidget;
}
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_ParserFactory_INCLUDED

View File

@ -1,75 +0,0 @@
//
// PwdField.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/PwdField.h#1 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: PwdField
//
// Definition of the PwdField 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_PwdField_INCLUDED
#define WebWidgets_PwdField_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/TextField.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API PwdField: public TextField
/// A textfield for password input.
{
public:
static const std::string FACTORY_ID;
PwdField(const std::string& uniqueName, Poco::UInt32 size, Poco::UInt32 maxLength);
/// Creates the PwdField.
PwdField(const Poco::XML::Element* pElem);
/// Creates the PwdField from the XML
virtual ~PwdField();
/// Destroys the PwdField.
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_PwdField_INCLUDED

View File

@ -1,77 +0,0 @@
//
// RadioButton.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/RadioButton.h#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: RadioButton
//
// Definition of the RadioButton 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_RadioButton_INCLUDED
#define WebWidgets_RadioButton_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/CheckBox.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API RadioButton: public CheckBox
/// A RadioButton is a member of a button group. Only one can be selected of a group.
/// <radioButton name="radio" checked="true">Click me</radioButton>
/// <radioButton name="radio"><![CDATA[<b>No! Click Me!</b>]]></radioButton>
{
public:
static const std::string FACTORY_ID;
RadioButton(const std::string& group, const std::string& text, bool checked=false);
/// Creates the RadioButton.
RadioButton(const Poco::XML::Element* pElem);
/// Creates the RadioButton.
virtual ~RadioButton();
/// Destroys the RadioButton.
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_RadioButton_INCLUDED

View File

@ -1,138 +0,0 @@
//
// RootPanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/RootPanel.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: RootPanel
//
// Definition of the RootPanel 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_RootPanel_INCLUDED
#define WebWidgets_RootPanel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/IndexedPanel.h"
#include "Poco/WebWidgets/HTML.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API RootPanel: public IndexedPanel
/// RootPanel defines the main window of the application.
/// The html tag is optional and contains header specific info
/// <rootPanel name="sometitle">
/// <header>
/// <html>
/// <![CDATA[
/// <i>some text</i>
/// ]]>
/// </html>
/// </header>
/// <children>
/// <!-- set of widgets -->
/// </children>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_NAME;
static const std::string XML_HEADER;
static const std::string XML_CHILDREN;
RootPanel(const std::string& name, const std::vector<Poco::AutoPtr<Widget> >& children = std::vector<Poco::AutoPtr<Widget> >());
/// Creates the RootPanel.
RootPanel(const Poco::XML::Element* pElem);
/// Creates the RootPanel from the XML.
virtual ~RootPanel();
/// Destroys the RootPanel.
void setHeader(Poco::AutoPtr<HTML> html);
void setHeader(const std::string& htmlData);
Poco::AutoPtr<HTML> getHeader() const;
/// Returns the header, can be null.
void accept(Visitor& v);
const std::string& getName() const;
void setName(const std::string& name);
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
private:
std::string _name;
Poco::AutoPtr<HTML> _ptrHeader;
};
inline const std::string& RootPanel::getName() const
{
return _name;
}
inline void RootPanel::setName(const std::string& name)
{
_name = name;
}
inline void RootPanel::setHeader(Poco::AutoPtr<HTML> html)
{
_ptrHeader = html;
}
inline void RootPanel::setHeader(const std::string& htmlData)
{
_ptrHeader = new HTML(htmlData);
}
inline Poco::AutoPtr<HTML> RootPanel::getHeader() const
{
return _ptrHeader;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_RootPanel_INCLUDED

View File

@ -1,92 +0,0 @@
//
// SimplePanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/SimplePanel.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: SimplePanel
//
// Definition of the SimplePanel 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_SimplePanel_INCLUDED
#define WebWidgets_SimplePanel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Panel.h"
#include "Poco/AutoPtr.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API SimplePanel: public Panel
/// A SimplePanel is a panel that contains exactly one single widget
{
public:
SimplePanel(Poco::AutoPtr<Widget> ptr);
/// Creates the SimplePanel.
SimplePanel(const Poco::XML::Element* pElem);
/// Creates the SimplePanel from the XML.
virtual ~SimplePanel();
/// Destroys the SimplePanel.
Poco::AutoPtr<Widget> getWidget() const;
void setWidget(Poco::AutoPtr<Widget> ptr);
void preAccept(Visitor& v);
Poco::AutoPtr<Widget> find(const std::string& id) const;
private:
Poco::AutoPtr<Widget> _ptrWidget;
};
inline Poco::AutoPtr<Widget> SimplePanel::getWidget() const
{
return _ptrWidget;
}
inline void SimplePanel::setWidget(Poco::AutoPtr<Widget> ptr)
{
_ptrWidget = ptr;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_SimplePanel_INCLUDED

View File

@ -1,75 +0,0 @@
//
// StackPanel.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/StackPanel.h#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: StackPanel
//
// Definition of the StackPanel 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_StackPanel_INCLUDED
#define WebWidgets_StackPanel_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/IndexedPanel.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API StackPanel: public IndexedPanel
/// A StackPanel contains a list of Widgets which are ordered on top of each other
{
public:
static const std::string FACTORY_ID;
StackPanel(const std::vector<Poco::AutoPtr<Widget> >& children = std::vector<Poco::AutoPtr<Widget> >());
/// Creates the StackPanel.
StackPanel(const Poco::XML::Element* pElem);
/// Creates the StackPanel.
virtual ~StackPanel();
/// Destroys the StackPanel.
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_StackPanel_INCLUDED

View File

@ -1,257 +0,0 @@
//
// Table.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Table.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Table
//
// Definition of the Table 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_Table_INCLUDED
#define WebWidgets_Table_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/Panel.h"
#include "Poco/AutoPtr.h"
#include <vector>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Table: public Panel
/// Table is a matrix of Widgets
///
/// <table cols="5" rows="3" border="0" footer="false" header="true" width="200">
/// <header id="" class="" style="" title=""/>
/// <body id="" class="" style="" title=""/>
/// <footer id="" class="" style="" title=""/>
/// <cell row="0" col="0"> [some widget]</cell>
/// <!-- col 1 will be empty-->
/// <cell row="0" col="2"> [some widget]</cell>
/// </table>
/// cols is mandatory, rows, border, width, header and footer are optional, col and row index are numbers that start with 0
/// if no col or row index is given, the Table will autoincrement the last used col/row value by
/// first incrementing the col, then on a column overflow the row.
/// Note that if table.rows is set, the table will be truncated/resized to that rows value!
{
public:
static const std::string FACTORY_ID;
static const std::string XML_WIDTH;
static const std::string XML_BORDER;
static const std::string XML_HEADER;
static const std::string XML_BODY;
static const std::string XML_FOOTER;
static const std::string VAL_COLS;
static const std::string VAL_ROWS;
static const std::string VAL_COL;
static const std::string VAL_ROW;
static const std::string VAL_CELL;
static const std::string VAL_TABLEFOOTER;
typedef std::vector<Poco::AutoPtr<Widget> > Row;
typedef std::vector<Row> Content;
Table(Poco::UInt32 numRows, Poco::UInt32 numCols, bool tableHasFooter, bool tableHasHeader = true, Poco::UInt32 borderStrength = 0, Poco::UInt32 width = 0);
/// Creates the Table with the given dimension. Per default all table cells are empty
Table(const Poco::XML::Element* pElem);
/// Creates the Table from the XML element
virtual ~Table();
/// Destroys the Table.
void addWidget(Poco::UInt32 row, Poco::UInt32 col, Poco::AutoPtr<Widget> ptrWidget);
/// Adds a Widget to the Table, the table will be set as new parent of ptrWidget.
/// Row and col must be smaller than the dimension of the table
Poco::AutoPtr<Widget> removeWidget(Poco::UInt32 row, Poco::UInt32 col);
/// Removes a Widget from the Table.
Poco::AutoPtr<Widget> getWidget(Poco::UInt32 row, Poco::UInt32 col) const;
/// Returns the Widget stored at the given position can return a Nullptr
void appendRow(const Row& aRow);
/// Inserts the row at the end of the table.
std::size_t numberOfRows() const;
/// Returns the number of rows
std::size_t numberOfColumns() const;
/// Returns the number of columns
Poco::UInt32 getBorder() const;
/// Returns the border thickness
Poco::UInt32 getWidth() const;
/// Returns the Width in Pixels
bool hasFooter() const;
/// Returns if the table has a footer row. If yes the last row of the table will be formatted like a footer
bool hasHeader() const;
/// Returns if the table has a footer row. If yes the last row of the table will be formatted like a footer
const Table::Content& getContent() const;
/// Returns the content of the table
void accept(Visitor& v);
void setHeaderAttributes(const Widget::Attributes& hdrAttr);
/// sets attributes for the header of the table
const Widget::Attributes& getHeaderAttributes() const;
/// Returns the header attributes
void setBodyAttributes(const Widget::Attributes& hdrAttr);
/// sets attributes for the body of the table
const Widget::Attributes& getBodyAttributes() const;
/// Returns the body attributes
void setFooterAttributes(const Widget::Attributes& hdrAttr);
/// sets attributes for the footer of the table
const Widget::Attributes& getFooterAttributes() const;
/// Returns the footer attributes
Poco::AutoPtr<Widget> find(const std::string& id) const;
Poco::AutoPtr<Widget> clone() const;
private:
void appendEmptyRow();
private:
std::size_t _cols;
Poco::UInt32 _border;
Poco::UInt32 _width;
bool _tableHasFooter;
bool _tableHasHeader;
Content _table;
Widget::Attributes _headerAttr;
Widget::Attributes _bodyAttr;
Widget::Attributes _footerAttr;
};
inline std::size_t Table::numberOfRows() const
{
return _table.size();
}
inline std::size_t Table::numberOfColumns() const
{
return _cols;
}
inline Poco::UInt32 Table::getBorder() const
{
return _border;
}
inline Poco::UInt32 Table::getWidth() const
{
return _width;
}
inline bool Table::hasFooter() const
{
return _tableHasFooter;
}
inline bool Table::hasHeader() const
{
return _tableHasHeader;
}
inline const Table::Content& Table::getContent() const
{
return _table;
}
inline void Table::setHeaderAttributes(const Widget::Attributes& hdrAttr)
{
_headerAttr = hdrAttr;
}
inline const Widget::Attributes& Table::getHeaderAttributes() const
{
return _headerAttr;
}
inline void Table::setBodyAttributes(const Widget::Attributes& bAttr)
{
_bodyAttr = bAttr;
}
inline const Widget::Attributes& Table::getBodyAttributes() const
{
return _bodyAttr;
}
inline void Table::setFooterAttributes(const Widget::Attributes& fAttr)
{
_footerAttr = fAttr;
}
inline const Widget::Attributes& Table::getFooterAttributes() const
{
return _footerAttr;
}
inline void Table::appendEmptyRow()
{
_table.push_back(Row(_cols, Poco::AutoPtr<Widget>()));
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Table_INCLUDED

View File

@ -1,114 +0,0 @@
//
// TextArea.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/TextArea.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: TextArea
//
// Definition of the TextArea 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_TextArea_INCLUDED
#define WebWidgets_TextArea_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/InputField.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API TextArea: public InputField
/// A TextArea is a multi-line text field. All attributes are mandatory.
/// <textArea rows="10" cols="30" name="unique">optional default text. Line breaks \n show up in the textArea</textArea>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_ROWS;
static const std::string XML_COLS;
TextArea(const std::string& uniqueName, Poco::UInt32 rows, Poco::UInt32 cols, const std::string& defTxt = std::string());
/// Creates the TextArea.
TextArea(const Poco::XML::Element* pElem);
/// Creates the TextArea from the XML.
virtual ~TextArea();
/// Destroys the TextArea.
Poco::UInt32 getRows() const;
Poco::UInt32 getCols() const;
void setRows(Poco::UInt32 rows);
void setCols(Poco::UInt32 cols);
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
private:
Poco::UInt32 _rows;
Poco::UInt32 _cols;
};
inline Poco::UInt32 TextArea::getRows() const
{
return _rows;
}
inline Poco::UInt32 TextArea::getCols() const
{
return _cols;
}
inline void TextArea::setRows(Poco::UInt32 rows)
{
_rows = rows;
}
inline void TextArea::setCols(Poco::UInt32 cols)
{
_cols = cols;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_TextArea_INCLUDED

View File

@ -1,114 +0,0 @@
//
// TextField.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/TextField.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: TextField
//
// Definition of the TextField 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_TextField_INCLUDED
#define WebWidgets_TextField_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/InputField.h"
namespace Poco {
namespace WebWidgets {
class WebWidgets_API TextField: public InputField
/// A single line TextField. Size and name are mandatory
/// <textField size="30" maxLength="30" name="unique">default value</textField>
{
public:
static const std::string FACTORY_ID;
static const std::string XML_SIZE;
static const std::string XML_MAXLENGTH;
TextField(const std::string& uniqueName, Poco::UInt32 size, Poco::UInt32 maxLength, const std::string& defTxt = std::string());
/// Creates the TextField with the given size and an optional maxLength value (set to 0 to disable it).
TextField(const Poco::XML::Element* pElem);
/// Creates the TextField from the XML
virtual ~TextField();
/// Destroys the TextField.
Poco::UInt32 getSize() const;
Poco::UInt32 getMaxLength() const;
void setSize(Poco::UInt32 sz);
void setMaxLength(Poco::UInt32 len);
void accept(Visitor& v);
Poco::AutoPtr<Widget> clone() const;
private:
Poco::UInt32 _size;
Poco::UInt32 _maxLength;
};
inline Poco::UInt32 TextField::getSize() const
{
return _size;
}
inline Poco::UInt32 TextField::getMaxLength() const
{
return _maxLength;
}
inline void TextField::setSize(Poco::UInt32 sz)
{
_size = sz;
}
inline void TextField::setMaxLength(Poco::UInt32 len)
{
_maxLength = len;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_TextField_INCLUDED

View File

@ -1,76 +0,0 @@
//
// Visitable.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Visitable.h#3 $
//
// Library: WebWidgets
// Package: WebVisitor
// Module: Visitable
//
// Definition of the Visitable 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_Visitable_INCLUDED
#define WebWidgets_Visitable_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/RefCountedObject.h"
namespace Poco {
namespace WebWidgets {
class Visitor;
class WebWidgets_API Visitable: public Poco::RefCountedObject
/// Interface class Visitable, used to implement visitor pattern
{
public:
Visitable();
/// Creates the Visitable.
virtual ~Visitable();
/// Destroys the Visitable.
virtual void preAccept(Visitor& v) = 0;
/// Implements the visitor pattern. Each subclass must implement it as
/// v.preVisit(this);
virtual void accept(Visitor& v) = 0;
/// Implements the visitor pattern. Each subclass must implement it as
/// v.visit(this);
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Visitable_INCLUDED

View File

@ -1,163 +0,0 @@
//
// Visitor.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Visitor.h#4 $
//
// Library: WebWidgets
// Package: WebVisitor
// Module: Visitor
//
// Definition of the Visitor 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_Visitor_INCLUDED
#define WebWidgets_Visitor_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
namespace Poco {
namespace WebWidgets {
class Label;
class RootPanel;
class Image;
class FlowPanel;
class SimplePanel;
class HTML;
class Table;
class HyperLink;
class Button;
class ImageButton;
class TextArea;
class TextField;
class CheckBox;
class RadioButton;
class Form;
class IndexedPanel;
class StackPanel;
class ComboBox;
class ListView;
class HidablePanel;
class Widget;
class InputField;
class PwdField;
class WebWidgets_API Visitor
/// A Visitor is used as an interface for code generation for a given set of different classes.
{
public:
Visitor();
/// Creates the Visitor.
virtual ~Visitor();
/// Destroys the Visitor.
virtual void visit(Label& label) = 0;
/// Generates code for a label
virtual void visit(HTML& raw) = 0;
/// Generates code for a raw HTML element
virtual void visit(RootPanel& main) = 0;
/// Generates code for the RootPanel class
virtual void visit(Image& img) = 0;
/// Generates code for an image
virtual void visit(FlowPanel& flow) = 0;
/// Generates code for a FlowPanel
virtual void visit(Table& table) = 0;
/// Generates code for a Table
virtual void visit(HyperLink& link) = 0;
/// Generates code for a HyperLink
virtual void visit(Button& but) = 0;
/// Generates code for a Button
virtual void visit(ImageButton& but) = 0;
/// Generates code for a ImageButton
virtual void visit(TextArea& txt) = 0;
/// Generates code for a TextArea
virtual void visit(TextField& txt) = 0;
/// Generates code for a TextField
virtual void visit(CheckBox& but) = 0;
/// Generates code for a CheckBox
virtual void visit(RadioButton& but) = 0;
/// Generates code for a RadioButton
virtual void visit(Form& f) = 0;
/// Generates code for a Form
virtual void visit(IndexedPanel& p) = 0;
/// Generates code for a IndexedPanel
virtual void visit(StackPanel& p) = 0;
/// Generates code for a StackPanel
virtual void visit(ComboBox& p) = 0;
/// Generates code for a ComboBox
virtual void visit(ListView& l) = 0;
/// Generates code for a ListView
virtual void visit(HidablePanel& l) = 0;
/// Generates code for a HidablePanel
virtual void visit(PwdField& l) = 0;
/// Generates code for a PwdField
virtual void preVisit(Widget& widget) = 0;
virtual void preVisit(SimplePanel& widget) = 0;
virtual void preVisit(IndexedPanel& widget) = 0;
virtual void preVisit(HidablePanel& widget) = 0;
virtual void preVisit(InputField& widget) = 0;
protected:
virtual void preVisit(RootPanel& main) = 0;
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Visitor_INCLUDED

View File

@ -1,70 +0,0 @@
//
// WebWidgets.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/WebWidgets.h#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: WebWidgets
//
// Basic definitions for the Poco WebWidgets library.
// This file must be the first file included by every other WebWidgets
// header file.
//
// 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_WebWidgets_INCLUDED
#define WebWidgets_WebWidgets_INCLUDED
#include "Poco/Foundation.h"
//
// The following block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the WebWidgets_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// WebWidgets_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
//
#if defined(_WIN32) && defined(POCO_DLL)
#if defined(WebWidgets_EXPORTS)
#define WebWidgets_API __declspec(dllexport)
#else
#define WebWidgets_API __declspec(dllimport)
#endif
#endif
#if !defined(WebWidgets_API)
#define WebWidgets_API
#endif
#endif // WebWidgets_WebWidgets_INCLUDED

View File

@ -1,357 +0,0 @@
//
// Widget.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/Widget.h#7 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Widget
//
// Definition of the Widget 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_Widget_INCLUDED
#define WebWidgets_Widget_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/GUIObject.h"
#include "Poco/WebWidgets/MouseEventArgs.h"
#include "Poco/WebWidgets/MouseMovementArgs.h"
#include "Poco/WebWidgets/KeyboardFocusArgs.h"
#include "Poco/WebWidgets/KeyEventArgs.h"
#include "Poco/WebWidgets/JavaScriptEvent.h"
#include <map>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API Widget: public GUIObject
/// Widget is the root class for all loadable GUI elements.
/// All subclasses of Widget support the following attributes:
/// * id
/// * class
/// * lang
/// * style
/// * title
///
/// To register events at a Widget via an XML configuration file, add a subchild named "events"
/// to the widget:
/// <widget>
/// <events>
/// <onclick>
/// <ondblclick>
/// <onmousedown>
/// <onmouseup>
/// <onmouseout>
/// <onmouseover>
/// <onmousemove>
/// <onfocus>
/// <onblur>
/// <onkeyup>
/// <onkeydown>
/// <onkeypressed>
/// </events>
/// </widget>
///
/// An InputField supports additionally "onselect" and "onchange" events.
///
/// For each event one can add delegates. Note that currently it is only possible to add javascript
/// method calls as delegates that expect as input an argument of type (event).
/// <onclick>
/// <delegate function="printMessage" file="additional.js"/>
/// <delegate function="verifyInput" file="additional.js"/>
/// </onclick>
///
/// The same delegates can be added manually in your program:
/// Poco::AutoPtr<Button> ptrBut = new Button("Submit");
/// ptrBut->ESingleClick += jsDelegate("printMessage", "additional.js");
/// ptrBut->ESingleClick += jsDelegate("verifyInput", "additional.js");
///
/// The generated HTML code will include the necessary javascript files and invoke the
/// javascript methods in the same sequence they were declared.
///
/// Per default each widget has no local server listener. Adding server side listeners (ie. C++ callbacks)
/// is similar to the way BasicEvents are treated and can only be done in your program code
/// not via the XML file:
/// Poco::AutoPtr<Button> ptrBut = new Button("Submit");
/// ptrBut->ESingleClick += delegate(this, &HTTPFormServer::onClicked);
///
/// For each event that has a server side listener registered, the HTML code will automatically
/// generate a callback to the server. The invocation sequence is always first javascript client listener,
/// then C++ server callback. Thus, only use server side callbacks when necessary! They will slow down
/// your HTML GUI.
{
public:
static const std::string XML_ID;
static const std::string XML_CLASS;
static const std::string XML_LANG;
static const std::string XML_STYLE;
static const std::string XML_TITLE;
static const std::string VAL_EMPTY;
JavaScriptEvent<MouseEventArgs> ESingleClick;
JavaScriptEvent<MouseEventArgs> EDoubleClick;
JavaScriptEvent<MouseEventArgs> EMouseDown;
JavaScriptEvent<MouseEventArgs> EMouseUp;
JavaScriptEvent<MouseMovementArgs> EMouseOver;
JavaScriptEvent<MouseMovementArgs> EMouseOut;
JavaScriptEvent<MouseMovementArgs> EMouseMove;
JavaScriptEvent<KeyboardFocusArgs> EFocusEnter;
JavaScriptEvent<KeyboardFocusArgs> EFocusLost;
JavaScriptEvent<KeyEventArgs> EKeyUp;
JavaScriptEvent<KeyEventArgs> EKeyDown;
JavaScriptEvent<KeyEventArgs> EKeyPressed;
typedef std::map<std::string, std::string> Attributes;
Widget();
/// Creates the Widget.
Widget(const Poco::XML::Element* pElem);
/// Creates the Widget.
virtual ~Widget();
/// Destroys the Widget.
const std::string& getAttrID() const;
const std::string& getAttrClass() const;
const std::string& getAttrLang() const;
const std::string& getAttrTitle() const;
const std::string& getAttrStyle() const;
void setAttrID(const std::string& val);
void setAttrClass(const std::string& val);
void setAttrLang(const std::string& val);
void setAttrTitle(const std::string& val);
void setAttrStyle(const std::string& val);
Attributes::const_iterator end() const;
/// Returns the end iterator of the Attributes map
Attributes::const_iterator begin() const;
/// Returns the begin iterator of the Attributes map
const Attributes& getAttributes() const;
/// Returns all attributes
void setAttributes(const Attributes& attr);
/// Erase all old attributes and set attr as new ones
Widget* getParent() const;
/// Returns the parent or null if we don't have a parent
void setParent(Widget* pWidget);
/// Sets the parent object.
void preAccept(Visitor& v);
virtual Poco::AutoPtr<Widget> clone() const = 0;
/// Deep-copies the Widget and all of its children
static Poco::AutoPtr<Widget> find(Poco::AutoPtr<Widget> widget, const std::string& id);
/// Searches if the passed widget or any of its children has the passed id
protected:
virtual Poco::AutoPtr<Widget> find(const std::string& id) const = 0;
/// Searches recursively all children until it finds a Widget with the given id.
/// Returns a null AutoPtr if nothing if none found.
/// Due to the fact we return an AutoPtr, we cannot compare with the id of the "this" object.
/// Use the static function for that
void addOptional(const std::string& id, const std::string& value);
/// Only adds/updates attributes with non-empty values
/// An empty value will remove the attribute!
void addAttribute(const std::string& id, const std::string& value);
/// Add/updates an attribute value
void eraseAttribute(const std::string& id);
/// Erases an attribute value
const std::string& getValue(const std::string& id) const;
/// Returns a value for the given attribute id, if not found
/// it returns an empty string
Attributes::const_iterator findAttr(const std::string& id) const;
/// Searches for the given attribute id, returns end() if not found
static void parseUniversalAttributes(const Poco::XML::Element* pElem, Attributes& attr);
/// Loads universal attributes and writes them to param attr
static void addOptional(const std::string& id, const std::string& value, Attributes& attr);
/// Only adds/updates attributes with non-empty values
/// An empty value will remove the attribute!
static void addAttribute(const std::string& id, const std::string& value, Attributes& attr);
/// Add/updates an attribute value
static void eraseAttribute(const std::string& id, Attributes& attr);
/// Erases an attribute value
private:
Widget* _pParent;
Attributes _attr;
};
inline const Widget::Attributes& Widget::getAttributes() const
{
return _attr;
}
inline Widget* Widget::getParent() const
{
return _pParent;
}
inline void Widget::setParent(Widget* pWidget)
{
_pParent = pWidget;
}
inline void Widget::addOptional(const std::string& id, const std::string& value)
{
addOptional(id, value, _attr);
}
inline void Widget::addAttribute(const std::string& id, const std::string& value)
{
addAttribute(id, value, _attr);
}
inline void Widget::eraseAttribute(const std::string& id)
{
eraseAttribute(id, _attr);
}
inline void Widget::eraseAttribute(const std::string& id, Attributes& attr)
{
attr.erase(id);
}
inline Widget::Attributes::const_iterator Widget::findAttr(const std::string& id) const
{
return _attr.find(id);
}
inline Widget::Attributes::const_iterator Widget::end() const
{
return _attr.end();
}
inline Widget::Attributes::const_iterator Widget::begin() const
{
return _attr.begin();
}
inline const std::string& Widget::getAttrID() const
{
return getValue(XML_ID);
}
inline const std::string& Widget::getAttrClass() const
{
return getValue(XML_CLASS);
}
inline const std::string& Widget::getAttrLang() const
{
return getValue(XML_LANG);
}
inline const std::string& Widget::getAttrTitle() const
{
return getValue(XML_TITLE);
}
inline const std::string& Widget::getAttrStyle() const
{
return getValue(XML_STYLE);
}
inline void Widget::setAttrID(const std::string& val)
{
addAttribute(XML_ID, val);
}
inline void Widget::setAttrClass(const std::string& val)
{
addAttribute(XML_CLASS, val);
}
inline void Widget::setAttrLang(const std::string& val)
{
addAttribute(XML_LANG, val);
}
inline void Widget::setAttrTitle(const std::string& val)
{
addAttribute(XML_TITLE, val);
}
inline void Widget::setAttrStyle(const std::string& val)
{
addAttribute(XML_STYLE, val);
}
inline void Widget::setAttributes(const Attributes& attr)
{
_attr = attr;
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_Widget_INCLUDED

View File

@ -1,110 +0,0 @@
//
// WidgetHandler.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/WidgetHandler.h#4 $
//
// Library: WebWidgets
// Package: HTTPHandler
// Module: WidgetHandler
//
// Definition of the WidgetHandler 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_WidgetHandler_INCLUDED
#define WebWidgets_WidgetHandler_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/URI.h"
#include "Poco/AutoPtr.h"
#include "Poco/BasicEvent.h"
namespace Poco {
namespace WebWidgets {
class Form;
class InputField;
class CheckBox;
class WebWidgets_API WidgetHandler: public Poco::Net::HTTPRequestHandler
/// A WidgetHandler is responsible for generating the code to display a Widget
/// and send it back to the user.
{
public:
Poco::BasicEvent<std::pair<Poco::URI, Widget*> > EWidget;
///Event contains the owner (the uri) and the widget
Poco::BasicEvent<std::pair<Poco::URI, Form*> > EContainsForm;
///Event contains the owner (the uri) and the form object
Poco::BasicEvent<std::pair<Form*, InputField*> > EHasInputField;
/// Events contains the InputField and the form to which it belongs
Poco::BasicEvent<std::pair<Form*, CheckBox*> > EHasCheckBox;
/// Events contains the CheckBox and the form to which it belongs
WidgetHandler(Poco::AutoPtr<Widget> ptr);
/// Creates the WidgetHandler.
virtual ~WidgetHandler();
/// Destroys the WidgetHandler.
void handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response);
private:
void onContainsForm(const void* pSender, std::pair<Poco::URI, Form*>& aPair);
void onHasInputField(const void* pSender, std::pair<Form*, InputField*>& aPair);
void onHasCheckBox(const void* pSender, std::pair<Form*, CheckBox*>& aPair);
void onWidget(const void* pSender, std::pair<Poco::URI, Widget*>& aPair);
private:
Poco::AutoPtr<Widget> _ptr;
};
inline void WidgetHandler::onWidget(const void* pSender, std::pair<Poco::URI, Widget*>& aPair)
{
EWidget(pSender, aPair);
}
} } // namespace Poco::WebWidgets
#endif // WebWidgets_WidgetHandler_INCLUDED

View File

@ -1,129 +0,0 @@
//
// WidgetHandlerFactory.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/WidgetHandlerFactory.h#4 $
//
// Library: WebWidgets
// Package: HTTPHandler
// Module: WidgetHandlerFactory
//
// Definition of the WidgetHandlerFactory 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_WidgetHandlerFactory_INCLUDED
#define WebWidgets_WidgetHandlerFactory_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/CheckBox.h"
#include "Poco/WebWidgets/Form.h"
#include "Poco/WebWidgets/InputField.h"
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/URI.h"
#include "Poco/AutoPtr.h"
#include <map>
#include <set>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API WidgetHandlerFactory: public Poco::Net::HTTPRequestHandlerFactory
/// A WidgetHandlerFactory is responsible for dispatching GUI callbacks
{
public:
WidgetHandlerFactory();
/// Creates the WidgetHandlerFactory.
virtual ~WidgetHandlerFactory();
/// Destroys the WidgetHandlerFactory.
void addWidget(const Poco::URI& path, Poco::AutoPtr<Widget> ptr);
void removeWidget(const Poco::URI& path);
std::set<std::string> getHandledURIs() const;
Poco::Net::HTTPRequestHandler* createRequestHandler(const Poco::Net::HTTPServerRequest& request);
private:
void registerForm(const Poco::URI& owner, Poco::AutoPtr<Form> ptrForm);
/// Registers a form so we handle data transferred through a form
void registerInputField(const std::string& uri, Poco::AutoPtr<InputField> ptrInput);
/// Registers an input field belonging to the form identified by the uri
void registerCheckBox(const std::string& uri, Poco::AutoPtr<CheckBox> ptrInput);
/// Registers a checkbox belonging to the form identified by the uri
void onContainsForm(std::pair<Poco::URI, Form*>& aPair);
void onHasInputField(std::pair<Form*, InputField*>& aPair);
void onHasCheckBox(std::pair<Form*, CheckBox*>& aPair);
void onWidget(std::pair<Poco::URI, Widget*>& aPair);
private:
typedef std::map<std::string, Poco::AutoPtr<Widget> > Widgets;
/// Maps a server uri to the Widget at that location
typedef std::multimap<std::string, Poco::AutoPtr<Form> > Forms;
/// Maps owner uris to forms
typedef std::map<std::string, Poco::AutoPtr<Form> > Actions;
/// Maps action uris to their forms
typedef std::map<std::string, Poco::AutoPtr<InputField> > NamedInputFields;
typedef std::map<std::string, NamedInputFields> ActionInputs;
///Maps action uris to a named map of inputfields
typedef std::multimap<std::string, Poco::AutoPtr<CheckBox> > NamedCheckBoxes;
typedef std::map<std::string, NamedCheckBoxes> ActionCheckBoxes;
///Maps action uris to a named map of checkboxes
typedef std::map<std::string, Widget*> IDToWidget;
typedef std::map<std::string, IDToWidget> OwnerToWidgets;
/// Maps for each url, the map of Widgets
Widgets _widgets;
Forms _forms;
Actions _actions;
ActionInputs _inputs;
ActionCheckBoxes _checkBoxes;
OwnerToWidgets _allWidgets;
/// Contains all widgets not only rootelements!
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_WidgetHandlerFactory_INCLUDED

View File

@ -1,177 +0,0 @@
//
// XMLUtil.h
//
// $Id: //poco/Main/WebWidgets/include/Poco/WebWidgets/XMLUtil.h#6 $
//
// Library: WebWidgets
// Package: WebParser
// Module: XMLUtil
//
// Definition of the XMLUtil 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_XMLUtil_INCLUDED
#define WebWidgets_XMLUtil_INCLUDED
#include "Poco/WebWidgets/WebWidgets.h"
#include "Poco/WebWidgets/Widget.h"
#include "Poco/WebWidgets/JSDelegate.h"
#include "Poco/WebWidgets/JavaScriptEvent.h"
#include "Poco/DOM/Element.h"
#include "Poco/AutoPtr.h"
#include "Poco/NumberParser.h"
#include <vector>
#include <istream>
namespace Poco {
namespace WebWidgets {
class WebWidgets_API XMLUtil
/// XMLUtil class contains helper methods for parsing XML documents
{
public:
static const std::string VAL_TRUE;
static const std::string VAL_FALSE;
static const std::string TAG_EVENTS;
static const std::string TAG_DELEGATE;
static const std::string ATTR_FUNCTION;
static const std::string ATTR_FILE;
static Poco::AutoPtr<Widget> loadWidget(std::istream& in);
/// Parses the XML behind the input stream and converts it into a widget
static std::vector<const Poco::XML::Element*> getAllElementChildren(const Poco::XML::Element* pElem);
/// Loads all children of pElem which are of type element, excluding events children!
static std::vector<const Poco::XML::Element*> getNamedElementChildren(const Poco::XML::Element* pElem, const std::string& tagName);
/// Loads all children of pElem which are of type element and have the given tagName
static std::vector<Poco::AutoPtr<Widget> > getAllWidgets(const Poco::XML::Element* pElem, Widget* pParent);
/// Loads all children of pElem which are of type element and converts them to Widgets. Excludes events
static std::vector<Poco::AutoPtr<Widget> > getWidgets(const Poco::XML::Element* pElem, const std::string& childName, Widget* pParent);
/// Loads all children of pElem which are of type element, are named childName and converts them to Widgets
static Poco::AutoPtr<Widget> createWidget(const Poco::XML::Element* pElem, Widget* pParent);
/// Creates a widget from an element, sets the parent
static std::string getText(const Poco::XML::Element* pElem);
/// Returns the inner text of pElem
static void initEvents(Widget& widget, const Poco::XML::Element* pEvents);
// Initializes the events of widget. Expects a not null pEvents pointer with the tagName "events"
static const Poco::XML::Element* getEvents(const Poco::XML::Element* pElem);
/// Returns 0 if no events, otherwise returns the events child
static bool getBoolAttr(const Poco::XML::Element* pElem , const std::string& attrName);
/// Returns the boolean value of an attr, exception if not found or illegal string value
static bool getBoolAttr(const Poco::XML::Element* pElem , const std::string& attrName, bool defaultValue);
/// Returns the boolean value of an attr, returns defaultValue if not found or illegal string value.
template<typename T>
static T getNumericAttr(const Poco::XML::Element* pElem , const std::string& attrName)
/// Returns the numeric value of an attr, exception if not found or illegal string value
{
const std::string& strVal = pElem->getAttribute(attrName);
return Poco::NumberParser::parse(strVal);
}
template<typename T>
static T getNumericAttrUnsigned(const Poco::XML::Element* pElem , const std::string& attrName)
/// Returns the numeric value of an attr, exception if not found or illegal string value
{
const std::string& strVal = pElem->getAttribute(attrName);
return Poco::NumberParser::parseUnsigned(strVal);
}
template<typename T>
static T getNumericAttr(const Poco::XML::Element* pElem , const std::string& attrName, T defaultValue)
/// Returns the numeric value of an attr, returns defaultValue if not found or illegal string value.
{
const std::string& strVal = pElem->getAttribute(attrName);
T val(defaultValue);
Poco::NumberParser::tryParse(strVal, val);
return val;
}
template<typename T>
static T getNumericAttrUnsigned(const Poco::XML::Element* pElem , const std::string& attrName, T defaultValue)
/// Returns the numeric value of an attr, returns defaultValue if not found or illegal string value.
{
const std::string& strVal = pElem->getAttribute(attrName);
T val(defaultValue);
Poco::NumberParser::tryParseUnsigned(strVal, val);
return val;
}
template<typename T>
static void add(JavaScriptEvent<T>& ev, const std::vector<JSDelegate>& delegates)
{
std::vector<JSDelegate>::const_iterator it = delegates.begin();
std::vector<JSDelegate>::const_iterator itEnd = delegates.end();
for (; it != itEnd; ++it)
ev.add(*it);
}
template <typename T>
static std::vector<Poco::AutoPtr<Widget> > castToWidget(const std::vector<Poco::AutoPtr<T> >& in)
{
std::vector<Poco::AutoPtr<Widget> > result;
std::vector<Poco::AutoPtr<T> >::const_iterator it = in.begin();
std::vector<Poco::AutoPtr<T> >::const_iterator itEnd = in.end();
for (; it != itEnd; ++it)
{
result.push_back(*it);
}
return result;
}
private:
static void getEventDelegates(const Poco::XML::Element* pEvents, const std::string& tagName, std::vector<JSDelegate>& result);
// Clears result, then converts all delegates from the child of pEvents named tagName to JSDelegate.
static void createDelegates(const std::vector<const Poco::XML::Element*>& xml, std::vector<JSDelegate>& result);
/// Adds the delegates from xml. result is NOT cleared prior!
private:
XMLUtil();
XMLUtil(const XMLUtil&);
XMLUtil& operator=(const XMLUtil&);
~XMLUtil();
};
} } // namespace Poco::WebWidgets
#endif // WebWidgets_XMLUtil_INCLUDED

View File

@ -1,10 +0,0 @@
# This is a sample configuration file for HTTPFormServer
logging.loggers.root.channel.class = ConsoleChannel
logging.loggers.app.name = Application
logging.loggers.app.channel = c1
logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = [%p] %t
logging.channels.c1.class = ConsoleChannel
logging.channels.c1.formatter = f1
HTTPFormServer.port = 9980

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="HTTPFormServer"
ProjectGUID="{42166902-22B1-461F-B36B-53C17025052D}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include;..\..\..\WebWidgets\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib PocoUtild.lib PocoWebWidgetsd.lib"
OutputFile="bin/HTTPFormServerd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/HTTPFormServerd.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="1"
UseOfMFC="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include;..\..\..\WebWidgets\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib PocoUtil.lib PocoWebWidgets.lib"
OutputFile="bin/HTTPFormServer.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Configuration Files"
Filter="">
<File
RelativePath=".\HTTPFormServer.properties">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\HTTPFormServer.cpp">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,217 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="HTTPFormServer"
ProjectGUID="{42166902-22B1-461F-B36B-53C17025052D}"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include;..\..\..\WebWidgets\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoNetd.lib PocoUtild.lib PocoWebWidgetsd.lib"
OutputFile="bin/HTTPFormServerd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin/HTTPFormServerd.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Net\include;..\..\..\Util\include;..\..\..\WebWidgets\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoNet.lib PocoUtil.lib PocoWebWidgets.lib"
OutputFile="bin/HTTPFormServer.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false"
ProgramDatabaseFile=""
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Configuration Files"
>
<File
RelativePath=".\HTTPFormServer.properties"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\HTTPFormServer.cpp"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,17 +0,0 @@
#
# Makefile
#
# $Id: //poco/Main/WebWidgets/samples/HTTPFormServer/Makefile#1 $
#
# Makefile for Poco HTTPFormServer
#
include $(POCO_BASE)/build/rules/global
objects = HTTPFormServer
target = HTTPFormServer
target_version = 1
target_libs = PocoWebWidgets PocoUtil PocoNet PocoXML PocoFoundation
include $(POCO_BASE)/build/rules/exec

View File

@ -1,244 +0,0 @@
//
// HTTPFormServer.cpp
//
// $Id: //poco/Main/WebWidgets/samples/HTTPFormServer/src/HTTPFormServer.cpp#3 $
//
// This sample demonstrates the HTTPServer and HTMLForm classes.
//
// Copyright (c) 2006, 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/WidgetHandlerFactory.h"
#include "Poco/WebWidgets/RootPanel.h"
#include "Poco/WebWidgets/TextArea.h"
#include "Poco/WebWidgets/Form.h"
#include "Poco/WebWidgets/StackPanel.h"
#include "Poco/WebWidgets/Button.h"
#include "Poco/WebWidgets/RadioButton.h"
#include "Poco/WebWidgets/TextField.h"
#include "Poco/WebWidgets/MouseEventArgs.h"
#include "Poco/Net/HTTPServer.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerParams.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h"
#include "Poco/Net/HTTPServerParams.h"
#include "Poco/Net/HTMLForm.h"
#include "Poco/Net/PartHandler.h"
#include "Poco/Net/MessageHeader.h"
#include "Poco/Net/ServerSocket.h"
#include "Poco/CountingStream.h"
#include "Poco/NullStream.h"
#include "Poco/StreamCopier.h"
#include "Poco/Exception.h"
#include "Poco/Delegate.h"
#include "Poco/NumberFormatter.h"
#include "Poco/Util/ServerApplication.h"
#include "Poco/Util/Option.h"
#include "Poco/Util/OptionSet.h"
#include "Poco/Util/HelpFormatter.h"
#include <iostream>
using namespace Poco::WebWidgets;
using Poco::Net::ServerSocket;
using Poco::Net::HTTPRequestHandler;
using Poco::Net::HTTPRequestHandlerFactory;
using Poco::Net::HTTPServer;
using Poco::Net::HTTPServerRequest;
using Poco::Net::HTTPServerResponse;
using Poco::Net::HTTPServerParams;
using Poco::Net::MessageHeader;
using Poco::Net::HTMLForm;
using Poco::Net::NameValueCollection;
using Poco::Util::ServerApplication;
using Poco::Util::Application;
using Poco::Util::Option;
using Poco::Util::OptionSet;
using Poco::Util::HelpFormatter;
using Poco::CountingInputStream;
using Poco::NullOutputStream;
using Poco::StreamCopier;
class HTTPFormServer: public Poco::Util::ServerApplication
/// The main application class.
///
/// This class handles command-line arguments and
/// configuration files.
/// Start the HTTPFormServer executable with the help
/// option (/help on Windows, --help on Unix) for
/// the available command line options.
///
/// To use the sample configuration file (HTTPFormServer.properties),
/// copy the file to the directory where the HTTPFormServer executable
/// resides. If you start the debug version of the HTTPFormServer
/// (HTTPFormServerd[.exe]), you must also create a copy of the configuration
/// file named HTTPFormServerd.properties. In the configuration file, you
/// can specify the port on which the server is listening (default
/// 9980) and the format of the date/Form string sent back to the client.
///
/// To test the FormServer you can use any web browser (http://localhost:9980/).
{
public:
HTTPFormServer(): _helpRequested(false)
{
}
~HTTPFormServer()
{
}
protected:
void initialize(Application& self)
{
loadConfiguration(); // load default configuration files, if present
ServerApplication::initialize(self);
}
void uninitialize()
{
ServerApplication::uninitialize();
}
void defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);
options.addOption(
Option("help", "h", "display help information on command line arguments")
.required(false)
.repeatable(false));
}
void handleOption(const std::string& name, const std::string& value)
{
ServerApplication::handleOption(name, value);
if (name == "help")
_helpRequested = true;
}
void displayHelp()
{
HelpFormatter helpFormatter(options());
helpFormatter.setCommand(commandName());
helpFormatter.setUsage("OPTIONS");
helpFormatter.setHeader("A web server that shows how to work with HTML forms.");
helpFormatter.format(std::cout);
}
void onNewText(const void* pSender, const std::string& txt)
{
const InputField* pIn = reinterpret_cast<const InputField*>(pSender);
logger().information(pIn->name() + ": new text: " + txt);
}
void onChecked(const void* pSender, const bool& checked)
{
const CheckBox* pIn = reinterpret_cast<const CheckBox*>(pSender);
if (checked)
logger().information(pIn->name() + " is checked, text is: " + pIn->getText());
else
logger().information(pIn->name() + " is NOT checked, text is: " + pIn->getText());
}
void onClicked(const void* pSender, MouseEventArgs& args)
{
logger().information(args.target()->getAttrID() +
"left: " + (args.leftButton()?"true":"false") +
" right: " + (args.rightButton()?"true":"false") +
" middle: " + (args.middleButton()?"true":"false") +
" posX: " + Poco::NumberFormatter::format(args.posX()) +
" posY: " + Poco::NumberFormatter::format(args.posY()));
}
int main(const std::vector<std::string>& args)
{
if (_helpRequested)
{
displayHelp();
}
else
{
unsigned short port = (unsigned short) config().getInt("HTTPFormServer.port", 9980);
// set-up a server socket
ServerSocket svs(port);
// set-up a HTTPServer instance
Poco::URI root("/");
Poco::URI callback("/callback");
WidgetHandlerFactory* pFac = new WidgetHandlerFactory();
Poco::AutoPtr<TextField> ptrInp = new TextField("text",30,30);
ptrInp->NewText += delegate(this, &HTTPFormServer::onNewText);
Poco::AutoPtr<StackPanel> ptrStack = new StackPanel();
ptrStack->add(ptrInp);
Poco::AutoPtr<CheckBox> ptrCheck1 = new CheckBox("group1", "Click This", false);
ptrCheck1->Checked += delegate(this, &HTTPFormServer::onChecked);
Poco::AutoPtr<CheckBox> ptrCheck2 = new CheckBox("group1", "Click That", true);
ptrCheck2->Checked += delegate(this, &HTTPFormServer::onChecked);
ptrStack->add(ptrCheck1);
ptrStack->add(ptrCheck2);
Poco::AutoPtr<CheckBox> ptrRadio1 = new RadioButton("radio1", "Click This", false);
ptrRadio1->Checked += delegate(this, &HTTPFormServer::onChecked);
Poco::AutoPtr<CheckBox> ptrRadio2 = new RadioButton("radio1", "Click That", true);
ptrRadio2->Checked += delegate(this, &HTTPFormServer::onChecked);
ptrStack->add(ptrRadio1);
ptrStack->add(ptrRadio2);
Poco::AutoPtr<Button> ptrBut = new Button("Submit");
ptrBut->ESingleClick += delegate(this, &HTTPFormServer::onClicked);
ptrStack->add(ptrBut);
Poco::AutoPtr<RootPanel> ptrRoot = new RootPanel("Test");
Poco::AutoPtr<Form> ptrForm = new Form(callback, root, Form::M_GET);
ptrForm->add(ptrStack);
ptrRoot->add(ptrForm);
pFac->addWidget(root, ptrRoot);
HTTPServer srv(pFac, svs, new HTTPServerParams);
// start the HTTPServer
srv.start();
// wait for CTRL-C or kill
waitForTerminationRequest();
// Stop the HTTPServer
srv.stop();
}
return Application::EXIT_OK;
}
private:
bool _helpRequested;
};
int main(int argc, char** argv)
{
HTTPFormServer app;
return app.run(argc, argv);
}

View File

@ -1,13 +0,0 @@
#
# Makefile
#
# $Id: //poco/Main/WebWidgets/samples/Makefile#2 $
#
# Makefile for Poco WebWidgets Samples
#
.PHONY: projects
clean all: projects
projects:
$(MAKE) -C HTTPFormServer $(MAKECMDGOALS)

View File

@ -1,3 +0,0 @@
Foundation
XML
Util

View File

@ -1,23 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPFormServer", "HTTPFormServer\HTTPFormServer_vs71.vcproj", "{42166902-22B1-461F-B36B-53C17025052D}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
debug_shared = debug_shared
release_shared = release_shared
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{42166902-22B1-461F-B36B-53C17025052D}.debug_shared.ActiveCfg = debug_shared|Win32
{42166902-22B1-461F-B36B-53C17025052D}.debug_shared.Build.0 = debug_shared|Win32
{42166902-22B1-461F-B36B-53C17025052D}.release_shared.ActiveCfg = release_shared|Win32
{42166902-22B1-461F-B36B-53C17025052D}.release_shared.Build.0 = release_shared|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@ -1,19 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HTTPFormServer", "HTTPFormServer\HTTPFormServer_vs80.vcproj", "{42166902-22B1-461F-B36B-53C17025052D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42166902-22B1-461F-B36B-53C17025052D}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{42166902-22B1-461F-B36B-53C17025052D}.debug_shared|Win32.Build.0 = debug_shared|Win32
{42166902-22B1-461F-B36B-53C17025052D}.release_shared|Win32.ActiveCfg = release_shared|Win32
{42166902-22B1-461F-B36B-53C17025052D}.release_shared|Win32.Build.0 = release_shared|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,66 +0,0 @@
//
// AbstractButton.cpp
//
// $Id: //poco/Main/WebWidgets/src/AbstractButton.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: AbstractButton
//
// 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/AbstractButton.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string AbstractButton::XML_TEXT("text");
AbstractButton::AbstractButton(const std::string& text):
_text(text)
{
}
AbstractButton::AbstractButton(const Poco::XML::Element* pElem):
Widget(pElem),
_text(pElem->getAttribute(XML_TEXT))
{
}
AbstractButton::~AbstractButton()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,92 +0,0 @@
//
// Button.cpp
//
// $Id: //poco/Main/WebWidgets/src/Button.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Button
//
// 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/Button.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
#include "Poco/String.h"
namespace Poco {
namespace WebWidgets {
const std::string Button::FACTORY_ID("button");
const std::string Button::XML_TYPE("type");
const std::string Button::VAL_RESET("reset");
Button::Button(const std::string& text, Type t):
AbstractButton(text),
_type(t)
{
}
Button::Button(const Poco::XML::Element* pElem):
AbstractButton(pElem),
_type(TYPE_SUBMIT)
{
const std::string& val = pElem->getAttribute(XML_TYPE);
if (!val.empty())
{
if (Poco::toLower(val) == VAL_RESET)
_type = TYPE_RESET;
}
}
Button::~Button()
{
}
void Button::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> Button::clone() const
{
Poco::AutoPtr<Widget> w = new Button(getText(), _type);
w->setAttributes(getAttributes());
// no parent!
return w;
}
} } // namespace Poco::WebWidgets

View File

@ -1,84 +0,0 @@
//
// CheckBox.cpp
//
// $Id: //poco/Main/WebWidgets/src/CheckBox.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: CheckBox
//
// 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/CheckBox.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string CheckBox::FACTORY_ID("checkBox");
const std::string CheckBox::XML_CHECKED("checked");
CheckBox::CheckBox(const std::string& name, const std::string& txt, bool checked):
InputField(name, txt),
_checked(checked)
{
}
CheckBox::CheckBox(const Poco::XML::Element* pElem):
InputField(pElem),
_checked(XMLUtil::getBoolAttr(pElem, XML_CHECKED, false))
{
}
CheckBox::~CheckBox()
{
}
void CheckBox::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> CheckBox::clone() const
{
Poco::AutoPtr<Widget> ptr = new CheckBox(name(), getText(), getChecked());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,96 +0,0 @@
//
// ComboBox.cpp
//
// $Id: //poco/Main/WebWidgets/src/ComboBox.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ComboBox
//
// 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/ComboBox.h"
#include "Poco/WebWidgets/Label.h"
#include "Poco/WebWidgets/InputField.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
namespace Poco {
namespace WebWidgets {
const std::string ComboBox::FACTORY_ID("comboBox");
const std::string ComboBox::XML_SELECT("select");
ComboBox::ComboBox(const std::string& uniqueName, const std::vector<Poco::AutoPtr<Label> >& children, int selected):
IndexedPanel(XMLUtil::castToWidget(children)),
_name(uniqueName),
_selected(selected)
{
}
ComboBox::ComboBox(const std::string& uniqueName, const std::vector<Poco::AutoPtr<Widget> >& children, int selected):
IndexedPanel(children),
_name(uniqueName),
_selected(selected)
{
}
ComboBox::ComboBox(const Poco::XML::Element* pElem):
IndexedPanel(pElem, Label::FACTORY_ID),
_name(pElem->getAttribute(InputField::XML_NAME)),
_selected(XMLUtil::getNumericAttr(pElem, XML_SELECT, -1))
{
poco_assert (!_name.empty());
}
ComboBox::~ComboBox()
{
}
void ComboBox::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> ComboBox::clone() const
{
Poco::AutoPtr<Widget> ptr = new ComboBox(_name, cloneChildren(), _selected);
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,61 +0,0 @@
//
// ComplexPanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/ComplexPanel.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ComplexPanel
//
// 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/ComplexPanel.h"
namespace Poco {
namespace WebWidgets {
ComplexPanel::ComplexPanel():
Panel()
{
}
ComplexPanel::ComplexPanel(const Poco::XML::Element* pElem):
Panel(pElem)
{
}
ComplexPanel::~ComplexPanel()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,128 +0,0 @@
//
// FileHandler.cpp
//
// $Id: //poco/Main/WebWidgets/src/FileHandler.cpp#1 $
//
// Library: WebWidgets
// Package: HTTPHandler
// Module: FileHandler
//
// 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/FileHandler.h"
#include "Poco/Exception.h"
#include "Poco/StreamCopier.h"
#include "Poco/Path.h"
#include <fstream>
namespace Poco {
namespace WebWidgets {
std::map<std::string, std::string> FileHandler::EXTENSIONMAPPING(FileHandler::initExtensions());
FileHandler::FileHandler()
{
}
FileHandler::~FileHandler()
{
}
void FileHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
const std::string& uri = request.getURI();
if (uri.find("..") != std::string::npos)
throw Poco::PathSyntaxException("Illegal entry \"..\" in path");
std::size_t pos = uri.rfind('.');
std::string fileType;
if (pos != std::string::npos)
{
fileType = uri.substr(pos+1);
}
std::string file = mapUriToFile(uri);
std::ifstream in(file.c_str());
response.setChunkedTransferEncoding(true);
if (in)
{
std::map<std::string, std::string>::const_iterator it = EXTENSIONMAPPING.find(fileType);
if (fileType.empty() || it == EXTENSIONMAPPING.end())
{
response.setContentType("text/html");
}
else
response.setContentType(it->second);
std::ostream& out = response.send();
Poco::StreamCopier::copyStream(in, out);
}
else
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);
std::ostream& out = response.send();
out << "<HTML><HEAD><TITLE>Not Found</TITLE></HEAD><BODY><H1>File Not Found</H1></BODY></HTML>";
}
}
std::string FileHandler::mapUriToFile(const std::string& uri) const
{
Poco::Path p((uri[0] == '/')?uri.substr(1):uri);
p.makeFile();
return p.toString();
}
std::map<std::string, std::string> FileHandler::initExtensions()
{
std::map<std::string, std::string> ext;
ext.insert(std::make_pair("", "text/html"));
ext.insert(std::make_pair("htm", "text/html"));
ext.insert(std::make_pair("html", "text/html"));
ext.insert(std::make_pair("bmp", "image/bmp"));
ext.insert(std::make_pair("gif", "image/gif"));
ext.insert(std::make_pair("jpe", "image/jpeg"));
ext.insert(std::make_pair("jpg", "image/jpeg"));
ext.insert(std::make_pair("jpeg", "image/jpeg"));
ext.insert(std::make_pair("log", "text/plain"));
ext.insert(std::make_pair("txt", "text/plain"));
ext.insert(std::make_pair("png", "image/png"));
ext.insert(std::make_pair("ico", "image/x-icon"));
ext.insert(std::make_pair("xml", "text/xml"));
ext.insert(std::make_pair("css", "text/css"));
ext.insert(std::make_pair("rss", "application/rss+xml"));
ext.insert(std::make_pair("js", "text/javascript"));
return ext;
}
} } // namespace Poco::WebWidgets

View File

@ -1,80 +0,0 @@
//
// FlowPanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/FlowPanel.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: FlowPanel
//
// 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/FlowPanel.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
namespace Poco {
namespace WebWidgets {
const std::string FlowPanel::FACTORY_ID("flow");
FlowPanel::FlowPanel(const std::vector<Poco::AutoPtr<Widget> >& children):
IndexedPanel(children)
{
}
FlowPanel::FlowPanel(const Poco::XML::Element* pElem):
IndexedPanel(pElem)
{
}
FlowPanel::~FlowPanel()
{
}
void FlowPanel::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> FlowPanel::clone() const
{
Poco::AutoPtr<Widget> ptr = new FlowPanel(cloneChildren());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,113 +0,0 @@
//
// Form.cpp
//
// $Id: //poco/Main/WebWidgets/src/Form.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Form
//
// 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/Form.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
#include "Poco/String.h"
namespace Poco {
namespace WebWidgets {
const std::string Form::FACTORY_ID("form");
const std::string Form::XML_ACTION("action");
const std::string Form::XML_METHOD("method");
const std::string Form::XML_REDIRECT("redirect");
const std::string Form::VAL_GET("get");
const std::string Form::VAL_POST("post");
Form::Form(const Poco::URI& action, const Poco::URI& redirect, Method m, const std::vector<Poco::AutoPtr<Widget> >& children):
IndexedPanel(children),
_action(action),
_redirect(redirect),
_method(m)
{
}
Form::Form(const Poco::XML::Element* pElem):
IndexedPanel(pElem),
_action(pElem->getAttribute(XML_ACTION)),
_redirect(),
_method(M_GET)
{
const std::string& elem = pElem->getAttribute(XML_METHOD);
if (!elem.empty() && Poco::toLower(elem) == VAL_POST)
_method = M_POST;
const std::string& redirect = pElem->getAttribute(XML_REDIRECT);
if (redirect.empty())
{
_redirect = _action;
}
else
{
_redirect = Poco::URI(redirect);
}
}
Form::~Form()
{
}
void Form::accept(Visitor& v)
{
v.visit(*this);
}
const std::string& Form::getMethodStr() const
{
if (_method == M_GET)
return VAL_GET;
return VAL_POST;
}
Poco::AutoPtr<Widget> Form::clone() const
{
Poco::AutoPtr<Widget> ptr = new Form(_action, _redirect, _method, cloneChildren());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,98 +0,0 @@
//
// FormHandler.cpp
//
// $Id: //poco/Main/WebWidgets/src/FormHandler.cpp#3 $
//
// Library: WebWidgets
// Package: HTTPHandler
// Module: FormHandler
//
// 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/FormHandler.h"
#include "Poco/Net/HTMLForm.h"
namespace Poco {
namespace WebWidgets {
FormHandler::FormHandler(Poco::AutoPtr<Form> ptrForm,
const std::map<std::string, Poco::AutoPtr<InputField> >& inputs,
const std::multimap<std::string, Poco::AutoPtr<CheckBox> >& checkBoxes):
_ptrForm(ptrForm),
_inputFields(inputs),
_checkBoxes(checkBoxes)
{
}
FormHandler::~FormHandler()
{
}
void FormHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
Poco::Net::HTMLForm form(request);
Poco::Net::NameValueCollection::ConstIterator it = form.begin();
Poco::Net::NameValueCollection::ConstIterator itEnd = form.end();
for (; it != itEnd; ++it)
{
std::map<std::string, Poco::AutoPtr<InputField> >::iterator itIn = _inputFields.find(it->first);
if (itIn != _inputFields.end())
{
itIn->second->setText(it->second);
}
else
{
std::multimap<std::string, Poco::AutoPtr<CheckBox> >::iterator itC = _checkBoxes.lower_bound(it->first);
std::multimap<std::string, Poco::AutoPtr<CheckBox> >::iterator itCEnd = _checkBoxes.upper_bound(it->first);
for (; itC != _checkBoxes.end() && itC != itCEnd; ++itC)
{
if (itC->second->getText() == it->second)
{
itC->second->setChecked(true);
_checkBoxes.erase(itC);
break;
}
}
}
}
std::multimap<std::string, Poco::AutoPtr<CheckBox> >::iterator itC = _checkBoxes.begin();
std::multimap<std::string, Poco::AutoPtr<CheckBox> >::iterator itCEnd = _checkBoxes.end();
for (; itC != itCEnd; ++itC)
itC->second->setChecked(false);
response.redirect(_ptrForm->getRedirect().toString());
}
} } // namespace Poco::WebWidgets

View File

@ -1,60 +0,0 @@
//
// GUIObject.cpp
//
// $Id: //poco/Main/WebWidgets/src/GUIObject.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: GUIObject
//
// 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/GUIObject.h"
namespace Poco {
namespace WebWidgets {
GUIObject::GUIObject()
{
}
GUIObject::GUIObject(const Poco::XML::Element* pElem)
{
poco_assert_dbg (pElem != 0);
}
GUIObject::~GUIObject()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,81 +0,0 @@
//
// HTML.cpp
//
// $Id: //poco/Main/WebWidgets/src/HTML.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: HTML
//
// 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/HTML.h"
#include "Poco/WebWidgets/Visitor.h"
namespace Poco {
namespace WebWidgets {
const std::string HTML::FACTORY_ID("html");
HTML::HTML()
{
}
HTML::HTML(const std::string& txt):Label(txt)
{
}
HTML::HTML(const Poco::XML::Element* pElem):Label(pElem)
{
}
HTML::~HTML()
{
}
void HTML::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> HTML::clone() const
{
Poco::AutoPtr<Widget> ptr = new HTML(getText());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,842 +0,0 @@
//
// HTMLVisitor.cpp
//
// $Id: //poco/Main/WebWidgets/src/HTMLVisitor.cpp#9 $
//
// Library: WebWidgets
// Package: WebVisitor
// Module: HTMLVisitor
//
// 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/HTMLVisitor.h"
#include "Poco/WebWidgets/Label.h"
#include "Poco/WebWidgets/HTML.h"
#include "Poco/WebWidgets/Form.h"
#include "Poco/WebWidgets/RootPanel.h"
#include "Poco/WebWidgets/Image.h"
#include "Poco/WebWidgets/FlowPanel.h"
#include "Poco/WebWidgets/SimplePanel.h"
#include "Poco/WebWidgets/Table.h"
#include "Poco/WebWidgets/HyperLink.h"
#include "Poco/WebWidgets/Button.h"
#include "Poco/WebWidgets/ImageButton.h"
#include "Poco/WebWidgets/TextArea.h"
#include "Poco/WebWidgets/TextField.h"
#include "Poco/WebWidgets/CheckBox.h"
#include "Poco/WebWidgets/RadioButton.h"
#include "Poco/WebWidgets/IndexedPanel.h"
#include "Poco/WebWidgets/StackPanel.h"
#include "Poco/WebWidgets/ComboBox.h"
#include "Poco/WebWidgets/ListView.h"
#include "Poco/WebWidgets/HidablePanel.h"
#include "Poco/WebWidgets/PwdField.h"
#include "Poco/NumberFormatter.h"
#include <algorithm>
#include <iostream>
namespace Poco {
namespace WebWidgets {
const std::string HTMLVisitor::TAG_DIV("div");
const std::string HTMLVisitor::TAG_HTML("html");
const std::string HTMLVisitor::TAG_HEAD("head");
const std::string HTMLVisitor::TAG_TABLE("table");
const std::string HTMLVisitor::TAG_THEAD("thead");
const std::string HTMLVisitor::TAG_TBODY("tbody");
const std::string HTMLVisitor::TAG_TFOOT("tfoot");
const std::string HTMLVisitor::TAG_TITLE("title");
const std::string HTMLVisitor::TAG_IMG("img");
const std::string HTMLVisitor::TAG_BODY("body");
const std::string HTMLVisitor::TAG_PRE("pre");
const std::string HTMLVisitor::TAG_A("a");
const std::string HTMLVisitor::TAG_INPUT("input");
const std::string HTMLVisitor::TAG_TEXTAREA("textarea");
const std::string HTMLVisitor::TAG_FORM("form");
const std::string HTMLVisitor::TAG_SELECT("select");
const std::string HTMLVisitor::TAG_OPTION("option");
const std::string HTMLVisitor::PRE_OPEN("<");
const std::string HTMLVisitor::PRE_CLOSE("</");
const std::string HTMLVisitor::CLOSE(">");
const std::string HTMLVisitor::FULLCLOSE("/>");
const std::string HTMLVisitor::VAL_SPACE(" ");
const std::string HTMLVisitor::VAL_TABLECELLEMPTY("&nbsp;");
const std::string HTMLVisitor::VAL_SUBMIT("submit");
const std::string HTMLVisitor::VAL_RESET("reset");
const std::string HTMLVisitor::VAL_IMAGE("image");
const std::string HTMLVisitor::VAL_TEXT("text");
const std::string HTMLVisitor::VAL_ONCLICK("onClick");
const std::string HTMLVisitor::VAL_CHECKBOX("checkbox");
const std::string HTMLVisitor::VAL_RADIO("radio");
const std::string HTMLVisitor::VAL_MULTIPLE("multiple");
const std::string HTMLVisitor::VAL_SELECTED("selected");
const std::string HTMLVisitor::VAL_PASSWORD("password");
const std::string HTMLVisitor::ASSIGNQUOTE("=\"");
const std::string HTMLVisitor::QUOTE("\"");
const std::string HTMLVisitor::XML_BR("<br>");
const std::string HTMLVisitor::XML_A_OPEN("<a>");
const std::string HTMLVisitor::XML_A_CLOSE("</a>");
const std::string HTMLVisitor::XML_P_OPEN("<p>");
const std::string HTMLVisitor::XML_P_CLOSE("</p>");
const std::string HTMLVisitor::XML_TR_OPEN("<tr>");
const std::string HTMLVisitor::XML_TR_CLOSE("</tr>");
const std::string HTMLVisitor::XML_TH_OPEN("<th>");
const std::string HTMLVisitor::XML_TH_CLOSE("</th>");
const std::string HTMLVisitor::XML_TD_OPEN("<td>");
const std::string HTMLVisitor::XML_TD_CLOSE("</td>");
const std::string HTMLVisitor::ATTR_HREF("href");
const std::string HTMLVisitor::ATTR_TYPE("type");
const std::string HTMLVisitor::ATTR_VALUE("value");
const std::string HTMLVisitor::ATTR_SRC("src");
const std::string HTMLVisitor::ATTR_ID("id");
const std::string HTMLVisitor::ATTR_ONCLICK("onclick");
const std::string HTMLVisitor::ATTR_ALT("alt");
const std::string HTMLVisitor::ATTR_COLS("cols");
const std::string HTMLVisitor::ATTR_CHECKED("checked");
const std::string HTMLVisitor::ATTR_ROWS("rows");
const std::string HTMLVisitor::ATTR_SIZE("size");
const std::string HTMLVisitor::ATTR_MAXLENGTH("maxlength");
const std::string HTMLVisitor::ATTR_NAME("name");
const std::string HTMLVisitor::CLASS_BUTTON("button");
const std::string HTMLVisitor::CLASS_CHECKBOX("checkbox");
const std::string HTMLVisitor::CLASS_COMBOBOX("combobox");
const std::string HTMLVisitor::CLASS_IMAGE("image");
const std::string HTMLVisitor::CLASS_IMAGEBUTTON("imagebutton");
const std::string HTMLVisitor::CLASS_LISTVIEW("listview");
const std::string HTMLVisitor::CLASS_RADIOBUTTON("radiobutton");
const std::string HTMLVisitor::CLASS_TABLE("table");
const std::string HTMLVisitor::CLASS_TEXTAREA("textarea");
const std::string HTMLVisitor::CLASS_TEXTFIELD("textfield");
const std::string HTMLVisitor::CLASS_PASSWORD("password");
const std::string HTMLVisitor::FILE_APPINF_JS("appinf.js");
const std::string HTMLVisitor::EVENT_SINGLECLICK("onclick");
const std::string HTMLVisitor::EVENT_DOUBLECLICK("ondblclick");
const std::string HTMLVisitor::EVENT_MOUSEDOWN("onmousedown");
const std::string HTMLVisitor::EVENT_MOUSEUP("onmouseup");
const std::string HTMLVisitor::EVENT_MOUSEOUT("onmouseout");
const std::string HTMLVisitor::EVENT_MOUSEOVER("onmouseover");
const std::string HTMLVisitor::EVENT_MOUSEMOVE("onmousemove");
const std::string HTMLVisitor::EVENT_FOCUSENTER("onfocus");
const std::string HTMLVisitor::EVENT_FOCUSLOST("onblur");
const std::string HTMLVisitor::EVENT_KEYUP("onkeyup");
const std::string HTMLVisitor::EVENT_KEYDOWN("onkeydown");
const std::string HTMLVisitor::EVENT_KEYPRESSED("onkeypressed");
const std::string HTMLVisitor::EVENT_SELECT("onselect");
const std::string HTMLVisitor::EVENT_CHANGE("onchange");
HTMLVisitor::HTMLVisitor(std::ostream& out, const Poco::URI& rootAddress):
_out(out),
_rootAddress(rootAddress),
_pActiveForm(0)
{
_javaScriptIncludes.insert(FILE_APPINF_JS);
}
HTMLVisitor::~HTMLVisitor()
{
}
void HTMLVisitor::visit(Label& label)
{
//writeOpenTag(TAG_PRE);
_out << label.getText();
//writeCloseTag(TAG_PRE);
}
void HTMLVisitor::visit(HTML& ht)
{
_out << ht.getText();
}
void HTMLVisitor::visit(RootPanel& main)
{
preVisit(main);
writeOpenTag(TAG_HTML);
writeOpenTag(TAG_HEAD);
writeJavaScript();
writeOpenTag(TAG_TITLE);
_out << main.getName();
writeCloseTag(TAG_TITLE);
Poco::AutoPtr<HTML> ptrHdr = main.getHeader();
if (ptrHdr)
ptrHdr->accept(*this);
writeCloseTag(TAG_HEAD);
writeOpenTag(TAG_BODY);
accept(main.children());
writeCloseTag(TAG_BODY);
writeCloseTag(TAG_HTML);
}
void HTMLVisitor::visit(Image& img)
{
Widget::Attributes attr(img.getAttributes());
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_IMAGE));
handleWidgetCallback(img, attr);
if (img.getWidth()>0)
attr.insert(std::make_pair(Image::XML_WIDTH, Poco::NumberFormatter::format(img.getWidth())));
if (img.getHeight()>0)
attr.insert(std::make_pair(Image::XML_HEIGHT, Poco::NumberFormatter::format(img.getHeight())));
writeTagWithAttributes(TAG_IMG, attr);
}
void HTMLVisitor::visit(FlowPanel& flow)
{
writeOpenWithAttributes(TAG_DIV, flow.getAttributes());
// a flowpanel only decorates with <a></a>
FlowPanel::Children::const_iterator it = flow.children().begin();
FlowPanel::Children::const_iterator itEnd = flow.children().end();
for (; it != itEnd; ++it)
{
_out << XML_A_OPEN;
Poco::AutoPtr<Widget> cpy = *it;
cpy->accept(*this);
_out << XML_A_CLOSE;
}
writeCloseTag(TAG_DIV);
}
void HTMLVisitor::visit(Table& table)
{
Widget::Attributes attr(table.getAttributes());
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_TABLE));
handleWidgetCallback(table, attr);
writeOpenWithAttributes(TAG_TABLE, attr);
Table::Content content = table.getContent();
Table::Content::const_iterator it = content.begin();
Table::Content::const_iterator itEnd = content.end();
if (it != itEnd)
{
if (table.hasHeader())
{
// header line
writeOpenWithAttributes(TAG_THEAD, table.getHeaderAttributes());
// <tr><th>...</th></tr>
_out << XML_TR_OPEN;
Table::Row::const_iterator itRow = it->begin();
Table::Row::const_iterator itRowEnd = it->end();
for (; itRow != itRowEnd; ++itRow)
{
_out << XML_TH_OPEN;
Poco::AutoPtr<Widget> ptrTmp = *itRow;
if (ptrTmp)
ptrTmp->accept(*this);
else
_out << VAL_TABLECELLEMPTY;
_out << XML_TH_CLOSE;
}
_out << XML_TR_CLOSE;
writeCloseTag(TAG_THEAD);
++it;
}
if (table.hasFooter())
{
--itEnd;
if (itEnd != content.begin() || !table.hasHeader()) // don't write the first line again
{
writeOpenWithAttributes(TAG_TFOOT, table.getFooterAttributes());
Table::Row::const_iterator itRow = itEnd->begin();
Table::Row::const_iterator itRowEnd = itEnd->end();
_out << XML_TR_OPEN;
for (; itRow != itRowEnd; ++itRow)
{
_out << XML_TD_OPEN;
Poco::AutoPtr<Widget> ptrTmp = *itRow;
if (ptrTmp)
ptrTmp->accept(*this);
else
_out << VAL_TABLECELLEMPTY;
_out << XML_TD_CLOSE;
}
_out << XML_TR_CLOSE;
writeCloseTag(TAG_TFOOT);
}
}
}
writeOpenWithAttributes(TAG_TBODY, table.getBodyAttributes());
for (; it != itEnd; ++it)
{
_out << XML_TR_OPEN;
Table::Row::const_iterator itRow = it->begin();
Table::Row::const_iterator itRowEnd = it->end();
for (; itRow != itRowEnd; ++itRow)
{
_out << XML_TD_OPEN;
Poco::AutoPtr<Widget> ptrTmp = *itRow;
if (ptrTmp)
ptrTmp->accept(*this);
else
_out << VAL_TABLECELLEMPTY;
_out << XML_TD_CLOSE;
}
_out << XML_TR_CLOSE;
}
writeCloseTag(TAG_TBODY);
writeCloseTag(TAG_TABLE);
}
void HTMLVisitor::visit(HyperLink& link)
{
Widget::Attributes attr(link.getAttributes());
attr.insert (std::make_pair(ATTR_HREF, link.getURI().toString()));
handleWidgetCallback(link, attr);
writeOpenWithAttributes(TAG_A, attr);
if (link.getInnerWidget())
{
link.getInnerWidget()->accept(*this);
}
_out << XML_A_CLOSE;
}
void HTMLVisitor::visit(Button& but)
{
//<input type="submit|reset" value="Absenden">
Widget::Attributes attr(but.getAttributes());
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_BUTTON));
if (but.getType() == Button::TYPE_RESET)
attr.insert(std::make_pair(ATTR_TYPE, VAL_RESET));
else
attr.insert(std::make_pair(ATTR_TYPE, VAL_SUBMIT));
handleWidgetCallback(but, attr);
attr.insert(std::make_pair(ATTR_VALUE, but.getText()));
writeTagWithAttributes(TAG_INPUT, attr);
}
void HTMLVisitor::visit(ImageButton& but)
{
//<input type="image" src="absende.gif" alt="Absenden">
Widget::Attributes attr(but.getAttributes());
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_IMAGEBUTTON));
attr.insert(std::make_pair(ATTR_TYPE, VAL_IMAGE));
attr.insert(std::make_pair(ATTR_SRC, but.getImage().toString()));
attr.insert(std::make_pair(ATTR_ALT, but.getText()));
if (but.getWidth()>0)
attr.insert(std::make_pair(ImageButton::XML_WIDTH, Poco::NumberFormatter::format(but.getWidth())));
if (but.getHeight()>0)
attr.insert(std::make_pair(ImageButton::XML_HEIGHT, Poco::NumberFormatter::format(but.getHeight())));
handleWidgetCallback(but, attr);
writeTagWithAttributes(TAG_INPUT, attr);
}
void HTMLVisitor::visit(TextArea& txt)
{
std::pair<Form*, InputField*> p = std::make_pair(_pActiveForm, &txt);
EHasInputField(this, p);
//<textarea name="Text" rows="10" cols="50">def text</textarea>
Widget::Attributes attr(txt.getAttributes());
handleWidgetCallback(txt, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_TEXTAREA));
attr.insert(std::make_pair(ATTR_NAME, txt.name()));
attr.insert(std::make_pair(ATTR_ROWS, Poco::NumberFormatter::format(txt.getRows())));
attr.insert(std::make_pair(ATTR_COLS, Poco::NumberFormatter::format(txt.getCols())));
writeOpenWithAttributes(TAG_TEXTAREA, attr);
if (!txt.getText().empty())
_out << txt.getText();
writeCloseTag(TAG_TEXTAREA);
}
void HTMLVisitor::visit(TextField& txt)
{
std::pair<Form*, InputField*> p = std::make_pair(_pActiveForm, &txt);
EHasInputField(this, p);
//<input name="Zuname" type="text" size="30" maxlength="40">
Widget::Attributes attr(txt.getAttributes());
handleWidgetCallback(txt, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_TEXTFIELD));
attr.insert(std::make_pair(ATTR_NAME, txt.name()));
attr.insert(std::make_pair(ATTR_TYPE, VAL_TEXT));
attr.insert(std::make_pair(ATTR_SIZE, Poco::NumberFormatter::format(txt.getSize())));
if (!txt.getText().empty())
attr.insert(std::make_pair(ATTR_VALUE, txt.getText()));
if (txt.getMaxLength() > 0)
{
attr.insert(std::make_pair(ATTR_MAXLENGTH, Poco::NumberFormatter::format(txt.getMaxLength())));
}
writeTagWithAttributes(TAG_INPUT, attr);
}
void HTMLVisitor::visit(CheckBox& but)
{
std::pair<Form*, CheckBox*> p = std::make_pair(_pActiveForm, &but);
EHasCheckBox(this, p);
//<input type="checkbox" name="zutat" value="salami" checked="checked">
Widget::Attributes attr(but.getAttributes());
handleWidgetCallback(but, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_CHECKBOX));
attr.insert(std::make_pair(ATTR_TYPE, VAL_CHECKBOX));
attr.insert(std::make_pair(ATTR_NAME, but.name()));
attr.insert(std::make_pair(ATTR_VALUE, but.getText()));
if (but.getChecked())
attr.insert(std::make_pair(ATTR_CHECKED, ATTR_CHECKED));
writeTagWithAttributes(TAG_INPUT, attr);
_out << but.getText();
}
void HTMLVisitor::visit(RadioButton& but)
{
std::pair<Form*, CheckBox*> p = std::make_pair(_pActiveForm, &but);
EHasCheckBox(this, p);
//<input type="radio" name="zutat" value="salami">
//<input type="radio" name="zutat" value="cheese">
Widget::Attributes attr(but.getAttributes());
handleWidgetCallback(but, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_RADIOBUTTON));
attr.insert(std::make_pair(ATTR_TYPE, VAL_RADIO));
attr.insert(std::make_pair(ATTR_NAME, but.name()));
attr.insert(std::make_pair(ATTR_VALUE, but.getText()));
if (but.getChecked())
attr.insert(std::make_pair(ATTR_CHECKED, ATTR_CHECKED));
writeTagWithAttributes(TAG_INPUT, attr);
_out << but.getText();
}
void HTMLVisitor::visit(Form& f)
{
_pActiveForm = &f;
std::pair<Poco::URI, Form*> p = std::make_pair(_rootAddress, _pActiveForm);
EContainsForm(this, p);
//<form action="/cgi-bin/auswertung.pl" method="get" target="Daten">
// children
//</form>
Widget::Attributes attr(f.getAttributes());
attr.insert(std::make_pair(Form::XML_ACTION, f.getAction().toString()));
attr.insert(std::make_pair(Form::XML_METHOD, f.getMethodStr()));
writeOpenWithAttributes(TAG_FORM, attr);
accept(f.children());
writeCloseTag(TAG_FORM);
}
void HTMLVisitor::visit(IndexedPanel& p)
{
accept(p.children());
}
void HTMLVisitor::visit(StackPanel& p)
{
writeOpenWithAttributes(TAG_DIV, p.getAttributes());
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = p.children().begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = p.children().end();
for (; it != itEnd; ++it)
{
if (it != p.children().begin())
_out << XML_BR;
Poco::AutoPtr<Widget> ptr = *it;
ptr->accept(*this);
}
writeCloseTag(TAG_DIV);
}
void HTMLVisitor::visit(ComboBox& p)
{
//<select name="top5" size="1">
Widget::Attributes attr(p.getAttributes());
handleWidgetCallback(p, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_COMBOBOX));
attr.insert(std::make_pair(ATTR_NAME, p.getName()));
attr.insert(std::make_pair(ATTR_SIZE, "1"));
writeOpenWithAttributes(TAG_SELECT, attr);
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = p.children().begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = p.children().end();
int selected = p.getSelectedIndex();
int cnt = 0;
for (; it != itEnd; ++it, ++cnt)
{
Poco::AutoPtr<Widget> ptr = *it;
Widget::Attributes optAttr;
if (cnt == selected)
optAttr.insert(std::make_pair(VAL_SELECTED, VAL_SELECTED));
writeOpenWithAttributes(TAG_OPTION, optAttr);
ptr->accept(*this);
writeCloseTag(TAG_OPTION);
}
writeCloseTag(TAG_SELECT);
}
void HTMLVisitor::visit(ListView& p)
{
//<select name="top5" size="1" multiple="multiple">
Widget::Attributes attr(p.getAttributes());
handleWidgetCallback(p, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_LISTVIEW));
attr.insert(std::make_pair(ATTR_NAME, p.getName()));
attr.insert(std::make_pair(ATTR_SIZE, Poco::NumberFormatter::format(p.getViewSize())));
if (p.getMultiple())
attr.insert(std::make_pair(VAL_MULTIPLE, VAL_MULTIPLE));
writeOpenWithAttributes(TAG_SELECT, attr);
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = p.children().begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = p.children().end();
std::set<int> selected = p.getSelectedIndizes();
int cnt = 0;
for (; it != itEnd; ++it, ++cnt)
{
Poco::AutoPtr<Widget> ptr = *it;
Widget::Attributes optAttr;
if (selected.find(cnt) != selected.end() )
{
optAttr.insert(std::make_pair(VAL_SELECTED, VAL_SELECTED));
if (!p.getMultiple())
selected.clear();
}
writeOpenWithAttributes(TAG_OPTION, optAttr);
ptr->accept(*this);
writeCloseTag(TAG_OPTION);
}
writeCloseTag(TAG_SELECT);
}
void HTMLVisitor::visit(HidablePanel& l)
{
// write an Imagebutton
Widget::Attributes attr;
attr.insert(std::make_pair(ATTR_ID, l.getAttrID()));
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_IMAGEBUTTON));
attr.insert(std::make_pair(ATTR_TYPE, VAL_IMAGE));
attr.insert(std::make_pair(ATTR_SRC, l.onImg().toString()));
attr.insert(std::make_pair(ATTR_ONCLICK, onClickMethodName(l.getAttrID())+"()"));
writeTagWithAttributes(TAG_INPUT, attr);
//write the text
_out << l.text() << "<br/>";
// write the child
l.getWidget()->accept(*this);
}
void HTMLVisitor::visit(PwdField& txt)
{
std::pair<Form*, InputField*> p = std::make_pair(_pActiveForm, &txt);
EHasInputField(this, p);
//<input name="Zuname" type="password" size="30" maxlength="40">
Widget::Attributes attr(txt.getAttributes());
handleWidgetCallback(txt, attr);
attr.insert(std::make_pair(Widget::XML_CLASS, CLASS_PASSWORD));
attr.insert(std::make_pair(ATTR_NAME, txt.name()));
attr.insert(std::make_pair(ATTR_TYPE, VAL_PASSWORD));
attr.insert(std::make_pair(ATTR_SIZE, Poco::NumberFormatter::format(txt.getSize())));
// never send the stored password as ATTR_VALUE
if (txt.getMaxLength() > 0)
{
attr.insert(std::make_pair(ATTR_MAXLENGTH, Poco::NumberFormatter::format(txt.getMaxLength())));
}
writeTagWithAttributes(TAG_INPUT, attr);
}
void HTMLVisitor::preVisit(Widget& widget)
{
assertHasID(widget);
handleEvent(widget, widget.ESingleClick, EVENT_SINGLECLICK);
handleEvent(widget, widget.EDoubleClick, EVENT_DOUBLECLICK);
handleEvent(widget, widget.EMouseDown, EVENT_MOUSEDOWN);
handleEvent(widget, widget.EMouseUp, EVENT_MOUSEUP);
handleEvent(widget, widget.EMouseOut, EVENT_MOUSEOUT);
handleEvent(widget, widget.EMouseOver, EVENT_MOUSEOVER);
handleEvent(widget, widget.EMouseOver, EVENT_MOUSEMOVE);
handleEvent(widget, widget.EMouseOver, EVENT_FOCUSENTER);
handleEvent(widget, widget.EMouseOver, EVENT_FOCUSLOST);
handleEvent(widget, widget.EKeyUp, EVENT_KEYUP);
handleEvent(widget, widget.EKeyDown, EVENT_KEYDOWN);
handleEvent(widget, widget.EKeyPressed, EVENT_KEYPRESSED);
std::pair<Poco::URI, Widget*> nfo = std::make_pair(_rootAddress, &widget);
EWidget(this, nfo);
}
void HTMLVisitor::preVisit(InputField& input)
{
assertHasID(input);
handleEvent(input, input.ESelect, EVENT_SELECT);
handleEvent(input, input.EChange, EVENT_CHANGE);
preVisit(static_cast<Widget&>(input));
}
void HTMLVisitor::preVisit(SimplePanel& widget)
{
preVisit(static_cast<Widget&>(widget));
widget.getWidget()->preAccept(*this);
}
void HTMLVisitor::preVisit(IndexedPanel& widget)
{
preVisit(static_cast<Widget&>(widget));
preAccept(widget.children());
}
void HTMLVisitor::preVisit(RootPanel& main)
{
preVisit(static_cast<Widget&>(main));
_javaScriptHeader.clear();
_javaScriptOnLoad.clear();
preAccept(main.children());
}
void HTMLVisitor::preVisit(HidablePanel& widget)
{
//a HidablePanel must have an id, also its child
preVisit(static_cast<Widget&>(widget));
if (widget.getWidget()->getAttrID().empty())
widget.getWidget()->setAttrID(autoID());
std::string fctName = onClickMethodName(widget.getAttrID());
addJavaScript("function "+fctName+"() {");
addJavaScript("var child = $(\""+widget.getWidget()->getAttrID()+"\");");
addJavaScript("var imgBut = $(\""+widget.getAttrID()+"\");");
addJavaScript("if (child.style.display == \"none\") {");
if(widget.inlineMode())
addJavaScript("child.style.display = \"inline\";");
else
addJavaScript("child.style.display = \"block\";");
addJavaScript("imgBut.src = \"" + widget.onImg().toString() + "\";");
addJavaScript("} else {");
addJavaScript("child.style.display = \"none\";");
addJavaScript("imgBut.src = \"" + widget.offImg().toString() + "\";");
addJavaScript("}");
addJavaScript("}");
widget.getWidget()->preAccept(*this);
}
void HTMLVisitor::writeOpenWithAttributes(const std::string& tag, const Widget::Attributes& attr)
{
_out << PRE_OPEN << tag;
writeAttributes(attr);
_out << CLOSE;
}
void HTMLVisitor::writeTagWithAttributes(const std::string& tag, const Widget::Attributes& attr)
{
_out << PRE_OPEN << tag;
writeAttributes(attr);
_out << FULLCLOSE;
}
void HTMLVisitor::writeAttributes(const Widget::Attributes& attr)
{
Widget::Attributes::const_iterator it = attr.begin();
Widget::Attributes::const_iterator itEnd = attr.end();
for (; it != itEnd; ++it)
{
_out << VAL_SPACE << it->first << ASSIGNQUOTE << it->second << QUOTE;
}
}
void HTMLVisitor::accept(const std::vector<Poco::AutoPtr<Widget> >& widgets)
{
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = widgets.begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = widgets.end();
for (; it != itEnd; ++it)
{
Poco::AutoPtr<Widget> ptr = *it;
ptr->accept(*this);
}
}
void HTMLVisitor::preAccept(const std::vector<Poco::AutoPtr<Widget> >& widgets)
{
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = widgets.begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = widgets.end();
for (; it != itEnd; ++it)
{
Poco::AutoPtr<Widget> ptr = *it;
ptr->preAccept(*this);
}
}
std::string HTMLVisitor::autoID()
{
static Poco::UInt32 VAL_ID(0);
static const std::string STR_ID("id");
std::string res(STR_ID);
res.append(Poco::NumberFormatter::format(VAL_ID++));
return res;
}
void HTMLVisitor::writeJavaScript()
{
int ind = 0;
writeJSIncludes(0);
if (_javaScriptHeader.empty() && _javaScriptOnLoad.empty())
return;
writeSingleLine("<script type=\"text/javascript\">", ind);
std::list<std::string>::const_iterator it = _javaScriptHeader.begin();
std::list<std::string>::const_iterator itEnd = _javaScriptHeader.end();
for (; it != itEnd; ++it)
{
writeSingleLine(*it, ind);
}
if (!_javaScriptOnLoad.empty())
{
writeSingleLine("window.onLoad = function() {", ind);
it = _javaScriptOnLoad.begin();
itEnd = _javaScriptOnLoad.end();
for (; it != itEnd; ++it)
{
writeSingleLine(*it, ind);
}
writeSingleLine("}", ind);
}
writeSingleLine("</script>", ind);
_javaScriptHeader.clear();
_javaScriptOnLoad.clear();
}
void HTMLVisitor::writeSingleLine(const std::string& code, int& indentation)
{
int cntOpen = (int)std::count_if(code.begin(), code.end(), std::bind2nd(std::equal_to<char>(), '{'));
int cntClose = (int)std::count_if(code.begin(), code.end(), std::bind2nd(std::equal_to<char>(), '}'));
if (!code.empty() && code[0] == '}')
writeIndent(indentation-1);
else
writeIndent(indentation);
_out << code << std::endl;
indentation += (cntOpen-cntClose);
if (indentation<0)
indentation = 0;
}
void HTMLVisitor::writeIndent(int indent)
{
static const std::string ind[] = {"", "\t", "\t\t", "\t\t\t", "\t\t\t\t", "\t\t\t\t\t", "\t\t\t\t\t\t"};
if (indent > 6)
indent = 6;
if (indent < 0)
indent = 0;
_out << ind[indent];
}
void HTMLVisitor::writeJSIncludes(int indent)
{
std::set<std::string>::const_iterator it = _javaScriptIncludes.begin();
std::set<std::string>::const_iterator itEnd = _javaScriptIncludes.end();
for (; it != itEnd; ++it)
{
if (!it->empty())
{
//<script src="xxx.js"></script>
std::string line=("<script src=\"");
line.append(*it);
line.append("\"></script>");
writeSingleLine(line, indent);
}
}
}
void HTMLVisitor::handleWidgetCallback(Widget& widget, Widget::Attributes& attr)
{
handleCallbackGeneration(widget, widget.ESingleClick, EVENT_SINGLECLICK, attr);
handleCallbackGeneration(widget, widget.EDoubleClick, EVENT_DOUBLECLICK, attr);
handleCallbackGeneration(widget, widget.EMouseDown, EVENT_MOUSEDOWN, attr);
handleCallbackGeneration(widget, widget.EMouseUp, EVENT_MOUSEUP, attr);
handleCallbackGeneration(widget, widget.EMouseOver, EVENT_MOUSEOVER, attr);
handleCallbackGeneration(widget, widget.EMouseOut, EVENT_MOUSEOUT, attr);
handleCallbackGeneration(widget, widget.EMouseMove, EVENT_MOUSEMOVE, attr);
handleCallbackGeneration(widget, widget.EFocusEnter, EVENT_FOCUSENTER, attr);
handleCallbackGeneration(widget, widget.EFocusLost, EVENT_FOCUSLOST, attr);
handleCallbackGeneration(widget, widget.EKeyUp, EVENT_KEYUP, attr);
handleCallbackGeneration(widget, widget.EKeyDown, EVENT_KEYDOWN, attr);
handleCallbackGeneration(widget, widget.EKeyPressed, EVENT_KEYPRESSED, attr);
InputField* pIn = dynamic_cast<InputField*>(&widget);
if (pIn)
{
handleCallbackGeneration(widget, pIn->ESelect, EVENT_SELECT, attr);
handleCallbackGeneration(widget, pIn->EChange, EVENT_CHANGE, attr);
}
}
std::string HTMLVisitor::generateMultiEventHandlerName(const Widget& widget, const std::string& eventType)
{
static const std::string PRE("multiEventHandler");
return PRE + eventType + widget.getAttrID();
}
std::string HTMLVisitor::generateServerEventHandlerName(const Widget& widget)
{
static const std::string PRE("serverEventHandler");
return PRE + widget.getAttrID();
}
} } // namespace Poco::WebWidgets

View File

@ -1,102 +0,0 @@
//
// HidablePanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/HidablePanel.cpp#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: HidablePanel
//
// 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/HidablePanel.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/WebWidgets/Visitor.h"
namespace Poco {
namespace WebWidgets {
const std::string HidablePanel::FACTORY_ID("hidablePanel");
const std::string HidablePanel::XML_ON("on");
const std::string HidablePanel::XML_OFF("off");
const std::string HidablePanel::XML_TEXT("text");
const std::string HidablePanel::ATTR_INLINE("inline");
HidablePanel::HidablePanel(Poco::AutoPtr<Widget> ptr, const Poco::URI& expandedImage, const Poco::URI& notExpandedImage, const std::string& text, bool inlineMode):
SimplePanel(ptr),
_onImg(expandedImage),
_offImg(notExpandedImage),
_text(text),
_inlineMode(inlineMode)
{
}
HidablePanel::HidablePanel(const Poco::XML::Element* pElem):
SimplePanel(pElem),
_onImg(pElem->getAttribute(XML_ON)),
_offImg(pElem->getAttribute(XML_OFF)),
_text(pElem->getAttribute(XML_TEXT)),
_inlineMode(XMLUtil::getBoolAttr(pElem, ATTR_INLINE, false))
{
}
HidablePanel::~HidablePanel()
{
}
void HidablePanel::accept(Visitor& v)
{
v.visit(*this);
}
void HidablePanel::preAccept(Visitor& v)
{
v.preVisit(*this);
}
Poco::AutoPtr<Widget> HidablePanel::clone() const
{
Poco::AutoPtr<Widget> ptrChild = getWidget();
if (ptrChild)
ptrChild = ptrChild->clone();
Poco::AutoPtr<Widget> ptr = new HidablePanel(ptrChild, _onImg, _offImg, _text, _inlineMode);
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,93 +0,0 @@
//
// HyperLink.cpp
//
// $Id: //poco/Main/WebWidgets/src/HyperLink.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: HyperLink
//
// 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/HyperLink.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string HyperLink::FACTORY_ID("hyperLink");
const std::string HyperLink::XML_REF("ref");
HyperLink::HyperLink(const Poco::URI& uri, Poco::AutoPtr<Widget> ptrWidget):
_uri(uri),
_ptrInner(ptrWidget)
{
}
HyperLink::HyperLink(const Poco::XML::Element* pElem):
Widget(pElem),
_uri(pElem->getAttribute(XML_REF))
{
std::vector<Poco::AutoPtr<Widget> > res = XMLUtil::getAllWidgets(pElem, this);
if (res.size() > 1)
{
throw Poco::SyntaxException("A HyperLink can only have one child!");
}
else if (res.size() == 1)
_ptrInner = res[0];
}
HyperLink::~HyperLink()
{
}
void HyperLink::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> HyperLink::clone() const
{
Poco::AutoPtr<Widget> ptrChild = getInnerWidget();
if (ptrChild)
ptrChild = ptrChild->clone();
Poco::AutoPtr<Widget> ptr = new HyperLink(_uri, ptrChild);
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,98 +0,0 @@
//
// Image.cpp
//
// $Id: //poco/Main/WebWidgets/src/Image.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Image
//
// 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/Image.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
#include "Poco/NumberParser.h"
namespace Poco {
namespace WebWidgets {
const std::string Image::FACTORY_ID("image");
const std::string Image::XML_ALT("alt");
const std::string Image::XML_SRC("src");
const std::string Image::XML_WIDTH("width");
const std::string Image::XML_HEIGHT("height");
Image::Image(const Poco::URI& uri, const std::string& text, Poco::UInt32 width, Poco::UInt32 height):
_uri(uri),
_width(width),
_height(height)
{
addAttribute(XML_SRC, uri.toString());
addAttribute(XML_ALT, text);
}
Image::Image(const Poco::XML::Element* pElem):
Widget(pElem),
_uri(pElem->getAttribute(XML_SRC)),
_width(0),
_height(0)
{
addAttribute(XML_SRC, pElem->getAttribute(XML_SRC));
addAttribute(XML_ALT, pElem->getAttribute(XML_ALT));
const std::string& w = pElem->getAttribute(XML_WIDTH);
Poco::NumberParser::tryParseUnsigned(w, _width);
const std::string& h = pElem->getAttribute(XML_HEIGHT);
Poco::NumberParser::tryParseUnsigned(h, _height);
}
Image::~Image()
{
}
void Image::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> Image::clone() const
{
Poco::AutoPtr<Widget> ptr = new Image(_uri, findAttr(XML_ALT)->second, _width, _height);
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,94 +0,0 @@
//
// ImageButton.cpp
//
// $Id: //poco/Main/WebWidgets/src/ImageButton.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ImageButton
//
// 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/ImageButton.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
#include "Poco/NumberParser.h"
namespace Poco {
namespace WebWidgets {
const std::string ImageButton::FACTORY_ID("imageButton");
const std::string ImageButton::XML_IMG("img");
const std::string ImageButton::XML_WIDTH("width");
const std::string ImageButton::XML_HEIGHT("height");
ImageButton::ImageButton(const Poco::URI& img, const std::string& alternativeText, Poco::UInt32 width, Poco::UInt32 height):
AbstractButton(alternativeText),
_img(img),
_width(width),
_height(height)
{
}
ImageButton::ImageButton(const Poco::XML::Element* pElem):
AbstractButton(pElem),
_img(pElem->getAttribute(XML_IMG)),
_width(0),
_height(0)
{
const std::string& w = pElem->getAttribute(XML_WIDTH);
Poco::NumberParser::tryParseUnsigned(w, _width);
const std::string& h = pElem->getAttribute(XML_HEIGHT);
Poco::NumberParser::tryParseUnsigned(h, _height);
}
ImageButton::~ImageButton()
{
}
void ImageButton::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> ImageButton::clone() const
{
Poco::AutoPtr<Widget> ptr = new ImageButton(_img, getText());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,129 +0,0 @@
//
// IndexedPanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/IndexedPanel.cpp#5 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: IndexedPanel
//
// 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/IndexedPanel.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
namespace Poco {
namespace WebWidgets {
IndexedPanel::IndexedPanel(const std::vector<Poco::AutoPtr<Widget> >& children):
ComplexPanel(),
_children(children)
{
std::vector<Poco::AutoPtr<Widget> >::iterator it = _children.begin();
std::vector<Poco::AutoPtr<Widget> >::iterator itEnd = _children.end();
for (; it != itEnd; ++it)
(*it)->setParent(this);
}
IndexedPanel::IndexedPanel(const Poco::XML::Element* pElem):
ComplexPanel(pElem),
_children()
{
_children = XMLUtil::getAllWidgets(pElem, this);
}
IndexedPanel::IndexedPanel(const Poco::XML::Element* pElem, const std::string& filter):
ComplexPanel(pElem),
_children()
{
_children = XMLUtil::getWidgets(pElem, filter, this);
}
IndexedPanel::~IndexedPanel()
{
}
void IndexedPanel::accept(Visitor& v)
{
v.visit(*this);
}
void IndexedPanel::preAccept(Visitor& v)
{
v.preVisit(*this);
}
Poco::AutoPtr<Widget> IndexedPanel::find(const std::string& id) const
{
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = _children.begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = _children.end();
Poco::AutoPtr<Widget> res;
for (; it != itEnd && res.isNull(); ++it)
{
res = Widget::find((*it), id);
}
return res;
}
Poco::AutoPtr<Widget> IndexedPanel::clone() const
{
Poco::AutoPtr<Widget> ptr = new IndexedPanel(cloneChildren());
ptr->setAttributes(getAttributes());
return ptr;
}
std::vector<Poco::AutoPtr<Widget> > IndexedPanel::cloneChildren() const
{
std::vector<Poco::AutoPtr<Widget> > result;
std::vector<Poco::AutoPtr<Widget> >::const_iterator it = _children.begin();
std::vector<Poco::AutoPtr<Widget> >::const_iterator itEnd = _children.end();
for (; it != itEnd; ++it)
{
if ((*it))
result.push_back((*it)->clone());
else
result.push_back(Poco::AutoPtr<Widget>());
}
return result;
}
} } // namespace Poco::WebWidgets

View File

@ -1,71 +0,0 @@
//
// InputField.cpp
//
// $Id: //poco/Main/WebWidgets/src/InputField.cpp#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: InputField
//
// 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/InputField.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/WebWidgets/Visitor.h"
namespace Poco {
namespace WebWidgets {
InputField::InputField(const std::string& uniqueName, const std::string& defTxt):
NamedWidget(uniqueName),
_lastText(defTxt)
{
}
InputField::InputField(const Poco::XML::Element* pElem):
NamedWidget(pElem),
_lastText(XMLUtil::getText(pElem))
{
}
InputField::~InputField()
{
}
void InputField::preAccept(Visitor& v)
{
v.preVisit(*this);
}
} } // namespace Poco::WebWidgets

View File

@ -1,68 +0,0 @@
//
// JSDelegate.cpp
//
// $Id: //poco/Main/WebWidgets/src/JSDelegate.cpp#4 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: JSDelegate
//
// 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/JSDelegate.h"
namespace Poco {
namespace WebWidgets {
JSDelegate::JSDelegate(const std::string& fct, const std::string& file):
_functionName(fct),
_jsFile(file)
{
}
JSDelegate::~JSDelegate()
{
}
bool JSDelegate::operator<(const JSDelegate& del) const
{
if (_functionName < del._functionName)
return true;
if (_functionName > del._functionName)
return false;
return _jsFile < del._jsFile;
}
} } // namespace Poco::WebWidgets

View File

@ -1,321 +0,0 @@
//
// JSEventHandler.cpp
//
// $Id: //poco/Main/WebWidgets/src/JSEventHandler.cpp#3 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: JSEventHandler
//
// 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/JSEventHandler.h"
#include "Poco/WebWidgets/MouseEventArgs.h"
#include "Poco/WebWidgets/MouseMovementArgs.h"
#include "Poco/WebWidgets/InputField.h"
#include "Poco/NumberParser.h"
namespace Poco {
namespace WebWidgets {
const std::string JSEventHandler::FORM_ID("id");
const std::string JSEventHandler::FORM_TYPE("type");
const std::string JSEventHandler::FORM_BUTTONS("buttons");
const std::string JSEventHandler::FORM_POSX("posX");
const std::string JSEventHandler::FORM_POSY("posY");
const std::string JSEventHandler::FORM_WINPOSX("windowPosX");
const std::string JSEventHandler::FORM_WINPOSY("windowPosY");
const std::string JSEventHandler::FORM_KEY("key");
const std::string JSEventHandler::FORM_SHIFT("shift");
const std::string JSEventHandler::FORM_CTRL("ctrl");
const std::string JSEventHandler::FORM_ALT("alt");
const std::string JSEventHandler::VAL_CLICK("click");
const std::string JSEventHandler::VAL_DBLCLICK("dblclick");
const std::string JSEventHandler::VAL_MOUSEUP("mouseup");
const std::string JSEventHandler::VAL_MOUSEDOWN("mousedown");
const std::string JSEventHandler::VAL_MOUSEOVER("mouseover");
const std::string JSEventHandler::VAL_MOUSEOUT("mouseout");
const std::string JSEventHandler::VAL_MOUSEMOVE("mousemove");
const std::string JSEventHandler::VAL_FOCUSENTER("focus");
const std::string JSEventHandler::VAL_FOCUSLOST("blur");
const std::string JSEventHandler::VAL_KEYUP("keyup");
const std::string JSEventHandler::VAL_KEYDOWN("keydown");
const std::string JSEventHandler::VAL_KEYPRESSED("keypressed");
const std::string JSEventHandler::VAL_SELECT("select");
const std::string JSEventHandler::VAL_CHANGE("change");
JSEventHandler::JSEventHandler(std::map<std::string, Widget*>& children):
_widgets(children)
{
}
JSEventHandler::~JSEventHandler()
{
}
void JSEventHandler::handleRequest(Poco::Net::HTTPServerRequest& request, Poco::Net::HTTPServerResponse& response)
{
static Handlers handlers;
Poco::Net::HTMLForm form(request);
Poco::Net::NameValueCollection::ConstIterator it = form.find(FORM_ID);
if (it == form.end())
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, "Missing id");
response.send();
return;
}
IDToWidget::iterator itW = _widgets.find(it->second);
if (itW == _widgets.end())
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, "Illegal id");
response.send();
return;
}
it = form.find(FORM_TYPE);
if (it == form.end())
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, "Missing event type");
response.send();
return;
}
const std::string& type = it->second;
try
{
Handlers::iterator it = handlers.find(type);
if (it == handlers.end())
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, "Illegal event type");
response.send();
return;
}
(this->*(it->second))(form, itW->second);
}
catch(Poco::Exception& e)
{
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR, e.displayText());
}
response.send();
}
void JSEventHandler::handleClick(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseEventArgs evArgs = createMouseClickArgs(form, pWidget);
pWidget->ESingleClick.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleMouseUp(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseEventArgs evArgs = createMouseClickArgs(form, pWidget);
pWidget->EMouseUp.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleMouseDown(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseEventArgs evArgs = createMouseClickArgs(form, pWidget);
pWidget->EMouseDown.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleDblClick(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseEventArgs evArgs = createMouseClickArgs(form, pWidget);
pWidget->EDoubleClick.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleMouseOut(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseMovementArgs evArgs = createMouseMovementArgs(form, pWidget);
pWidget->EMouseOut.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleMouseOver(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseMovementArgs evArgs = createMouseMovementArgs(form, pWidget);
pWidget->EMouseOver.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleMouseMove(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseMovementArgs evArgs = createMouseMovementArgs(form, pWidget);
pWidget->EMouseMove.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleFocusEnter(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseMovementArgs evArgs = createMouseMovementArgs(form, pWidget);
pWidget->EFocusEnter.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleFocusLost(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
MouseMovementArgs evArgs = createMouseMovementArgs(form, pWidget);
pWidget->EFocusLost.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleKeyUp(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
KeyEventArgs evArgs = createKeyEventArgs(form, pWidget);
pWidget->EKeyUp.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleKeyDown(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
KeyEventArgs evArgs = createKeyEventArgs(form, pWidget);
pWidget->EKeyUp.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleKeyPressed(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
poco_check_ptr (pWidget);
KeyEventArgs evArgs = createKeyEventArgs(form, pWidget);
pWidget->EKeyUp.notifyAsync(pWidget, evArgs);
}
void JSEventHandler::handleSelect(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
InputField* pIn = dynamic_cast<InputField*>(pWidget);
poco_check_ptr (pIn);
pIn->ESelect.notifyAsync(pIn, pIn);
}
void JSEventHandler::handleChange(const Poco::Net::HTMLForm& form, Widget* pWidget)
{
InputField* pIn = dynamic_cast<InputField*>(pWidget);
poco_check_ptr (pIn);
pIn->ESelect.notifyAsync(pIn, pIn);
}
MouseEventArgs JSEventHandler::createMouseClickArgs(const Poco::Net::HTMLForm& form, Widget* id) const
{
Poco::Net::NameValueCollection::ConstIterator it = form.find(FORM_BUTTONS);
poco_assert (it != form.end());
int val = Poco::NumberParser::parse(it->second);
bool left = ((val & 1) > 0);
bool middle = ((val & 4) > 0);
bool right = ((val & 2) > 0);
it = form.find(FORM_POSX);
poco_assert (it != form.end());
int posX = Poco::NumberParser::parse(it->second);
it = form.find(FORM_POSY);
poco_assert (it != form.end());
int posY = Poco::NumberParser::parse(it->second);
return MouseEventArgs(id, posX, posY, left, middle, right);
}
MouseMovementArgs JSEventHandler::createMouseMovementArgs(const Poco::Net::HTMLForm& form, Widget* id) const
{
Poco::Net::NameValueCollection::ConstIterator it = form.find(FORM_POSX);
poco_assert (it != form.end());
int posX = Poco::NumberParser::parse(it->second);
it = form.find(FORM_POSY);
poco_assert (it != form.end());
int posY = Poco::NumberParser::parse(it->second);
it = form.find(FORM_WINPOSX);
poco_assert (it != form.end());
int winPosX = Poco::NumberParser::parse(it->second);
it = form.find(FORM_WINPOSY);
poco_assert (it != form.end());
int winPosY = Poco::NumberParser::parse(it->second);
return MouseMovementArgs(id, posX, posY, winPosX, winPosY);
}
KeyEventArgs JSEventHandler::createKeyEventArgs(const Poco::Net::HTMLForm& form, Widget* id) const
{
Poco::Net::NameValueCollection::ConstIterator it = form.find(FORM_KEY);
poco_assert (it != form.end());
int keyCode = Poco::NumberParser::parse(it->second);
it = form.find(FORM_ALT);
poco_assert (it != form.end());
bool alt = (Poco::NumberParser::parse(it->second) != 0);
it = form.find(FORM_SHIFT);
poco_assert (it != form.end());
bool shift = (Poco::NumberParser::parse(it->second) != 0);
it = form.find(FORM_CTRL);
poco_assert (it != form.end());
bool ctrl = (Poco::NumberParser::parse(it->second) != 0);
return KeyEventArgs(id, keyCode, alt, shift, ctrl);
}
JSEventHandler::Handlers JSEventHandler::createHandlers()
{
Handlers h;
h.insert(std::make_pair(VAL_CLICK, &JSEventHandler::handleClick));
h.insert(std::make_pair(VAL_DBLCLICK, &JSEventHandler::handleDblClick));
h.insert(std::make_pair(VAL_MOUSEUP, &JSEventHandler::handleMouseUp));
h.insert(std::make_pair(VAL_MOUSEDOWN, &JSEventHandler::handleMouseDown));
h.insert(std::make_pair(VAL_MOUSEOUT, &JSEventHandler::handleMouseOut));
h.insert(std::make_pair(VAL_MOUSEOVER, &JSEventHandler::handleMouseOver));
h.insert(std::make_pair(VAL_MOUSEMOVE, &JSEventHandler::handleMouseMove));
h.insert(std::make_pair(VAL_FOCUSENTER, &JSEventHandler::handleFocusEnter));
h.insert(std::make_pair(VAL_FOCUSLOST, &JSEventHandler::handleFocusLost));
h.insert(std::make_pair(VAL_KEYUP, &JSEventHandler::handleKeyUp));
h.insert(std::make_pair(VAL_KEYDOWN, &JSEventHandler::handleKeyDown));
h.insert(std::make_pair(VAL_KEYPRESSED, &JSEventHandler::handleKeyPressed));
h.insert(std::make_pair(VAL_SELECT, &JSEventHandler::handleSelect));
h.insert(std::make_pair(VAL_CHANGE, &JSEventHandler::handleChange));
return h;
}
} } // namespace Poco::WebWidgets

View File

@ -1,59 +0,0 @@
//
// KeyEventArgs.cpp
//
// $Id: //poco/Main/WebWidgets/src/KeyEventArgs.cpp#2 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: KeyEventArgs
//
// 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/KeyEventArgs.h"
namespace Poco {
namespace WebWidgets {
KeyEventArgs::KeyEventArgs(Widget* pTarget, int keyCode, bool alt, bool shift, bool ctrl):
_pTarget(pTarget),
_keyCode(keyCode),
_alt(alt),
_shift(shift),
_ctrl(ctrl)
{
}
KeyEventArgs::~KeyEventArgs()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,88 +0,0 @@
//
// Label.cpp
//
// $Id: //poco/Main/WebWidgets/src/Label.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Label
//
// 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/Label.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string Label::FACTORY_ID("label");
Label::Label():
_text()
{
}
Label::Label(const std::string& txt):
_text(txt)
{
}
Label::Label(const Poco::XML::Element* pElem):
Widget(pElem),
_text(XMLUtil::getText(pElem))
{
}
Label::~Label()
{
}
void Label::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> Label::clone() const
{
Poco::AutoPtr<Widget> ptr = new Label(getText());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,128 +0,0 @@
//
// ListView.cpp
//
// $Id: //poco/Main/WebWidgets/src/ListView.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: ListView
//
// 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/ListView.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
#include "Poco/StringTokenizer.h"
namespace Poco {
namespace WebWidgets {
const std::string ListView::FACTORY_ID("listView");
const std::string ListView::XML_MULTIPLE("multiple");
const std::string ListView::XML_SIZE("size");
ListView::ListView(const std::string& uniqueName, int viewSize, bool multiple, const std::vector<Poco::AutoPtr<Label> >& children):
ComboBox(uniqueName, children),
_selected(),
_multiple(multiple),
_size(viewSize)
{
}
ListView::ListView(const std::string& uniqueName, int viewSize, bool multiple, const std::vector<Poco::AutoPtr<Widget> >& children):
ComboBox(uniqueName, children),
_selected(),
_multiple(multiple),
_size(viewSize)
{
}
ListView::ListView(const Poco::XML::Element* pElem):
ComboBox(pElem),
_selected(),
_multiple(XMLUtil::getBoolAttr(pElem, XML_MULTIPLE, false)),
_size(XMLUtil::getNumericAttr<int>(pElem, XML_SIZE))
{
const std::string& attr = pElem->getAttribute(XML_SELECT);
Poco::StringTokenizer tok(attr, ", ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
Poco::StringTokenizer::Iterator it = tok.begin();
Poco::StringTokenizer::Iterator itEnd = tok.end();
for (; it != itEnd; ++it)
{
int tmp = Poco::NumberParser::parse(*it);
select(tmp);
}
}
ListView::~ListView()
{
}
int ListView::getSelectedIndex() const
{
if (_selected.empty())
return -1;
return *_selected.begin();
}
void ListView::select(int idx)
{
if (idx >= 0)
_selected.insert(idx);
}
void ListView::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> ListView::clone() const
{
Poco::AutoPtr<ListView> ptr = new ListView(getName(), _size, _multiple, cloneChildren());
ptr->setAttributes(getAttributes());
const std::set<int>& sels = getSelectedIndizes();
std::set<int>::const_iterator it = sels.begin();
std::set<int>::const_iterator itEnd = sels.end();
for(; it != itEnd; ++it)
ptr->select(*it);
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,60 +0,0 @@
//
// MouseEventArgs.cpp
//
// $Id: //poco/Main/WebWidgets/src/MouseEventArgs.cpp#4 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: MouseEventArgs
//
// 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/MouseEventArgs.h"
namespace Poco {
namespace WebWidgets {
MouseEventArgs::MouseEventArgs(Widget* target, int posX, int posY, bool left, bool middle, bool right):
_pTarget(target),
_posX(posX),
_posY(posY),
_left(left),
_middle(middle),
_right(right)
{
}
MouseEventArgs::~MouseEventArgs()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,59 +0,0 @@
//
// MouseMovementArgs.cpp
//
// $Id: //poco/Main/WebWidgets/src/MouseMovementArgs.cpp#3 $
//
// Library: WebWidgets
// Package: WebEvents
// Module: MouseMovementArgs
//
// 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/MouseMovementArgs.h"
namespace Poco {
namespace WebWidgets {
MouseMovementArgs::MouseMovementArgs(Widget* pTarget, int posX, int posY, int windowsPosX, int windowsPosY):
_pTarget(pTarget),
_posX(posX),
_posY(posY),
_windowsPosX(windowsPosX),
_windowsPosY(windowsPosY)
{
}
MouseMovementArgs::~MouseMovementArgs()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,70 +0,0 @@
//
// NamedWidget.cpp
//
// $Id: //poco/Main/WebWidgets/src/NamedWidget.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: NamedWidget
//
// 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/NamedWidget.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string NamedWidget::XML_NAME("name");
NamedWidget::NamedWidget(const std::string& name):
_name(name)
{
if (_name.empty())
throw Poco::InvalidArgumentException("name attribute must not be empty");
}
NamedWidget::NamedWidget(const Poco::XML::Element* pElem):
Widget(pElem),
_name(pElem->getAttribute(XML_NAME))
{
if (_name.empty())
throw Poco::InvalidArgumentException("name attribute must not be empty");
}
NamedWidget::~NamedWidget()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,60 +0,0 @@
//
// Panel.cpp
//
// $Id: //poco/Main/WebWidgets/src/Panel.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Panel
//
// 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/Panel.h"
namespace Poco {
namespace WebWidgets {
Panel::Panel()
{
}
Panel::Panel(const Poco::XML::Element* pElem):
Widget(pElem)
{
}
Panel::~Panel()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,127 +0,0 @@
//
// Parser.cpp
//
// $Id: //poco/Main/WebWidgets/src/Parser.cpp#3 $
//
// Library: WebWidgets
// Package: WebParser
// Module: Parser
//
// 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/Parser.h"
#include "Poco/WebWidgets/Label.h"
#include "Poco/WebWidgets/HTML.h"
#include "Poco/WebWidgets/Image.h"
#include "Poco/WebWidgets/FlowPanel.h"
#include "Poco/WebWidgets/SimplePanel.h"
#include "Poco/WebWidgets/RootPanel.h"
#include "Poco/WebWidgets/Table.h"
#include "Poco/WebWidgets/HyperLink.h"
#include "Poco/WebWidgets/Button.h"
#include "Poco/WebWidgets/ImageButton.h"
#include "Poco/WebWidgets/TextArea.h"
#include "Poco/WebWidgets/TextField.h"
#include "Poco/WebWidgets/CheckBox.h"
#include "Poco/WebWidgets/ImageButton.h"
#include "Poco/WebWidgets/RadioButton.h"
#include "Poco/WebWidgets/Form.h"
#include "Poco/WebWidgets/StackPanel.h"
#include "Poco/WebWidgets/ComboBox.h"
#include "Poco/WebWidgets/ListView.h"
#include "Poco/WebWidgets/HidablePanel.h"
#include "Poco/WebWidgets/PwdField.h"
#include "Poco/Exception.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
Parser::Parser()
{
registerFactory(RootPanel::FACTORY_ID, new ParserFactoryImpl<RootPanel>());
registerFactory(Label::FACTORY_ID, new ParserFactoryImpl<Label>());
registerFactory(HTML::FACTORY_ID, new ParserFactoryImpl<HTML>());
registerFactory(Image::FACTORY_ID, new ParserFactoryImpl<Image>());
registerFactory(FlowPanel::FACTORY_ID, new ParserFactoryImpl<FlowPanel>());
registerFactory(Table::FACTORY_ID, new ParserFactoryImpl<Table>());
registerFactory(HyperLink::FACTORY_ID, new ParserFactoryImpl<HyperLink>());
registerFactory(Button::FACTORY_ID, new ParserFactoryImpl<Button>());
registerFactory(ImageButton::FACTORY_ID, new ParserFactoryImpl<ImageButton>());
registerFactory(TextArea::FACTORY_ID, new ParserFactoryImpl<TextArea>());
registerFactory(TextField::FACTORY_ID, new ParserFactoryImpl<TextField>());
registerFactory(CheckBox::FACTORY_ID, new ParserFactoryImpl<CheckBox>());
registerFactory(RadioButton::FACTORY_ID, new ParserFactoryImpl<RadioButton>());
registerFactory(Form::FACTORY_ID, new ParserFactoryImpl<Form>());
registerFactory(StackPanel::FACTORY_ID, new ParserFactoryImpl<StackPanel>());
registerFactory(ComboBox::FACTORY_ID, new ParserFactoryImpl<ComboBox>());
registerFactory(ListView::FACTORY_ID, new ParserFactoryImpl<ListView>());
registerFactory(HidablePanel::FACTORY_ID, new ParserFactoryImpl<HidablePanel>());
registerFactory(PwdField::FACTORY_ID, new ParserFactoryImpl<PwdField>());
}
Parser::~Parser()
{
}
Parser& Parser::instance()
{
static Poco::SingletonHolder<Parser> sh;
return *(sh.get());
}
void Parser::registerFactory(const std::string& id, ParserFactoryPtr pFac)
{
bool ok = _factories.insert(std::make_pair(id, pFac)).second;
if (!ok)
throw Poco::ExistsException("Parser::registerFactory" + id);
}
void Parser::unregisterFactory(const std::string& id)
{
_factories.erase(id);
}
Poco::AutoPtr<Widget> Parser::load(const Poco::XML::Element* pElem) const
{
poco_check_ptr (pElem);
Factories::const_iterator it = _factories.find(pElem->tagName());
if (it == _factories.end())
throw Poco::DataFormatException("Illegal XML tag (no factory known): " + pElem->tagName());
return it->second->load(pElem);
}
} } // namespace Poco::WebWidgets

View File

@ -1,54 +0,0 @@
//
// ParserFactory.cpp
//
// $Id: //poco/Main/WebWidgets/src/ParserFactory.cpp#2 $
//
// Library: WebWidgets
// Package: WebParser
// Module: ParserFactory
//
// 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/ParserFactory.h"
namespace Poco {
namespace WebWidgets {
ParserFactory::ParserFactory()
{
}
ParserFactory::~ParserFactory()
{
}
} } // namespace Poco::WebWidgets

View File

@ -1,81 +0,0 @@
//
// PwdField.cpp
//
// $Id: //poco/Main/WebWidgets/src/PwdField.cpp#1 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: PwdField
//
// 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/PwdField.h"
#include "Poco/WebWidgets/Visitor.h"
namespace Poco {
namespace WebWidgets {
const std::string PwdField::FACTORY_ID("pwdField");
PwdField::PwdField(const std::string& uniqueName, Poco::UInt32 size, Poco::UInt32 maxLength):
TextField(uniqueName, size, maxLength)
{
}
PwdField::PwdField(const Poco::XML::Element* pElem):
TextField(pElem)
{
}
PwdField::~PwdField()
{
}
void PwdField::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> PwdField::clone() const
{
Poco::AutoPtr<PwdField> ptr = new PwdField(name(), getSize(), getMaxLength());
ptr->setText(getText());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,79 +0,0 @@
//
// RadioButton.cpp
//
// $Id: //poco/Main/WebWidgets/src/RadioButton.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: RadioButton
//
// 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/RadioButton.h"
#include "Poco/WebWidgets/Visitor.h"
namespace Poco {
namespace WebWidgets {
const std::string RadioButton::FACTORY_ID("radioButton");
RadioButton::RadioButton(const std::string& group, const std::string& label, bool checked):
CheckBox(group, label, checked)
{
}
RadioButton::RadioButton(const Poco::XML::Element* pElem):
CheckBox(pElem)
{
}
RadioButton::~RadioButton()
{
}
void RadioButton::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> RadioButton::clone() const
{
Poco::AutoPtr<Widget> ptr = new RadioButton(name(), getText(), getChecked());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,129 +0,0 @@
//
// RootPanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/RootPanel.cpp#3 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: RootPanel
//
// 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/RootPanel.h"
#include "Poco/WebWidgets/Parser.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string RootPanel::FACTORY_ID("rootPanel");
const std::string RootPanel::XML_NAME("name");
const std::string RootPanel::XML_HEADER("header");
const std::string RootPanel::XML_CHILDREN("children");
RootPanel::RootPanel(const std::string& title, const std::vector<Poco::AutoPtr<Widget> >& children):
IndexedPanel(children),
_name(title),
_ptrHeader()
{
}
RootPanel::RootPanel(const Poco::XML::Element* pElem):
IndexedPanel(),
_name(pElem->getAttribute(XML_NAME)),
_ptrHeader()
{
const Poco::XML::Element* pEv = XMLUtil::getEvents(pElem);
if (pEv)
{
Widget* pThis = this;
XMLUtil::initEvents(*pThis, pEv);
}
std::vector<const Poco::XML::Element*> header = XMLUtil::getNamedElementChildren(pElem, XML_HEADER);
if (header.size() > 1)
throw Poco::DataException("More than one header detected");
else if (header.size() == 1)
{
header = XMLUtil::getNamedElementChildren(header[0], HTML::FACTORY_ID);
if (header.size() > 1)
throw Poco::DataException("More than one HTML entry in header detected");
else if (header.size() == 1)
{
_ptrHeader = Parser::instance().load<HTML>(header[0]);
_ptrHeader->setParent(this);
}
}
std::vector<const Poco::XML::Element*> child = XMLUtil::getNamedElementChildren(pElem, XML_CHILDREN);
if (child.size() > 1)
throw Poco::DataException("More than one children entry detected");
else if (child.size() == 1)
{
children() = XMLUtil::getAllWidgets(child[0], this);
}
}
RootPanel::~RootPanel()
{
}
void RootPanel::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> RootPanel::find(const std::string& id) const
{
Poco::AutoPtr<Widget> res = IndexedPanel::find(id);
if (res.isNull() && _ptrHeader)
return _ptrHeader->find(id);
return res;
}
Poco::AutoPtr<Widget> RootPanel::clone() const
{
Poco::AutoPtr<RootPanel> ptr = new RootPanel(_name, cloneChildren());
ptr->setAttributes(getAttributes());
if (_ptrHeader)
ptr->setHeader(_ptrHeader->clone().cast<HTML>());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,85 +0,0 @@
//
// SimplePanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/SimplePanel.cpp#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: SimplePanel
//
// 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/SimplePanel.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
namespace Poco {
namespace WebWidgets {
SimplePanel::SimplePanel(Poco::AutoPtr<Widget> ptr):
_ptrWidget(ptr)
{
_ptrWidget->setParent(this);
}
SimplePanel::SimplePanel(const Poco::XML::Element* pElem):
Panel(pElem),
_ptrWidget()
{
poco_assert_dbg (pElem != 0);
std::vector<Poco::AutoPtr<Widget> > res = XMLUtil::getAllWidgets(pElem, this);
if (res.size() != 1)
{
throw Poco::SyntaxException("A SimplePanel can only have one child!");
}
_ptrWidget = res[0];
_ptrWidget->setParent(this);
}
SimplePanel::~SimplePanel()
{
}
void SimplePanel::preAccept(Visitor& v)
{
v.preVisit(*this);
}
Poco::AutoPtr<Widget> SimplePanel::find(const std::string& id) const
{
return Widget::find(getWidget(), id);
}
} } // namespace Poco::WebWidgets

View File

@ -1,79 +0,0 @@
//
// StackPanel.cpp
//
// $Id: //poco/Main/WebWidgets/src/StackPanel.cpp#2 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: StackPanel
//
// 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/StackPanel.h"
#include "Poco/WebWidgets/Visitor.h"
namespace Poco {
namespace WebWidgets {
const std::string StackPanel::FACTORY_ID("stack");
StackPanel::StackPanel(const std::vector<Poco::AutoPtr<Widget> >& children):
IndexedPanel(children)
{
}
StackPanel::StackPanel(const Poco::XML::Element* pElem):
IndexedPanel(pElem)
{
}
StackPanel::~StackPanel()
{
}
void StackPanel::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> StackPanel::clone() const
{
Poco::AutoPtr<Widget> ptr = new StackPanel(cloneChildren());
ptr->setAttributes(getAttributes());
return ptr;
}
} } // namespace Poco::WebWidgets

View File

@ -1,285 +0,0 @@
//
// Table.cpp
//
// $Id: //poco/Main/WebWidgets/src/Table.cpp#4 $
//
// Library: WebWidgets
// Package: WebGUI
// Module: Table
//
// 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/Table.h"
#include "Poco/WebWidgets/Visitor.h"
#include "Poco/WebWidgets/XMLUtil.h"
#include "Poco/Exception.h"
#include "Poco/NumberFormatter.h"
#include "Poco/NumberParser.h"
#include "Poco/String.h"
#include "Poco/DOM/Element.h"
namespace Poco {
namespace WebWidgets {
const std::string Table::FACTORY_ID("table");
const std::string Table::XML_WIDTH("width");
const std::string Table::XML_BORDER("border");
const std::string Table::XML_HEADER("header");
const std::string Table::XML_BODY("body");
const std::string Table::XML_FOOTER("footer");
const std::string Table::VAL_COLS("cols");
const std::string Table::VAL_ROWS("rows");
const std::string Table::VAL_COL("col");
const std::string Table::VAL_ROW("row");
const std::string Table::VAL_CELL("cell");
const std::string Table::VAL_TABLEFOOTER("footer");
Table::Table(Poco::UInt32 numRows, Poco::UInt32 numCols, bool tableHasFooter, bool tableHasHeader, Poco::UInt32 borderStrength, Poco::UInt32 width):
_cols(numCols),
_border(borderStrength),
_width(width),
_tableHasFooter(tableHasFooter),
_tableHasHeader(tableHasHeader),
_table(numRows, Row(numCols, Poco::AutoPtr<Widget>())),
_headerAttr(),
_bodyAttr(),
_footerAttr()
{
addAttribute(XML_BORDER, Poco::NumberFormatter::format(_border));
if (_width > 0)
addAttribute(XML_WIDTH, Poco::NumberFormatter::format(_width));
poco_assert (_cols > 0);
}
Table::Table(const Poco::XML::Element* pElem):
Panel(pElem),
_cols(XMLUtil::getNumericAttrUnsigned<Poco::UInt32>(pElem, VAL_COLS)),
_border(XMLUtil::getNumericAttrUnsigned<Poco::UInt32>(pElem, XML_BORDER, 0)),
_width(XMLUtil::getNumericAttrUnsigned<Poco::UInt32>(pElem, XML_WIDTH, 0)),
_tableHasFooter(XMLUtil::getBoolAttr(pElem, VAL_TABLEFOOTER, false)),
_tableHasHeader(XMLUtil::getBoolAttr(pElem, XML_HEADER, true)),
_table(),
_headerAttr(),
_bodyAttr(),
_footerAttr()
{
Poco::UInt32 rows = 0;
bool rowsDefined = false;
std::string tmp = pElem->getAttribute(VAL_ROWS);
if (!tmp.empty())
{
rows = Poco::NumberParser::parseUnsigned(tmp);
_table.resize(rows, Row(_cols, Poco::AutoPtr<Widget>()));
rowsDefined = true;
}
addAttribute(XML_BORDER, Poco::NumberFormatter::format(_border));
// now parse the children of a table
std::vector<const Poco::XML::Element*> cells = XMLUtil::getNamedElementChildren(pElem, VAL_CELL);
std::vector<const Poco::XML::Element*>::const_iterator it = cells.begin();
std::vector<const Poco::XML::Element*>::const_iterator itEnd = cells.end();
Poco::UInt32 row(0);
Poco::UInt32 col(0);
for (; it != itEnd; ++it)
{
Poco::UInt32 rowAttr(row);
tmp = (*it)->getAttribute(VAL_ROW);
if (!tmp.empty())
{
rowAttr = Poco::NumberParser::parseUnsigned(tmp);
if (rowAttr != row)
col = 0;
row = rowAttr;
tmp = (*it)->getAttribute(VAL_COL);
if (!tmp.empty())
{
col = Poco::NumberParser::parseUnsigned(tmp);
}
}
else
{
// no row defined, check overflow
tmp = (*it)->getAttribute(VAL_COL);
if (!tmp.empty())
{
col = Poco::NumberParser::parseUnsigned(tmp);
}
else
{
// no column defined
if (col == numberOfColumns())
{
col = 0;
++row;
}
}
}
// createWidget
if (!rowsDefined)
{
// auto increment
if (numberOfRows() <= row)
_table.resize(row+1, Row(_cols, Poco::AutoPtr<Widget>()));
}
std::vector<const Poco::XML::Element*> cellChild = XMLUtil::getAllElementChildren(*it);
if (cellChild.size() > 1)
throw Poco::SyntaxException("A cell can only have one single child!");
else if (cellChild.size() == 1)
{
Poco::AutoPtr<Widget> ptrWidget = XMLUtil::createWidget(cellChild[0], this);
addWidget(row, col, ptrWidget);
}
// no content is valid
++col;
}
// extract header element
std::vector<const Poco::XML::Element*> hdr = XMLUtil::getNamedElementChildren(pElem, XML_HEADER);
if (hdr.size() > 1)
throw Poco::SyntaxException("A Table can only have one single header!");
if (hdr.size() == 1)
Widget::parseUniversalAttributes(hdr[0], _headerAttr);
// extract body element
hdr = XMLUtil::getNamedElementChildren(pElem, XML_BODY);
if (hdr.size() > 1)
throw Poco::SyntaxException("A Table can only have one single body!");
if (hdr.size() == 1)
Widget::parseUniversalAttributes(hdr[0], _bodyAttr);
hdr = XMLUtil::getNamedElementChildren(pElem, XML_FOOTER);
if (hdr.size() > 1)
throw Poco::SyntaxException("A Table can only have one single footer!");
if (hdr.size() == 1)
Widget::parseUniversalAttributes(hdr[0], _footerAttr);
}
Table::~Table()
{
}
void Table::addWidget(Poco::UInt32 row, Poco::UInt32 col, Poco::AutoPtr<Widget> ptrWidget)
{
if (row >= _table.size() || col >= _cols)
throw InvalidAccessException("Setting Widget outside of table boundaries");
_table[row][col] = ptrWidget;
}
Poco::AutoPtr<Widget> Table::removeWidget(Poco::UInt32 row, Poco::UInt32 col)
{
Poco::AutoPtr<Widget> res;
if (row < _table.size() && col < _cols)
res = _table[row][col];
return res;
}
Poco::AutoPtr<Widget> Table::getWidget(Poco::UInt32 row, Poco::UInt32 col) const
{
if (row >= _table.size() || col >= _cols)
throw InvalidAccessException("Setting Widget outside of table boundaries");
return _table[row][col];
}
void Table::appendRow(const Row& aRow)
{
if (aRow.size() != _cols)
throw InvalidArgumentException("Column count differs");
_table.push_back(aRow);
}
void Table::accept(Visitor& v)
{
v.visit(*this);
}
Poco::AutoPtr<Widget> Table::find(const std::string& id) const
{
Content::const_iterator it = _table.begin();
Content::const_iterator itEnd = _table.end();
Poco::AutoPtr<Widget> res;
for (; it != itEnd; ++it)
{
Row::const_iterator itRow = it->begin();
Row::const_iterator itRowEnd = it->end();
for (; itRow != itRowEnd && res.isNull(); ++itRow)
{
res = Widget::find(*itRow, id);
}
}
return res;
}
Poco::AutoPtr<Widget> Table::clone() const
{
Poco::AutoPtr<Table> ptr = new Table(0xffffffffu, static_cast<Poco::UInt32>(_cols), _tableHasFooter, _tableHasHeader, _border, _width);
ptr->setAttributes(getAttributes());
ptr->_bodyAttr = _bodyAttr;
ptr->_footerAttr = _footerAttr;
ptr->_headerAttr = _headerAttr;
Content& table = ptr->_table;
Content::const_iterator it = _table.begin();
Content::const_iterator itEnd = _table.end();
for (; it != itEnd; ++it)
{
table.push_back(Row());
Content::iterator itInRow = (--table.end());
Row::const_iterator itRow = it->begin();
Row::const_iterator itRowEnd = it->end();
for (; itRow != itRowEnd; ++itRow)
{
if ((*itRow))
{
Poco::AutoPtr<Widget> ptrChild = (*itRow)->clone();
ptrChild->setParent(ptr);
itInRow->push_back(ptrChild);
}
else
itInRow->push_back(Poco::AutoPtr<Widget>());
}
}
return ptr;
}
} } // namespace Poco::WebWidgets

Some files were not shown because too many files have changed in this diff Show More