diff --git a/TODO.md b/TODO.md index d7c1717c..791e0256 100644 --- a/TODO.md +++ b/TODO.md @@ -44,34 +44,46 @@ https://zhuanlan.zhihu.com/p/33778843 ## GacUI #### Before 1.0 -- [ ] Redesign ToolstripMenu so that toolstrip items can be managed by an item source - - [ ] `GuiToolstripCollection` remove the space of an item if its `Visible` property is false +- [x] Redesign ToolstripMenu so that toolstrip items can be managed by an item source + - [x] `GuiToolstripCollection` remove the space of an item if its `Visible` property is false - [x] `GuiToolstripGroupContainer` insert splitters between items - [x] `SplitterTemplate` property - [x] `ToolstripItems` (default) property - [x] `GuiToolstripGroup` insert multiple items in one control - - [ ] ItemTemplate property - [x] `ToolstripItems` (default) property - - [ ] `AutoVisible` property (set to true (default) will keep `Visible = ToolstripItems.Count() > 0`) - - [ ] ``, `` (set `ItemTemplate` property) - - [ ] `GuiToolstripGroupBinder` - - `Commands` property - - `OwnCommands` constructor argument, set to true so that - - The binder will maintain lifecycles for commands - - The binder will register / unregister commands - - `ToolstripGroups` (default) property\ - - [ ] `` and `` tags -- [ ] Real visual state: different layouts / different images in different sizes -- [ ] Add and query services from controls -- [ ] Demo: DocumentEditor - - [ ] Manually crafted Ribbon +- [ ] `` and `` tags +- [x] Real visual state: different layouts / different images in different sizes + - [ ] `GuiResponsiveContainer` control to trigger level switching + - [x] GuiResponsiveLayoutCompositionBase + - [x] GuiResponsiveLayoutViewComposition + Explicitly define views for different size level, with shared item, views should be `GuiResponsiveLayoutCompositionBase` + - [x] GuiResponsiveLayoutGroupComposition + All child `GuiResponsiveLayoutCompositionBase` transform at the same time + - [x] GuiResponsiveLayoutStackComposition + All child `GuiResponsiveLayoutCompositionBase` transform one by one + - [x] GuiFixedLayoutComposition + No transformation +- [ ] Add simple demo for responsive layout to FullControlTest - [ ] Demo: TextEditor - [ ] Use toolstrip group instead of splitter - [ ] Recently opened files in both menu and toolbar - [ ] **Update Release** +- [ ] Demo: TriplePhaseImageButton + - [ ] Add TemplateContext(Changed) property to both Control and Template +- [ ] Locale awared text resource with `str://` protocol +- [ ] **Update Release** +- [ ] Add and query services from controls +- [ ] Demo: DocumentEditor + - [ ] Manually crafted Ribbon + - [ ] Big version of toolstrip buttons / Button groups + - [ ] Label with icon and another editor control + - [ ] Multiple toolstrip panel + - [ ] Preview list box + - [ ] Ribbon Group with expand button + - [ ] Ribbon tab with home button +- [ ] **Update Release** - [ ] Normal text box supports surrogate pairs like document viewer - [ ] RTF / HTML clipboard format for document viewer -- [ ] Locale awared text resource with `str://` protocol - [ ] Demo: DocumentEditor - [ ] Load / Save - [ ] **Update Release** diff --git a/Tutorial/GacUI_Windows/Direct2DClock.sln b/Tutorial/GacUI_Windows/Direct2DClock.sln new file mode 100644 index 00000000..94463284 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock.sln @@ -0,0 +1,44 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2027 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Direct2DClock", "Direct2DClock\Direct2DClock.vcxproj", "{9EB0726A-AA9E-4372-81F0-68AD18E82CCB}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{A9A7E9AB-319E-4AA6-B2E7-D551B28A485B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GacUILite", "..\Lib\GacUILite\GacUILite.vcxproj", "{96C559CA-9718-4BEC-A053-28A0AB6A8CA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Debug|x64.ActiveCfg = Debug|x64 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Debug|x64.Build.0 = Debug|x64 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Debug|x86.ActiveCfg = Debug|Win32 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Debug|x86.Build.0 = Debug|Win32 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Release|x64.ActiveCfg = Release|x64 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Release|x64.Build.0 = Release|x64 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Release|x86.ActiveCfg = Release|Win32 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB}.Release|x86.Build.0 = Release|Win32 + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Debug|x64.ActiveCfg = Debug|Win32 + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Debug|x86.ActiveCfg = Debug|Win32 + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Debug|x86.Build.0 = Debug|Win32 + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Release|x64.ActiveCfg = Release|Win32 + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Release|x86.ActiveCfg = Release|Win32 + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {96C559CA-9718-4BEC-A053-28A0AB6A8CA2} = {A9A7E9AB-319E-4AA6-B2E7-D551B28A485B} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B1695089-4980-4B45-8BFD-9E55CA064276} + EndGlobalSection +EndGlobal diff --git a/Tutorial/GacUI_Windows/Direct2DClock/AnimationControl.cpp b/Tutorial/GacUI_Windows/Direct2DClock/AnimationControl.cpp new file mode 100644 index 00000000..9e8cadf2 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/AnimationControl.cpp @@ -0,0 +1,123 @@ +#define GAC_HEADER_USE_NAMESPACE +#include "AnimationControl.h" +#include + +namespace demo +{ + struct AnimationControlMembers + { + DateTime lastUpdateTime; + + ComPtr borderBrush; + ComPtr hourBrush; + ComPtr minuteBrush; + ComPtr secondBrush; + }; + + void AnimationControl::GlobalTimer() + { + auto time = DateTime::LocalTime(); + if (time.totalMilliseconds - members->lastUpdateTime.totalMilliseconds >= 100) + { + members->lastUpdateTime = time; + if (auto renderer = element->GetRenderer()) + { + this->GetRelatedControlHost()->GetGraphicsHost()->RequestRender(); + } + } + } + + void AnimationControl::OnBeforeRenderTargetChanged(GuiGraphicsComposition* sender, D2DEventArgs& arguments) + { + members->borderBrush = nullptr; + members->hourBrush = nullptr; + members->minuteBrush = nullptr; + members->secondBrush = nullptr; + } + + void AnimationControl::OnAfterRenderTargetChanged(GuiGraphicsComposition* sender, D2DEventArgs& arguments) + { + if (!arguments.rt) return; + { + ID2D1SolidColorBrush* brush = nullptr; + arguments.rt->CreateSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 1.0f), &brush); + members->borderBrush = brush; + } + { + ID2D1SolidColorBrush* brush = nullptr; + arguments.rt->CreateSolidColorBrush(D2D1::ColorF(0.0f, 1.0f, 1.0f), &brush); + members->hourBrush = brush; + } + { + ID2D1SolidColorBrush* brush = nullptr; + arguments.rt->CreateSolidColorBrush(D2D1::ColorF(0.0f, 1.0f, 0.0f), &brush); + members->minuteBrush = brush; + } + { + ID2D1SolidColorBrush* brush = nullptr; + arguments.rt->CreateSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 0.0f), &brush); + members->secondBrush = brush; + } + } + + void AnimationControl::OnRendering(GuiGraphicsComposition* sender, D2DEventArgs& arguments) + { + auto rt = arguments.rt; + if (!rt) return; + 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()); + 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()); + } + + auto time = DateTime::LocalTime(); + { + 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()); + } + { + 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()); + } + { + 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()); + } + } + + AnimationControl::AnimationControl() + :GuiControl(theme::ThemeName::CustomControl) + , members(MakePtr()) + { + element = D2DElement::Create(); + element->BeforeRenderTargetChanged.AttachMethod(this, &AnimationControl::OnBeforeRenderTargetChanged); + element->AfterRenderTargetChanged.AttachMethod(this, &AnimationControl::OnAfterRenderTargetChanged); + element->Rendering.AttachMethod(this, &AnimationControl::OnRendering); + { + auto bounds = new GuiBoundsComposition(); + bounds->SetAlignmentToParent(Margin(0, 0, 0, 0)); + bounds->SetOwnedElement(element); + GetContainerComposition()->AddChild(bounds); + } + + members->lastUpdateTime = DateTime::LocalTime(); + + GetCurrentController()->CallbackService()->InstallListener(this); + } + + AnimationControl::~AnimationControl() + { + GetCurrentController()->CallbackService()->UninstallListener(this); + } +} \ No newline at end of file diff --git a/Tutorial/GacUI_Windows/Direct2DClock/AnimationControl.h b/Tutorial/GacUI_Windows/Direct2DClock/AnimationControl.h new file mode 100644 index 00000000..5016aaaf --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/AnimationControl.h @@ -0,0 +1,41 @@ +#pragma once + +#include + +namespace vl +{ + namespace presentation + { + namespace elements + { + struct GuiDirect2DElementEventArgs; + class GuiDirect2DElement; + } + } +} + +namespace demo +{ + struct AnimationControlMembers; + + class AnimationControl + : public vl::presentation::controls::GuiControl + , protected vl::presentation::INativeControllerListener + { + using D2DElement = vl::presentation::elements::GuiDirect2DElement; + using D2DEventArgs = vl::presentation::elements::GuiDirect2DElementEventArgs; + using GuiGraphicsComposition = vl::presentation::compositions::GuiGraphicsComposition; + + protected: + vl::Ptr members; + D2DElement* element; + + void GlobalTimer()override; + void OnBeforeRenderTargetChanged(GuiGraphicsComposition* sender, D2DEventArgs& arguments); + void OnAfterRenderTargetChanged(GuiGraphicsComposition* sender, D2DEventArgs& arguments); + void OnRendering(GuiGraphicsComposition* sender, D2DEventArgs& arguments); + public: + AnimationControl(); + ~AnimationControl(); + }; +} \ No newline at end of file diff --git a/Tutorial/GacUI_Windows/Direct2DClock/Direct2DClock.vcxproj b/Tutorial/GacUI_Windows/Direct2DClock/Direct2DClock.vcxproj new file mode 100644 index 00000000..1bca6e05 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/Direct2DClock.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + {96c559ca-9718-4bec-a053-28a0ab6a8ca2} + + + + 15.0 + {9EB0726A-AA9E-4372-81F0-68AD18E82CCB} + Win32Proj + Direct2DClock + 10.0.16299.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\..\Import;$(IncludePath) + + + true + $(ProjectDir)..\..\..\Import;$(IncludePath) + + + false + $(ProjectDir)..\..\..\Import;$(IncludePath) + + + false + $(ProjectDir)..\..\..\Import;$(IncludePath) + + + + NotUsing + Level3 + Disabled + true + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION + true + + + Windows + true + + + + + NotUsing + Level3 + Disabled + true + _DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION + true + + + Windows + true + + + + + NotUsing + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION + true + + + Windows + true + true + true + + + + + NotUsing + Level3 + MaxSpeed + true + true + true + NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION + true + + + Windows + true + true + true + + + + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Windows/Direct2DClock/Direct2DClock.vcxproj.filters b/Tutorial/GacUI_Windows/Direct2DClock/Direct2DClock.vcxproj.filters new file mode 100644 index 00000000..a94d0aca --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/Direct2DClock.vcxproj.filters @@ -0,0 +1,53 @@ + + + + + {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 + + + {c45e71ee-e33d-4003-8481-8914536da541} + + + + + Source Files + + + UI + + + UI + + + Source Files + + + + + Resource Files + + + + + UI + + + UI + + + UI + + + Source Files + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Windows/Direct2DClock/Main.cpp b/Tutorial/GacUI_Windows/Direct2DClock/Main.cpp new file mode 100644 index 00000000..9496b2a8 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/Main.cpp @@ -0,0 +1,19 @@ +#define GAC_HEADER_USE_NAMESPACE +#include "UI/Source/Demo.h" + +using namespace vl::collections; +using namespace vl::stream; +using namespace vl::reflection::description; +using namespace demo; + +void GuiMain() +{ + { + FileStream fileStream(L"../UIRes/Direct2DClock.bin", FileStream::ReadOnly); + auto resource = GuiResource::LoadPrecompiledBinary(fileStream); + GetResourceManager()->SetResource(L"Resource", resource); + } + MainWindow window; + window.MoveToScreenCenter(); + GetApplication()->Run(&window); +} \ No newline at end of file diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Resource.xml b/Tutorial/GacUI_Windows/Direct2DClock/UI/Resource.xml new file mode 100644 index 00000000..af1f625e --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Resource.xml @@ -0,0 +1,33 @@ + + + + Source + ..\..\UIRes\Direct2DClock.bin + ../../AnimationControl.h + GacUIReflection.h + Demo + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/Demo.h b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/Demo.h new file mode 100644 index 00000000..3cd0ec2e --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/Demo.h @@ -0,0 +1,16 @@ +/*********************************************************************** +!!!!!! 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" +#include "MainWindow.h" + +#endif diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoPartialClasses.cpp new file mode 100644 index 00000000..a6beb198 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoPartialClasses.cpp @@ -0,0 +1,101 @@ +/*********************************************************************** +!!!!!! DO NOT MODIFY !!!!!! + +GacGen.exe Resource.xml + +This file is generated by Workflow compiler +https://github.com/vczh-libraries +***********************************************************************/ + +#include "Demo.h" +/* CodePack:BeginIgnore() */ +#ifndef VCZH_DEBUG_NO_REFLECTION +/* CodePack:ConditionOff(VCZH_DEBUG_NO_REFLECTION, DemoReflection.h) */ +#include "DemoReflection.h" +#endif +/* CodePack:EndIgnore() */ + +#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 + +#define GLOBAL_SYMBOL ::vl_workflow_global::Demo:: +#define GLOBAL_NAME ::vl_workflow_global::Demo::Instance(). +#define GLOBAL_OBJ &::vl_workflow_global::Demo::Instance() +#define USERIMPL(...) + +/*********************************************************************** +Global Variables +***********************************************************************/ + +BEGIN_GLOBAL_STORAGE_CLASS(vl_workflow_global_Demo) + vl_workflow_global::Demo instance; + INITIALIZE_GLOBAL_STORAGE_CLASS + FINALIZE_GLOBAL_STORAGE_CLASS +END_GLOBAL_STORAGE_CLASS(vl_workflow_global_Demo) + +namespace vl_workflow_global +{ +/*********************************************************************** +Global Functions +***********************************************************************/ + + Demo& Demo::Instance() + { + return Getvl_workflow_global_Demo().instance; + } +} + +/*********************************************************************** +Class (::demo::MainWindowConstructor) +***********************************************************************/ + +namespace demo +{ + void MainWindowConstructor::__vwsn_initialize_instance_(::demo::MainWindow* __vwsn_this_) + { + (this->self = __vwsn_this_); + { + ::vl::__vwsn::This(this->self)->SetClientSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = static_cast<::vl::vint>(800); __vwsn_temp__.y = static_cast<::vl::vint>(600); return __vwsn_temp__; }()); + } + { + ::vl::__vwsn::This(this->self)->SetText(::vl::WString(L"Direct2DClock", false)); + } + (this->animationBounds = new ::vl::presentation::compositions::GuiBoundsComposition()); + { + ::vl::__vwsn::This(this->animationBounds)->SetAlignmentToParent([&](){ ::vl::presentation::Margin __vwsn_temp__; __vwsn_temp__.left = static_cast<::vl::vint>(5); __vwsn_temp__.top = static_cast<::vl::vint>(5); __vwsn_temp__.right = (- static_cast<::vl::vint>(1)); __vwsn_temp__.bottom = (- static_cast<::vl::vint>(1)); return __vwsn_temp__; }()); + } + { + ::vl::__vwsn::This(this->animationBounds)->SetPreferredMinSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = static_cast<::vl::vint>(400); __vwsn_temp__.y = static_cast<::vl::vint>(400); return __vwsn_temp__; }()); + } + { + ::vl::__vwsn::This(::vl::__vwsn::This(this->self)->GetContainerComposition())->AddChild(static_cast<::vl::presentation::compositions::GuiGraphicsComposition*>(this->animationBounds)); + } + } + + MainWindowConstructor::MainWindowConstructor() + : self(static_cast<::demo::MainWindow*>(nullptr)) + , animationBounds(static_cast<::vl::presentation::compositions::GuiBoundsComposition*>(nullptr)) + { + } + +} +#undef GLOBAL_SYMBOL +#undef GLOBAL_NAME +#undef GLOBAL_OBJ +#undef USERIMPL + +#if defined( _MSC_VER) +#pragma warning(pop) +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#elif defined(__clang__) +#pragma clang diagnostic pop +#endif diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoPartialClasses.h b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoPartialClasses.h new file mode 100644 index 00000000..8f811694 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoPartialClasses.h @@ -0,0 +1,67 @@ +/*********************************************************************** +!!!!!! DO NOT MODIFY !!!!!! + +GacGen.exe Resource.xml + +This file is generated by Workflow compiler +https://github.com/vczh-libraries +***********************************************************************/ + +#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_DEMOPARTIALCLASSES +#define VCZH_WORKFLOW_COMPILER_GENERATED_DEMOPARTIALCLASSES + +#include "../../AnimationControl.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 + +namespace demo +{ + class MainWindowConstructor; + class MainWindow; + + class MainWindowConstructor : public ::vl::Object, public ::vl::reflection::Description + { +#ifndef VCZH_DEBUG_NO_REFLECTION + friend struct ::vl::reflection::description::CustomTypeDescriptorSelector; +#endif + protected: + ::demo::MainWindow* self; + ::vl::presentation::compositions::GuiBoundsComposition* animationBounds; + void __vwsn_initialize_instance_(::demo::MainWindow* __vwsn_this_); + public: + MainWindowConstructor(); + }; + +} +/*********************************************************************** +Global Variables and Functions +***********************************************************************/ + +namespace vl_workflow_global +{ + class Demo + { + public: + + static Demo& Instance(); + }; +} + +#if defined( _MSC_VER) +#pragma warning(pop) +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#elif defined(__clang__) +#pragma clang diagnostic pop +#endif + +#endif diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoReflection.cpp b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoReflection.cpp new file mode 100644 index 00000000..f1204c35 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoReflection.cpp @@ -0,0 +1,87 @@ +/*********************************************************************** +!!!!!! 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::MainWindow) + IMPL_CPP_TYPE_INFO(demo::MainWindowConstructor) + +#define _ , + BEGIN_CLASS_MEMBER(::demo::MainWindow) + CLASS_MEMBER_CONSTRUCTOR(::demo::MainWindow*(), NO_PARAMETER) + CLASS_MEMBER_METHOD(__vwsn_instance_ctor_, NO_PARAMETER) + CLASS_MEMBER_METHOD(InstallAnimationControl, NO_PARAMETER) + 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(animationBounds) + CLASS_MEMBER_FIELD(self) + END_CLASS_MEMBER(::demo::MainWindowConstructor) + +#undef _ + class DemoTypeLoader : public Object, public ITypeLoader + { + public: + void Load(ITypeManager* manager) + { + ADD_TYPE_INFO(::demo::MainWindow) + ADD_TYPE_INFO(::demo::MainWindowConstructor) + } + + void Unload(ITypeManager* manager) + { + } + }; +#endif + + bool LoadDemoTypes() + { +#ifndef VCZH_DEBUG_NO_REFLECTION + if (auto manager = GetGlobalTypeManager()) + { + return manager->AddTypeLoader(MakePtr()); + } +#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 diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoReflection.h b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoReflection.h new file mode 100644 index 00000000..5ce202bc --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/DemoReflection.h @@ -0,0 +1,57 @@ +/*********************************************************************** +!!!!!! 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::MainWindow) + DECL_TYPE_INFO(::demo::MainWindowConstructor) +#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 diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/MainWindow.cpp b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/MainWindow.cpp new file mode 100644 index 00000000..7614fec2 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/MainWindow.cpp @@ -0,0 +1,80 @@ +/*********************************************************************** +!!!!!! DO NOT MODIFY !!!!!! + +GacGen.exe Resource.xml + +This file is generated by Workflow compiler +https://github.com/vczh-libraries +***********************************************************************/ + +#include "Demo.h" +/* CodePack:BeginIgnore() */ +#ifndef VCZH_DEBUG_NO_REFLECTION +/* CodePack:ConditionOff(VCZH_DEBUG_NO_REFLECTION, DemoReflection.h) */ +#include "DemoReflection.h" +#endif +/* CodePack:EndIgnore() */ + +#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 + +#define GLOBAL_SYMBOL ::vl_workflow_global::Demo:: +#define GLOBAL_NAME ::vl_workflow_global::Demo::Instance(). +#define GLOBAL_OBJ &::vl_workflow_global::Demo::Instance() +#define USERIMPL(...) + +/*********************************************************************** +Class (::demo::MainWindow) +***********************************************************************/ + +namespace demo +{ + USERIMPL(/* ::demo::MainWindow */) + void MainWindow::InstallAnimationControl() + { + auto animationControl = new AnimationControl; + animationControl->GetBoundsComposition()->SetAlignmentToParent(vl::presentation::Margin(0, 0, 0, 0)); + animationBounds->AddChild(animationControl->GetBoundsComposition()); + } + + MainWindow::MainWindow() + : ::vl::presentation::controls::GuiWindow(::vl::presentation::theme::ThemeName::Window) + { + auto __vwsn_resource_ = ::vl::__vwsn::This(::vl::presentation::GetResourceManager())->GetResourceFromClassName(::vl::WString(L"demo::MainWindow", false)); + auto __vwsn_resolver_ = ::vl::Ptr<::vl::presentation::GuiResourcePathResolver>(new ::vl::presentation::GuiResourcePathResolver(__vwsn_resource_, ::vl::__vwsn::This(__vwsn_resource_.Obj())->GetWorkingDirectory())); + ::vl::__vwsn::This(this)->SetResourceResolver(__vwsn_resolver_); + ::vl::__vwsn::This(this)->__vwsn_initialize_instance_(this); + this->__vwsn_instance_ctor_(); + } + + void MainWindow::__vwsn_instance_ctor_() + { + ::vl::__vwsn::This(this->self)->InstallAnimationControl(); + } + + MainWindow::~MainWindow() + { + this->FinalizeInstanceRecursively(static_cast<::vl::presentation::controls::GuiControlHost*>(this)); + } + +} +#undef GLOBAL_SYMBOL +#undef GLOBAL_NAME +#undef GLOBAL_OBJ +#undef USERIMPL + +#if defined( _MSC_VER) +#pragma warning(pop) +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#elif defined(__clang__) +#pragma clang diagnostic pop +#endif diff --git a/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/MainWindow.h b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/MainWindow.h new file mode 100644 index 00000000..0be29bb8 --- /dev/null +++ b/Tutorial/GacUI_Windows/Direct2DClock/UI/Source/MainWindow.h @@ -0,0 +1,51 @@ +/*********************************************************************** +!!!!!! DO NOT MODIFY !!!!!! + +GacGen.exe Resource.xml + +This file is generated by Workflow compiler +https://github.com/vczh-libraries +***********************************************************************/ + +#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_MAINWINDOW +#define VCZH_WORKFLOW_COMPILER_GENERATED_MAINWINDOW + +#include "DemoPartialClasses.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 + +namespace demo +{ + class MainWindow : public ::vl::presentation::controls::GuiWindow, public ::demo::MainWindowConstructor, public ::vl::reflection::Description + { + friend class ::demo::MainWindowConstructor; +#ifndef VCZH_DEBUG_NO_REFLECTION + friend struct ::vl::reflection::description::CustomTypeDescriptorSelector; +#endif + private: + void InstallAnimationControl(); + public: + MainWindow(); + void __vwsn_instance_ctor_(); + ~MainWindow(); + }; + +} +#if defined( _MSC_VER) +#pragma warning(pop) +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#elif defined(__clang__) +#pragma clang diagnostic pop +#endif + +#endif diff --git a/Tutorial/GacUI_Windows/UIRes/Direct2DClock.bin b/Tutorial/GacUI_Windows/UIRes/Direct2DClock.bin new file mode 100644 index 00000000..b7b654f0 Binary files /dev/null and b/Tutorial/GacUI_Windows/UIRes/Direct2DClock.bin differ