diff --git a/Tutorial/Codegen.bat b/Tutorial/Codegen.bat index a43734b9..bfaa5708 100644 --- a/Tutorial/Codegen.bat +++ b/Tutorial/Codegen.bat @@ -1,4 +1,7 @@ pushd GacUI_HelloWorlds +pushd Xml\UI +call Codegen.bat +popd pushd CppXml\UI call Codegen.bat popd diff --git a/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin b/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin index 6998e724..4d150787 100644 Binary files a/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin and b/Tutorial/GacUI_ControlTemplate/UIRes/BlackSkin.bin differ diff --git a/Tutorial/GacUI_Controls/UIRes/ContainersAndButtons.bin b/Tutorial/GacUI_Controls/UIRes/ContainersAndButtons.bin index 6a090830..4956084d 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/ContainersAndButtons.bin and b/Tutorial/GacUI_Controls/UIRes/ContainersAndButtons.bin differ diff --git a/Tutorial/GacUI_Controls/UIRes/TextEditor.bin b/Tutorial/GacUI_Controls/UIRes/TextEditor.bin index c82828e1..cecf7088 100644 Binary files a/Tutorial/GacUI_Controls/UIRes/TextEditor.bin and b/Tutorial/GacUI_Controls/UIRes/TextEditor.bin differ diff --git a/Tutorial/GacUI_HelloWorlds/GacUI_HelloWorlds.sln b/Tutorial/GacUI_HelloWorlds/GacUI_HelloWorlds.sln index 2d5d9608..e845130a 100644 --- a/Tutorial/GacUI_HelloWorlds/GacUI_HelloWorlds.sln +++ b/Tutorial/GacUI_HelloWorlds/GacUI_HelloWorlds.sln @@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MVVM", "MVVM\MVVM.vcxproj", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUIComplete", "..\Lib\GacUIComplete\GacUIComplete.vcxproj", "{3AEC5E1A-482F-41B1-8598-C02321621A64}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Xml", "Xml\Xml.vcxproj", "{4C3F091C-1A77-401A-B773-E755A2E6E0F5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -53,6 +55,10 @@ Global {3AEC5E1A-482F-41B1-8598-C02321621A64}.Debug|Win32.Build.0 = Debug|Win32 {3AEC5E1A-482F-41B1-8598-C02321621A64}.Release|Win32.ActiveCfg = Release|Win32 {3AEC5E1A-482F-41B1-8598-C02321621A64}.Release|Win32.Build.0 = Release|Win32 + {4C3F091C-1A77-401A-B773-E755A2E6E0F5}.Debug|Win32.ActiveCfg = Debug|Win32 + {4C3F091C-1A77-401A-B773-E755A2E6E0F5}.Debug|Win32.Build.0 = Debug|Win32 + {4C3F091C-1A77-401A-B773-E755A2E6E0F5}.Release|Win32.ActiveCfg = Release|Win32 + {4C3F091C-1A77-401A-B773-E755A2E6E0F5}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/CppXml.bin b/Tutorial/GacUI_HelloWorlds/UIRes/CppXml.bin index 72a0f3be..eed58bf0 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/CppXml.bin and b/Tutorial/GacUI_HelloWorlds/UIRes/CppXml.bin differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin b/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin index e81917d4..8e7b9745 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin and b/Tutorial/GacUI_HelloWorlds/UIRes/MVVM.bin differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin new file mode 100644 index 00000000..b223fb4e Binary files /dev/null and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin differ diff --git a/Tutorial/GacUI_HelloWorlds/Xml/Main.cpp b/Tutorial/GacUI_HelloWorlds/Xml/Main.cpp new file mode 100644 index 00000000..81b7ec37 --- /dev/null +++ b/Tutorial/GacUI_HelloWorlds/Xml/Main.cpp @@ -0,0 +1,26 @@ +#include +#include + +using namespace vl::collections; +using namespace vl::stream; +using namespace vl::reflection::description; + +int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow) +{ + return SetupWindowsDirect2DRenderer(); +} + +void GuiMain() +{ + { + List errors; + FileStream fileStream(L"../UIRes/Xml.bin", FileStream::ReadOnly); + auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors); + GetResourceManager()->SetResource(L"Resource", resource, GuiResourceUsage::DevelopmentTool); + } + + auto window = UnboxValue(Value::Create(L"helloworld::MainWindow")); + window->MoveToScreenCenter(); + GetApplication()->Run(window); + delete window; +} \ No newline at end of file diff --git a/Tutorial/GacUI_HelloWorlds/Xml/UI/Codegen.bat b/Tutorial/GacUI_HelloWorlds/Xml/UI/Codegen.bat new file mode 100644 index 00000000..27f6654b --- /dev/null +++ b/Tutorial/GacUI_HelloWorlds/Xml/UI/Codegen.bat @@ -0,0 +1 @@ +..\..\..\..\Tools\GacGen.exe Resource.xml \ No newline at end of file diff --git a/Tutorial/GacUI_HelloWorlds/Xml/UI/Resource.xml b/Tutorial/GacUI_HelloWorlds/Xml/UI/Resource.xml new file mode 100644 index 00000000..4c187364 --- /dev/null +++ b/Tutorial/GacUI_HelloWorlds/Xml/UI/Resource.xml @@ -0,0 +1,21 @@ + + + + + ..\..\UIRes + Xml.bin + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tutorial/GacUI_HelloWorlds/Xml/Xml.vcxproj b/Tutorial/GacUI_HelloWorlds/Xml/Xml.vcxproj new file mode 100644 index 00000000..db4ed3be --- /dev/null +++ b/Tutorial/GacUI_HelloWorlds/Xml/Xml.vcxproj @@ -0,0 +1,96 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {4C3F091C-1A77-401A-B773-E755A2E6E0F5} + Win32Proj + Xml + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + $(ProjectDir)..\..\..\Import;$(IncludePath) + + + false + $(ProjectDir)..\..\..\Import;$(IncludePath) + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + + + + + + + {8018d622-66ba-4e65-9d03-bdac37ea9a54} + + + + + + \ No newline at end of file diff --git a/Tutorial/GacUI_HelloWorlds/Xml/Xml.vcxproj.filters b/Tutorial/GacUI_HelloWorlds/Xml/Xml.vcxproj.filters new file mode 100644 index 00000000..99cfa5c6 --- /dev/null +++ b/Tutorial/GacUI_HelloWorlds/Xml/Xml.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Layout/UIRes/Alignment.bin b/Tutorial/GacUI_Layout/UIRes/Alignment.bin index 0ee07cd9..17650812 100644 Binary files a/Tutorial/GacUI_Layout/UIRes/Alignment.bin and b/Tutorial/GacUI_Layout/UIRes/Alignment.bin differ diff --git a/Tutorial/GacUI_Layout/UIRes/Flow.bin b/Tutorial/GacUI_Layout/UIRes/Flow.bin index 23c2b34d..6d0d9be3 100644 Binary files a/Tutorial/GacUI_Layout/UIRes/Flow.bin and b/Tutorial/GacUI_Layout/UIRes/Flow.bin differ diff --git a/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin b/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin index 2b537548..2b96e768 100644 Binary files a/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin and b/Tutorial/GacUI_Layout/UIRes/RichTextEmbedding.bin differ diff --git a/Tutorial/GacUI_Layout/UIRes/Stack.bin b/Tutorial/GacUI_Layout/UIRes/Stack.bin index d3027026..85366001 100644 Binary files a/Tutorial/GacUI_Layout/UIRes/Stack.bin and b/Tutorial/GacUI_Layout/UIRes/Stack.bin differ diff --git a/Tutorial/GacUI_Layout/UIRes/Table.bin b/Tutorial/GacUI_Layout/UIRes/Table.bin index 9cd6f0b4..4921cc49 100644 Binary files a/Tutorial/GacUI_Layout/UIRes/Table.bin and b/Tutorial/GacUI_Layout/UIRes/Table.bin differ diff --git a/Tutorial/README.md b/Tutorial/README.md index 168a7f75..5365b484 100644 --- a/Tutorial/README.md +++ b/Tutorial/README.md @@ -3,11 +3,12 @@ GacUI tutorials and the plan * GacUI_HelloWorlds - * **Cpp**: Using C++ to write a GacUI project. - * **WorkflowScript**: Using Workflow script to write a GacUI project. - * **CppXml**: Using Xml Resource with generated Workflow script and C++ code to write a GacUI project. + * **Cpp**: Using C++ from stratch. + * **WorkflowScript**: Using Workflow script from stratch. + * **CppXml**: Using C++ and GacUI Xml Resource, with generated C++ code for loading UI from the precompiled binary GacUI Xml Resource. + * **Xml**: Loading the precompiled binary GacUI Xml Resource dynamically at runtime. * **MVVM**: A MVVM pattern demo using Xml Resource. - * **PureCppXml**: + * **PureCppXml**: Using C++ and GacUI Xml Resource, but all UI in the resource is completely compiled to C++. (developing) * GacUI_Layout * **Alignment**: Simple layout. * **Stack**: Stack layout with configurable axis directions. @@ -30,6 +31,7 @@ GacUI tutorials and the plan * GacUI_XmlResource * **MultipleWindow** * **CustomControl** + * **InheritableCustomControl** * **Event**: * **ViewModel**: * **Bindings**: