diff --git a/Tutorial/Codegen.bat b/Tutorial/Codegen.bat index 226deab8..ea38e776 100644 --- a/Tutorial/Codegen.bat +++ b/Tutorial/Codegen.bat @@ -43,4 +43,7 @@ pushd GacUI_Xml pushd Instance_Window\UI call Codegen.bat popd +pushd Instance_MultipleWindows\UI +call Codegen.bat +popd popd \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/GacUI_Xml.sln b/Tutorial/GacUI_Xml/GacUI_Xml.sln index e2ef1961..fc09e594 100644 --- a/Tutorial/GacUI_Xml/GacUI_Xml.sln +++ b/Tutorial/GacUI_Xml/GacUI_Xml.sln @@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUILite", "..\Lib\GacUILi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUI", "..\Lib\GacUI\GacUI.vcxproj", "{8018D622-66BA-4E65-9D03-BDAC37EA9A54}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Instance_MultipleWindows", "Instance_MultipleWindows\Instance_MultipleWindows.vcxproj", "{427E2DA5-28E0-48E2-9170-7E6F15B1D14C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -29,6 +31,10 @@ Global {8018D622-66BA-4E65-9D03-BDAC37EA9A54}.Debug|Win32.Build.0 = Debug|Win32 {8018D622-66BA-4E65-9D03-BDAC37EA9A54}.Release|Win32.ActiveCfg = Release|Win32 {8018D622-66BA-4E65-9D03-BDAC37EA9A54}.Release|Win32.Build.0 = Release|Win32 + {427E2DA5-28E0-48E2-9170-7E6F15B1D14C}.Debug|Win32.ActiveCfg = Debug|Win32 + {427E2DA5-28E0-48E2-9170-7E6F15B1D14C}.Debug|Win32.Build.0 = Debug|Win32 + {427E2DA5-28E0-48E2-9170-7E6F15B1D14C}.Release|Win32.ActiveCfg = Release|Win32 + {427E2DA5-28E0-48E2-9170-7E6F15B1D14C}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/Instance_MultipleWindows.vcxproj b/Tutorial/GacUI_Xml/Instance_MultipleWindows/Instance_MultipleWindows.vcxproj new file mode 100644 index 00000000..7c25c07a --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/Instance_MultipleWindows.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {427E2DA5-28E0-48E2-9170-7E6F15B1D14C} + Win32Proj + Instance_MultipleWindows + + + + 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_Xml/Instance_MultipleWindows/Instance_MultipleWindows.vcxproj.filters b/Tutorial/GacUI_Xml/Instance_MultipleWindows/Instance_MultipleWindows.vcxproj.filters new file mode 100644 index 00000000..cae93487 --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/Instance_MultipleWindows.vcxproj.filters @@ -0,0 +1,47 @@ + + + + + {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 + + + {9f2b59c4-ca24-41f5-8bff-0c55bfc8c54e} + + + + + Source Files + + + UI + + + UI + + + + + Resource Files + + + + + UI + + + UI + + + UI + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/Main.cpp b/Tutorial/GacUI_Xml/Instance_MultipleWindows/Main.cpp new file mode 100644 index 00000000..1e71cd6f --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/Main.cpp @@ -0,0 +1,23 @@ +#include "UI/Source/Demo.h" +#include + +using namespace vl::collections; +using namespace vl::stream; + +int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow) +{ + return SetupWindowsDirect2DRenderer(); +} + +void GuiMain() +{ + { + List errors; + FileStream fileStream(L"../UIRes/Instance_MultipleWindows.bin", FileStream::ReadOnly); + auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors); + GetResourceManager()->SetResource(L"Resource", resource); + } + demo::MainWindow window; + window.MoveToScreenCenter(); + GetApplication()->Run(&window); +} \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Codegen.bat b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Codegen.bat new file mode 100644 index 00000000..27f6654b --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Codegen.bat @@ -0,0 +1 @@ +..\..\..\..\Tools\GacGen.exe Resource.xml \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Resource.xml b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Resource.xml new file mode 100644 index 00000000..7eec1483 --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Resource.xml @@ -0,0 +1,38 @@ + + + + + Source + GacUIReflection.h + Demo + + + + ..\..\UIRes + Instance_MultipleWindows.bin + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/Demo.h b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/Demo.h new file mode 100644 index 00000000..0f5f6c6b --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/Demo.h @@ -0,0 +1,17 @@ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Demo + +This file is generated by: Vczh GacUI Resource Code Generator +************************************************************************ +DO NOT MODIFY +***********************************************************************/ + +#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo +#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo + +#include "DemoPartialClasses.h" +#include "MainWindow.h" + +#endif diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/DemoPartialClasses.cpp new file mode 100644 index 00000000..5348969d --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/DemoPartialClasses.cpp @@ -0,0 +1,89 @@ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Partial Classes + +This file is generated by: Vczh GacUI Resource Code Generator +************************************************************************ +DO NOT MODIFY +***********************************************************************/ + +#include "Demo.h" + +namespace demo +{ + // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) + + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + + AnotherWindow::AnotherWindow() + { + InitializeComponents(); + } + + AnotherWindow::~AnotherWindow() + { + ClearSubscriptions(); + } +} + + +namespace vl +{ + namespace reflection + { + namespace description + { + #define _ , + IMPL_CPP_TYPE_INFO(demo::AnotherWindow) + IMPL_CPP_TYPE_INFO(demo::MainWindow) + + BEGIN_CLASS_MEMBER(demo::AnotherWindow) + CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) + CLASS_MEMBER_CONSTRUCTOR(demo::AnotherWindow*(), NO_PARAMETER) + END_CLASS_MEMBER(demo::AnotherWindow) + + BEGIN_CLASS_MEMBER(demo::MainWindow) + CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) + CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(), NO_PARAMETER) + + CLASS_MEMBER_GUIEVENT_HANDLER(buttonShowWindow_Clicked, vl::presentation::compositions::GuiEventArgs) + END_CLASS_MEMBER(demo::MainWindow) + + #undef _ + + class DemoResourceLoader : public Object, public ITypeLoader + { + public: + void Load(ITypeManager* manager) + { + ADD_TYPE_INFO(demo::AnotherWindow) + ADD_TYPE_INFO(demo::MainWindow) + } + + void Unload(ITypeManager* manager) + { + } + }; + + class DemoResourcePlugin : public Object, public vl::presentation::controls::IGuiPlugin + { + public: + void Load()override + { + GetGlobalTypeManager()->AddTypeLoader(new DemoResourceLoader); + } + + void AfterLoad()override + { + } + + void Unload()override + { + } + }; + GUI_REGISTER_PLUGIN(DemoResourcePlugin) + } + } +} + diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/DemoPartialClasses.h new file mode 100644 index 00000000..a7c3ec11 --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/DemoPartialClasses.h @@ -0,0 +1,100 @@ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Partial Classes + +This file is generated by: Vczh GacUI Resource Code Generator +************************************************************************ +DO NOT MODIFY +***********************************************************************/ + +#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_PARTIAL_CLASSES +#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_PARTIAL_CLASSES + +#include "GacUIReflection.h" + +namespace demo +{ + class AnotherWindow; + class MainWindow; + + template + class AnotherWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass, public vl::reflection::Description + { + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + private: + protected: + + void InitializeComponents() + { + if (InitializeFromResource()) + { + } + else + { + } + } + public: + AnotherWindow_() + :vl::presentation::GuiInstancePartialClass(L"demo::AnotherWindow") + ,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle()) + { + } + }; + + template + class MainWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass, public vl::reflection::Description + { + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + private: + protected: + + void InitializeComponents() + { + if (InitializeFromResource()) + { + } + else + { + } + } + public: + MainWindow_() + :vl::presentation::GuiInstancePartialClass(L"demo::MainWindow") + ,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle()) + { + } + }; + +} +namespace vl +{ + namespace reflection + { + namespace description + { + DECL_TYPE_INFO(demo::AnotherWindow) + DECL_TYPE_INFO(demo::MainWindow) + + } + } +} +namespace demo +{ + class AnotherWindow : public demo::AnotherWindow_ + { + friend class demo::AnotherWindow_; + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + protected: + + // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + public: + AnotherWindow(); + ~AnotherWindow(); + }; +} + + + +#endif diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/MainWindow.cpp b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/MainWindow.cpp new file mode 100644 index 00000000..98f204cd --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/MainWindow.cpp @@ -0,0 +1,33 @@ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::MainWindow + +This file is generated by: Vczh GacUI Resource Code Generator +***********************************************************************/ + +#include "Demo.h" + +namespace demo +{ + // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) + + void MainWindow::buttonShowWindow_Clicked(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments) + { + auto window = new AnotherWindow; + window->MoveToScreenCenter(); + window->ShowModalAndDelete(this, [](){}); + } + + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + + MainWindow::MainWindow() + { + InitializeComponents(); + } + + MainWindow::~MainWindow() + { + ClearSubscriptions(); + } +} diff --git a/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/MainWindow.h b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/MainWindow.h new file mode 100644 index 00000000..6474d2db --- /dev/null +++ b/Tutorial/GacUI_Xml/Instance_MultipleWindows/UI/Source/MainWindow.h @@ -0,0 +1,31 @@ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::MainWindow + +This file is generated by: Vczh GacUI Resource Code Generator +***********************************************************************/ + +#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_MainWindow +#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_Demo_MainWindow + +#include "DemoPartialClasses.h" + +namespace demo +{ + class MainWindow : public demo::MainWindow_ + { + friend class demo::MainWindow_; + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + protected: + + // #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.) + void buttonShowWindow_Clicked(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments); + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + public: + MainWindow(); + ~MainWindow(); + }; +} + +#endif diff --git a/Tutorial/GacUI_Xml/UIRes/Instance_MultipleWindows.bin b/Tutorial/GacUI_Xml/UIRes/Instance_MultipleWindows.bin new file mode 100644 index 00000000..a2cc02bc Binary files /dev/null and b/Tutorial/GacUI_Xml/UIRes/Instance_MultipleWindows.bin differ