demo: GacUI_Controls\Localization

This commit is contained in:
Zihan Chen
2018-04-10 22:10:38 -07:00
parent 8b3c15d97c
commit 0e061335cf
13 changed files with 3416 additions and 6 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ https://zhuanlan.zhihu.com/p/33778843
- [ ] Demo: TriplePhaseImageButton
- [x] Add TemplateContext(Changed) property to both Control and Template
- [x] Remove ViewModelContext in BindableDataGrid
- [ ] Locale awared text resource with `str://` protocol
- [x] Locale awared text resource with `str://` protocol
- [ ] **Update Release**
- [ ] Add and query services from controls
- [ ] Demo: DocumentEditor
@@ -29,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Animation", "Animation\Anim
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MenuVisibility", "MenuVisibility\MenuVisibility.vcxproj", "{AE7EDFDA-A4D8-4992-87D6-BA1085B801F8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Localization", "Localization\Localization.vcxproj", "{145FBB41-62AB-4E29-B5A5-0F48518AECC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -123,6 +125,14 @@ Global
{AE7EDFDA-A4D8-4992-87D6-BA1085B801F8}.Release|Win32.Build.0 = Release|Win32
{AE7EDFDA-A4D8-4992-87D6-BA1085B801F8}.Release|x64.ActiveCfg = Release|x64
{AE7EDFDA-A4D8-4992-87D6-BA1085B801F8}.Release|x64.Build.0 = Release|x64
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Debug|Win32.ActiveCfg = Debug|Win32
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Debug|Win32.Build.0 = Debug|Win32
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Debug|x64.ActiveCfg = Debug|x64
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Debug|x64.Build.0 = Debug|x64
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Release|Win32.ActiveCfg = Release|Win32
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Release|Win32.Build.0 = Release|Win32
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Release|x64.ActiveCfg = Release|x64
{145FBB41-62AB-4E29-B5A5-0F48518AECC7}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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>
<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>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{145FBB41-62AB-4E29-B5A5-0F48518AECC7}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Localization</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</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>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -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>{2acbd7a2-3ec0-43c1-82ac-8b870a1dab57}</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/Localization.bin", FileStream::ReadOnly);
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
GetResourceManager()->SetResource(L"Resource", resource);
}
demo::MainWindow window;
window.MoveToScreenCenter();
GetApplication()->Run(&window);
}
@@ -0,0 +1,134 @@
<Resource>
<Folder name="GacGenConfig">
<Folder name="Cpp">
<Text name="SourceFolder">Source</Text>
<Text name="Resource">..\..\UIRes\Localization.bin</Text>
<Text name="NormalInclude">GacUI.h</Text>
<Text name="ReflectionInclude">GacUIReflection.h</Text>
<Text name="Name">Demo</Text>
</Folder>
</Folder>
<LocalizedStrings name="StringResource">
<LocalizedStrings ref.Class="demo::StringResource" DefaultLocale="en-US">
<Strings Locales="en-US">
<String Name="ShortDate" Text="ShortDate: $(0:ShortDate)"/>
<String Name="LongDate" Text="LongDate: $(0:LongDate)"/>
<String Name="YearMonthDate" Text="YearMonthDate: $(0:YearMonthDate)"/>
<String Name="ShortTime" Text="ShortTime: $(0:ShortTime)"/>
<String Name="LongTime" Text="LongTime: $(0:LongTime)"/>
<String Name="DateFormat" Text="DateFormat: $(0:Date:yyyy)"/>
<String Name="TimeFormat" Text="TimeFormat: $(0:Time:HH)"/>
<String Name="Number" Text="Number: $(0:Number)"/>
<String Name="Currency" Text="Currency: $(0:Currency)"/>
<String Name="Sentence" Text="$($)Good morning, $(0)!$($)"/>
<String Name="Title" Text="Localization"/>
<String Name="Label" Text="Selected Locale:"/>
</Strings>
<Strings Locales="zh-CN">
<String Name="ShortDate" Text="短日期:$(0:ShortDate)"/>
<String Name="LongDate" Text="长日期:$(0:LongDate)"/>
<String Name="YearMonthDate" Text="年月:$(0:YearMonthDate)"/>
<String Name="ShortTime" Text="短时间:$(0:ShortTime)"/>
<String Name="LongTime" Text="长时间:$(0:LongTime)"/>
<String Name="DateFormat" Text="日期格式:$(0:Date:yyyy)"/>
<String Name="TimeFormat" Text="时间格式: $(0:Time:HH)"/>
<String Name="Number" Text="数字:$(0:Number)"/>
<String Name="Currency" Text="货币:$(0:Currency)"/>
<String Name="Sentence" Text="$($)$(0),早上好!$($)"/>
<String Name="Title" Text="本地化"/>
<String Name="Label" Text="语言设置:"/>
</Strings>
</LocalizedStrings>
</LocalizedStrings>
<Instance name="MainWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
<ref.Members>
<![CDATA[
func GetLocaleIndex(locale: Locale): int
{
for (i in range (0, listLocales.Items.Count))
{
if (listLocales.Items[i].Text == locale)
{
return i;
}
}
return 0;
}
var dateTime: DateTime = Sys::GetLocalTime();
var number: int = 2147483647;
var currency: double = 1342177.28;
]]>
</ref.Members>
<ref.LocalizedStrings Name="Strings" Uri="res://StringResource" Default="true"/>
<Window ref.Name="self" Text-str="Title()" ClientSize="x:640 y:480">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5">
<att.Rows>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
</att.Rows>
<att.Columns>
<_>composeType:MinSize</_>
<_>composeType:MinSize</_>
<_>composeType:Percentage percentage:1.0</_>
</att.Columns>
<Cell Site="row:0 column:0">
<SolidLabel Font-bind="self.Font" Color="#FFFFFF" Text-str="Label()" VerticalAlignment="Center"/>
</Cell>
<Cell Site="row:0 column:1">
<ComboBox ref.Name="comboLocales">
<att.BoundsComposition-set PreferredMinSize="x:120"/>
<att.SelectedIndex-bind>self.GetLocaleIndex(Application::GetApplication().Locale)</att.SelectedIndex-bind>
<ev.SelectedIndexChanged-eval>
<![CDATA[
{
var index = comboLocales.SelectedIndex;
if (index == -1)
{
index = 0;
}
Application::GetApplication().Locale = cast Locale listLocales.Items[index].Text;
}
]]>
</ev.SelectedIndexChanged-eval>
<att.ListControl>
<TextList ref.Name="listLocales" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.Items>
<_ Text="en-US"/>
<_ Text="zh-CN"/>
</att.Items>
</TextList>
</att.ListControl>
</ComboBox>
</Cell>
<Cell Site="row:1 column:0 columnSpan:3">
<TextList HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.Items>
<_ Text-str="ShortDate(self.dateTime)"/>
<_ Text-str="LongDate(self.dateTime)"/>
<_ Text-str="YearMonthDate(self.dateTime)"/>
<_ Text-str="ShortTime(self.dateTime)"/>
<_ Text-str="LongTime(self.dateTime)"/>
<_ Text-str="DateFormat(self.dateTime)"/>
<_ Text-str="TimeFormat(self.dateTime)"/>
<_ Text-str="Number(self.number)"/>
<_ Text-str="Currency(self.currency)"/>
<_ Text-str="Sentence('John Smith')"/>
<_ Text-str="Strings.Sentence('John Smith')"/>
<_ Text-bind="self.Strings.Sentence('John Smith') ?? ''"/>
</att.Items>
</TextList>
</Cell>
</Table>
</Window>
</Instance>
</Instance>
</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
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,143 @@
/***********************************************************************
!!!!!! 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::IStringResourceStrings)
IMPL_CPP_TYPE_INFO(demo::MainWindow)
IMPL_CPP_TYPE_INFO(demo::MainWindowConstructor)
IMPL_CPP_TYPE_INFO(demo::StringResource)
#define _ ,
BEGIN_INTERFACE_MEMBER(::demo::IStringResourceStrings)
CLASS_MEMBER_METHOD(Currency, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(DateFormat, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(Label, NO_PARAMETER)
CLASS_MEMBER_METHOD(LongDate, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(LongTime, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(Number, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(Sentence, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(ShortDate, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(ShortTime, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(TimeFormat, { L"__vwsn_ls_0" })
CLASS_MEMBER_METHOD(Title, NO_PARAMETER)
CLASS_MEMBER_METHOD(YearMonthDate, { L"__vwsn_ls_0" })
END_INTERFACE_MEMBER(::demo::IStringResourceStrings)
BEGIN_CLASS_MEMBER(::demo::MainWindow)
CLASS_MEMBER_CONSTRUCTOR(::demo::MainWindow*(), NO_PARAMETER)
CLASS_MEMBER_METHOD(GetLocaleIndex, { L"locale" })
CLASS_MEMBER_METHOD(GetStrings, NO_PARAMETER)
CLASS_MEMBER_METHOD(SetStrings, { L"__vwsn_value_" })
CLASS_MEMBER_EVENT(StringsChanged)
CLASS_MEMBER_FIELD(__vwsn_prop_Strings)
CLASS_MEMBER_PROPERTY_EVENT(Strings, GetStrings, SetStrings, StringsChanged)
CLASS_MEMBER_FIELD(currency)
CLASS_MEMBER_FIELD(dateTime)
CLASS_MEMBER_FIELD(number)
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(__vwsn_precompile_10)
CLASS_MEMBER_FIELD(__vwsn_precompile_11)
CLASS_MEMBER_FIELD(__vwsn_precompile_12)
CLASS_MEMBER_FIELD(__vwsn_precompile_13)
CLASS_MEMBER_FIELD(__vwsn_precompile_14)
CLASS_MEMBER_FIELD(__vwsn_precompile_15)
CLASS_MEMBER_FIELD(__vwsn_precompile_16)
CLASS_MEMBER_FIELD(__vwsn_precompile_17)
CLASS_MEMBER_FIELD(__vwsn_precompile_18)
CLASS_MEMBER_FIELD(__vwsn_precompile_19)
CLASS_MEMBER_FIELD(__vwsn_precompile_2)
CLASS_MEMBER_FIELD(__vwsn_precompile_20)
CLASS_MEMBER_FIELD(__vwsn_precompile_21)
CLASS_MEMBER_FIELD(__vwsn_precompile_3)
CLASS_MEMBER_FIELD(__vwsn_precompile_4)
CLASS_MEMBER_FIELD(__vwsn_precompile_5)
CLASS_MEMBER_FIELD(__vwsn_precompile_6)
CLASS_MEMBER_FIELD(__vwsn_precompile_7)
CLASS_MEMBER_FIELD(__vwsn_precompile_8)
CLASS_MEMBER_FIELD(__vwsn_precompile_9)
CLASS_MEMBER_FIELD(Strings)
CLASS_MEMBER_FIELD(comboLocales)
CLASS_MEMBER_FIELD(listLocales)
CLASS_MEMBER_FIELD(self)
END_CLASS_MEMBER(::demo::MainWindowConstructor)
BEGIN_CLASS_MEMBER(::demo::StringResource)
CLASS_MEMBER_CONSTRUCTOR(::vl::Ptr<::demo::StringResource>(), NO_PARAMETER)
CLASS_MEMBER_STATIC_METHOD(__vwsn_ls_First, { L"__vwsn_ls_formats" })
CLASS_MEMBER_STATIC_METHOD(Get, { L"__vwsn_ls_locale" })
END_CLASS_MEMBER(::demo::StringResource)
#undef _
class DemoTypeLoader : public Object, public ITypeLoader
{
public:
void Load(ITypeManager* manager)
{
ADD_TYPE_INFO(::demo::IStringResourceStrings)
ADD_TYPE_INFO(::demo::MainWindow)
ADD_TYPE_INFO(::demo::MainWindowConstructor)
ADD_TYPE_INFO(::demo::StringResource)
}
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,110 @@
/***********************************************************************
!!!!!! 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::IStringResourceStrings)
DECL_TYPE_INFO(::demo::MainWindow)
DECL_TYPE_INFO(::demo::MainWindowConstructor)
DECL_TYPE_INFO(::demo::StringResource)
BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(::demo::IStringResourceStrings)
::vl::WString Currency(const ::vl::WString& __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(Currency, __vwsn_ls_0);
}
::vl::WString DateFormat(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(DateFormat, __vwsn_ls_0);
}
::vl::WString Label() override
{
INVOKEGET_INTERFACE_PROXY_NOPARAMS(Label);
}
::vl::WString LongDate(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(LongDate, __vwsn_ls_0);
}
::vl::WString LongTime(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(LongTime, __vwsn_ls_0);
}
::vl::WString Number(const ::vl::WString& __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(Number, __vwsn_ls_0);
}
::vl::WString Sentence(const ::vl::WString& __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(Sentence, __vwsn_ls_0);
}
::vl::WString ShortDate(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(ShortDate, __vwsn_ls_0);
}
::vl::WString ShortTime(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(ShortTime, __vwsn_ls_0);
}
::vl::WString TimeFormat(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(TimeFormat, __vwsn_ls_0);
}
::vl::WString Title() override
{
INVOKEGET_INTERFACE_PROXY_NOPARAMS(Title);
}
::vl::WString YearMonthDate(::vl::DateTime __vwsn_ls_0) override
{
INVOKEGET_INTERFACE_PROXY(YearMonthDate, __vwsn_ls_0);
}
END_INTERFACE_PROXY(::demo::IStringResourceStrings)
#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
Binary file not shown.
@@ -67,12 +67,12 @@ namespace demo
vint cx = arguments.bounds.Left() + arguments.bounds.Width() / 2;
vint cy = arguments.bounds.Top() + arguments.bounds.Height() / 2;
rt->DrawEllipse(D2D1::Ellipse(D2D1::Point2F(cx, cy), 160, 160), members->borderBrush.Obj());
rt->DrawEllipse(D2D1::Ellipse(D2D1::Point2F((FLOAT)cx, (FLOAT)cy), 160, 160), members->borderBrush.Obj());
for (vint i = 0; i < 12; i++)
{
auto s = sin(i * 3.14 / 6);
auto c = cos(i * 3.14 / 6);
rt->DrawLine(D2D1::Point2F(cx + c * 150, cy + s * 150), D2D1::Point2F(cx + c * 160, cy + s * 160), members->borderBrush.Obj());
rt->DrawLine(D2D1::Point2F((FLOAT)(cx + c * 150), (FLOAT)(cy + s * 150)), D2D1::Point2F((FLOAT)(cx + c * 160), (FLOAT)(cy + s * 160)), members->borderBrush.Obj());
}
auto time = DateTime::LocalTime();
@@ -80,19 +80,19 @@ namespace demo
auto d = ((time.hour + time.minute / 60.f + time.second / 3600.f) / 6.f - 0.5) * 3.14;
auto s = sin(d);
auto c = cos(d);
rt->DrawLine(D2D1::Point2F(cx, cy), D2D1::Point2F(cx + c * 90, cy + s * 90), members->hourBrush.Obj());
rt->DrawLine(D2D1::Point2F((FLOAT)cx, (FLOAT)cy), D2D1::Point2F((FLOAT)(cx + c * 90), (FLOAT)(cy + s * 90)), members->hourBrush.Obj());
}
{
auto d = ((time.minute + time.second / 60.f) / 30.f - 0.5) * 3.14;
auto s = sin(d);
auto c = cos(d);
rt->DrawLine(D2D1::Point2F(cx, cy), D2D1::Point2F(cx + c * 110, cy + s * 110), members->minuteBrush.Obj());
rt->DrawLine(D2D1::Point2F((FLOAT)cx, (FLOAT)cy), D2D1::Point2F((FLOAT)(cx + c * 110), (FLOAT)(cy + s * 110)), members->minuteBrush.Obj());
}
{
auto d = (time.second / 30.f - 0.5) * 3.14;
auto s = sin(d);
auto c = cos(d);
rt->DrawLine(D2D1::Point2F(cx, cy), D2D1::Point2F(cx + c * 130, cy + s * 130), members->secondBrush.Obj());
rt->DrawLine(D2D1::Point2F((FLOAT)cx, (FLOAT)cy), D2D1::Point2F((FLOAT)(cx + c * 130), (FLOAT)(cy + s * 130)), members->secondBrush.Obj());
}
}