From 2551dc1e03add21157c55df279883de433fd88a1 Mon Sep 17 00:00:00 2001 From: vczh Date: Tue, 5 Jan 2016 21:33:13 -0800 Subject: [PATCH] Create GacUI_Controls/TextEditor demo --- Tutorial/Codegen.bat | 3 + Tutorial/GacUI_Controls/GacUI_Controls.sln | 6 ++ Tutorial/GacUI_Controls/TextEditor/Main.cpp | 23 ++++ .../TextEditor/TextEditor.vcxproj | 101 ++++++++++++++++++ .../TextEditor/TextEditor.vcxproj.filters | 41 +++++++ .../GacUI_Controls/TextEditor/UI/Codegen.bat | 1 + .../GacUI_Controls/TextEditor/UI/Resource.xml | 24 +++++ .../TextEditor/UI/Source/Demo.h | 16 +++ .../UI/Source/DemoPartialClasses.cpp | 80 ++++++++++++++ .../TextEditor/UI/Source/DemoPartialClasses.h | 74 +++++++++++++ Tutorial/GacUI_Controls/UIRes/TextEditor.bin | Bin 0 -> 9363 bytes 11 files changed, 369 insertions(+) create mode 100644 Tutorial/GacUI_Controls/TextEditor/Main.cpp create mode 100644 Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj create mode 100644 Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj.filters create mode 100644 Tutorial/GacUI_Controls/TextEditor/UI/Codegen.bat create mode 100644 Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml create mode 100644 Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h create mode 100644 Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp create mode 100644 Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h create mode 100644 Tutorial/GacUI_Controls/UIRes/TextEditor.bin diff --git a/Tutorial/Codegen.bat b/Tutorial/Codegen.bat index 7b45912d..4f677dae 100644 --- a/Tutorial/Codegen.bat +++ b/Tutorial/Codegen.bat @@ -27,4 +27,7 @@ pushd GacUI_Controls pushd ContainersAndButtons\UI call Codegen.bat popd +pushd TextEditor\UI +call Codegen.bat +popd popd \ No newline at end of file diff --git a/Tutorial/GacUI_Controls/GacUI_Controls.sln b/Tutorial/GacUI_Controls/GacUI_Controls.sln index 6858a865..afd7af6e 100644 --- a/Tutorial/GacUI_Controls/GacUI_Controls.sln +++ b/Tutorial/GacUI_Controls/GacUI_Controls.sln @@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUI", "..\Lib\GacUI\GacUI EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUILite", "..\Lib\GacUILite\GacUILite.vcxproj", "{96C559CA-9718-4BEC-A053-28A0AB6A8CA2}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TextEditor", "TextEditor\TextEditor.vcxproj", "{66069A5E-F697-42E2-8D9E-7D6E82019838}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -41,6 +43,10 @@ Global {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Debug|Win32.Build.0 = Debug|Win32 {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Release|Win32.ActiveCfg = Release|Win32 {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Release|Win32.Build.0 = Release|Win32 + {66069A5E-F697-42E2-8D9E-7D6E82019838}.Debug|Win32.ActiveCfg = Debug|Win32 + {66069A5E-F697-42E2-8D9E-7D6E82019838}.Debug|Win32.Build.0 = Debug|Win32 + {66069A5E-F697-42E2-8D9E-7D6E82019838}.Release|Win32.ActiveCfg = Release|Win32 + {66069A5E-F697-42E2-8D9E-7D6E82019838}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tutorial/GacUI_Controls/TextEditor/Main.cpp b/Tutorial/GacUI_Controls/TextEditor/Main.cpp new file mode 100644 index 00000000..49da4924 --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/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/TextEditor.bin", FileStream::ReadOnly); + auto resource = GuiResource::LoadPrecompiledBinary(fileStream, errors); + GetInstanceLoaderManager()->SetResource(L"Resource", resource); + } + demo::MainWindow window; + window.MoveToScreenCenter(); + GetApplication()->Run(&window); +} \ No newline at end of file diff --git a/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj new file mode 100644 index 00000000..02fb0e82 --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj @@ -0,0 +1,101 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {66069A5E-F697-42E2-8D9E-7D6E82019838} + Win32Proj + TextEditor + + + + 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_Controls/TextEditor/TextEditor.vcxproj.filters b/Tutorial/GacUI_Controls/TextEditor/TextEditor.vcxproj.filters new file mode 100644 index 00000000..9a654f64 --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/TextEditor.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 + + + {da083a3e-40d5-4084-9b00-ea95886358e4} + + + + + Source Files + + + UI + + + + + Resource Files + + + + + UI + + + UI + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Codegen.bat b/Tutorial/GacUI_Controls/TextEditor/UI/Codegen.bat new file mode 100644 index 00000000..27f6654b --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Codegen.bat @@ -0,0 +1 @@ +..\..\..\..\Tools\GacGen.exe Resource.xml \ No newline at end of file diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml b/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml new file mode 100644 index 00000000..0ca6d6d0 --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Resource.xml @@ -0,0 +1,24 @@ + + + + + Source + GacUIReflection.h + Demo + + + + ..\..\UIRes + TextEditor.bin + + + + + + + + + + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h b/Tutorial/GacUI_Controls/TextEditor/UI/Source/Demo.h new file mode 100644 index 00000000..febeba0f --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/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_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp new file mode 100644 index 00000000..aa0483a1 --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/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_Controls/TextEditor/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h new file mode 100644 index 00000000..8088a85f --- /dev/null +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.h @@ -0,0 +1,74 @@ +/*********************************************************************** +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: + + 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::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_Controls/UIRes/TextEditor.bin b/Tutorial/GacUI_Controls/UIRes/TextEditor.bin new file mode 100644 index 0000000000000000000000000000000000000000..95c36db237c750bac10c0bc3a68082f0738e1f84 GIT binary patch literal 9363 zcmeHNNsn7a5Uvo`u!vO%f?#5?WDK#gN@y4?5hpT1N@C$G7cPVCnON~Sqp=4_fIA`= zKtduHPH^GIg#&li8xlvj6TyW)fcdJsKKr@md6h@XNb@YedR<-BRrU4au72Jv@w(mU zIjPBe(w4ied`g&3H=jD{V39fongH#)K)Lu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