mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-20 03:11:23 +08:00
Demo: CalculatorAndStateMachine
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7A1792BE-F866-44EE-83BF-E686BDA54B37}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>CalculatorAndStateMachine</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir)..\..\..\Import;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="UI\Source\DemoPartialClasses.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Lib\GacUILite\GacUILite.vcxproj">
|
||||
<Project>{96c559ca-9718-4bec-a053-28a0ab6a8ca2}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="UI\Resource.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UI\Source\Demo.h" />
|
||||
<ClInclude Include="UI\Source\DemoPartialClasses.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="UI">
|
||||
<UniqueIdentifier>{0c926036-4529-444a-aeb1-63261a271d51}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UI\Source\DemoPartialClasses.cpp">
|
||||
<Filter>UI</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="UI\Resource.xml">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Xml>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="UI\Source\DemoPartialClasses.h">
|
||||
<Filter>UI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UI\Source\Demo.h">
|
||||
<Filter>UI</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,17 @@
|
||||
#define GAC_HEADER_USE_NAMESPACE
|
||||
#include "UI/Source/Demo.h"
|
||||
|
||||
using namespace vl::collections;
|
||||
using namespace vl::stream;
|
||||
|
||||
void GuiMain()
|
||||
{
|
||||
{
|
||||
FileStream fileStream(L"../UIRes/CalculatorAndStateMachine.bin", FileStream::ReadOnly);
|
||||
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
|
||||
GetResourceManager()->SetResource(L"Resource", resource);
|
||||
}
|
||||
demo::MainWindow window(new demo::Calculator);
|
||||
window.MoveToScreenCenter();
|
||||
GetApplication()->Run(&window);
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Resource>
|
||||
<Folder name="GacGenConfig">
|
||||
<Folder name="Cpp">
|
||||
<Text name="SourceFolder">Source</Text>
|
||||
<Text name="Resource">..\..\UIRes\CalculatorAndStateMachine.bin</Text>
|
||||
<Text name="NormalInclude">GacUI.h</Text>
|
||||
<Text name="ReflectionInclude">GacUIReflection.h</Text>
|
||||
<Text name="Name">Demo</Text>
|
||||
</Folder>
|
||||
</Folder>
|
||||
|
||||
<Script name="ViewModelResource">
|
||||
<Workflow>
|
||||
<![CDATA[
|
||||
module viewmodel;
|
||||
|
||||
using system::*;
|
||||
using presentation::*;
|
||||
|
||||
namespace demo
|
||||
{
|
||||
class Calculator : StateMachine
|
||||
{
|
||||
var valueFirst : string = "";
|
||||
var op : string = "";
|
||||
prop Value : string = "0" {}
|
||||
|
||||
func Update(value : string) : void
|
||||
{
|
||||
SetValue(value);
|
||||
valueFirst = value;
|
||||
}
|
||||
|
||||
func Calculate() : void
|
||||
{
|
||||
if (valueFirst == "")
|
||||
{
|
||||
valueFirst = Value;
|
||||
}
|
||||
else if (op == "+")
|
||||
{
|
||||
Update((cast double valueFirst) + (cast double Value));
|
||||
}
|
||||
else if (op == "*")
|
||||
{
|
||||
Update((cast double valueFirst) * (cast double Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
raise $"Unrecognized operator: $(op)";
|
||||
}
|
||||
}
|
||||
|
||||
$state_machine
|
||||
{
|
||||
$state_input Digit(i : int);
|
||||
$state_input Dot();
|
||||
$state_input Add();
|
||||
$state_input Mul();
|
||||
$state_input Equal();
|
||||
$state_input Clear();
|
||||
|
||||
$state Digits()
|
||||
{
|
||||
$switch (continue)
|
||||
{
|
||||
case Digit(i):
|
||||
{
|
||||
Value = Value & i;
|
||||
$goto_state Digits();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$state Integer(newNumber: bool)
|
||||
{
|
||||
$switch (continue)
|
||||
{
|
||||
case Digit(i):
|
||||
{
|
||||
if (newNumber)
|
||||
{
|
||||
Value = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
Value = Value & i;
|
||||
}
|
||||
$goto_state Digits();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$state Number()
|
||||
{
|
||||
$push_state Integer(true);
|
||||
$switch (continue, return)
|
||||
{
|
||||
case Dot():
|
||||
{
|
||||
Value = Value & ".";
|
||||
}
|
||||
}
|
||||
$push_state Integer(false);
|
||||
}
|
||||
|
||||
$state Operator()
|
||||
{
|
||||
$push_state Number();
|
||||
$switch (raise)
|
||||
{
|
||||
case Add(): {Calculate(); op = "+";}
|
||||
case Mul(): {Calculate(); op = "*";}
|
||||
case Equal(): {Calculate(); op = "=";}
|
||||
case Clear():
|
||||
{
|
||||
valueFirst = "";
|
||||
op = "";
|
||||
Value = "0";
|
||||
}
|
||||
}
|
||||
$goto_state Operator();
|
||||
}
|
||||
|
||||
$state default()
|
||||
{
|
||||
$goto_state Operator();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</Workflow>
|
||||
</Script>
|
||||
|
||||
<Folder name="MainWindow">
|
||||
<Instance name="MainWindowResource">
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
|
||||
<ref.Parameter Name="CalculatorAndStateMachine" Class="demo::Calculator"/>
|
||||
<Window Text="ColorPicker" ClientSize="x:480 y:320">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
|
||||
</Window>
|
||||
</Instance>
|
||||
</Instance>
|
||||
</Folder>
|
||||
</Resource>
|
||||
@@ -0,0 +1,15 @@
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
|
||||
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMO
|
||||
|
||||
#include "DemoPartialClasses.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#include "Demo.h"
|
||||
/* CodePack:BeginIgnore() */
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
/* CodePack:ConditionOff(VCZH_DEBUG_NO_REFLECTION, DemoReflection.h) */
|
||||
#include "DemoReflection.h"
|
||||
#endif
|
||||
/* CodePack:EndIgnore() */
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4250)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wparentheses-equality"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
#endif
|
||||
|
||||
#define GLOBAL_SYMBOL ::vl_workflow_global::Demo::
|
||||
#define GLOBAL_NAME ::vl_workflow_global::Demo::Instance().
|
||||
#define GLOBAL_OBJ &::vl_workflow_global::Demo::Instance()
|
||||
#define USERIMPL(...)
|
||||
|
||||
/***********************************************************************
|
||||
Global Variables
|
||||
***********************************************************************/
|
||||
|
||||
BEGIN_GLOBAL_STORAGE_CLASS(vl_workflow_global_Demo)
|
||||
vl_workflow_global::Demo instance;
|
||||
INITIALIZE_GLOBAL_STORAGE_CLASS
|
||||
FINALIZE_GLOBAL_STORAGE_CLASS
|
||||
END_GLOBAL_STORAGE_CLASS(vl_workflow_global_Demo)
|
||||
|
||||
namespace vl_workflow_global
|
||||
{
|
||||
/***********************************************************************
|
||||
Global Functions
|
||||
***********************************************************************/
|
||||
|
||||
Demo& Demo::Instance()
|
||||
{
|
||||
return Getvl_workflow_global_Demo().instance;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Class (::demo::MainWindowConstructor)
|
||||
***********************************************************************/
|
||||
|
||||
namespace demo
|
||||
{
|
||||
void MainWindowConstructor::__vwsn_initialize_instance_(::demo::MainWindow* __vwsn_this_)
|
||||
{
|
||||
(this->__vwsn_precompile_0 = __vwsn_this_);
|
||||
(this->CalculatorAndStateMachine = ::vl::__vwsn::This(__vwsn_this_)->GetCalculatorAndStateMachine());
|
||||
(this->__vwsn_precompile_1 = ::vl::__vwsn::This(this->__vwsn_precompile_0)->GetBoundsComposition());
|
||||
{
|
||||
::vl::__vwsn::This(this->__vwsn_precompile_1)->SetPreferredMinSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = static_cast<::vl::vint>(480); __vwsn_temp__.y = static_cast<::vl::vint>(320); return __vwsn_temp__; }());
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(this->__vwsn_precompile_0)->SetClientSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = static_cast<::vl::vint>(480); __vwsn_temp__.y = static_cast<::vl::vint>(320); return __vwsn_temp__; }());
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(this->__vwsn_precompile_0)->SetText(::vl::WString(L"ColorPicker", false));
|
||||
}
|
||||
}
|
||||
|
||||
MainWindowConstructor::MainWindowConstructor()
|
||||
{
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Class (::demo::MainWindow)
|
||||
***********************************************************************/
|
||||
|
||||
::vl::Ptr<::demo::Calculator> MainWindow::GetCalculatorAndStateMachine()
|
||||
{
|
||||
return this->__vwsn_parameter_CalculatorAndStateMachine;
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(::vl::Ptr<::demo::Calculator> __vwsn_ctor_parameter_CalculatorAndStateMachine)
|
||||
: ::vl::presentation::controls::GuiWindow(::vl::presentation::theme::ThemeName::Window)
|
||||
{
|
||||
(this->__vwsn_parameter_CalculatorAndStateMachine = __vwsn_ctor_parameter_CalculatorAndStateMachine);
|
||||
auto __vwsn_resource_ = ::vl::__vwsn::This(::vl::presentation::GetResourceManager())->GetResourceFromClassName(::vl::WString(L"demo::MainWindow", false));
|
||||
auto __vwsn_resolver_ = ::vl::Ptr<::vl::presentation::GuiResourcePathResolver>(new ::vl::presentation::GuiResourcePathResolver(__vwsn_resource_, ::vl::__vwsn::This(__vwsn_resource_.Obj())->GetWorkingDirectory()));
|
||||
::vl::__vwsn::This(this)->SetResourceResolver(__vwsn_resolver_);
|
||||
::vl::__vwsn::This(this)->__vwsn_initialize_instance_(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
this->FinalizeInstanceRecursively(static_cast<::vl::presentation::controls::GuiControlHost*>(this));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Class (::demo::Calculator)
|
||||
***********************************************************************/
|
||||
|
||||
::vl::WString Calculator::GetValue()
|
||||
{
|
||||
return this->__vwsn_prop_Value;
|
||||
}
|
||||
void Calculator::SetValue(const ::vl::WString& __vwsn_value_)
|
||||
{
|
||||
if ((this->__vwsn_prop_Value != __vwsn_value_))
|
||||
{
|
||||
(this->__vwsn_prop_Value = __vwsn_value_);
|
||||
::vl::__vwsn::EventInvoke(this->ValueChanged)();
|
||||
}
|
||||
}
|
||||
|
||||
void Calculator::Update(const ::vl::WString& value)
|
||||
{
|
||||
this->SetValue(value);
|
||||
(this->valueFirst = value);
|
||||
}
|
||||
|
||||
void Calculator::Calculate()
|
||||
{
|
||||
if ((this->valueFirst == ::vl::WString(L"", false)))
|
||||
{
|
||||
(this->valueFirst = this->GetValue());
|
||||
}
|
||||
else if ((this->op == ::vl::WString(L"+", false)))
|
||||
{
|
||||
this->Update(::vl::__vwsn::ToString((::vl::__vwsn::Parse<double>(this->valueFirst) + ::vl::__vwsn::Parse<double>(this->GetValue()))));
|
||||
}
|
||||
else if ((this->op == ::vl::WString(L"*", false)))
|
||||
{
|
||||
this->Update(::vl::__vwsn::ToString((::vl::__vwsn::Parse<double>(this->valueFirst) * ::vl::__vwsn::Parse<double>(this->GetValue()))));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ::vl::Exception((::vl::WString(L"Unrecognized operator: ", false) + this->op));
|
||||
}
|
||||
}
|
||||
|
||||
Calculator::Calculator()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
#undef GLOBAL_SYMBOL
|
||||
#undef GLOBAL_NAME
|
||||
#undef GLOBAL_OBJ
|
||||
#undef USERIMPL
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
@@ -0,0 +1,99 @@
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMOPARTIALCLASSES
|
||||
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMOPARTIALCLASSES
|
||||
|
||||
#include "GacUI.h"
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4250)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wparentheses-equality"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
#endif
|
||||
|
||||
namespace demo
|
||||
{
|
||||
class MainWindowConstructor;
|
||||
class MainWindow;
|
||||
class Calculator;
|
||||
|
||||
class MainWindowConstructor : public ::vl::Object, public ::vl::reflection::Description<MainWindowConstructor>
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<MainWindowConstructor>;
|
||||
#endif
|
||||
protected:
|
||||
::vl::Ptr<::demo::Calculator> CalculatorAndStateMachine = ::vl::Ptr<::demo::Calculator>();
|
||||
::demo::MainWindow* __vwsn_precompile_0 = static_cast<::demo::MainWindow*>(nullptr);
|
||||
::vl::presentation::compositions::GuiBoundsComposition* __vwsn_precompile_1 = static_cast<::vl::presentation::compositions::GuiBoundsComposition*>(nullptr);
|
||||
void __vwsn_initialize_instance_(::demo::MainWindow* __vwsn_this_);
|
||||
public:
|
||||
MainWindowConstructor();
|
||||
};
|
||||
|
||||
class MainWindow : public ::vl::presentation::controls::GuiWindow, public ::demo::MainWindowConstructor, public ::vl::reflection::Description<MainWindow>
|
||||
{
|
||||
friend class ::demo::MainWindowConstructor;
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<MainWindow>;
|
||||
#endif
|
||||
public:
|
||||
::vl::Ptr<::demo::Calculator> __vwsn_parameter_CalculatorAndStateMachine = ::vl::Ptr<::demo::Calculator>();
|
||||
::vl::Ptr<::demo::Calculator> GetCalculatorAndStateMachine();
|
||||
MainWindow(::vl::Ptr<::demo::Calculator> __vwsn_ctor_parameter_CalculatorAndStateMachine);
|
||||
~MainWindow();
|
||||
};
|
||||
|
||||
class Calculator : public ::vl::reflection::description::StateMachine, public ::vl::reflection::Description<Calculator>
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<Calculator>;
|
||||
#endif
|
||||
public:
|
||||
::vl::WString valueFirst = ::vl::WString(L"", false);
|
||||
::vl::WString op = ::vl::WString(L"", false);
|
||||
::vl::WString __vwsn_prop_Value = ::vl::WString(L"0", false);
|
||||
::vl::WString GetValue();
|
||||
void SetValue(const ::vl::WString& __vwsn_value_);
|
||||
::vl::Event<void()> ValueChanged;
|
||||
void Update(const ::vl::WString& value);
|
||||
void Calculate();
|
||||
Calculator();
|
||||
};
|
||||
|
||||
}
|
||||
/***********************************************************************
|
||||
Global Variables and Functions
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl_workflow_global
|
||||
{
|
||||
class Demo
|
||||
{
|
||||
public:
|
||||
|
||||
static Demo& Instance();
|
||||
};
|
||||
}
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#include "DemoReflection.h"
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4250)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wparentheses-equality"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
Reflection
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace reflection
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
IMPL_CPP_TYPE_INFO(demo::Calculator)
|
||||
IMPL_CPP_TYPE_INFO(demo::MainWindow)
|
||||
IMPL_CPP_TYPE_INFO(demo::MainWindowConstructor)
|
||||
|
||||
#define _ ,
|
||||
BEGIN_CLASS_MEMBER(::demo::Calculator)
|
||||
CLASS_MEMBER_CONSTRUCTOR(::vl::Ptr<::demo::Calculator>(), NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(Calculate, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(GetValue, NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(SetValue, { L"__vwsn_value_" })
|
||||
CLASS_MEMBER_METHOD(Update, { L"value" })
|
||||
CLASS_MEMBER_EVENT(ValueChanged)
|
||||
CLASS_MEMBER_FIELD(__vwsn_prop_Value)
|
||||
CLASS_MEMBER_PROPERTY_EVENT(Value, GetValue, SetValue, ValueChanged)
|
||||
CLASS_MEMBER_FIELD(op)
|
||||
CLASS_MEMBER_FIELD(valueFirst)
|
||||
END_CLASS_MEMBER(::demo::Calculator)
|
||||
|
||||
BEGIN_CLASS_MEMBER(::demo::MainWindow)
|
||||
CLASS_MEMBER_CONSTRUCTOR(::demo::MainWindow*(::vl::Ptr<::demo::Calculator>), { L"__vwsn_ctor_parameter_CalculatorAndStateMachine" })
|
||||
CLASS_MEMBER_METHOD(GetCalculatorAndStateMachine, NO_PARAMETER)
|
||||
CLASS_MEMBER_FIELD(__vwsn_parameter_CalculatorAndStateMachine)
|
||||
CLASS_MEMBER_PROPERTY_READONLY(CalculatorAndStateMachine, GetCalculatorAndStateMachine)
|
||||
END_CLASS_MEMBER(::demo::MainWindow)
|
||||
|
||||
BEGIN_CLASS_MEMBER(::demo::MainWindowConstructor)
|
||||
CLASS_MEMBER_CONSTRUCTOR(::vl::Ptr<::demo::MainWindowConstructor>(), NO_PARAMETER)
|
||||
CLASS_MEMBER_METHOD(__vwsn_initialize_instance_, { L"__vwsn_this_" })
|
||||
CLASS_MEMBER_FIELD(__vwsn_precompile_0)
|
||||
CLASS_MEMBER_FIELD(__vwsn_precompile_1)
|
||||
CLASS_MEMBER_FIELD(CalculatorAndStateMachine)
|
||||
END_CLASS_MEMBER(::demo::MainWindowConstructor)
|
||||
|
||||
#undef _
|
||||
class DemoTypeLoader : public Object, public ITypeLoader
|
||||
{
|
||||
public:
|
||||
void Load(ITypeManager* manager)
|
||||
{
|
||||
ADD_TYPE_INFO(::demo::Calculator)
|
||||
ADD_TYPE_INFO(::demo::MainWindow)
|
||||
ADD_TYPE_INFO(::demo::MainWindowConstructor)
|
||||
}
|
||||
|
||||
void Unload(ITypeManager* manager)
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
bool LoadDemoTypes()
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (auto manager = GetGlobalTypeManager())
|
||||
{
|
||||
return manager->AddTypeLoader(MakePtr<DemoTypeLoader>());
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMOREFLECTION
|
||||
#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMOREFLECTION
|
||||
|
||||
#include "Demo.h"
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
#include "GacUIReflection.h"
|
||||
#endif
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4250)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wparentheses-equality"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
Reflection
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace reflection
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
DECL_TYPE_INFO(::demo::Calculator)
|
||||
DECL_TYPE_INFO(::demo::MainWindow)
|
||||
DECL_TYPE_INFO(::demo::MainWindowConstructor)
|
||||
#endif
|
||||
|
||||
extern bool LoadDemoTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -23,6 +23,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataGrid", "DataGrid\DataGr
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocumentEditor", "DocumentEditor\DocumentEditor.vcxproj", "{DB0EEADE-E377-4A35-A432-96982EFC6AF6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculatorAndStateMachine", "CalculatorAndStateMachine\CalculatorAndStateMachine.vcxproj", "{7A1792BE-F866-44EE-83BF-E686BDA54B37}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -93,6 +95,14 @@ Global
|
||||
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|Win32.Build.0 = Release|Win32
|
||||
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|x64.ActiveCfg = Release|x64
|
||||
{DB0EEADE-E377-4A35-A432-96982EFC6AF6}.Release|x64.Build.0 = Release|x64
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Debug|x64.Build.0 = Debug|x64
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Release|Win32.Build.0 = Release|Win32
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Release|x64.ActiveCfg = Release|x64
|
||||
{7A1792BE-F866-44EE-83BF-E686BDA54B37}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user