diff --git a/Tutorial/Codegen.bat b/Tutorial/Codegen.bat index dbc67f15..932aa452 100644 --- a/Tutorial/Codegen.bat +++ b/Tutorial/Codegen.bat @@ -64,4 +64,13 @@ popd pushd Binding_ViewModel\UI call Codegen.bat popd +pushd Event_Cpp\UI +call Codegen.bat +popd +pushd Event_Script\UI +call Codegen.bat +popd +pushd Event_ViewModel\UI +call Codegen.bat +popd popd \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Binding_Bind/UI/Resource.xml b/Tutorial/GacUI_Xml/Binding_Bind/UI/Resource.xml index 0592f9cc..72e7998e 100644 --- a/Tutorial/GacUI_Xml/Binding_Bind/UI/Resource.xml +++ b/Tutorial/GacUI_Xml/Binding_Bind/UI/Resource.xml @@ -56,7 +56,6 @@ - diff --git a/Tutorial/GacUI_Xml/Binding_ViewModel/UI/Resource.xml b/Tutorial/GacUI_Xml/Binding_ViewModel/UI/Resource.xml index 4123a1e4..5a3b465e 100644 --- a/Tutorial/GacUI_Xml/Binding_ViewModel/UI/Resource.xml +++ b/Tutorial/GacUI_Xml/Binding_ViewModel/UI/Resource.xml @@ -15,15 +15,17 @@ diff --git a/Tutorial/GacUI_Xml/Event_Cpp/Event_Cpp.vcxproj b/Tutorial/GacUI_Xml/Event_Cpp/Event_Cpp.vcxproj new file mode 100644 index 00000000..d40f2f63 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/Event_Cpp.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {B25B6626-47A4-4008-949A-E9BA3A32DB3B} + Win32Proj + Event_Cpp + + + + 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/Event_Cpp/Event_Cpp.vcxproj.filters b/Tutorial/GacUI_Xml/Event_Cpp/Event_Cpp.vcxproj.filters new file mode 100644 index 00000000..ae8b491e --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/Event_Cpp.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 + + + {e027aa18-afc0-4935-bb8a-0ac5707b6baf} + + + + + Resource Files + + + + + UI + + + UI + + + UI + + + + + UI + + + Source Files + + + UI + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_Cpp/Main.cpp b/Tutorial/GacUI_Xml/Event_Cpp/Main.cpp new file mode 100644 index 00000000..7a07f780 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/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/Event_Cpp.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/Event_Cpp/UI/Codegen.bat b/Tutorial/GacUI_Xml/Event_Cpp/UI/Codegen.bat new file mode 100644 index 00000000..27f6654b --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/UI/Codegen.bat @@ -0,0 +1 @@ +..\..\..\..\Tools\GacGen.exe Resource.xml \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_Cpp/UI/Resource.xml b/Tutorial/GacUI_Xml/Event_Cpp/UI/Resource.xml new file mode 100644 index 00000000..75bf618d --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/UI/Resource.xml @@ -0,0 +1,70 @@ + + + + + Source + GacUIReflection.h + Demo + + + + ..\..\UIRes + Event_Cpp.bin + + + + + + + + + + composeType:MinSize + composeType:MinSize + composeType:MinSize + composeType:Percentage percentage:1.0 + + + composeType:MinSize + composeType:Absolute absolute:100 + composeType:MinSize + composeType:Percentage percentage:1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/Demo.h b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/Demo.h new file mode 100644 index 00000000..0f5f6c6b --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/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/Event_Cpp/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/DemoPartialClasses.cpp new file mode 100644 index 00000000..88ea0ddb --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/DemoPartialClasses.cpp @@ -0,0 +1,64 @@ +/*********************************************************************** +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 vl +{ + namespace reflection + { + namespace description + { + #define _ , + IMPL_CPP_TYPE_INFO(demo::MainWindow) + + BEGIN_CLASS_MEMBER(demo::MainWindow) + CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) + CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(), NO_PARAMETER) + + CLASS_MEMBER_GUIEVENT_HANDLER(buttonCalculate_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::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/Event_Cpp/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/DemoPartialClasses.h new file mode 100644 index 00000000..a7ca1abf --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/DemoPartialClasses.h @@ -0,0 +1,66 @@ +/*********************************************************************** +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 MainWindow; + + template + class MainWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass, public vl::reflection::Description + { + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + private: + protected: + vl::presentation::controls::GuiSinglelineTextBox* textBoxA; + vl::presentation::controls::GuiSinglelineTextBox* textBoxB; + vl::presentation::controls::GuiSinglelineTextBox* textBoxC; + + void InitializeComponents() + { + if (InitializeFromResource()) + { + GUI_INSTANCE_REFERENCE(textBoxA); + GUI_INSTANCE_REFERENCE(textBoxB); + GUI_INSTANCE_REFERENCE(textBoxC); + } + else + { + } + } + public: + MainWindow_() + :vl::presentation::GuiInstancePartialClass(L"demo::MainWindow") + ,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle()) + ,textBoxA(0) + ,textBoxB(0) + ,textBoxC(0) + { + } + }; + +} +namespace vl +{ + namespace reflection + { + namespace description + { + DECL_TYPE_INFO(demo::MainWindow) + + } + } +} + +#endif diff --git a/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/MainWindow.cpp b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/MainWindow.cpp new file mode 100644 index 00000000..ced33fb6 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/MainWindow.cpp @@ -0,0 +1,40 @@ +/*********************************************************************** +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::buttonCalculate_Clicked(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments) + { + bool successA = false; + bool successB = false; + auto a = wtoi_test(textBoxA->GetText(), successA); + auto b = wtoi_test(textBoxB->GetText(), successB); + auto c = (successA&&successB) + ? itow(a + b) + : L"" + ; + textBoxC->SetText(c); + } + + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + + MainWindow::MainWindow() + { + InitializeComponents(); + } + + MainWindow::~MainWindow() + { + ClearSubscriptions(); + } +} + diff --git a/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/MainWindow.h b/Tutorial/GacUI_Xml/Event_Cpp/UI/Source/MainWindow.h new file mode 100644 index 00000000..4ea0fa74 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Cpp/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 buttonCalculate_Clicked(GuiGraphicsComposition* sender, vl::presentation::compositions::GuiEventArgs& arguments); + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + public: + MainWindow(); + ~MainWindow(); + }; +} + +#endif diff --git a/Tutorial/GacUI_Xml/Event_Script/Event_Script.vcxproj b/Tutorial/GacUI_Xml/Event_Script/Event_Script.vcxproj new file mode 100644 index 00000000..94a0f84c --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/Event_Script.vcxproj @@ -0,0 +1,101 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9B5F90E9-13AF-44FF-BF0C-15B0F5F55D6D} + Win32Proj + Event_Script + + + + 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/Event_Script/Event_Script.vcxproj.filters b/Tutorial/GacUI_Xml/Event_Script/Event_Script.vcxproj.filters new file mode 100644 index 00000000..529d57fc --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/Event_Script.vcxproj.filters @@ -0,0 +1,41 @@ + + + + + {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 + + + {94f0552a-ad47-4fa2-a4aa-fd2a128826b5} + + + + + Resource Files + + + + + UI + + + Source Files + + + + + UI + + + UI + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_Script/Main.cpp b/Tutorial/GacUI_Xml/Event_Script/Main.cpp new file mode 100644 index 00000000..9b2b01e9 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/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/Event_Script.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/Event_Script/UI/Codegen.bat b/Tutorial/GacUI_Xml/Event_Script/UI/Codegen.bat new file mode 100644 index 00000000..27f6654b --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/UI/Codegen.bat @@ -0,0 +1 @@ +..\..\..\..\Tools\GacGen.exe Resource.xml \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_Script/UI/Resource.xml b/Tutorial/GacUI_Xml/Event_Script/UI/Resource.xml new file mode 100644 index 00000000..e3740c53 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/UI/Resource.xml @@ -0,0 +1,80 @@ + + + + + Source + GacUIReflection.h + Demo + + + + ..\..\UIRes + Event_Script.bin + + + + + + + + + + composeType:MinSize + composeType:MinSize + composeType:MinSize + composeType:Percentage percentage:1.0 + + + composeType:MinSize + composeType:Absolute absolute:100 + composeType:MinSize + composeType:Percentage percentage:1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_Script/UI/Source/Demo.h b/Tutorial/GacUI_Xml/Event_Script/UI/Source/Demo.h new file mode 100644 index 00000000..febeba0f --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/UI/Source/Demo.h @@ -0,0 +1,16 @@ +/*********************************************************************** +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" + +#endif diff --git a/Tutorial/GacUI_Xml/Event_Script/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Xml/Event_Script/UI/Source/DemoPartialClasses.cpp new file mode 100644 index 00000000..aa0483a1 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/UI/Source/DemoPartialClasses.cpp @@ -0,0 +1,80 @@ +/*********************************************************************** +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 + + MainWindow::MainWindow() + { + InitializeComponents(); + } + + MainWindow::~MainWindow() + { + ClearSubscriptions(); + } +} + + +namespace vl +{ + namespace reflection + { + namespace description + { + #define _ , + IMPL_CPP_TYPE_INFO(demo::MainWindow) + + BEGIN_CLASS_MEMBER(demo::MainWindow) + CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) + CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(), NO_PARAMETER) + END_CLASS_MEMBER(demo::MainWindow) + + #undef _ + + class DemoResourceLoader : public Object, public ITypeLoader + { + public: + void Load(ITypeManager* manager) + { + 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/Event_Script/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Xml/Event_Script/UI/Source/DemoPartialClasses.h new file mode 100644 index 00000000..b18085c5 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_Script/UI/Source/DemoPartialClasses.h @@ -0,0 +1,83 @@ +/*********************************************************************** +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 MainWindow; + + template + class MainWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass, public vl::reflection::Description + { + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + private: + protected: + vl::presentation::controls::GuiSinglelineTextBox* textBoxA; + vl::presentation::controls::GuiSinglelineTextBox* textBoxB; + vl::presentation::controls::GuiSinglelineTextBox* textBoxC; + + void InitializeComponents() + { + if (InitializeFromResource()) + { + GUI_INSTANCE_REFERENCE(textBoxA); + GUI_INSTANCE_REFERENCE(textBoxB); + GUI_INSTANCE_REFERENCE(textBoxC); + } + else + { + } + } + public: + MainWindow_() + :vl::presentation::GuiInstancePartialClass(L"demo::MainWindow") + ,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle()) + ,textBoxA(0) + ,textBoxB(0) + ,textBoxC(0) + { + } + }; + +} +namespace vl +{ + namespace reflection + { + namespace description + { + DECL_TYPE_INFO(demo::MainWindow) + + } + } +} +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.) + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + public: + MainWindow(); + ~MainWindow(); + }; +} + + + +#endif diff --git a/Tutorial/GacUI_Xml/Event_ViewModel/Event_ViewModel.vcxproj b/Tutorial/GacUI_Xml/Event_ViewModel/Event_ViewModel.vcxproj new file mode 100644 index 00000000..6524b30e --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/Event_ViewModel.vcxproj @@ -0,0 +1,101 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D87E9BEF-D61E-4254-AED7-A1D6665D587E} + Win32Proj + Event_ViewModel + + + + 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/Event_ViewModel/Event_ViewModel.vcxproj.filters b/Tutorial/GacUI_Xml/Event_ViewModel/Event_ViewModel.vcxproj.filters new file mode 100644 index 00000000..9ba07665 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/Event_ViewModel.vcxproj.filters @@ -0,0 +1,41 @@ + + + + + {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 + + + {2e8d2a37-0d9c-47a5-98c5-37454a473d39} + + + + + Resource Files + + + + + UI + + + UI + + + + + UI + + + Source Files + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_ViewModel/Main.cpp b/Tutorial/GacUI_Xml/Event_ViewModel/Main.cpp new file mode 100644 index 00000000..0f91c4a0 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/Main.cpp @@ -0,0 +1,37 @@ +#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(); +} + +class ViewModelImpl : public Object, public virtual demo::IViewModel +{ +public: + vint32_t Add(vint32_t a, vint32_t b)override + { + return a + b; + } + + WString Error()override + { + return L""; + } +}; + +void GuiMain() +{ + { + List errors; + FileStream fileStream(L"../UIRes/Event_ViewModel.bin", FileStream::ReadOnly); + auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors); + GetResourceManager()->SetResource(L"Resource", resource); + } + demo::MainWindow window(new ViewModelImpl); + window.MoveToScreenCenter(); + GetApplication()->Run(&window); +} \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_ViewModel/UI/Codegen.bat b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Codegen.bat new file mode 100644 index 00000000..27f6654b --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Codegen.bat @@ -0,0 +1 @@ +..\..\..\..\Tools\GacGen.exe Resource.xml \ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_ViewModel/UI/Resource.xml b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Resource.xml new file mode 100644 index 00000000..d502892b --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Resource.xml @@ -0,0 +1,94 @@ + + + + + Source + GacUIReflection.h + Demo + + + + ..\..\UIRes + Event_ViewModel.bin + + + + + + + + + + + + composeType:MinSize + composeType:MinSize + composeType:MinSize + composeType:Percentage percentage:1.0 + + + composeType:MinSize + composeType:Absolute absolute:100 + composeType:MinSize + composeType:Percentage percentage:1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/Demo.h b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/Demo.h new file mode 100644 index 00000000..febeba0f --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/Demo.h @@ -0,0 +1,16 @@ +/*********************************************************************** +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" + +#endif diff --git a/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/DemoPartialClasses.cpp new file mode 100644 index 00000000..bcccfbe4 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/DemoPartialClasses.cpp @@ -0,0 +1,90 @@ +/*********************************************************************** +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 + + MainWindow::MainWindow(Ptr ViewModel) + { + InitializeComponents(ViewModel); + } + + MainWindow::~MainWindow() + { + ClearSubscriptions(); + } +} + + +namespace vl +{ + namespace reflection + { + namespace description + { + #define _ , + IMPL_CPP_TYPE_INFO(demo::IViewModel) + IMPL_CPP_TYPE_INFO(demo::MainWindow) + + BEGIN_CLASS_MEMBER(demo::IViewModel) + CLASS_MEMBER_BASE(vl::reflection::IDescriptable) + CLASS_MEMBER_METHOD(Add, { L"a" _ L"b" }); + CLASS_MEMBER_METHOD(Error, NO_PARAMETER); + END_CLASS_MEMBER(demo::IViewModel) + + BEGIN_CLASS_MEMBER(demo::MainWindow) + CLASS_MEMBER_BASE(vl::presentation::controls::GuiWindow) + CLASS_MEMBER_CONSTRUCTOR(demo::MainWindow*(Ptr), { L"ViewModel" }) + + CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModel) + END_CLASS_MEMBER(demo::MainWindow) + + #undef _ + + class DemoResourceLoader : public Object, public ITypeLoader + { + public: + void Load(ITypeManager* manager) + { + ADD_TYPE_INFO(demo::IViewModel) + 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/Event_ViewModel/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Xml/Event_ViewModel/UI/Source/DemoPartialClasses.h new file mode 100644 index 00000000..5237cbd0 --- /dev/null +++ b/Tutorial/GacUI_Xml/Event_ViewModel/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 IViewModel; + class MainWindow; + + class IViewModel : public virtual vl::reflection::IDescriptable, public vl::reflection::Description + { + public: + virtual vl::vint32_t Add(vl::vint32_t a, vl::vint32_t b) = 0; + virtual vl::WString Error() = 0; + }; + + template + class MainWindow_ : public vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass, public vl::reflection::Description + { + friend struct vl::reflection::description::CustomTypeDescriptorSelector; + private: + Ptr ViewModel_; + protected: + vl::presentation::controls::GuiSinglelineTextBox* textBoxA; + vl::presentation::controls::GuiSinglelineTextBox* textBoxB; + vl::presentation::controls::GuiSinglelineTextBox* textBoxC; + + void InitializeComponents(Ptr ViewModel) + { + ViewModel_ = ViewModel; + if (InitializeFromResource()) + { + GUI_INSTANCE_REFERENCE(textBoxA); + GUI_INSTANCE_REFERENCE(textBoxB); + GUI_INSTANCE_REFERENCE(textBoxC); + } + else + { + ViewModel_ = 0; + } + } + public: + MainWindow_() + :vl::presentation::GuiInstancePartialClass(L"demo::MainWindow") + ,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle()) + ,textBoxA(0) + ,textBoxB(0) + ,textBoxC(0) + { + } + + Ptr GetViewModel() + { + return ViewModel_; + } + }; + +} +namespace vl +{ + namespace reflection + { + namespace description + { + DECL_TYPE_INFO(demo::IViewModel) + DECL_TYPE_INFO(demo::MainWindow) + + } + } +} +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.) + // #endregion CLASS_MEMBER_GUIEVENT_HANDLER + public: + MainWindow(Ptr ViewModel); + ~MainWindow(); + }; +} + + + +#endif diff --git a/Tutorial/GacUI_Xml/GacUI_Xml.sln b/Tutorial/GacUI_Xml/GacUI_Xml.sln index 8e6f998d..d589ec64 100644 --- a/Tutorial/GacUI_Xml/GacUI_Xml.sln +++ b/Tutorial/GacUI_Xml/GacUI_Xml.sln @@ -25,6 +25,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Binding_Format", "Binding_F EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Binding_ViewModel", "Binding_ViewModel\Binding_ViewModel.vcxproj", "{9E6E19C5-88AF-438F-8784-AD3A862274FA}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Event_Cpp", "Event_Cpp\Event_Cpp.vcxproj", "{B25B6626-47A4-4008-949A-E9BA3A32DB3B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Event_Script", "Event_Script\Event_Script.vcxproj", "{9B5F90E9-13AF-44FF-BF0C-15B0F5F55D6D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Event_ViewModel", "Event_ViewModel\Event_ViewModel.vcxproj", "{D87E9BEF-D61E-4254-AED7-A1D6665D587E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -71,6 +77,18 @@ Global {9E6E19C5-88AF-438F-8784-AD3A862274FA}.Debug|Win32.Build.0 = Debug|Win32 {9E6E19C5-88AF-438F-8784-AD3A862274FA}.Release|Win32.ActiveCfg = Release|Win32 {9E6E19C5-88AF-438F-8784-AD3A862274FA}.Release|Win32.Build.0 = Release|Win32 + {B25B6626-47A4-4008-949A-E9BA3A32DB3B}.Debug|Win32.ActiveCfg = Debug|Win32 + {B25B6626-47A4-4008-949A-E9BA3A32DB3B}.Debug|Win32.Build.0 = Debug|Win32 + {B25B6626-47A4-4008-949A-E9BA3A32DB3B}.Release|Win32.ActiveCfg = Release|Win32 + {B25B6626-47A4-4008-949A-E9BA3A32DB3B}.Release|Win32.Build.0 = Release|Win32 + {9B5F90E9-13AF-44FF-BF0C-15B0F5F55D6D}.Debug|Win32.ActiveCfg = Debug|Win32 + {9B5F90E9-13AF-44FF-BF0C-15B0F5F55D6D}.Debug|Win32.Build.0 = Debug|Win32 + {9B5F90E9-13AF-44FF-BF0C-15B0F5F55D6D}.Release|Win32.ActiveCfg = Release|Win32 + {9B5F90E9-13AF-44FF-BF0C-15B0F5F55D6D}.Release|Win32.Build.0 = Release|Win32 + {D87E9BEF-D61E-4254-AED7-A1D6665D587E}.Debug|Win32.ActiveCfg = Debug|Win32 + {D87E9BEF-D61E-4254-AED7-A1D6665D587E}.Debug|Win32.Build.0 = Debug|Win32 + {D87E9BEF-D61E-4254-AED7-A1D6665D587E}.Release|Win32.ActiveCfg = Release|Win32 + {D87E9BEF-D61E-4254-AED7-A1D6665D587E}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tutorial/GacUI_Xml/UIRes/Event_Cpp.bin b/Tutorial/GacUI_Xml/UIRes/Event_Cpp.bin new file mode 100644 index 00000000..c9a13b02 Binary files /dev/null and b/Tutorial/GacUI_Xml/UIRes/Event_Cpp.bin differ diff --git a/Tutorial/GacUI_Xml/UIRes/Event_Script.bin b/Tutorial/GacUI_Xml/UIRes/Event_Script.bin new file mode 100644 index 00000000..efc9cd99 Binary files /dev/null and b/Tutorial/GacUI_Xml/UIRes/Event_Script.bin differ diff --git a/Tutorial/GacUI_Xml/UIRes/Event_ViewModel.bin b/Tutorial/GacUI_Xml/UIRes/Event_ViewModel.bin new file mode 100644 index 00000000..54612b1a Binary files /dev/null and b/Tutorial/GacUI_Xml/UIRes/Event_ViewModel.bin differ diff --git a/Tutorial/GacUI_Xml/UIRes/Instance_Window.bin b/Tutorial/GacUI_Xml/UIRes/Instance_Window.bin index d4733cda..6a9340ca 100644 Binary files a/Tutorial/GacUI_Xml/UIRes/Instance_Window.bin and b/Tutorial/GacUI_Xml/UIRes/Instance_Window.bin differ diff --git a/Tutorial/README.md b/Tutorial/README.md index 6bb8e575..a7369234 100644 --- a/Tutorial/README.md +++ b/Tutorial/README.md @@ -29,20 +29,20 @@ GacUI tutorials and the plan * **Windows7Skin**: * **Windows8Skin**: * GacUI_Xml - * **Instance_Window**: Create a window. - * **Instance_MultipleWindows**: Create multiple windows. - * **Instance_Control**: Create a control. - * **Binding_Uri**: Using -uri binding. - * **Binding_Eval**: Using -eval binding. - * **Binding_Bind**: Using -bind binding. - * **Binding_Format**: Using -format binding. - * **Binding_ViewModel**: Binding to view model. - * **Event_Cpp**:Handling event in C++. (developing) - * **Event_Script**:Handling event in Workflow script. (developing) - * **Event_ViewModel**:Handling event in view model. (developing) - * **Member_ViewModel**:Adding view model to window. (developing) - * **Member_Property**:Adding property to window. (developing) - * **Member_State**:Adding state to window. (developing) + * **Instance_Window**: Create a window. + * **Instance_MultipleWindows**: Create multiple windows. + * **Instance_Control**: Create a control. + * **Binding_Uri**: Using -uri binding. + * **Binding_Eval**: Using -eval binding. + * **Binding_Bind**: Using -bind binding. + * **Binding_Format**: Using -format binding. + * **Binding_ViewModel**: Binding to view model. + * **Event_Cpp**:Handling event in C++. + * **Event_Script**:Handling event in Workflow script. + * **Event_ViewModel**:Handling event in view model. + * **Member_ViewModel**:Adding view model to window. (developing) + * **Member_Property**:Adding property to window. (developing) + * **Member_State**:Adding state to window. (developing) * **InheritableCustomControl** * **VisualState**: * **StateMachine**: