diff --git a/Import/GacUI.Windows.cpp b/Import/GacUI.Windows.cpp index f67c98f7..4c61592f 100644 --- a/Import/GacUI.Windows.cpp +++ b/Import/GacUI.Windows.cpp @@ -4198,86 +4198,102 @@ namespace vl using namespace collections; /*********************************************************************** -IMPLEMENT_BRUSH_ELEMENT_RENDERER +GuiDirect2DElementRendererBase ***********************************************************************/ -#define IMPLEMENT_BRUSH_ELEMENT_RENDERER(TRENDERER)\ - void TRENDERER::InitializeInternal()\ - {\ - }\ - void TRENDERER::FinalizeInternal()\ - {\ - DestroyBrush(renderTarget);\ - }\ - void TRENDERER::RenderTargetChangedInternal(IWindowsDirect2DRenderTarget* oldRenderTarget, IWindowsDirect2DRenderTarget* newRenderTarget)\ - {\ - DestroyBrush(oldRenderTarget);\ - CreateBrush(newRenderTarget);\ - }\ - TRENDERER::TRENDERER()\ - {\ - }\ - void TRENDERER::Render(Rect bounds)\ - -#define IMPLEMENT_BRUSH_ELEMENT_RENDERER_SOLID_COLOR_BRUSH(TRENDERER)\ - void TRENDERER::CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget)\ - {\ - if(_renderTarget)\ - {\ - oldColor=element->GetColor();\ - brush=_renderTarget->CreateDirect2DBrush(oldColor);\ - }\ - }\ - void TRENDERER::DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget)\ - {\ - if(_renderTarget && brush)\ - {\ - _renderTarget->DestroyDirect2DBrush(oldColor);\ - brush=0;\ - }\ - }\ - void TRENDERER::OnElementStateChanged()\ - {\ - if(renderTarget)\ - {\ - Color color=element->GetColor();\ - if(oldColor!=color)\ - {\ - DestroyBrush(renderTarget);\ - CreateBrush(renderTarget);\ - }\ - }\ - }\ - -#define IMPLEMENT_BRUSH_ELEMENT_RENDERER_LINEAR_GRADIENT_BRUSH(TRENDERER)\ - void TRENDERER::CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget)\ - {\ - if(_renderTarget)\ - {\ - oldColor=Pair(element->GetColor1(), element->GetColor2());\ - brush=_renderTarget->CreateDirect2DLinearBrush(oldColor.key, oldColor.value);\ - }\ - }\ - void TRENDERER::DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget)\ - {\ - if(_renderTarget && brush)\ - {\ - _renderTarget->DestroyDirect2DLinearBrush(oldColor.key, oldColor.value);\ - brush=0;\ - }\ - }\ - void TRENDERER::OnElementStateChanged()\ - {\ - if(renderTarget)\ - {\ - Pair color=Pair(element->GetColor1(), element->GetColor2());\ - if(oldColor!=color)\ - {\ - DestroyBrush(renderTarget);\ - CreateBrush(renderTarget);\ - }\ - }\ - }\ + template + void GuiDirect2DElementRendererBase::InitializeInternal() + { + } + + template + void GuiDirect2DElementRendererBase::FinalizeInternal() + { + static_cast(this)->DestroyBrush(this->renderTarget); + } + + template + void GuiDirect2DElementRendererBase::RenderTargetChangedInternal(IWindowsDirect2DRenderTarget* oldRenderTarget, IWindowsDirect2DRenderTarget* newRenderTarget) + { + static_cast(this)->DestroyBrush(oldRenderTarget); + static_cast(this)->CreateBrush(newRenderTarget); + } + +/*********************************************************************** +GuiSolidBrushElementRendererBase +***********************************************************************/ + + template + void GuiSolidBrushElementRendererBase::CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget) + { + if (_renderTarget) + { + oldColor = this->element->GetColor(); + brush = _renderTarget->CreateDirect2DBrush(oldColor); + } + } + + template + void GuiSolidBrushElementRendererBase::DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget) + { + if (_renderTarget && brush) + { + _renderTarget->DestroyDirect2DBrush(oldColor); + brush = 0; + } + } + + template + void GuiSolidBrushElementRendererBase::OnElementStateChanged() + { + if (this->renderTarget) + { + Color color = this->element->GetColor(); + if (oldColor != color) + { + DestroyBrush(this->renderTarget); + CreateBrush(this->renderTarget); + } + } + } + +/*********************************************************************** +GuiGradientBrushElementRendererBase +***********************************************************************/ + + template + void GuiGradientBrushElementRendererBase::CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget) + { + if (_renderTarget) + { + oldColor = Pair(this->element->GetColor1(), this->element->GetColor2()); + brush = _renderTarget->CreateDirect2DLinearBrush(oldColor.key, oldColor.value); + } + } + + template + void GuiGradientBrushElementRendererBase::DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget) + { + if (_renderTarget && brush) + { + _renderTarget->DestroyDirect2DLinearBrush(oldColor.key, oldColor.value); + brush = 0; + } + } + + template + void GuiGradientBrushElementRendererBase::OnElementStateChanged() + { + if (this->renderTarget) + { + auto color = Pair(this->element->GetColor1(), this->element->GetColor2()); + if (oldColor != color) + { + DestroyBrush(this->renderTarget); + CreateBrush(this->renderTarget); + } + } + } /*********************************************************************** GuiSolidBorderElementRenderer @@ -4339,8 +4355,11 @@ GuiSolidBorderElementRenderer GuiSolidBorderElementRenderer ***********************************************************************/ - IMPLEMENT_BRUSH_ELEMENT_RENDERER_SOLID_COLOR_BRUSH(GuiSolidBorderElementRenderer) - IMPLEMENT_BRUSH_ELEMENT_RENDERER(GuiSolidBorderElementRenderer) + GuiSolidBorderElementRenderer::GuiSolidBorderElementRenderer() + { + } + + void GuiSolidBorderElementRenderer::Render(Rect bounds) { ID2D1RenderTarget* d2dRenderTarget = renderTarget->GetDirect2DRenderTarget(); auto shape = element->GetShape(); @@ -4546,9 +4565,12 @@ Gui3DSplitterElementRenderer /*********************************************************************** GuiSolidBackgroundElementRenderer ***********************************************************************/ - - IMPLEMENT_BRUSH_ELEMENT_RENDERER_SOLID_COLOR_BRUSH(GuiSolidBackgroundElementRenderer) - IMPLEMENT_BRUSH_ELEMENT_RENDERER(GuiSolidBackgroundElementRenderer) + + GuiSolidBackgroundElementRenderer::GuiSolidBackgroundElementRenderer() + { + } + + void GuiSolidBackgroundElementRenderer::Render(Rect bounds) { ID2D1RenderTarget* d2dRenderTarget=renderTarget->GetDirect2DRenderTarget(); auto shape = element->GetShape(); @@ -4584,8 +4606,11 @@ GuiSolidBackgroundElementRenderer GuiGradientBackgroundElementRenderer ***********************************************************************/ - IMPLEMENT_BRUSH_ELEMENT_RENDERER_LINEAR_GRADIENT_BRUSH(GuiGradientBackgroundElementRenderer) - IMPLEMENT_BRUSH_ELEMENT_RENDERER(GuiGradientBackgroundElementRenderer) + GuiGradientBackgroundElementRenderer::GuiGradientBackgroundElementRenderer() + { + } + + void GuiGradientBackgroundElementRenderer::Render(Rect bounds) { D2D1_POINT_2F points[2]; switch(element->GetDirection()) @@ -5497,6 +5522,7 @@ GuiColorizedTextElementRenderer void GuiColorizedTextElementRenderer::FinalizeInternal() { + element->SetCallback(nullptr); DestroyTextBrush(renderTarget); DestroyCaretBrush(renderTarget); @@ -5678,14 +5704,14 @@ GuiDirect2DElementRenderer { IDWriteFactory* fdw=GetWindowsDirect2DObjectProvider()->GetDirectWriteFactory(); ID2D1Factory* fd2d=GetWindowsDirect2DObjectProvider()->GetDirect2DFactory(); - renderTarget->PushClipper(bounds); + renderTarget->PushClipper(bounds, element); if(!renderTarget->IsClipperCoverWholeTarget()) { ID2D1RenderTarget* rt=renderTarget->GetDirect2DRenderTarget(); GuiDirect2DElementEventArgs arguments(element, rt, fdw, fd2d, bounds); element->Rendering.Execute(arguments); } - renderTarget->PopClipper(); + renderTarget->PopClipper(element); } } @@ -5731,10 +5757,10 @@ GuiDirect2DElement CachedResourceAllocator ***********************************************************************/ - class CachedSolidBrushAllocator - { - DEFINE_CACHED_RESOURCE_ALLOCATOR(Color, ComPtr) + typedef Pair ColorPair; + class CachedSolidBrushAllocator : public GuiCachedResourceAllocatorBase> + { IWindowsDirect2DRenderTarget* guiRenderTarget = nullptr; public: CachedSolidBrushAllocator() @@ -5756,11 +5782,8 @@ CachedResourceAllocator } }; - class CachedLinearBrushAllocator + class CachedLinearBrushAllocator : public GuiCachedResourceAllocatorBase> { - typedef Pair ColorPair; - DEFINE_CACHED_RESOURCE_ALLOCATOR(ColorPair, ComPtr) - IWindowsDirect2DRenderTarget* guiRenderTarget = nullptr; public: CachedLinearBrushAllocator() @@ -5806,11 +5829,8 @@ CachedResourceAllocator } }; - class CachedRadialBrushAllocator + class CachedRadialBrushAllocator : public GuiCachedResourceAllocatorBase> { - typedef Pair ColorPair; - DEFINE_CACHED_RESOURCE_ALLOCATOR(ColorPair, ComPtr) - IWindowsDirect2DRenderTarget* guiRenderTarget = nullptr; public: CachedRadialBrushAllocator() @@ -5856,10 +5876,8 @@ CachedResourceAllocator } }; - class CachedTextFormatAllocator + class CachedTextFormatAllocator : public GuiCachedResourceAllocatorBase> { - private: - DEFINE_CACHED_RESOURCE_ALLOCATOR(FontProperties, Ptr) public: static ComPtr CreateDirect2DFont(const FontProperties& fontProperties) @@ -5895,10 +5913,8 @@ CachedResourceAllocator } }; - class CachedCharMeasurerAllocator + class CachedCharMeasurerAllocator : public GuiCachedResourceAllocatorBase> { - DEFINE_CACHED_RESOURCE_ALLOCATOR(FontProperties, Ptr) - protected: class Direct2DCharMeasurer : public text::CharMeasurer { @@ -6116,7 +6132,7 @@ WindowsDirect2DRenderTarget return window->Convert(window->GetClientSize()); } - void AfterPushedClipper(Rect clipper, Rect validArea) override + void AfterPushedClipper(Rect clipper, Rect validArea, reflection::DescriptableObject* generator) override { d2dRenderTarget->PushAxisAlignedClip( D2D1::RectF((FLOAT)validArea.x1, (FLOAT)validArea.y1, (FLOAT)validArea.x2, (FLOAT)validArea.y2), @@ -6124,15 +6140,15 @@ WindowsDirect2DRenderTarget ); } - void AfterPushedClipperAndBecameInvalid(Rect clipper) override + void AfterPushedClipperAndBecameInvalid(Rect clipper, reflection::DescriptableObject* generator) override { } - void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) override + void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) override { } - void AfterPoppedClipper(Rect validArea, bool clipperExists) override + void AfterPoppedClipper(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) override { d2dRenderTarget->PopAxisAlignedClip(); } @@ -9885,13 +9901,14 @@ GuiColorizedTextElementRenderer void GuiColorizedTextElementRenderer::InitializeInternal() { auto resourceManager=GetWindowsGDIResourceManager(); - element->SetCallback(this); oldCaretColor=element->GetCaretColor(); caretPen=resourceManager->CreateGdiPen(oldCaretColor); + element->SetCallback(this); } void GuiColorizedTextElementRenderer::FinalizeInternal() { + element->SetCallback(nullptr); auto resourceManager=GetWindowsGDIResourceManager(); if(font) { @@ -10048,14 +10065,14 @@ GuiGDIElementRenderer { if(renderTarget) { - renderTarget->PushClipper(bounds); + renderTarget->PushClipper(bounds, element); if(!renderTarget->IsClipperCoverWholeTarget()) { WinDC* dc=renderTarget->GetDC(); GuiGDIElementEventArgs arguments(element, dc, bounds); element->Rendering.Execute(arguments); } - renderTarget->PopClipper(); + renderTarget->PopClipper(element); } } @@ -12623,21 +12640,21 @@ WindowsGDIRenderTarget return window->Convert(window->GetClientSize()); } - void AfterPushedClipper(Rect clipper, Rect validArea) override + void AfterPushedClipper(Rect clipper, Rect validArea, reflection::DescriptableObject* generator) override { ApplyClipper(validArea, true); } - void AfterPushedClipperAndBecameInvalid(Rect clipper) override + void AfterPushedClipperAndBecameInvalid(Rect clipper, reflection::DescriptableObject* generator) override { } - void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) override + void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) override { ApplyClipper(validArea, clipperExists); } - void AfterPoppedClipper(Rect validArea, bool clipperExists) override + void AfterPoppedClipper(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) override { ApplyClipper(validArea, clipperExists); } @@ -12657,9 +12674,8 @@ WindowsGDIRenderTarget CachedResourceAllocator ***********************************************************************/ - class CachedPenAllocator + class CachedPenAllocator : public GuiCachedResourceAllocatorBase> { - DEFINE_CACHED_RESOURCE_ALLOCATOR(Color, Ptr) public: Ptr CreateInternal(Color color) { @@ -12667,9 +12683,8 @@ CachedResourceAllocator } }; - class CachedBrushAllocator + class CachedBrushAllocator : public GuiCachedResourceAllocatorBase> { - DEFINE_CACHED_RESOURCE_ALLOCATOR(Color, Ptr) public: Ptr CreateInternal(Color color) { @@ -12677,9 +12692,8 @@ CachedResourceAllocator } }; - class CachedFontAllocator + class CachedFontAllocator : public GuiCachedResourceAllocatorBase> { - DEFINE_CACHED_RESOURCE_ALLOCATOR(FontProperties, Ptr) public: static Ptr CreateGdiFont(const FontProperties& value) { @@ -12693,10 +12707,8 @@ CachedResourceAllocator } }; - class CachedCharMeasurerAllocator + class CachedCharMeasurerAllocator : public GuiCachedResourceAllocatorBase> { - DEFINE_CACHED_RESOURCE_ALLOCATOR(FontProperties, Ptr) - protected: class GdiCharMeasurer : public text::CharMeasurer { diff --git a/Import/GacUI.Windows.h b/Import/GacUI.Windows.h index 7037ea92..ca2978b8 100644 --- a/Import/GacUI.Windows.h +++ b/Import/GacUI.Windows.h @@ -144,7 +144,8 @@ Raw API Rendering Element /// class GuiDirect2DElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiDirect2DElement, L"Direct2DElement") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"Direct2DElement"; protected: GuiDirect2DElement(); public: @@ -255,28 +256,53 @@ namespace vl { using namespace elements; -#define DEFINE_BRUSH_ELEMENT_RENDERER(TELEMENT, TRENDERER, TBRUSH, TBRUSHPROPERTY)\ - DEFINE_GUI_GRAPHICS_RENDERER(TELEMENT, TRENDERER, IWindowsDirect2DRenderTarget)\ - protected:\ - TBRUSHPROPERTY oldColor;\ - TBRUSH* brush = nullptr;\ - void CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget);\ - void DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget);\ - void InitializeInternal();\ - void FinalizeInternal();\ - void RenderTargetChangedInternal(IWindowsDirect2DRenderTarget* oldRenderTarget, IWindowsDirect2DRenderTarget* newRenderTarget);\ - public:\ - TRENDERER();\ - void Render(Rect bounds)override;\ - void OnElementStateChanged()override;\ + typedef collections::Pair ColorPair; + + template + class GuiDirect2DElementRendererBase : public GuiElementRendererBase + { + protected: + void InitializeInternal(); + void FinalizeInternal(); + void RenderTargetChangedInternal(IWindowsDirect2DRenderTarget* oldRenderTarget, IWindowsDirect2DRenderTarget* newRenderTarget); + public: + }; + + template + class GuiSolidBrushElementRendererBase : public GuiDirect2DElementRendererBase + { + protected: + Color oldColor; + TBrush* brush = nullptr; + + void CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget); + void DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget); + public: + + void OnElementStateChanged()override; + }; + + template + class GuiGradientBrushElementRendererBase : public GuiDirect2DElementRendererBase + { + protected: + ColorPair oldColor; + TBrush* brush = nullptr; + + void CreateBrush(IWindowsDirect2DRenderTarget* _renderTarget); + void DestroyBrush(IWindowsDirect2DRenderTarget* _renderTarget); + public: + + void OnElementStateChanged()override; + }; /*********************************************************************** Renderers ***********************************************************************/ - class GuiFocusRectangleElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiFocusRectangleElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiFocusRectangleElement, GuiFocusRectangleElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: ID2D1Effect* focusRectangleEffect = nullptr; @@ -289,14 +315,19 @@ Renderers void OnElementStateChanged()override; }; - class GuiSolidBorderElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiSolidBorderElementRenderer : public GuiSolidBrushElementRendererBase { - DEFINE_BRUSH_ELEMENT_RENDERER(GuiSolidBorderElement, GuiSolidBorderElementRenderer, ID2D1SolidColorBrush, Color) + friend class GuiElementRendererBase; + friend class GuiDirect2DElementRendererBase; + public: + GuiSolidBorderElementRenderer(); + + void Render(Rect bounds)override; }; - class Gui3DBorderElementRenderer : public Object, public IGuiGraphicsRenderer + class Gui3DBorderElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(Gui3DBorderElement, Gui3DBorderElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor1; Color oldColor2; @@ -315,9 +346,9 @@ Renderers void OnElementStateChanged()override; }; - class Gui3DSplitterElementRenderer : public Object, public IGuiGraphicsRenderer + class Gui3DSplitterElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(Gui3DSplitterElement, Gui3DSplitterElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor1; Color oldColor2; @@ -336,21 +367,29 @@ Renderers void OnElementStateChanged()override; }; - class GuiSolidBackgroundElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiSolidBackgroundElementRenderer : public GuiSolidBrushElementRendererBase { - DEFINE_BRUSH_ELEMENT_RENDERER(GuiSolidBackgroundElement, GuiSolidBackgroundElementRenderer, ID2D1SolidColorBrush, Color) + friend class GuiElementRendererBase; + friend class GuiDirect2DElementRendererBase; + public: + GuiSolidBackgroundElementRenderer(); + + void Render(Rect bounds)override; }; - class GuiGradientBackgroundElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiGradientBackgroundElementRenderer : public GuiGradientBrushElementRendererBase { - typedef collections::Pair ColorPair; - DEFINE_BRUSH_ELEMENT_RENDERER(GuiGradientBackgroundElement, GuiGradientBackgroundElementRenderer, ID2D1LinearGradientBrush, ColorPair) + friend class GuiElementRendererBase; + friend class GuiDirect2DElementRendererBase; + public: + GuiGradientBackgroundElementRenderer(); + + void Render(Rect bounds)override; }; - class GuiInnerShadowElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiInnerShadowElementRenderer : public GuiElementRendererBase { - typedef collections::Pair ColorPair; - DEFINE_GUI_GRAPHICS_RENDERER(GuiInnerShadowElement, GuiInnerShadowElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor; Color transparentColor; @@ -369,9 +408,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiSolidLabelElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiSolidLabelElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiSolidLabelElement, GuiSolidLabelElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor; FontProperties oldFont; @@ -399,9 +438,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiImageFrameElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiImageFrameElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiImageFrameElement, GuiImageFrameElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: ComPtr bitmap; @@ -417,9 +456,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiPolygonElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiPolygonElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiPolygonElement, GuiPolygonElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: Color oldBorderColor; Color oldBackgroundColor; @@ -442,9 +481,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiColorizedTextElementRenderer : public Object, public IGuiGraphicsRenderer, protected GuiColorizedTextElement::ICallback + class GuiColorizedTextElementRenderer : public GuiElementRendererBase, protected GuiColorizedTextElement::ICallback { - DEFINE_GUI_GRAPHICS_RENDERER(GuiColorizedTextElement, GuiColorizedTextElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; public: struct ColorItemResource @@ -490,9 +529,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiDirect2DElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiDirect2DElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiDirect2DElement, GuiDirect2DElementRenderer, IWindowsDirect2DRenderTarget) + friend class GuiElementRendererBase; protected: @@ -1410,7 +1449,8 @@ Raw API Rendering Element /// class GuiGDIElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiGDIElement, L"GDIElement") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"GDIElement"; protected: GuiGDIElement(); public: @@ -1503,9 +1543,9 @@ namespace vl Renderers ***********************************************************************/ - class GuiFocusRectangleElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiFocusRectangleElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiFocusRectangleElement, GuiFocusRectangleElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: Ptr pen; Ptr brush; @@ -1518,9 +1558,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiSolidBorderElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiSolidBorderElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiSolidBorderElement, GuiSolidBorderElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor; Ptr pen; @@ -1534,9 +1574,9 @@ Renderers void OnElementStateChanged()override; }; - class Gui3DBorderElementRenderer : public Object, public IGuiGraphicsRenderer + class Gui3DBorderElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(Gui3DBorderElement, Gui3DBorderElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor1; Color oldColor2; @@ -1551,9 +1591,9 @@ Renderers void OnElementStateChanged()override; }; - class Gui3DSplitterElementRenderer : public Object, public IGuiGraphicsRenderer + class Gui3DSplitterElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(Gui3DSplitterElement, Gui3DSplitterElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor1; Color oldColor2; @@ -1568,9 +1608,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiSolidBackgroundElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiSolidBackgroundElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiSolidBackgroundElement, GuiSolidBackgroundElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: Color oldColor; Ptr pen; @@ -1584,9 +1624,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiGradientBackgroundElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiGradientBackgroundElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiGradientBackgroundElement, GuiGradientBackgroundElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: void InitializeInternal(); void FinalizeInternal(); @@ -1596,9 +1636,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiInnerShadowElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiInnerShadowElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiInnerShadowElement, GuiInnerShadowElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: void InitializeInternal(); void FinalizeInternal(); @@ -1610,9 +1650,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiSolidLabelElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiSolidLabelElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiSolidLabelElement, GuiSolidLabelElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: FontProperties oldFont; Ptr font; @@ -1630,9 +1670,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiImageFrameElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiImageFrameElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiImageFrameElement, GuiImageFrameElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: Ptr bitmap; @@ -1648,9 +1688,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiPolygonElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiPolygonElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiPolygonElement, GuiPolygonElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: POINT* points; vint pointCount; @@ -1670,9 +1710,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiColorizedTextElementRenderer : public Object, public IGuiGraphicsRenderer, protected GuiColorizedTextElement::ICallback + class GuiColorizedTextElementRenderer : public GuiElementRendererBase, protected GuiColorizedTextElement::ICallback { - DEFINE_GUI_GRAPHICS_RENDERER(GuiColorizedTextElement, GuiColorizedTextElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; public: struct ColorItemResource @@ -1712,9 +1752,9 @@ Renderers void OnElementStateChanged()override; }; - class GuiGDIElementRenderer : public Object, public IGuiGraphicsRenderer + class GuiGDIElementRenderer : public GuiElementRendererBase { - DEFINE_GUI_GRAPHICS_RENDERER(GuiGDIElement, GuiGDIElementRenderer, IWindowsGDIRenderTarget) + friend class GuiElementRendererBase; protected: diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index 71ac091b..7d5dfc43 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -558,6 +558,7 @@ Helpers GuiApplication* application = nullptr; bool GACUI_UNITTEST_ONLY_SKIP_THREAD_LOCAL_STORAGE_DISPOSE_STORAGES = false; + bool GACUI_UNITTEST_ONLY_SKIP_TYPE_AND_PLUGIN_LOAD_UNLOAD = false; GuiApplication* GetApplication() { @@ -608,14 +609,16 @@ GuiApplicationMain void GuiApplicationInitialize() { - GetCurrentController()->InputService()->StartTimer(); - theme::InitializeTheme(); - + if (!GACUI_UNITTEST_ONLY_SKIP_TYPE_AND_PLUGIN_LOAD_UNLOAD) + { #ifndef VCZH_DEBUG_NO_REFLECTION - GetGlobalTypeManager()->Load(); + GetGlobalTypeManager()->Load(); #endif - GetPluginManager()->Load(); + GetPluginManager()->Load(); + } + theme::InitializeTheme(); + GetCurrentController()->InputService()->StartTimer(); { GuiApplication app; application = &app; @@ -626,19 +629,23 @@ GuiApplicationMain GuiFinalizeUtilities(); IAsyncScheduler::UnregisterDefaultScheduler(); IAsyncScheduler::UnregisterSchedulerForCurrentThread(); + application = nullptr; } - application = nullptr; - - DestroyPluginManager(); + GetCurrentController()->InputService()->StopTimer(); theme::FinalizeTheme(); + FinalizeGlobalStorage(); + + if (!GACUI_UNITTEST_ONLY_SKIP_TYPE_AND_PLUGIN_LOAD_UNLOAD) + { + DestroyPluginManager(); +#ifndef VCZH_DEBUG_NO_REFLECTION + ResetGlobalTypeManager(); +#endif + } if (!GACUI_UNITTEST_ONLY_SKIP_THREAD_LOCAL_STORAGE_DISPOSE_STORAGES) { ThreadLocalStorage::DisposeStorages(); } - FinalizeGlobalStorage(); -#ifndef VCZH_DEBUG_NO_REFLECTION - ResetGlobalTypeManager(); -#endif } } } @@ -1919,7 +1926,7 @@ GuiControlHost GuiControl* GuiControlHost::GetTooltipOwner(Point location) { - GuiGraphicsComposition* composition=this->GetBoundsComposition()->FindComposition(location, true); + GuiGraphicsComposition* composition=this->GetBoundsComposition()->FindVisibleComposition(location, true); if(composition) { GuiControl* control=composition->GetRelatedControl(); @@ -2084,12 +2091,24 @@ GuiControlHost SetNativeWindow(nullptr); } + void GuiControlHost::UpdateClientSize(Size value, bool updateNativeWindowOnly) + { + if (auto window = host->GetNativeWindow()) + { + host->GetNativeWindow()->SetClientSize(window->Convert(value)); + if (!updateNativeWindowOnly) + { + host->RequestUpdateSizeFromNativeWindow(); + } + } + } + void GuiControlHost::UpdateClientSizeAfterRendering(Size preferredSize, Size clientSize) { auto size = GetClientSize(); if (size != clientSize) { - SetClientSize(clientSize); + UpdateClientSize(clientSize, true); } } @@ -2347,10 +2366,7 @@ GuiControlHost void GuiControlHost::SetClientSize(Size value) { - if (auto window = host->GetNativeWindow()) - { - host->GetNativeWindow()->SetClientSize(window->Convert(value)); - } + UpdateClientSize(value, false); } NativePoint GuiControlHost::GetLocation() @@ -3734,9 +3750,9 @@ GuiGraphicsComposition } } - if (children.Count() > 0) + if (children.Count() > 0 || associatedHitTestResult != INativeWindowListener::NoDecision) { - renderTarget->PushClipper(bounds); + renderTarget->PushClipper(bounds, this); if (!renderTarget->IsClipperCoverWholeTarget()) { for (auto child : children) @@ -3744,7 +3760,7 @@ GuiGraphicsComposition child->Render(Size(bounds.x1, bounds.y1)); } } - renderTarget->PopClipper(); + renderTarget->PopClipper(this); } isRendering = false; } @@ -3765,7 +3781,7 @@ GuiGraphicsComposition return eventReceiver; } - GuiGraphicsComposition* GuiGraphicsComposition::FindComposition(Point location, bool forMouseEvent) + GuiGraphicsComposition* GuiGraphicsComposition::FindVisibleComposition(Point location, bool forMouseEvent) { if (!visible) return 0; Rect bounds = GetCachedBounds(); @@ -3778,7 +3794,7 @@ GuiGraphicsComposition GuiGraphicsComposition* child = children[i]; Rect childBounds = child->GetCachedBounds(); Point newLocation = location - Size(childBounds.x1, childBounds.y1); - GuiGraphicsComposition* childResult = child->FindComposition(newLocation, forMouseEvent); + GuiGraphicsComposition* childResult = child->FindVisibleComposition(newLocation, forMouseEvent); if (childResult) { return childResult; @@ -3888,6 +3904,24 @@ GuiGraphicsComposition return nullptr; } + INativeWindowListener::HitTestResult GuiGraphicsComposition::GetRelatedHitTestResult() + { + GuiGraphicsComposition* composition = this; + while (composition) + { + INativeWindowListener::HitTestResult result = composition->GetAssociatedHitTestResult(); + if (result == INativeWindowListener::NoDecision) + { + composition = composition->GetParent(); + } + else + { + return result; + } + } + return INativeWindowListener::NoDecision; + } + Margin GuiGraphicsComposition::GetInternalMargin() { return internalMargin; @@ -4388,7 +4422,7 @@ GuiGraphicsHost { hostRecord.nativeWindow->RequireCapture(); auto point = hostRecord.nativeWindow->Convert(NativePoint(info.x, info.y)); - mouseCaptureComposition = windowComposition->FindComposition(point, true); + mouseCaptureComposition = windowComposition->FindVisibleComposition(point, true); } } } @@ -4532,7 +4566,7 @@ GuiGraphicsHost else { auto point = hostRecord.nativeWindow->Convert(NativePoint(info.x, info.y)); - composition = windowComposition->FindComposition(point, true); + composition = windowComposition->FindVisibleComposition(point, true); } if (release) MouseUncapture(info); @@ -4571,18 +4605,9 @@ GuiGraphicsHost NativeRect clientBounds = hostRecord.nativeWindow->GetClientBoundsInScreen(); NativePoint clientLocation(location.x + bounds.x1 - clientBounds.x1, location.y + bounds.y1 - clientBounds.y1); auto point = hostRecord.nativeWindow->Convert(clientLocation); - GuiGraphicsComposition* hitComposition = windowComposition->FindComposition(point, true); - while (hitComposition) + if (auto hitComposition = windowComposition->FindVisibleComposition(point, true)) { - INativeWindowListener::HitTestResult result = hitComposition->GetAssociatedHitTestResult(); - if (result == INativeWindowListener::NoDecision) - { - hitComposition = hitComposition->GetParent(); - } - else - { - return result; - } + return hitComposition->GetRelatedHitTestResult(); } return INativeWindowListener::NoDecision; } @@ -4632,15 +4657,7 @@ GuiGraphicsHost void GuiGraphicsHost::Moved() { - NativeSize size = hostRecord.nativeWindow->GetClientSize(); - if (previousClientSize != size) - { - previousClientSize = size; - windowComposition->Layout_UpdateMinSize(); - windowComposition->Layout_UpdateBounds(hostRecord.nativeWindow->Convert(size)); - minSize = windowComposition->GetCachedMinSize(); - needRender = true; - } + RequestUpdateSizeFromNativeWindow(); } void GuiGraphicsHost::DpiChanged(bool preparing) @@ -4733,7 +4750,7 @@ GuiGraphicsHost CompositionList newCompositions; { auto point = hostRecord.nativeWindow->Convert(NativePoint(info.x, info.y)); - GuiGraphicsComposition* composition = windowComposition->FindComposition(point, true); + GuiGraphicsComposition* composition = windowComposition->FindVisibleComposition(point, true); while (composition) { newCompositions.Insert(0, composition); @@ -5069,6 +5086,19 @@ GuiGraphicsHost needRender = true; } + void GuiGraphicsHost::RequestUpdateSizeFromNativeWindow() + { + NativeSize size = hostRecord.nativeWindow->GetClientSize(); + if (previousClientSize != size) + { + previousClientSize = size; + windowComposition->Layout_UpdateMinSize(); + windowComposition->Layout_UpdateBounds(hostRecord.nativeWindow->Convert(size)); + minSize = windowComposition->GetCachedMinSize(); + needRender = true; + } + } + void GuiGraphicsHost::InvokeAfterRendering(const Func& proc, ProcKey key) { if (key.key == nullptr) @@ -13071,11 +13101,11 @@ ListViewColumnItemArranger::ColumnItemArrangerRepeatComposition arranger->FixColumnsAfterLayout(); } - Size ListViewColumnItemArranger::ColumnItemArrangerRepeatComposition::Layout_CalculateTotalSize() + void ListViewColumnItemArranger::ColumnItemArrangerRepeatComposition::Layout_CalculateTotalSize(Size& full, Size& minimum) { - auto size = TBase::ArrangerRepeatComposition::Layout_CalculateTotalSize(); - size.x += arranger->SplitterWidth; - return size; + TBase::ArrangerRepeatComposition::Layout_CalculateTotalSize(full, minimum); + full.x += arranger->SplitterWidth; + minimum.x += arranger->SplitterWidth; } ListViewColumnItemArranger::ColumnItemArrangerRepeatComposition::ColumnItemArrangerRepeatComposition(ListViewColumnItemArranger* _arranger) @@ -17388,6 +17418,10 @@ namespace vl } templates.Add(name, theme); + if (!first) + { + first = theme.Obj(); + } if (last) { last->next = theme.Obj(); @@ -25526,9 +25560,10 @@ GalleryItemArrangerRepeatComposition itemWidth = 1; } - Size GalleryItemArrangerRepeatComposition::Layout_CalculateTotalSize() + void GalleryItemArrangerRepeatComposition::Layout_CalculateTotalSize(Size& full, Size& minimum) { - return Size(1, 1); + full = Size(1, 1); + minimum = Size(1, 1); } GalleryItemArrangerRepeatComposition::GalleryItemArrangerRepeatComposition(GuiBindableRibbonGalleryList* _owner) @@ -27992,7 +28027,7 @@ GuiVirtualRepeatCompositionBase } else if (count > visibleCount) { - vint deltaA = expectedSize - count * itemSize; + vint deltaA = expectedSize - visibleCount * itemSize; vint deltaB = itemSize - deltaA; if (deltaB < deltaA) { @@ -28015,6 +28050,14 @@ GuiVirtualRepeatCompositionBase DeleteStyleInternal(style); } + void GuiVirtualRepeatCompositionBase::UpdateFullSize() + { + Size fullSize, minimumSize; + Layout_CalculateTotalSize(fullSize, minimumSize); + realFullSize = axis->VirtualSizeToRealSize(fullSize); + realMinimumFullSize = axis->VirtualSizeToRealSize(minimumSize); + } + void GuiVirtualRepeatCompositionBase::OnViewChangedInternal(Rect oldBounds, Rect newBounds, bool forceUpdateTotalSize) { bool needToUpdateTotalSize = forceUpdateTotalSize; @@ -28091,7 +28134,7 @@ GuiVirtualRepeatCompositionBase if (needToUpdateTotalSize) { - realFullSize = axis->VirtualSizeToRealSize(Layout_CalculateTotalSize()); + UpdateFullSize(); TotalSizeChanged.Execute(GuiEventArgs(this)); AdoptedSizeInvalidated.Execute(GuiEventArgs(this)); } @@ -28132,7 +28175,7 @@ GuiVirtualRepeatCompositionBase Size GuiVirtualRepeatCompositionBase::GetTotalSize() { - return realFullSize; + return useMinimumFullSize ? realMinimumFullSize : realFullSize; } bool GuiVirtualRepeatCompositionBase::GetUseMinimumTotalSize() @@ -28145,7 +28188,7 @@ GuiVirtualRepeatCompositionBase if (useMinimumFullSize != value) { useMinimumFullSize = value; - realFullSize = axis->VirtualSizeToRealSize(Layout_CalculateTotalSize()); + UpdateFullSize(); TotalSizeChanged.Execute(GuiEventArgs(this)); } } @@ -28309,13 +28352,19 @@ GuiRepeatFreeHeightItemComposition } } - Size GuiRepeatFreeHeightItemComposition::Layout_CalculateTotalSize() + void GuiRepeatFreeHeightItemComposition::Layout_CalculateTotalSize(Size& full, Size& minimum) { - if (heights.Count() == 0) return Size(0, 0); + if (heights.Count() == 0) + { + full = minimum = Size(0, 0); + return; + } + EnsureOffsetForItem(heights.Count()); - vint w = useMinimumFullSize ? 0 : viewBounds.Width(); + vint w = viewBounds.Width(); vint h = offsets[heights.Count() - 1] + heights[heights.Count() - 1]; - return Size(w, h); + full = Size(w, h); + minimum = Size(0, h); } void GuiRepeatFreeHeightItemComposition::OnItemChanged(vint start, vint oldCount, vint newCount) @@ -28516,13 +28565,20 @@ GuiRepeatFixedHeightItemComposition rowHeight = 1; } - Size GuiRepeatFixedHeightItemComposition::Layout_CalculateTotalSize() + void GuiRepeatFixedHeightItemComposition::Layout_CalculateTotalSize(Size& full, Size& minimum) { - if (!itemSource || itemSource->GetCount() == 0) return Size(0, 0); + if (!itemSource || itemSource->GetCount() == 0) + { + full = minimum = Size(0, 0); + return; + } - vint width = itemWidth; - if (width == -1) width = useMinimumFullSize ? 0 : viewBounds.Width(); - return Size(width, rowHeight * itemSource->GetCount() + itemYOffset); + vint w = itemWidth; + vint w1 = w == -1 ? viewBounds.Width() : w; + vint w2 = w == -1 ? 0 : w; + vint h = rowHeight * itemSource->GetCount() + itemYOffset; + full = Size(w1, h); + minimum = Size(w2, h); } vint GuiRepeatFixedHeightItemComposition::FindItemByVirtualKeyDirection(vint itemIndex, compositions::KeyDirection key) @@ -28727,16 +28783,22 @@ GuiRepeatFixedSizeMultiColumnItemComposition itemSize = Size(1, 1); } - Size GuiRepeatFixedSizeMultiColumnItemComposition::Layout_CalculateTotalSize() + void GuiRepeatFixedSizeMultiColumnItemComposition::Layout_CalculateTotalSize(Size& full, Size& minimum) { - if (!itemSource || itemSource->GetCount() == 0) return Size(0, 0); + if (!itemSource || itemSource->GetCount() == 0) + { + full = minimum = Size(0, 0); + return; + } vint rowItems = viewBounds.Width() / itemSize.x; if (rowItems < 1) rowItems = 1; vint rows = itemSource->GetCount() / rowItems; if (itemSource->GetCount() % rowItems) rows++; - return Size(itemSize.x * (useMinimumFullSize ? 1 : rowItems), itemSize.y * rows); + vint h = itemSize.y * rows; + full = Size(itemSize.x * rowItems, h); + minimum = Size(itemSize.x, h); } vint GuiRepeatFixedSizeMultiColumnItemComposition::FindItemByVirtualKeyDirection(vint itemIndex, compositions::KeyDirection key) @@ -28842,7 +28904,11 @@ GuiRepeatFixedSizeMultiColumnItemComposition if (!itemSource) return expectedSize; vint count = itemSource->GetCount(); vint columnCount = viewBounds.Width() / itemSize.x; - vint rowCount = viewBounds.Height() / itemSize.y; + vint rowCount = count / columnCount; + if (count % columnCount != 0) rowCount++; + + if (columnCount == 0) columnCount = 1; + if (rowCount == 0) rowCount = 1; return Size( CalculateAdoptedSize(expectedSize.x, columnCount, itemSize.x), CalculateAdoptedSize(expectedSize.y, rowCount, itemSize.y) @@ -29011,15 +29077,22 @@ GuiRepeatFixedHeightMultiColumnItemComposition itemHeight = 1; } - Size GuiRepeatFixedHeightMultiColumnItemComposition::Layout_CalculateTotalSize() + void GuiRepeatFixedHeightMultiColumnItemComposition::Layout_CalculateTotalSize(Size& full, Size& minimum) { - if (!itemSource || itemSource->GetCount() == 0) return Size(0, 0); + if (!itemSource || itemSource->GetCount() == 0) + { + full = minimum = Size(0, 0); + return; + } vint rows = viewBounds.Height() / itemHeight; if (rows < 1) rows = 1; vint columns = (itemSource->GetCount() + rows - 1) / rows; - return Size(viewBounds.Width() * (columns + 1), (useMinimumFullSize ? 0 : rows * itemHeight)); + vint w = viewBounds.Width() * (columns + 1); + vint h = rows * itemHeight; + full = Size(w, h); + minimum = Size(w, 0); } vint GuiRepeatFixedHeightMultiColumnItemComposition::FindItemByVirtualKeyDirection(vint itemIndex, compositions::KeyDirection key) @@ -29104,7 +29177,10 @@ GuiRepeatFixedHeightMultiColumnItemComposition { if (!itemSource) return expectedSize; vint count = itemSource->GetCount(); - return Size(expectedSize.x, CalculateAdoptedSize(expectedSize.y, count, itemHeight)); + vint rowCount = viewBounds.Height() / itemHeight; + if (rowCount > count) rowCount = count; + if (rowCount == 0) rowCount = 1; + return Size(expectedSize.x, CalculateAdoptedSize(expectedSize.y, rowCount, itemHeight)); } } } @@ -32080,7 +32156,7 @@ GuiDocumentElement::GuiDocumentElementRenderer { element->callback->OnStartRender(); } - renderTarget->PushClipper(bounds); + renderTarget->PushClipper(bounds, element); if(!renderTarget->IsClipperCoverWholeTarget()) { vint maxWidth=bounds.Width(); @@ -32145,7 +32221,7 @@ GuiDocumentElement::GuiDocumentElementRenderer y+=paragraphHeight+paragraphDistance; } } - renderTarget->PopClipper(); + renderTarget->PopClipper(element); if (element->callback) { element->callback->OnFinishRender(); @@ -33591,7 +33667,7 @@ GuiGraphicsRenderTarget return RenderTargetFailure::None; } - void GuiGraphicsRenderTarget::PushClipper(Rect clipper) + void GuiGraphicsRenderTarget::PushClipper(Rect clipper, reflection::DescriptableObject* generator) { if (clipperCoverWholeTargetCounter > 0) { @@ -33610,30 +33686,30 @@ GuiGraphicsRenderTarget if (currentClipper.x1 < currentClipper.x2 && currentClipper.y1 < currentClipper.y2) { clippers.Add(currentClipper); - AfterPushedClipper(clipper, currentClipper); + AfterPushedClipper(clipper, currentClipper, generator); } else { clipperCoverWholeTargetCounter++; - AfterPushedClipperAndBecameInvalid(clipper); + AfterPushedClipperAndBecameInvalid(clipper, generator); } } } - void GuiGraphicsRenderTarget::PopClipper() + void GuiGraphicsRenderTarget::PopClipper(reflection::DescriptableObject* generator) { if (clipperCoverWholeTargetCounter > 0) { clipperCoverWholeTargetCounter--; if (clipperCoverWholeTargetCounter == 0) { - AfterPoppedClipperAndBecameValid(GetClipper(), clippers.Count() > 0); + AfterPoppedClipperAndBecameValid(GetClipper(), clippers.Count() > 0, generator); } } else if (clippers.Count() > 0) { clippers.RemoveAt(clippers.Count() - 1); - AfterPoppedClipper(GetClipper(), clippers.Count() > 0); + AfterPoppedClipper(GetClipper(), clippers.Count() > 0, generator); } } @@ -36286,6 +36362,11 @@ GuiHostedController #undef ERROR_MESSAGE_PREFIX } + void GuiHostedController::RequestRefresh() + { + wmManager->needRefresh = true; + } + /*********************************************************************** GuiHostedController::INativeController ***********************************************************************/ @@ -37799,6 +37880,10 @@ GuiRemoteController::INativeWindowService { remoteProtocol->ProcessRemoteEvents(); remoteMessages.Submit(); + if (timerEnabled) + { + callbackService.InvokeGlobalTimer(); + } } return !connectionStopped; } @@ -37817,11 +37902,13 @@ GuiRemoteController (events) remoteScreenConfig = remoteMessages.RetrieveControllerGetScreenConfig(idGetScreenConfig); remoteMessages.ClearResponses(); remoteWindow.OnControllerConnect(); + resourceManager->OnControllerConnect(); } void GuiRemoteController::OnControllerDisconnect() { remoteWindow.OnControllerDisconnect(); + resourceManager->OnControllerDisconnect(); } void GuiRemoteController::OnControllerRequestExit() @@ -37940,18 +38027,20 @@ extern void GuiApplicationMain(); int SetupRemoteNativeController(vl::presentation::IGuiRemoteProtocol* protocol) { GuiRemoteController remoteController(protocol); - GuiRemoteGraphicsResourceManager remoteResourceManager(&remoteController); - GuiHostedController hostedController(&remoteController); + + GuiRemoteGraphicsResourceManager remoteResourceManager(&remoteController, &hostedController); GuiHostedGraphicsResourceManager hostedResourceManager(&hostedController, &remoteResourceManager); SetNativeController(&hostedController); SetGuiGraphicsResourceManager(&hostedResourceManager); remoteController.Initialize(); + remoteResourceManager.Initialize(); hostedController.Initialize(); GuiApplicationMain(); hostedController.Finalize(); + remoteResourceManager.Finalize(); remoteController.Finalize(); SetGuiGraphicsResourceManager(nullptr); @@ -38229,18 +38318,141 @@ GuiRemoteEvents (events) namespace vl::presentation::elements { + using namespace collections; + using namespace compositions; /*********************************************************************** GuiRemoteGraphicsRenderTarget ***********************************************************************/ + GuiRemoteGraphicsRenderTarget::HitTestResult GuiRemoteGraphicsRenderTarget::GetHitTestResultFromGenerator(reflection::DescriptableObject* generator) + { + if (auto composition = dynamic_cast(generator)) + { + auto hitTestResult = composition->GetAssociatedHitTestResult(); + if (hitTestResult != INativeWindowListener::NoDecision) + { + if (auto graphicsHost = composition->GetRelatedGraphicsHost()) + { + if (auto nativeWindow = graphicsHost->GetNativeWindow()) + { + if (nativeWindow == GetCurrentController()->WindowService()->GetMainWindow()) + { + return hitTestResult; + } + } + } + } + } + return INativeWindowListener::NoDecision; + } + void GuiRemoteGraphicsRenderTarget::StartRenderingOnNativeWindow() { + CHECK_ERROR(hitTestResults.Count() == 0, L"vl::presentation::elements::GuiRemoteGraphicsRenderTarget::StartRenderingOnNativeWindow()#Internal error: hit test result stack is not cleared."); canvasSize = remote->remoteWindow.GetClientSize(); + clipperValidArea = GetClipper(); + renderingBatchId++; + + if (destroyedRenderers.Count() > 0) + { + auto ids = Ptr(new List); + CopyFrom(*ids.Obj(), destroyedRenderers); + destroyedRenderers.Clear(); + remote->remoteMessages.RequestRendererDestroyed(ids); + } + + if (createdRenderers.Count() > 0) + { + auto ids = Ptr(new List); + for (auto id : createdRenderers) + { + ids->Add({ id,renderers[id]->GetRendererType() }); + } + createdRenderers.Clear(); + remote->remoteMessages.RequestRendererCreated(ids); + } + + for (auto [id, renderer] : renderers) + { + if (renderer->IsUpdated()) + { + renderer->SendUpdateElementMessages(false); + if (renderer->NeedUpdateMinSizeFromCache()) + { + if (!renderersAskingForCache.Contains(renderer)) + { + renderersAskingForCache.Add(renderer); + } + } + renderer->ResetUpdated(); + } + } + + remote->remoteMessages.RequestRendererBeginRendering(); } RenderTargetFailure GuiRemoteGraphicsRenderTarget::StopRenderingOnNativeWindow() { + CHECK_ERROR(hitTestResults.Count() == 0, L"vl::presentation::elements::GuiRemoteGraphicsRenderTarget::StartRenderingOnNativeWindow()#Internal error: hit test result stack is not cleared."); + vint idRendering = remote->remoteMessages.RequestRendererEndRendering(); + remote->remoteMessages.Submit(); + auto measuring = remote->remoteMessages.RetrieveRendererEndRendering(idRendering); + remote->remoteMessages.ClearResponses(); + + bool minSizeChanged = false; + + if (measuring.fontHeights) + { + for (auto&& fontHeight : *measuring.fontHeights.Obj()) + { + auto key = Tuple(fontHeight.fontFamily, fontHeight.fontSize); + if (!fontHeights.Keys().Contains(key)) + { + fontHeights.Add(key, fontHeight.height); + } + } + + // TODO: (enumerable) foreach:indexed(alterable(reversed)) + for (vint i = renderersAskingForCache.Count() - 1; i >= 0; i--) + { + auto renderer = renderersAskingForCache[i]; + auto oldMinSize = renderer->GetRenderer()->GetMinSize(); + renderer->TryFetchMinSizeFromCache(); + if (renderer->IsRenderedInLastBatch() && oldMinSize != renderer->GetRenderer()->GetMinSize()) + { + minSizeChanged = true; + } + if (!renderer->NeedUpdateMinSizeFromCache()) + { + renderersAskingForCache.RemoveAt(i); + } + } + } + + if (measuring.minSizes) + { + for (auto&& minSize : *measuring.minSizes.Obj()) + { + vint index = renderers.Keys().IndexOf(minSize.id); + if (index != -1) + { + auto renderer = renderers.Values()[index]; + auto oldMinSize = renderer->GetRenderer()->GetMinSize(); + renderer->UpdateMinSize(minSize.minSize); + if (renderer->IsRenderedInLastBatch() && oldMinSize != renderer->GetRenderer()->GetMinSize()) + { + minSizeChanged = true; + } + } + } + } + + if (minSizeChanged) + { + hostedController->RequestRefresh(); + } + if (canvasSize == remote->remoteWindow.GetClientSize()) { return RenderTargetFailure::None; @@ -38256,24 +38468,51 @@ GuiRemoteGraphicsRenderTarget return remote->remoteWindow.Convert(canvasSize); } - void GuiRemoteGraphicsRenderTarget::AfterPushedClipper(Rect clipper, Rect validArea) + void GuiRemoteGraphicsRenderTarget::AfterPushedClipper(Rect clipper, Rect validArea, reflection::DescriptableObject* generator) { + clipperValidArea = validArea; + auto hitTestResult = GetHitTestResultFromGenerator(generator); + if (hitTestResult != INativeWindowListener::NoDecision) + { + if (hitTestResults.Count() == 0 || hitTestResults[hitTestResults.Count() - 1] != hitTestResult) + { + remoteprotocol::ElementBoundary arguments; + arguments.hitTestResult = hitTestResult; + arguments.bounds = clipper; + arguments.clipper = validArea; + remote->remoteMessages.RequestRendererBeginBoundary(arguments); + } + hitTestResults.Add(hitTestResult); + } } - void GuiRemoteGraphicsRenderTarget::AfterPushedClipperAndBecameInvalid(Rect clipper) + void GuiRemoteGraphicsRenderTarget::AfterPushedClipperAndBecameInvalid(Rect clipper, reflection::DescriptableObject* generator) { + clipperValidArea.Reset(); } - void GuiRemoteGraphicsRenderTarget::AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) + void GuiRemoteGraphicsRenderTarget::AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) { + clipperValidArea = validArea; } - void GuiRemoteGraphicsRenderTarget::AfterPoppedClipper(Rect validArea, bool clipperExists) + void GuiRemoteGraphicsRenderTarget::AfterPoppedClipper(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) { + clipperValidArea = validArea; + auto hitTestResult = GetHitTestResultFromGenerator(generator); + if (hitTestResult != INativeWindowListener::NoDecision) + { + hitTestResults.RemoveAt(hitTestResults.Count() - 1); + if (hitTestResults.Count() == 0 || hitTestResults[hitTestResults.Count() - 1] != hitTestResult) + { + remote->remoteMessages.RequestRendererEndBoundary(); + } + } } - GuiRemoteGraphicsRenderTarget::GuiRemoteGraphicsRenderTarget(GuiRemoteController* _remote) + GuiRemoteGraphicsRenderTarget::GuiRemoteGraphicsRenderTarget(GuiRemoteController* _remote, GuiHostedController* _hostedController) : remote(_remote) + , hostedController(_hostedController) { } @@ -38281,21 +38520,133 @@ GuiRemoteGraphicsRenderTarget { } + void GuiRemoteGraphicsRenderTarget::OnControllerConnect() + { + fontHeights.Clear(); + renderersAskingForCache.Clear(); + + if (renderers.Count() > 0) + { + { + auto ids = Ptr(new List); + for (auto renderer : renderers.Values()) + { + ids->Add({ renderer->GetID(),renderer->GetRendererType() }); + renderer->NotifyMinSizeCacheInvalidated(); + } + createdRenderers.Clear(); + remote->remoteMessages.RequestRendererCreated(ids); + } + + for (auto renderer : renderers.Values()) + { + renderer->SendUpdateElementMessages(true); + if (renderer->NeedUpdateMinSizeFromCache()) + { + renderersAskingForCache.Add(renderer); + } + renderer->ResetUpdated(); + } + } + } + + void GuiRemoteGraphicsRenderTarget::OnControllerDisconnect() + { + } + + GuiRemoteMessages& GuiRemoteGraphicsRenderTarget::GetRemoteMessages() + { + return remote->remoteMessages; + } + + vint GuiRemoteGraphicsRenderTarget::AllocateNewElementId() + { + return ++usedElementIds; + } + + void GuiRemoteGraphicsRenderTarget::RegisterRenderer(elements_remoteprotocol::IGuiRemoteProtocolElementRender* renderer) + { + vint id = renderer->GetID(); + if (!createdRenderers.Contains(id)) + { + renderers.Add(id, renderer); + createdRenderers.Add(id); + } + } + + void GuiRemoteGraphicsRenderTarget::UnregisterRenderer(elements_remoteprotocol::IGuiRemoteProtocolElementRender* renderer) + { + vint id = renderer->GetID(); + renderers.Remove(id); + renderersAskingForCache.Remove(renderer); + { + vint index = createdRenderers.IndexOf(id); + if (index == -1) + { + if (!destroyedRenderers.Contains(id)) + { + destroyedRenderers.Add(id); + } + } + else + { + createdRenderers.RemoveAt(index); + } + } + } + + Rect GuiRemoteGraphicsRenderTarget::GetClipperValidArea() + { + return clipperValidArea.Value(); + } + /*********************************************************************** GuiRemoteGraphicsResourceManager ***********************************************************************/ - GuiRemoteGraphicsResourceManager::GuiRemoteGraphicsResourceManager(GuiRemoteController* _remote) + GuiRemoteGraphicsResourceManager::GuiRemoteGraphicsResourceManager(GuiRemoteController* _remote, GuiHostedController* _hostedController) : remote(_remote) - , renderTarget(_remote) + , renderTarget(_remote, _hostedController) + , hostedController(_hostedController) { - // TODO: register element renderers; + remote->resourceManager = this; } GuiRemoteGraphicsResourceManager::~GuiRemoteGraphicsResourceManager() { } + void GuiRemoteGraphicsResourceManager::Initialize() + { + elements_remoteprotocol::GuiFocusRectangleElementRenderer::Register(); + elements_remoteprotocol::GuiSolidBorderElementRenderer::Register(); + elements_remoteprotocol::Gui3DBorderElementRenderer::Register(); + elements_remoteprotocol::Gui3DSplitterElementRenderer::Register(); + elements_remoteprotocol::GuiSolidBackgroundElementRenderer::Register(); + elements_remoteprotocol::GuiGradientBackgroundElementRenderer::Register(); + elements_remoteprotocol::GuiInnerShadowElementRenderer::Register(); + elements_remoteprotocol::GuiSolidLabelElementRenderer::Register(); + elements_remoteprotocol::GuiImageFrameElementRenderer::Register(); + elements_remoteprotocol::GuiPolygonElementRenderer::Register(); + elements_remoteprotocol::GuiColorizedTextElementRenderer::Register(); + elements::GuiDocumentElement::GuiDocumentElementRenderer::Register(); + } + + void GuiRemoteGraphicsResourceManager::Finalize() + { + } + + void GuiRemoteGraphicsResourceManager::OnControllerConnect() + { + renderTarget.OnControllerConnect(); + hostedController->RequestRefresh(); + } + + void GuiRemoteGraphicsResourceManager::OnControllerDisconnect() + { + renderTarget.OnControllerDisconnect(); + } + IGuiGraphicsRenderTarget* GuiRemoteGraphicsResourceManager::GetRenderTarget(INativeWindow* window) { CHECK_ERROR(window == &remote->remoteWindow, L"vl::presentation::elements::GuiRemoteGraphicsResourceManager::GetRenderTarget(INativeWindow*)#GuiHostedController should call this function with the native window."); @@ -38316,6 +38667,494 @@ GuiRemoteGraphicsResourceManager } } +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEGRAPHICS_BASICELEMENTS.CPP +***********************************************************************/ + +namespace vl::presentation::elements_remoteprotocol +{ + using namespace collections; + using namespace remoteprotocol; + +/*********************************************************************** +GuiSolidBorderElementRenderer +***********************************************************************/ + +#define RENDERER_TEMPLATE_HEADER template +#define RENDERER_CLASS_TYPE GuiRemoteProtocolElementRenderer + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::InitializeInternal() + { + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::FinalizeInternal() + { + if (this->renderTarget && id != -1) + { + this->renderTarget->UnregisterRenderer(this); + id = -1; + } + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::RenderTargetChangedInternal(GuiRemoteGraphicsRenderTarget* oldRenderTarget, GuiRemoteGraphicsRenderTarget* newRenderTarget) + { + if (oldRenderTarget == newRenderTarget) return; + if (oldRenderTarget && id != -1) + { + oldRenderTarget->UnregisterRenderer(this); + id = -1; + } + if (newRenderTarget) + { + id = newRenderTarget->AllocateNewElementId(); + newRenderTarget->RegisterRenderer(this); + } + } + + RENDERER_TEMPLATE_HEADER + IGuiGraphicsRenderer* RENDERER_CLASS_TYPE::GetRenderer() + { + return this; + } + + RENDERER_TEMPLATE_HEADER + vint RENDERER_CLASS_TYPE::GetID() + { + return id; + } + + RENDERER_TEMPLATE_HEADER + remoteprotocol::RendererType RENDERER_CLASS_TYPE::GetRendererType() + { + return _RendererType; + } + + RENDERER_TEMPLATE_HEADER + bool RENDERER_CLASS_TYPE::IsUpdated() + { + return updated; + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::ResetUpdated() + { + updated = false; + } + + RENDERER_TEMPLATE_HEADER + bool RENDERER_CLASS_TYPE::IsRenderedInLastBatch() + { + return this->renderTarget && this->renderTarget->renderingBatchId == renderingBatchId; + } + + RENDERER_TEMPLATE_HEADER + bool RENDERER_CLASS_TYPE::NeedUpdateMinSizeFromCache() + { + return false; + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::TryFetchMinSizeFromCache() + { + CHECK_FAIL(L"vl::presentation::elements_remoteprotocol::GuiRemoteProtocolElementRenderer::TryUpdateFromCache()#This function should not be called."); + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::UpdateMinSize(Size size) + { + CHECK_FAIL(L"vl::presentation::elements_remoteprotocol::GuiRemoteProtocolElementRenderer::UpdateMinSize(Size)#This function should not be called."); + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::NotifyMinSizeCacheInvalidated() + { + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::Render(Rect bounds) + { + remoteprotocol::ElementRendering arguments; + arguments.id = id; + arguments.bounds = bounds; + arguments.clipper = this->renderTarget->GetClipperValidArea(); + this->renderTarget->GetRemoteMessages().RequestRendererRenderElement(arguments); + renderingBatchId = this->renderTarget->renderingBatchId; + } + + RENDERER_TEMPLATE_HEADER + void RENDERER_CLASS_TYPE::OnElementStateChanged() + { + updated = true; + } + + +#undef RENDERER_CLASS_TYPE +#undef RENDERER_TEMPLATE_HEADER + +/*********************************************************************** +GuiSolidBorderElementRenderer +***********************************************************************/ + + GuiFocusRectangleElementRenderer::GuiFocusRectangleElementRenderer() + { + } + + bool GuiFocusRectangleElementRenderer::IsUpdated() + { + // there is no properties for this element + return false; + } + + void GuiFocusRectangleElementRenderer::ResetUpdated() + { + // nothing to update + } + + void GuiFocusRectangleElementRenderer::OnElementStateChanged() + { + // nothing to update + } + + void GuiFocusRectangleElementRenderer::SendUpdateElementMessages(bool fullContent) + { + // nothing to update + } + +/*********************************************************************** +GuiSolidBorderElementRenderer +***********************************************************************/ + + GuiSolidBorderElementRenderer::GuiSolidBorderElementRenderer() + { + } + + void GuiSolidBorderElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_SolidBorder arguments; + arguments.id = id; + arguments.borderColor = element->GetColor(); + arguments.shape = element->GetShape(); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_SolidBorder(arguments); + } + +/*********************************************************************** +Gui3DBorderElementRenderer +***********************************************************************/ + + Gui3DBorderElementRenderer::Gui3DBorderElementRenderer() + { + } + + void Gui3DBorderElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_SinkBorder arguments; + arguments.id = id; + arguments.leftTopColor = element->GetColor1(); + arguments.rightBottomColor = element->GetColor2(); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_SinkBorder(arguments); + } + +/*********************************************************************** +Gui3DSplitterElementRenderer +***********************************************************************/ + + Gui3DSplitterElementRenderer::Gui3DSplitterElementRenderer() + { + } + + void Gui3DSplitterElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_SinkSplitter arguments; + arguments.id = id; + arguments.leftTopColor = element->GetColor1(); + arguments.rightBottomColor = element->GetColor2(); + arguments.direction = element->GetDirection(); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_SinkSplitter(arguments); + } + +/*********************************************************************** +GuiSolidBackgroundElementRenderer +***********************************************************************/ + + GuiSolidBackgroundElementRenderer::GuiSolidBackgroundElementRenderer() + { + } + + void GuiSolidBackgroundElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_SolidBackground arguments; + arguments.id = id; + arguments.backgroundColor = element->GetColor(); + arguments.shape = element->GetShape(); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_SolidBackground(arguments); + } + +/*********************************************************************** +GuiGradientBackgroundElementRenderer +***********************************************************************/ + + GuiGradientBackgroundElementRenderer::GuiGradientBackgroundElementRenderer() + { + } + + void GuiGradientBackgroundElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_GradientBackground arguments; + arguments.id = id; + arguments.leftTopColor = element->GetColor1(); + arguments.rightBottomColor = element->GetColor2(); + arguments.direction = element->GetDirection(); + arguments.shape = element->GetShape(); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_GradientBackground(arguments); + } + +/*********************************************************************** +GuiInnerShadowElementRenderer +***********************************************************************/ + + GuiInnerShadowElementRenderer::GuiInnerShadowElementRenderer() + { + } + + void GuiInnerShadowElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_InnerShadow arguments; + arguments.id = id; + arguments.shadowColor = element->GetColor(); + arguments.thickness = element->GetThickness(); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_InnerShadow(arguments); + } + +/*********************************************************************** +GuiSolidLabelElementRenderer +***********************************************************************/ + + GuiSolidLabelElementRenderer::MeasuringRequest GuiSolidLabelElementRenderer::GetMeasuringRequest() + { + if (element->GetWrapLine()) + { + if (element->GetWrapLineHeightCalculation()) + { + return ElementSolidLabelMeasuringRequest::TotalSize; + } + else + { + return {}; + } + } + else + { + if (element->GetEllipse()) + { + return ElementSolidLabelMeasuringRequest::FontHeight; + } + else + { + return ElementSolidLabelMeasuringRequest::TotalSize; + } + } + } + + bool GuiSolidLabelElementRenderer::IsNeedFontHeight(MeasuringRequest request) + { + return request && request.Value() == ElementSolidLabelMeasuringRequest::FontHeight; + } + + GuiSolidLabelElementRenderer::GuiSolidLabelElementRenderer() + { + } + + bool GuiSolidLabelElementRenderer::NeedUpdateMinSizeFromCache() + { + return needFontHeight; + } + + void GuiSolidLabelElementRenderer::TryFetchMinSizeFromCache() + { + if (needFontHeight) + { + vint index = renderTarget->fontHeights.Keys().IndexOf({ lastFont.fontFamily,lastFont.size }); + if (index != -1) + { + needFontHeight = false; + minSize = { 0,renderTarget->fontHeights.Values()[index] }; + } + } + } + + void GuiSolidLabelElementRenderer::UpdateMinSize(Size size) + { + minSize = size; + } + + void GuiSolidLabelElementRenderer::NotifyMinSizeCacheInvalidated() + { + OnElementStateChanged(); + auto request = GetMeasuringRequest(); + needFontHeight = IsNeedFontHeight(request); + } + + void GuiSolidLabelElementRenderer::SendUpdateElementMessages(bool fullContent) + { + ElementDesc_SolidLabel arguments; + arguments.id = id; + arguments.textColor = element->GetColor(); + arguments.wrapLine = element->GetWrapLine(); + arguments.wrapLineHeightCalculation = element->GetWrapLineHeightCalculation(); + arguments.ellipse = element->GetEllipse(); + arguments.multiline = element->GetMultiline(); + + switch (element->GetHorizontalAlignment()) + { + case Alignment::Left: + arguments.horizontalAlignment = ElementHorizontalAlignment::Left; + break; + case Alignment::Right: + arguments.horizontalAlignment = ElementHorizontalAlignment::Right; + break; + default: + arguments.horizontalAlignment = ElementHorizontalAlignment::Center; + } + + switch (element->GetVerticalAlignment()) + { + case Alignment::Top: + arguments.verticalAlignment = ElementVerticalAlignment::Top; + break; + case Alignment::Bottom: + arguments.verticalAlignment = ElementVerticalAlignment::Bottom; + break; + default: + arguments.verticalAlignment = ElementVerticalAlignment::Center; + } + + auto elementFont = element->GetFont(); + auto elementText = element->GetText(); + if (elementFont.fontFamily == WString::Empty) + { + elementFont = GetCurrentController()->ResourceService()->GetDefaultFont(); + } + + if (fullContent || lastFont != elementFont) + { + arguments.font = elementFont; + } + + if (fullContent || lastText != elementText) + { + arguments.text = elementText; + } + + lastFont = elementFont; + lastText = elementText; + arguments.measuringRequest = GetMeasuringRequest(); + if ((needFontHeight = IsNeedFontHeight(arguments.measuringRequest))) + { + TryFetchMinSizeFromCache(); + if (!needFontHeight) + { + arguments.measuringRequest = {}; + } + } + + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_SolidLabel(arguments); + } + +/*********************************************************************** +GuiImageFrameElementRenderer +***********************************************************************/ + + GuiImageFrameElementRenderer::GuiImageFrameElementRenderer() + { + } + + void GuiImageFrameElementRenderer::SendUpdateElementMessages(bool fullContent) + { + // Image + // FrameIndex + // HorizontalAlignment + // VerticalAlignment + // Stretch + // Enabled + // UpdateMinSize(Stretch ? {0,0} : frame->GetSize()) + CHECK_FAIL(L"Not Implemented!"); + } + +/*********************************************************************** +GuiPolygonElementRenderer +***********************************************************************/ + + GuiPolygonElementRenderer::GuiPolygonElementRenderer() + { + } + + void GuiPolygonElementRenderer::SendUpdateElementMessages(bool fullContent) + { + minSize = element->GetSize(); + + ElementDesc_Polygon arguments; + arguments.id = id; + arguments.size = element->GetSize(); + arguments.borderColor = element->GetBorderColor(); + arguments.backgroundColor = element->GetBackgroundColor(); + arguments.points = Ptr(new List); + CopyFrom(*arguments.points.Obj(), element->GetPointsArray()); + renderTarget->GetRemoteMessages().RequestRendererUpdateElement_Polygon(arguments); + } + +/*********************************************************************** +GuiColorizedTextElementRenderer +***********************************************************************/ + + void GuiColorizedTextElementRenderer::ColorChanged() + { + } + + void GuiColorizedTextElementRenderer::FontChanged() + { + } + + void GuiColorizedTextElementRenderer::InitializeInternal() + { + TBase::InitializeInternal(); + element->SetCallback(this); + } + + void GuiColorizedTextElementRenderer::FinalizeInternal() + { + element->SetCallback(nullptr); + TBase::FinalizeInternal(); + } + + GuiColorizedTextElementRenderer::GuiColorizedTextElementRenderer() + { + } + + void GuiColorizedTextElementRenderer::OnElementStateChanged() + { + TBase::OnElementStateChanged(); + } + + void GuiColorizedTextElementRenderer::SendUpdateElementMessages(bool fullContent) + { + // Lines + // Colors + // Font + // PasswordChar + // ViewPosition + // VisuallyEnabled + // Focused + // CaretBegin + // CaretEnd + // CaretVisible + // CaretColor + CHECK_FAIL(L"Not Implemented!"); + } +} + /*********************************************************************** .\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOLSCHEMASHARED.CPP ***********************************************************************/ @@ -38367,6 +39206,11 @@ namespace vl::presentation::remoteprotocol return ConvertCustomTypeToJson((vint)value); } + template<> Ptr ConvertCustomTypeToJson(const Color& value) + { + return ConvertCustomTypeToJson(value.ToString()); + } + template<> void ConvertJsonToCustomType(Ptr node, bool& value) { #define ERROR_MESSAGE_PREFIX L"presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, bool&)#" @@ -38433,6 +39277,13 @@ namespace vl::presentation::remoteprotocol ConvertJsonToCustomType(node, intValue); value = (VKEY)intValue; } + + template<> void ConvertJsonToCustomType(Ptr node, Color& value) + { + WString strValue; + ConvertJsonToCustomType(node, strValue); + value = Color::Parse(strValue); + } } @@ -39035,7 +39886,6 @@ GuiRemoteWindow (INativeWindow) void GuiRemoteWindow::RedrawContent() { - CHECK_FAIL(L"Not Implemented!"); } #undef SET_REMOTE_WINDOW_STYLE_INVALIDATE @@ -39053,15 +39903,67 @@ Licensed under https ://github.com/vczh-libraries/License namespace vl::presentation::remoteprotocol { - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseButton & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::IOMouseButton>(const ::vl::presentation::remoteprotocol::IOMouseButton & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::IOMouseButton>(const ::vl::presentation::remoteprotocol::IOMouseButton&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::remoteprotocol::IOMouseButton::Left: node->content.value = WString::Unmanaged(L"Left"); break; + case ::vl::presentation::remoteprotocol::IOMouseButton::Middle: node->content.value = WString::Unmanaged(L"Middle"); break; + case ::vl::presentation::remoteprotocol::IOMouseButton::Right: node->content.value = WString::Unmanaged(L"Right"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeWindowListener::HitTestResult>(const ::vl::presentation::INativeWindowListener::HitTestResult & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::INativeWindowListener::HitTestResult>(const ::vl::presentation::INativeWindowListener::HitTestResult&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::INativeWindowListener::BorderNoSizing: node->content.value = WString::Unmanaged(L"BorderNoSizing"); break; + case ::vl::presentation::INativeWindowListener::BorderLeft: node->content.value = WString::Unmanaged(L"BorderLeft"); break; + case ::vl::presentation::INativeWindowListener::BorderRight: node->content.value = WString::Unmanaged(L"BorderRight"); break; + case ::vl::presentation::INativeWindowListener::BorderTop: node->content.value = WString::Unmanaged(L"BorderTop"); break; + case ::vl::presentation::INativeWindowListener::BorderBottom: node->content.value = WString::Unmanaged(L"BorderBottom"); break; + case ::vl::presentation::INativeWindowListener::BorderLeftTop: node->content.value = WString::Unmanaged(L"BorderLeftTop"); break; + case ::vl::presentation::INativeWindowListener::BorderRightTop: node->content.value = WString::Unmanaged(L"BorderRightTop"); break; + case ::vl::presentation::INativeWindowListener::BorderLeftBottom: node->content.value = WString::Unmanaged(L"BorderLeftBottom"); break; + case ::vl::presentation::INativeWindowListener::BorderRightBottom: node->content.value = WString::Unmanaged(L"BorderRightBottom"); break; + case ::vl::presentation::INativeWindowListener::Title: node->content.value = WString::Unmanaged(L"Title"); break; + case ::vl::presentation::INativeWindowListener::ButtonMinimum: node->content.value = WString::Unmanaged(L"ButtonMinimum"); break; + case ::vl::presentation::INativeWindowListener::ButtonMaximum: node->content.value = WString::Unmanaged(L"ButtonMaximum"); break; + case ::vl::presentation::INativeWindowListener::ButtonClose: node->content.value = WString::Unmanaged(L"ButtonClose"); break; + case ::vl::presentation::INativeWindowListener::Client: node->content.value = WString::Unmanaged(L"Client"); break; + case ::vl::presentation::INativeWindowListener::Icon: node->content.value = WString::Unmanaged(L"Icon"); break; + case ::vl::presentation::INativeWindowListener::NoDecision: node->content.value = WString::Unmanaged(L"NoDecision"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeCursor::SystemCursorType>(const ::vl::presentation::INativeCursor::SystemCursorType & value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseButton&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::INativeCursor::SystemCursorType>(const ::vl::presentation::INativeCursor::SystemCursorType&)#" auto node = Ptr(new glr::json::JsonString); switch (value) { - case vl::presentation::remoteprotocol::IOMouseButton::Left: node->content.value = L"Left"; break; - case vl::presentation::remoteprotocol::IOMouseButton::Middle: node->content.value = L"Middle"; break; - case vl::presentation::remoteprotocol::IOMouseButton::Right: node->content.value = L"Right"; break; + case ::vl::presentation::INativeCursor::SmallWaiting: node->content.value = WString::Unmanaged(L"SmallWaiting"); break; + case ::vl::presentation::INativeCursor::LargeWaiting: node->content.value = WString::Unmanaged(L"LargeWaiting"); break; + case ::vl::presentation::INativeCursor::Arrow: node->content.value = WString::Unmanaged(L"Arrow"); break; + case ::vl::presentation::INativeCursor::Cross: node->content.value = WString::Unmanaged(L"Cross"); break; + case ::vl::presentation::INativeCursor::Hand: node->content.value = WString::Unmanaged(L"Hand"); break; + case ::vl::presentation::INativeCursor::Help: node->content.value = WString::Unmanaged(L"Help"); break; + case ::vl::presentation::INativeCursor::IBeam: node->content.value = WString::Unmanaged(L"IBeam"); break; + case ::vl::presentation::INativeCursor::SizeAll: node->content.value = WString::Unmanaged(L"SizeAll"); break; + case ::vl::presentation::INativeCursor::SizeNESW: node->content.value = WString::Unmanaged(L"SizeNESW"); break; + case ::vl::presentation::INativeCursor::SizeNS: node->content.value = WString::Unmanaged(L"SizeNS"); break; + case ::vl::presentation::INativeCursor::SizeNWSE: node->content.value = WString::Unmanaged(L"SizeNWSE"); break; + case ::vl::presentation::INativeCursor::SizeWE: node->content.value = WString::Unmanaged(L"SizeWE"); break; default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); } return node; @@ -39074,9 +39976,122 @@ namespace vl::presentation::remoteprotocol auto node = Ptr(new glr::json::JsonString); switch (value) { - case ::vl::presentation::INativeWindow::WindowSizeState::Minimized: node->content.value = L"Minimized"; break; - case ::vl::presentation::INativeWindow::WindowSizeState::Restored: node->content.value = L"Restored"; break; - case ::vl::presentation::INativeWindow::WindowSizeState::Maximized: node->content.value = L"Maximized"; break; + case ::vl::presentation::INativeWindow::WindowSizeState::Minimized: node->content.value = WString::Unmanaged(L"Minimized"); break; + case ::vl::presentation::INativeWindow::WindowSizeState::Restored: node->content.value = WString::Unmanaged(L"Restored"); break; + case ::vl::presentation::INativeWindow::WindowSizeState::Maximized: node->content.value = WString::Unmanaged(L"Maximized"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::RendererType>(const ::vl::presentation::remoteprotocol::RendererType & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::RendererType>(const ::vl::presentation::remoteprotocol::RendererType&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::remoteprotocol::RendererType::FocusRectangle: node->content.value = WString::Unmanaged(L"FocusRectangle"); break; + case ::vl::presentation::remoteprotocol::RendererType::SolidBorder: node->content.value = WString::Unmanaged(L"SolidBorder"); break; + case ::vl::presentation::remoteprotocol::RendererType::SinkBorder: node->content.value = WString::Unmanaged(L"SinkBorder"); break; + case ::vl::presentation::remoteprotocol::RendererType::SinkSplitter: node->content.value = WString::Unmanaged(L"SinkSplitter"); break; + case ::vl::presentation::remoteprotocol::RendererType::SolidBackground: node->content.value = WString::Unmanaged(L"SolidBackground"); break; + case ::vl::presentation::remoteprotocol::RendererType::GradientBackground: node->content.value = WString::Unmanaged(L"GradientBackground"); break; + case ::vl::presentation::remoteprotocol::RendererType::InnerShadow: node->content.value = WString::Unmanaged(L"InnerShadow"); break; + case ::vl::presentation::remoteprotocol::RendererType::SolidLabel: node->content.value = WString::Unmanaged(L"SolidLabel"); break; + case ::vl::presentation::remoteprotocol::RendererType::Polygon: node->content.value = WString::Unmanaged(L"Polygon"); break; + case ::vl::presentation::remoteprotocol::RendererType::UnsupportedImageFrame: node->content.value = WString::Unmanaged(L"UnsupportedImageFrame"); break; + case ::vl::presentation::remoteprotocol::RendererType::UnsupportedColorizedText: node->content.value = WString::Unmanaged(L"UnsupportedColorizedText"); break; + case ::vl::presentation::remoteprotocol::RendererType::UnsupportedDocument: node->content.value = WString::Unmanaged(L"UnsupportedDocument"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::ElementShapeType>(const ::vl::presentation::elements::ElementShapeType & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::elements::ElementShapeType>(const ::vl::presentation::elements::ElementShapeType&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::elements::ElementShapeType::Rectangle: node->content.value = WString::Unmanaged(L"Rectangle"); break; + case ::vl::presentation::elements::ElementShapeType::Ellipse: node->content.value = WString::Unmanaged(L"Ellipse"); break; + case ::vl::presentation::elements::ElementShapeType::RoundRect: node->content.value = WString::Unmanaged(L"RoundRect"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::GuiGradientBackgroundElement::Direction>(const ::vl::presentation::elements::GuiGradientBackgroundElement::Direction & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::elements::GuiGradientBackgroundElement::Direction>(const ::vl::presentation::elements::GuiGradientBackgroundElement::Direction&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::elements::GuiGradientBackgroundElement::Horizontal: node->content.value = WString::Unmanaged(L"Horizontal"); break; + case ::vl::presentation::elements::GuiGradientBackgroundElement::Vertical: node->content.value = WString::Unmanaged(L"Vertical"); break; + case ::vl::presentation::elements::GuiGradientBackgroundElement::Slash: node->content.value = WString::Unmanaged(L"Slash"); break; + case ::vl::presentation::elements::GuiGradientBackgroundElement::Backslash: node->content.value = WString::Unmanaged(L"Backslash"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::Gui3DSplitterElement::Direction>(const ::vl::presentation::elements::Gui3DSplitterElement::Direction & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::elements::Gui3DSplitterElement::Direction>(const ::vl::presentation::elements::Gui3DSplitterElement::Direction&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::elements::Gui3DSplitterElement::Horizontal: node->content.value = WString::Unmanaged(L"Horizontal"); break; + case ::vl::presentation::elements::Gui3DSplitterElement::Vertical: node->content.value = WString::Unmanaged(L"Vertical"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementHorizontalAlignment>(const ::vl::presentation::remoteprotocol::ElementHorizontalAlignment & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementHorizontalAlignment>(const ::vl::presentation::remoteprotocol::ElementHorizontalAlignment&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::remoteprotocol::ElementHorizontalAlignment::Left: node->content.value = WString::Unmanaged(L"Left"); break; + case ::vl::presentation::remoteprotocol::ElementHorizontalAlignment::Right: node->content.value = WString::Unmanaged(L"Right"); break; + case ::vl::presentation::remoteprotocol::ElementHorizontalAlignment::Center: node->content.value = WString::Unmanaged(L"Center"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementVerticalAlignment>(const ::vl::presentation::remoteprotocol::ElementVerticalAlignment & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementVerticalAlignment>(const ::vl::presentation::remoteprotocol::ElementVerticalAlignment&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::remoteprotocol::ElementVerticalAlignment::Top: node->content.value = WString::Unmanaged(L"Top"); break; + case ::vl::presentation::remoteprotocol::ElementVerticalAlignment::Bottom: node->content.value = WString::Unmanaged(L"Bottom"); break; + case ::vl::presentation::remoteprotocol::ElementVerticalAlignment::Center: node->content.value = WString::Unmanaged(L"Center"); break; + default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); + } + return node; +#undef ERROR_MESSAGE_PREFIX + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest>(const ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest & value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest>(const ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest&)#" + auto node = Ptr(new glr::json::JsonString); + switch (value) + { + case ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest::FontHeight: node->content.value = WString::Unmanaged(L"FontHeight"); break; + case ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest::TotalSize: node->content.value = WString::Unmanaged(L"TotalSize"); break; default: CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); } return node; @@ -39126,6 +40141,32 @@ namespace vl::presentation::remoteprotocol return node; } + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::Point>(const ::vl::presentation::Point & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"x", value.x); + ConvertCustomTypeToJsonField(node, L"y", value.y); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::Size>(const ::vl::presentation::Size & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"x", value.x); + ConvertCustomTypeToJsonField(node, L"y", value.y); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::Rect>(const ::vl::presentation::Rect & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"x1", value.x1); + ConvertCustomTypeToJsonField(node, L"y1", value.y1); + ConvertCustomTypeToJsonField(node, L"x2", value.x2); + ConvertCustomTypeToJsonField(node, L"y2", value.y2); + return node; + } + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::FontProperties>(const ::vl::presentation::FontProperties & value) { auto node = Ptr(new glr::json::JsonObject); @@ -39140,7 +40181,7 @@ namespace vl::presentation::remoteprotocol return node; } - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::FontConfig & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::FontConfig>(const ::vl::presentation::remoteprotocol::FontConfig & value) { auto node = Ptr(new glr::json::JsonObject); ConvertCustomTypeToJsonField(node, L"defaultFont", value.defaultFont); @@ -39148,7 +40189,7 @@ namespace vl::presentation::remoteprotocol return node; } - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::ScreenConfig & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ScreenConfig>(const ::vl::presentation::remoteprotocol::ScreenConfig & value) { auto node = Ptr(new glr::json::JsonObject); ConvertCustomTypeToJsonField(node, L"bounds", value.bounds); @@ -39173,7 +40214,7 @@ namespace vl::presentation::remoteprotocol return node; } - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseInfoWithButton & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::IOMouseInfoWithButton>(const ::vl::presentation::remoteprotocol::IOMouseInfoWithButton & value) { auto node = Ptr(new glr::json::JsonObject); ConvertCustomTypeToJsonField(node, L"button", value.button); @@ -39204,7 +40245,7 @@ namespace vl::presentation::remoteprotocol return node; } - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::GlobalShortcutKey & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::GlobalShortcutKey>(const ::vl::presentation::remoteprotocol::GlobalShortcutKey & value) { auto node = Ptr(new glr::json::JsonObject); ConvertCustomTypeToJsonField(node, L"id", value.id); @@ -39215,7 +40256,7 @@ namespace vl::presentation::remoteprotocol return node; } - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowSizingConfig & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::WindowSizingConfig>(const ::vl::presentation::remoteprotocol::WindowSizingConfig & value) { auto node = Ptr(new glr::json::JsonObject); ConvertCustomTypeToJsonField(node, L"bounds", value.bounds); @@ -39225,7 +40266,7 @@ namespace vl::presentation::remoteprotocol return node; } - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowShowing & value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::WindowShowing>(const ::vl::presentation::remoteprotocol::WindowShowing & value) { auto node = Ptr(new glr::json::JsonObject); ConvertCustomTypeToJsonField(node, L"activate", value.activate); @@ -39233,14 +40274,205 @@ namespace vl::presentation::remoteprotocol return node; } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseButton& value) + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::ElementShape>(const ::vl::presentation::elements::ElementShape & value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::IOMouseButton&)#" + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"shapeType", value.shapeType); + ConvertCustomTypeToJsonField(node, L"radiusX", value.radiusX); + ConvertCustomTypeToJsonField(node, L"radiusY", value.radiusY); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SolidBorder>(const ::vl::presentation::remoteprotocol::ElementDesc_SolidBorder & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"borderColor", value.borderColor); + ConvertCustomTypeToJsonField(node, L"shape", value.shape); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SinkBorder>(const ::vl::presentation::remoteprotocol::ElementDesc_SinkBorder & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"leftTopColor", value.leftTopColor); + ConvertCustomTypeToJsonField(node, L"rightBottomColor", value.rightBottomColor); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter>(const ::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"leftTopColor", value.leftTopColor); + ConvertCustomTypeToJsonField(node, L"rightBottomColor", value.rightBottomColor); + ConvertCustomTypeToJsonField(node, L"direction", value.direction); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SolidBackground>(const ::vl::presentation::remoteprotocol::ElementDesc_SolidBackground & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"backgroundColor", value.backgroundColor); + ConvertCustomTypeToJsonField(node, L"shape", value.shape); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_GradientBackground>(const ::vl::presentation::remoteprotocol::ElementDesc_GradientBackground & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"leftTopColor", value.leftTopColor); + ConvertCustomTypeToJsonField(node, L"rightBottomColor", value.rightBottomColor); + ConvertCustomTypeToJsonField(node, L"direction", value.direction); + ConvertCustomTypeToJsonField(node, L"shape", value.shape); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_InnerShadow>(const ::vl::presentation::remoteprotocol::ElementDesc_InnerShadow & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"shadowColor", value.shadowColor); + ConvertCustomTypeToJsonField(node, L"thickness", value.thickness); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_Polygon>(const ::vl::presentation::remoteprotocol::ElementDesc_Polygon & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"size", value.size); + ConvertCustomTypeToJsonField(node, L"borderColor", value.borderColor); + ConvertCustomTypeToJsonField(node, L"backgroundColor", value.backgroundColor); + ConvertCustomTypeToJsonField(node, L"points", value.points); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SolidLabel>(const ::vl::presentation::remoteprotocol::ElementDesc_SolidLabel & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"textColor", value.textColor); + ConvertCustomTypeToJsonField(node, L"horizontalAlignment", value.horizontalAlignment); + ConvertCustomTypeToJsonField(node, L"verticalAlignment", value.verticalAlignment); + ConvertCustomTypeToJsonField(node, L"wrapLine", value.wrapLine); + ConvertCustomTypeToJsonField(node, L"wrapLineHeightCalculation", value.wrapLineHeightCalculation); + ConvertCustomTypeToJsonField(node, L"ellipse", value.ellipse); + ConvertCustomTypeToJsonField(node, L"multiline", value.multiline); + ConvertCustomTypeToJsonField(node, L"font", value.font); + ConvertCustomTypeToJsonField(node, L"text", value.text); + ConvertCustomTypeToJsonField(node, L"measuringRequest", value.measuringRequest); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::RendererCreation>(const ::vl::presentation::remoteprotocol::RendererCreation & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"type", value.type); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementRendering>(const ::vl::presentation::remoteprotocol::ElementRendering & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"bounds", value.bounds); + ConvertCustomTypeToJsonField(node, L"clipper", value.clipper); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementBoundary>(const ::vl::presentation::remoteprotocol::ElementBoundary & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"hitTestResult", value.hitTestResult); + ConvertCustomTypeToJsonField(node, L"bounds", value.bounds); + ConvertCustomTypeToJsonField(node, L"clipper", value.clipper); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight>(const ::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"fontFamily", value.fontFamily); + ConvertCustomTypeToJsonField(node, L"fontSize", value.fontSize); + ConvertCustomTypeToJsonField(node, L"height", value.height); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize>(const ::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"id", value.id); + ConvertCustomTypeToJsonField(node, L"minSize", value.minSize); + return node; + } + + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementMeasurings>(const ::vl::presentation::remoteprotocol::ElementMeasurings & value) + { + auto node = Ptr(new glr::json::JsonObject); + ConvertCustomTypeToJsonField(node, L"fontHeights", value.fontHeights); + ConvertCustomTypeToJsonField(node, L"minSizes", value.minSizes); + return node; + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::IOMouseButton>(vl::Ptr node, ::vl::presentation::remoteprotocol::IOMouseButton& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::IOMouseButton>(Ptr, ::vl::presentation::remoteprotocol::IOMouseButton&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Left") value = ::vl::presentation::remoteprotocol::IOMouseButton::Left; else + if (jsonNode->content.value == L"Middle") value = ::vl::presentation::remoteprotocol::IOMouseButton::Middle; else + if (jsonNode->content.value == L"Right") value = ::vl::presentation::remoteprotocol::IOMouseButton::Right; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::INativeWindowListener::HitTestResult>(vl::Ptr node, ::vl::presentation::INativeWindowListener::HitTestResult& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::INativeWindowListener::HitTestResult>(Ptr, ::vl::presentation::INativeWindowListener::HitTestResult&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); - if (jsonNode->content.value == L"Left") value = vl::presentation::remoteprotocol::IOMouseButton::Left; else - if (jsonNode->content.value == L"Middle") value = vl::presentation::remoteprotocol::IOMouseButton::Middle; else - if (jsonNode->content.value == L"Right") value = vl::presentation::remoteprotocol::IOMouseButton::Right; else + if (jsonNode->content.value == L"BorderNoSizing") value = ::vl::presentation::INativeWindowListener::BorderNoSizing; else + if (jsonNode->content.value == L"BorderLeft") value = ::vl::presentation::INativeWindowListener::BorderLeft; else + if (jsonNode->content.value == L"BorderRight") value = ::vl::presentation::INativeWindowListener::BorderRight; else + if (jsonNode->content.value == L"BorderTop") value = ::vl::presentation::INativeWindowListener::BorderTop; else + if (jsonNode->content.value == L"BorderBottom") value = ::vl::presentation::INativeWindowListener::BorderBottom; else + if (jsonNode->content.value == L"BorderLeftTop") value = ::vl::presentation::INativeWindowListener::BorderLeftTop; else + if (jsonNode->content.value == L"BorderRightTop") value = ::vl::presentation::INativeWindowListener::BorderRightTop; else + if (jsonNode->content.value == L"BorderLeftBottom") value = ::vl::presentation::INativeWindowListener::BorderLeftBottom; else + if (jsonNode->content.value == L"BorderRightBottom") value = ::vl::presentation::INativeWindowListener::BorderRightBottom; else + if (jsonNode->content.value == L"Title") value = ::vl::presentation::INativeWindowListener::Title; else + if (jsonNode->content.value == L"ButtonMinimum") value = ::vl::presentation::INativeWindowListener::ButtonMinimum; else + if (jsonNode->content.value == L"ButtonMaximum") value = ::vl::presentation::INativeWindowListener::ButtonMaximum; else + if (jsonNode->content.value == L"ButtonClose") value = ::vl::presentation::INativeWindowListener::ButtonClose; else + if (jsonNode->content.value == L"Client") value = ::vl::presentation::INativeWindowListener::Client; else + if (jsonNode->content.value == L"Icon") value = ::vl::presentation::INativeWindowListener::Icon; else + if (jsonNode->content.value == L"NoDecision") value = ::vl::presentation::INativeWindowListener::NoDecision; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::INativeCursor::SystemCursorType>(vl::Ptr node, ::vl::presentation::INativeCursor::SystemCursorType& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::INativeCursor::SystemCursorType>(Ptr, ::vl::presentation::INativeCursor::SystemCursorType&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"SmallWaiting") value = ::vl::presentation::INativeCursor::SmallWaiting; else + if (jsonNode->content.value == L"LargeWaiting") value = ::vl::presentation::INativeCursor::LargeWaiting; else + if (jsonNode->content.value == L"Arrow") value = ::vl::presentation::INativeCursor::Arrow; else + if (jsonNode->content.value == L"Cross") value = ::vl::presentation::INativeCursor::Cross; else + if (jsonNode->content.value == L"Hand") value = ::vl::presentation::INativeCursor::Hand; else + if (jsonNode->content.value == L"Help") value = ::vl::presentation::INativeCursor::Help; else + if (jsonNode->content.value == L"IBeam") value = ::vl::presentation::INativeCursor::IBeam; else + if (jsonNode->content.value == L"SizeAll") value = ::vl::presentation::INativeCursor::SizeAll; else + if (jsonNode->content.value == L"SizeNESW") value = ::vl::presentation::INativeCursor::SizeNESW; else + if (jsonNode->content.value == L"SizeNS") value = ::vl::presentation::INativeCursor::SizeNS; else + if (jsonNode->content.value == L"SizeNWSE") value = ::vl::presentation::INativeCursor::SizeNWSE; else + if (jsonNode->content.value == L"SizeWE") value = ::vl::presentation::INativeCursor::SizeWE; else CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); #undef ERROR_MESSAGE_PREFIX } @@ -39257,6 +40489,98 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::RendererType>(vl::Ptr node, ::vl::presentation::remoteprotocol::RendererType& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::RendererType>(Ptr, ::vl::presentation::remoteprotocol::RendererType&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"FocusRectangle") value = ::vl::presentation::remoteprotocol::RendererType::FocusRectangle; else + if (jsonNode->content.value == L"SolidBorder") value = ::vl::presentation::remoteprotocol::RendererType::SolidBorder; else + if (jsonNode->content.value == L"SinkBorder") value = ::vl::presentation::remoteprotocol::RendererType::SinkBorder; else + if (jsonNode->content.value == L"SinkSplitter") value = ::vl::presentation::remoteprotocol::RendererType::SinkSplitter; else + if (jsonNode->content.value == L"SolidBackground") value = ::vl::presentation::remoteprotocol::RendererType::SolidBackground; else + if (jsonNode->content.value == L"GradientBackground") value = ::vl::presentation::remoteprotocol::RendererType::GradientBackground; else + if (jsonNode->content.value == L"InnerShadow") value = ::vl::presentation::remoteprotocol::RendererType::InnerShadow; else + if (jsonNode->content.value == L"SolidLabel") value = ::vl::presentation::remoteprotocol::RendererType::SolidLabel; else + if (jsonNode->content.value == L"Polygon") value = ::vl::presentation::remoteprotocol::RendererType::Polygon; else + if (jsonNode->content.value == L"UnsupportedImageFrame") value = ::vl::presentation::remoteprotocol::RendererType::UnsupportedImageFrame; else + if (jsonNode->content.value == L"UnsupportedColorizedText") value = ::vl::presentation::remoteprotocol::RendererType::UnsupportedColorizedText; else + if (jsonNode->content.value == L"UnsupportedDocument") value = ::vl::presentation::remoteprotocol::RendererType::UnsupportedDocument; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::elements::ElementShapeType>(vl::Ptr node, ::vl::presentation::elements::ElementShapeType& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::elements::ElementShapeType>(Ptr, ::vl::presentation::elements::ElementShapeType&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Rectangle") value = ::vl::presentation::elements::ElementShapeType::Rectangle; else + if (jsonNode->content.value == L"Ellipse") value = ::vl::presentation::elements::ElementShapeType::Ellipse; else + if (jsonNode->content.value == L"RoundRect") value = ::vl::presentation::elements::ElementShapeType::RoundRect; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::elements::GuiGradientBackgroundElement::Direction>(vl::Ptr node, ::vl::presentation::elements::GuiGradientBackgroundElement::Direction& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::elements::GuiGradientBackgroundElement::Direction>(Ptr, ::vl::presentation::elements::GuiGradientBackgroundElement::Direction&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Horizontal") value = ::vl::presentation::elements::GuiGradientBackgroundElement::Horizontal; else + if (jsonNode->content.value == L"Vertical") value = ::vl::presentation::elements::GuiGradientBackgroundElement::Vertical; else + if (jsonNode->content.value == L"Slash") value = ::vl::presentation::elements::GuiGradientBackgroundElement::Slash; else + if (jsonNode->content.value == L"Backslash") value = ::vl::presentation::elements::GuiGradientBackgroundElement::Backslash; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::elements::Gui3DSplitterElement::Direction>(vl::Ptr node, ::vl::presentation::elements::Gui3DSplitterElement::Direction& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::elements::Gui3DSplitterElement::Direction>(Ptr, ::vl::presentation::elements::Gui3DSplitterElement::Direction&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Horizontal") value = ::vl::presentation::elements::Gui3DSplitterElement::Horizontal; else + if (jsonNode->content.value == L"Vertical") value = ::vl::presentation::elements::Gui3DSplitterElement::Vertical; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementHorizontalAlignment>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementHorizontalAlignment& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementHorizontalAlignment>(Ptr, ::vl::presentation::remoteprotocol::ElementHorizontalAlignment&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Left") value = ::vl::presentation::remoteprotocol::ElementHorizontalAlignment::Left; else + if (jsonNode->content.value == L"Right") value = ::vl::presentation::remoteprotocol::ElementHorizontalAlignment::Right; else + if (jsonNode->content.value == L"Center") value = ::vl::presentation::remoteprotocol::ElementHorizontalAlignment::Center; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementVerticalAlignment>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementVerticalAlignment& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementVerticalAlignment>(Ptr, ::vl::presentation::remoteprotocol::ElementVerticalAlignment&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"Top") value = ::vl::presentation::remoteprotocol::ElementVerticalAlignment::Top; else + if (jsonNode->content.value == L"Bottom") value = ::vl::presentation::remoteprotocol::ElementVerticalAlignment::Bottom; else + if (jsonNode->content.value == L"Center") value = ::vl::presentation::remoteprotocol::ElementVerticalAlignment::Center; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest>(Ptr, ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + if (jsonNode->content.value == L"FontHeight") value = ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest::FontHeight; else + if (jsonNode->content.value == L"TotalSize") value = ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest::TotalSize; else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported enum value."); +#undef ERROR_MESSAGE_PREFIX + } + template<> void ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(vl::Ptr node, ::vl::presentation::NativeCoordinate& value) { #define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(Ptr, ::vl::presentation::NativeCoordinate&)#" @@ -39330,6 +40654,50 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } + template<> void ConvertJsonToCustomType<::vl::presentation::Point>(vl::Ptr node, ::vl::presentation::Point& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::Point>(Ptr, ::vl::presentation::Point&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"x") ConvertJsonToCustomType(field->value, value.x); else + if (field->name.value == L"y") ConvertJsonToCustomType(field->value, value.y); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::Size>(vl::Ptr node, ::vl::presentation::Size& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::Size>(Ptr, ::vl::presentation::Size&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"x") ConvertJsonToCustomType(field->value, value.x); else + if (field->name.value == L"y") ConvertJsonToCustomType(field->value, value.y); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::Rect>(vl::Ptr node, ::vl::presentation::Rect& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::Rect>(Ptr, ::vl::presentation::Rect&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"x1") ConvertJsonToCustomType(field->value, value.x1); else + if (field->name.value == L"y1") ConvertJsonToCustomType(field->value, value.y1); else + if (field->name.value == L"x2") ConvertJsonToCustomType(field->value, value.x2); else + if (field->name.value == L"y2") ConvertJsonToCustomType(field->value, value.y2); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + template<> void ConvertJsonToCustomType<::vl::presentation::FontProperties>(vl::Ptr node, ::vl::presentation::FontProperties& value) { #define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::FontProperties>(Ptr, ::vl::presentation::FontProperties&)#" @@ -39350,9 +40718,9 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::FontConfig& value) + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::FontConfig>(vl::Ptr node, ::vl::presentation::remoteprotocol::FontConfig& value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::FontConfig&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::FontConfig>(Ptr, ::vl::presentation::remoteprotocol::FontConfig&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); for (auto field : jsonNode->fields) @@ -39364,9 +40732,9 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::ScreenConfig& value) + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ScreenConfig>(vl::Ptr node, ::vl::presentation::remoteprotocol::ScreenConfig& value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::ScreenConfig&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ScreenConfig>(Ptr, ::vl::presentation::remoteprotocol::ScreenConfig&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); for (auto field : jsonNode->fields) @@ -39401,9 +40769,9 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseInfoWithButton& value) + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::IOMouseInfoWithButton>(vl::Ptr node, ::vl::presentation::remoteprotocol::IOMouseInfoWithButton& value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::IOMouseInfoWithButton&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::IOMouseInfoWithButton>(Ptr, ::vl::presentation::remoteprotocol::IOMouseInfoWithButton&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); for (auto field : jsonNode->fields) @@ -39450,9 +40818,9 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::GlobalShortcutKey& value) + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::GlobalShortcutKey>(vl::Ptr node, ::vl::presentation::remoteprotocol::GlobalShortcutKey& value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::GlobalShortcutKey&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::GlobalShortcutKey>(Ptr, ::vl::presentation::remoteprotocol::GlobalShortcutKey&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); for (auto field : jsonNode->fields) @@ -39467,9 +40835,9 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowSizingConfig& value) + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::WindowSizingConfig>(vl::Ptr node, ::vl::presentation::remoteprotocol::WindowSizingConfig& value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::WindowSizingConfig&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::WindowSizingConfig>(Ptr, ::vl::presentation::remoteprotocol::WindowSizingConfig&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); for (auto field : jsonNode->fields) @@ -39483,9 +40851,9 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowShowing& value) + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::WindowShowing>(vl::Ptr node, ::vl::presentation::remoteprotocol::WindowShowing& value) { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, vl::presentation::remoteprotocol::WindowShowing&)#" +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::WindowShowing>(Ptr, ::vl::presentation::remoteprotocol::WindowShowing&)#" auto jsonNode = node.Cast(); CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); for (auto field : jsonNode->fields) @@ -39497,6 +40865,241 @@ namespace vl::presentation::remoteprotocol #undef ERROR_MESSAGE_PREFIX } + template<> void ConvertJsonToCustomType<::vl::presentation::elements::ElementShape>(vl::Ptr node, ::vl::presentation::elements::ElementShape& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::elements::ElementShape>(Ptr, ::vl::presentation::elements::ElementShape&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"shapeType") ConvertJsonToCustomType(field->value, value.shapeType); else + if (field->name.value == L"radiusX") ConvertJsonToCustomType(field->value, value.radiusX); else + if (field->name.value == L"radiusY") ConvertJsonToCustomType(field->value, value.radiusY); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidBorder>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SolidBorder& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidBorder>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_SolidBorder&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"borderColor") ConvertJsonToCustomType(field->value, value.borderColor); else + if (field->name.value == L"shape") ConvertJsonToCustomType(field->value, value.shape); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SinkBorder>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SinkBorder& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SinkBorder>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_SinkBorder&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"leftTopColor") ConvertJsonToCustomType(field->value, value.leftTopColor); else + if (field->name.value == L"rightBottomColor") ConvertJsonToCustomType(field->value, value.rightBottomColor); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"leftTopColor") ConvertJsonToCustomType(field->value, value.leftTopColor); else + if (field->name.value == L"rightBottomColor") ConvertJsonToCustomType(field->value, value.rightBottomColor); else + if (field->name.value == L"direction") ConvertJsonToCustomType(field->value, value.direction); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidBackground>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SolidBackground& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidBackground>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_SolidBackground&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"backgroundColor") ConvertJsonToCustomType(field->value, value.backgroundColor); else + if (field->name.value == L"shape") ConvertJsonToCustomType(field->value, value.shape); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_GradientBackground>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_GradientBackground& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_GradientBackground>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_GradientBackground&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"leftTopColor") ConvertJsonToCustomType(field->value, value.leftTopColor); else + if (field->name.value == L"rightBottomColor") ConvertJsonToCustomType(field->value, value.rightBottomColor); else + if (field->name.value == L"direction") ConvertJsonToCustomType(field->value, value.direction); else + if (field->name.value == L"shape") ConvertJsonToCustomType(field->value, value.shape); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_InnerShadow>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_InnerShadow& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_InnerShadow>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_InnerShadow&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"shadowColor") ConvertJsonToCustomType(field->value, value.shadowColor); else + if (field->name.value == L"thickness") ConvertJsonToCustomType(field->value, value.thickness); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_Polygon>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_Polygon& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_Polygon>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_Polygon&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"size") ConvertJsonToCustomType(field->value, value.size); else + if (field->name.value == L"borderColor") ConvertJsonToCustomType(field->value, value.borderColor); else + if (field->name.value == L"backgroundColor") ConvertJsonToCustomType(field->value, value.backgroundColor); else + if (field->name.value == L"points") ConvertJsonToCustomType(field->value, value.points); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidLabel>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SolidLabel& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidLabel>(Ptr, ::vl::presentation::remoteprotocol::ElementDesc_SolidLabel&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"textColor") ConvertJsonToCustomType(field->value, value.textColor); else + if (field->name.value == L"horizontalAlignment") ConvertJsonToCustomType(field->value, value.horizontalAlignment); else + if (field->name.value == L"verticalAlignment") ConvertJsonToCustomType(field->value, value.verticalAlignment); else + if (field->name.value == L"wrapLine") ConvertJsonToCustomType(field->value, value.wrapLine); else + if (field->name.value == L"wrapLineHeightCalculation") ConvertJsonToCustomType(field->value, value.wrapLineHeightCalculation); else + if (field->name.value == L"ellipse") ConvertJsonToCustomType(field->value, value.ellipse); else + if (field->name.value == L"multiline") ConvertJsonToCustomType(field->value, value.multiline); else + if (field->name.value == L"font") ConvertJsonToCustomType(field->value, value.font); else + if (field->name.value == L"text") ConvertJsonToCustomType(field->value, value.text); else + if (field->name.value == L"measuringRequest") ConvertJsonToCustomType(field->value, value.measuringRequest); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::RendererCreation>(vl::Ptr node, ::vl::presentation::remoteprotocol::RendererCreation& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::RendererCreation>(Ptr, ::vl::presentation::remoteprotocol::RendererCreation&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"type") ConvertJsonToCustomType(field->value, value.type); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementRendering>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementRendering& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementRendering>(Ptr, ::vl::presentation::remoteprotocol::ElementRendering&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"bounds") ConvertJsonToCustomType(field->value, value.bounds); else + if (field->name.value == L"clipper") ConvertJsonToCustomType(field->value, value.clipper); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementBoundary>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementBoundary& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementBoundary>(Ptr, ::vl::presentation::remoteprotocol::ElementBoundary&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"hitTestResult") ConvertJsonToCustomType(field->value, value.hitTestResult); else + if (field->name.value == L"bounds") ConvertJsonToCustomType(field->value, value.bounds); else + if (field->name.value == L"clipper") ConvertJsonToCustomType(field->value, value.clipper); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight>(Ptr, ::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"fontFamily") ConvertJsonToCustomType(field->value, value.fontFamily); else + if (field->name.value == L"fontSize") ConvertJsonToCustomType(field->value, value.fontSize); else + if (field->name.value == L"height") ConvertJsonToCustomType(field->value, value.height); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize>(Ptr, ::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"id") ConvertJsonToCustomType(field->value, value.id); else + if (field->name.value == L"minSize") ConvertJsonToCustomType(field->value, value.minSize); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasurings>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementMeasurings& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasurings>(Ptr, ::vl::presentation::remoteprotocol::ElementMeasurings&)#" + auto jsonNode = node.Cast(); + CHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + for (auto field : jsonNode->fields) + { + if (field->name.value == L"fontHeights") ConvertJsonToCustomType(field->value, value.fontHeights); else + if (field->name.value == L"minSizes") ConvertJsonToCustomType(field->value, value.minSizes); else + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Unsupported struct member."); + } +#undef ERROR_MESSAGE_PREFIX + } + } diff --git a/Import/GacUI.h b/Import/GacUI.h index ae8d3d9e..ab302294 100644 --- a/Import/GacUI.h +++ b/Import/GacUI.h @@ -1319,11 +1319,13 @@ Basic Construction /// The result clipper is combined by all clippers in the clipper stack maintained by the render target. /// /// The clipper to push. - virtual void PushClipper(Rect clipper) = 0; + /// The object that generates this clipper. It could be null. + virtual void PushClipper(Rect clipper, reflection::DescriptableObject* generator) = 0; /// /// Remove the last pushed clipper from the clipper stack. /// - virtual void PopClipper() = 0; + /// The object that generates this clipper. It could be null. + virtual void PopClipper(reflection::DescriptableObject* generator) = 0; /// /// Get the combined clipper /// @@ -1351,10 +1353,10 @@ Basic Construction virtual RenderTargetFailure StopRenderingOnNativeWindow() = 0; virtual Size GetCanvasSize() = 0; - virtual void AfterPushedClipper(Rect clipper, Rect validArea) = 0; - virtual void AfterPushedClipperAndBecameInvalid(Rect clipper) = 0; - virtual void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) = 0; - virtual void AfterPoppedClipper(Rect validArea, bool clipperExists) = 0; + virtual void AfterPushedClipper(Rect clipper, Rect validArea, reflection::DescriptableObject* generator) = 0; + virtual void AfterPushedClipperAndBecameInvalid(Rect clipper, reflection::DescriptableObject* generator) = 0; + virtual void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) = 0; + virtual void AfterPoppedClipper(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) = 0; public: bool IsInHostedRendering() override; @@ -1363,8 +1365,8 @@ Basic Construction void StartRendering() override; RenderTargetFailure StopRendering() override; - void PushClipper(Rect clipper) override; - void PopClipper() override; + void PushClipper(Rect clipper, reflection::DescriptableObject* generator) override; + void PopClipper(reflection::DescriptableObject* generator) override; Rect GetClipper() override; bool IsClipperCoverWholeTarget() override; }; @@ -4249,7 +4251,7 @@ Basic Construction /// The deepest composition that under a specified location. /// The specified location. /// Find a composition for mouse event, it will ignore all compositions that are transparent to mouse events. - GuiGraphicsComposition* FindComposition(Point location, bool forMouseEvent); + GuiGraphicsComposition* FindVisibleComposition(Point location, bool forMouseEvent); /// Get is this composition transparent to mouse events. /// Returns true if this composition is transparent to mouse events, which means it just passes all mouse events to the composition under it. bool GetTransparentToMouse(); @@ -4288,6 +4290,9 @@ Basic Construction /// Get the related cursor. A related cursor is from the deepest composition that contains this composition and associated with a cursor. /// The related cursor. INativeCursor* GetRelatedCursor(); + /// Get the related hit test result. A related hit test result is from the deepest composition that contains this composition and associated with a hit test result. + /// The related hit test result. + INativeWindowListener::HitTestResult GetRelatedHitTestResult(); /// Get the internal margin. /// The internal margin. @@ -5091,8 +5096,10 @@ Host /// Get the main . If a window is associated, everything that put into the main composition will be shown in the window. /// The main compositoin. GuiGraphicsComposition* GetMainComposition(); - /// Request a rendering + /// Request rendering. void RequestRender(); + /// Request updating sizes of compositions. + void RequestUpdateSizeFromNativeWindow(); /// Invoke a specified function after rendering. /// The specified function. /// A key to cancel a previous binded key if not null. @@ -6188,6 +6195,7 @@ GuiVirtualRepeatCompositionBase bool itemSourceUpdated = false; bool useMinimumFullSize = false; Size realFullSize; + Size realMinimumFullSize; Rect viewBounds; vint startIndex = 0; StyleList visibleStyles; @@ -6197,7 +6205,7 @@ GuiVirtualRepeatCompositionBase virtual VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex) = 0; virtual void Layout_EndLayout(bool totalSizeUpdated) = 0; virtual void Layout_InvalidateItemSizeCache() = 0; - virtual Size Layout_CalculateTotalSize() = 0; + virtual void Layout_CalculateTotalSize(Size& full, Size& minimum) = 0; virtual void Layout_UpdateIndex(ItemStyleRecord style, vint index); void Layout_UpdateViewBounds(Rect value, bool forceUpdateTotalSize); @@ -6221,6 +6229,7 @@ GuiVirtualRepeatCompositionBase vint CalculateAdoptedSize(vint expectedSize, vint count, vint itemSize); ItemStyleRecord CreateStyle(vint index); void DeleteStyle(ItemStyleRecord style); + void UpdateFullSize(); void OnViewChangedInternal(Rect oldBounds, Rect newBounds, bool forceUpdateTotalSize); public: @@ -6278,7 +6287,7 @@ GuiVirtualRepeatCompositionBase VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex) override; void Layout_EndLayout(bool totalSizeUpdated) override; void Layout_InvalidateItemSizeCache() override; - Size Layout_CalculateTotalSize() override; + void Layout_CalculateTotalSize(Size& full, Size& minimum) override; void OnItemChanged(vint start, vint oldCount, vint newCount) override; void OnInstallItems() override; @@ -6310,7 +6319,7 @@ GuiVirtualRepeatCompositionBase VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex)override; void Layout_EndLayout(bool totalSizeUpdated) override; void Layout_InvalidateItemSizeCache()override; - Size Layout_CalculateTotalSize()override; + void Layout_CalculateTotalSize(Size& full, Size& minimum)override; public: /// Create the arranger. GuiRepeatFixedHeightItemComposition() = default; @@ -6340,7 +6349,7 @@ GuiVirtualRepeatCompositionBase VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex)override; void Layout_EndLayout(bool totalSizeUpdated) override; void Layout_InvalidateItemSizeCache()override; - Size Layout_CalculateTotalSize()override; + void Layout_CalculateTotalSize(Size& full, Size& minimum)override; public: /// Create the arranger. GuiRepeatFixedSizeMultiColumnItemComposition() = default; @@ -6374,7 +6383,7 @@ GuiVirtualRepeatCompositionBase VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex)override; void Layout_EndLayout(bool totalSizeUpdated) override; void Layout_InvalidateItemSizeCache()override; - Size Layout_CalculateTotalSize()override; + void Layout_CalculateTotalSize(Size& full, Size& minimum)override; public: /// Create the arranger. GuiRepeatFixedHeightMultiColumnItemComposition() = default; @@ -6908,6 +6917,18 @@ Helpers InvokeOnCompositionStateChanged(); } public: + static vint GetElementType() + { + static vint elementType = -1; + if (elementType == -1) + { + auto manager = GetGuiGraphicsResourceManager(); + CHECK_ERROR(manager != nullptr, L"SetGuiGraphicsResourceManager must be called before registering element types."); + elementType = manager->RegisterElementType(WString::Unmanaged(TElement::ElementTypeName)); + } + return elementType; + } + static TElement* Create() { auto rendererFactory = GetGuiGraphicsResourceManager()->GetRendererFactory(TElement::GetElementType()); @@ -6938,147 +6959,151 @@ Helpers } }; -#define DEFINE_GUI_GRAPHICS_ELEMENT(TELEMENT, ELEMENT_TYPE_NAME)\ - friend class GuiElementBase;\ - public:\ - static vint GetElementType()\ - {\ - static vint elementType = -1;\ - if (elementType == -1)\ - {\ - auto manager = GetGuiGraphicsResourceManager();\ - CHECK_ERROR(manager != nullptr, L"SetGuiGraphicsResourceManager must be called before registering element types.");\ - elementType = manager->RegisterElementType(WString::Unmanaged(ELEMENT_TYPE_NAME));\ - }\ - return elementType;\ - }\ + template + class GuiElementRendererBase : public Object, public IGuiGraphicsRenderer + { + public: + class Factory : public Object, public IGuiGraphicsRendererFactory + { + public: + IGuiGraphicsRenderer* Create() + { + TRenderer* renderer=new TRenderer; + renderer->factory=this; + renderer->element=nullptr; + renderer->renderTarget=nullptr; + return renderer; + } + }; + protected: -#define DEFINE_GUI_GRAPHICS_RENDERER(TELEMENT, TRENDERER, TTARGET)\ - public:\ - class Factory : public Object, public IGuiGraphicsRendererFactory\ - {\ - public:\ - IGuiGraphicsRenderer* Create()\ - {\ - TRENDERER* renderer=new TRENDERER;\ - renderer->factory=this;\ - renderer->element=nullptr;\ - renderer->renderTarget=nullptr;\ - return renderer;\ - }\ - };\ - protected:\ - IGuiGraphicsRendererFactory* factory;\ - TELEMENT* element;\ - TTARGET* renderTarget;\ - Size minSize;\ - public:\ - static void Register()\ - {\ - auto manager = GetGuiGraphicsResourceManager();\ - CHECK_ERROR(manager != nullptr, L"SetGuiGraphicsResourceManager must be called before registering element renderers.");\ - manager->RegisterRendererFactory(TELEMENT::GetElementType(), Ptr(new TRENDERER::Factory));\ - }\ - IGuiGraphicsRendererFactory* GetFactory()override\ - {\ - return factory;\ - }\ - void Initialize(IGuiGraphicsElement* _element)override\ - {\ - element=dynamic_cast(_element);\ - InitializeInternal();\ - }\ - void Finalize()override\ - {\ - FinalizeInternal();\ - }\ - void SetRenderTarget(IGuiGraphicsRenderTarget* _renderTarget)override\ - {\ - TTARGET* oldRenderTarget=renderTarget;\ - renderTarget=dynamic_cast(_renderTarget);\ - RenderTargetChangedInternal(oldRenderTarget, renderTarget);\ - }\ - Size GetMinSize()override\ - {\ - return minSize;\ - }\ + IGuiGraphicsRendererFactory* factory; + TElement* element; + TRenderTarget* renderTarget; + Size minSize; -#define DEFINE_CACHED_RESOURCE_ALLOCATOR(TKEY, TVALUE)\ - public:\ - static const vint DeadPackageMax=32;\ - struct Package\ - {\ - TVALUE resource;\ - vint counter;\ - std::partial_ordering operator<=>(const Package&) const { return std::partial_ordering::unordered; }\ - bool operator==(const Package&)const{return false;}\ - };\ - struct DeadPackage\ - {\ - TKEY key;\ - TVALUE value;\ - std::partial_ordering operator<=>(const DeadPackage&) const { return std::partial_ordering::unordered; }\ - bool operator==(const DeadPackage&)const{return false;}\ - };\ - Dictionary aliveResources;\ - List deadResources;\ - public:\ - TVALUE Create(const TKEY& key)\ - {\ - vint index=aliveResources.Keys().IndexOf(key);\ - if(index!=-1)\ - {\ - Package package=aliveResources.Values().Get(index);\ - package.counter++;\ - aliveResources.Set(key, package);\ - return package.resource;\ - }\ - TVALUE resource;\ - for(vint i=0;iRegisterRendererFactory(TElement::GetElementType(), Ptr(new typename TRenderer::Factory)); + } + + IGuiGraphicsRendererFactory* GetFactory()override + { + return factory; + } + + void Initialize(IGuiGraphicsElement* _element)override + { + element=dynamic_cast(_element); + static_cast(this)->InitializeInternal(); + } + + void Finalize()override + { + static_cast(this)->FinalizeInternal(); + } + + void SetRenderTarget(IGuiGraphicsRenderTarget* _renderTarget)override + { + TRenderTarget* oldRenderTarget=renderTarget; + renderTarget= static_cast(_renderTarget); + static_cast(this)->RenderTargetChangedInternal(oldRenderTarget, renderTarget); + } + + Size GetMinSize()override + { + return minSize; + } + }; + + template + class GuiCachedResourceAllocatorBase : public Object + { + public: + static const vint DeadPackageMax = 32; + + struct Package + { + TValue resource; + vint counter; + std::partial_ordering operator<=>(const Package&) const { return std::partial_ordering::unordered; } + bool operator==(const Package&)const { return false; } + }; + + struct DeadPackage + { + TKey key; + TValue value; + std::partial_ordering operator<=>(const DeadPackage&) const { return std::partial_ordering::unordered; } + bool operator==(const DeadPackage&)const { return false; } + }; + + collections::Dictionary aliveResources; + collections::List deadResources; + + public: + + TValue Create(const TKey& key) + { + vint index = aliveResources.Keys().IndexOf(key); + if (index != -1) + { + Package package = aliveResources.Values().Get(index); + package.counter++; + aliveResources.Set(key, package); + return package.resource; + } + TValue resource; + for (vint i = 0; i < deadResources.Count(); i++) + { + if (deadResources[i].key == key) + { + DeadPackage deadPackage = deadResources[i]; + deadResources.RemoveAt(i); + resource = deadPackage.value; + break; + } + } + if (!resource) + { + resource = static_cast(this)->CreateInternal(key); + } + Package package; + package.resource = resource; + package.counter = 1; + aliveResources.Add(key, package); + return package.resource; + } + + void Destroy(const TKey& key) + { + vint index = aliveResources.Keys().IndexOf(key); + if (index != -1) + { + Package package = aliveResources.Values().Get(index); + package.counter--; + if (package.counter == 0) + { + aliveResources.Remove(key); + if (deadResources.Count() == DeadPackageMax) + { + deadResources.RemoveAt(DeadPackageMax - 1); + } + DeadPackage deadPackage; + deadPackage.key = key; + deadPackage.value = package.resource; + deadResources.Insert(0, deadPackage); + } + else + { + aliveResources.Set(key, package); + } + } } + }; } } } @@ -8001,1756 +8026,1819 @@ GuiHostedWindow #endif /*********************************************************************** -.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEGRAPHICS.H +.\RESOURCES\GUIPLUGINMANAGER.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) -GacUI::Remote Window +GacUI::Resource Interfaces: - GuiRemoteController - ***********************************************************************/ -#ifndef VCZH_PRESENTATION_GUIREMOTEGRAPHICS -#define VCZH_PRESENTATION_GUIREMOTEGRAPHICS +#ifndef VCZH_PRESENTATION_RESOURCES_GUIPLUGINMANAGER +#define VCZH_PRESENTATION_RESOURCES_GUIPLUGINMANAGER -namespace vl::presentation +namespace vl { - class GuiRemoteController; - - namespace elements + namespace presentation { + /*********************************************************************** -GuiRemoteGraphicsRenderTarget +Plugin ***********************************************************************/ - class GuiRemoteGraphicsRenderTarget : public GuiGraphicsRenderTarget + /// Represents a plugin for the gui. + class IGuiPlugin : public IDescriptable, public Description { - protected: - GuiRemoteController* remote; - NativeSize canvasSize; - - void StartRenderingOnNativeWindow() override; - RenderTargetFailure StopRenderingOnNativeWindow() override; + public: + /// Get the name of this plugin. + /// Returns the name of the plugin. + virtual WString GetName() = 0; + /// Get all dependencies of this plugin. + /// To receive all dependencies. + virtual void GetDependencies(collections::List& dependencies) = 0; + /// Called when the plugin manager want to load this plugin. + virtual void Load()=0; + /// Called when the plugin manager want to unload this plugin. + virtual void Unload()=0; + }; - Size GetCanvasSize() override; - void AfterPushedClipper(Rect clipper, Rect validArea) override; - void AfterPushedClipperAndBecameInvalid(Rect clipper) override; - void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists) override; - void AfterPoppedClipper(Rect validArea, bool clipperExists) override; + /// Represents a plugin manager. + class IGuiPluginManager : public IDescriptable, public Description + { public: - GuiRemoteGraphicsRenderTarget(GuiRemoteController* _remote); - ~GuiRemoteGraphicsRenderTarget(); + /// Add a plugin before [F:vl.presentation.controls.IGuiPluginManager.Load] is called. + /// The plugin. + virtual void AddPlugin(Ptr plugin)=0; + /// Load all plugins, and check if dependencies of all plugins are ready. + virtual void Load()=0; + /// Unload all plugins. + virtual void Unload()=0; + /// Returns true if all plugins are loaded. + virtual bool IsLoaded()=0; }; /*********************************************************************** -GuiRemoteGraphicsResourceManager +Plugin Manager ***********************************************************************/ - class GuiRemoteGraphicsResourceManager : public GuiGraphicsResourceManager + struct GuiPluginDescriptor { - protected: - GuiRemoteController* remote; - GuiRemoteGraphicsRenderTarget renderTarget; + GuiPluginDescriptor* next = nullptr; - public: - GuiRemoteGraphicsResourceManager(GuiRemoteController* _remote); - ~GuiRemoteGraphicsResourceManager(); + virtual Ptr CreatePlugin() = 0; + }; - // ============================================================= - // IGuiGraphicsResourceManager - // ============================================================= + /// Get the global object. + /// The global object. + extern IGuiPluginManager* GetPluginManager(); - IGuiGraphicsRenderTarget* GetRenderTarget(INativeWindow* window) override; - void RecreateRenderTarget(INativeWindow* window) override; - void ResizeRenderTarget(INativeWindow* window) override; - IGuiGraphicsLayoutProvider* GetLayoutProvider() override; - }; + /// Register a plugin descriptor. Do not call this function directly, use GUI_REGISTER_PLUGIN macro instead. + /// The plugin descriptor. + extern void RegisterPluginDescriptor(GuiPluginDescriptor* pluginDescriptor); + + /// Destroy the global object. + extern void DestroyPluginManager(); + +#define GUI_REGISTER_PLUGIN(TYPE)\ + struct GuiRegisterPluginClass_##TYPE : private vl::presentation::GuiPluginDescriptor\ + {\ + private:\ + vl::Ptr CreatePlugin() override\ + {\ + return vl::Ptr(new TYPE);\ + }\ + public:\ + GuiRegisterPluginClass_##TYPE()\ + {\ + vl::presentation::RegisterPluginDescriptor(this);\ + }\ + } instance_GuiRegisterPluginClass_##TYPE;\ + +#define GUI_PLUGIN_NAME(NAME)\ + vl::WString GetName()override { return L ## #NAME; }\ + void GetDependencies(vl::collections::List& dependencies)override\ + +#define GUI_PLUGIN_DEPEND(NAME) dependencies.Add(L ## #NAME) } } #endif /*********************************************************************** -.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOLSCHEMASHARED.H +.\RESOURCES\GUIRESOURCE.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) -GacUI::Remote Window +GacUI::Resource Interfaces: - IGuiRemoteProtocol - ***********************************************************************/ -#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMASHARED -#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMASHARED +#ifndef VCZH_PRESENTATION_RESOURCES_GUIRESOURCE +#define VCZH_PRESENTATION_RESOURCES_GUIRESOURCE -namespace vl::presentation::remoteprotocol +namespace vl { - template - struct JsonHelper - { - static Ptr ToJson(const T& value); - static void ConvertJsonToCustomType(Ptr node, T& value); - }; - - template - Ptr ConvertCustomTypeToJson(const T& value) + namespace workflow { - return JsonHelper::ToJson(value); + class IWfCompilerCallback; } - template<> Ptr ConvertCustomTypeToJson(const bool& value); - template<> Ptr ConvertCustomTypeToJson(const vint& value); - template<> Ptr ConvertCustomTypeToJson(const float& value); - template<> Ptr ConvertCustomTypeToJson(const double& value); - template<> Ptr ConvertCustomTypeToJson(const WString& value); - template<> Ptr ConvertCustomTypeToJson(const wchar_t& value); - template<> Ptr ConvertCustomTypeToJson(const VKEY& value); - - template - void ConvertJsonToCustomType(Ptr node, T& value) + namespace presentation { - return JsonHelper::FromJson(node, value); - } - - template<> void ConvertJsonToCustomType(Ptr node, bool& value); - template<> void ConvertJsonToCustomType(Ptr node, vint& value); - template<> void ConvertJsonToCustomType(Ptr node, float& value); - template<> void ConvertJsonToCustomType(Ptr node, double& value); - template<> void ConvertJsonToCustomType(Ptr node, WString& value); - template<> void ConvertJsonToCustomType(Ptr node, wchar_t& value); - template<> void ConvertJsonToCustomType(Ptr node, VKEY& value); + class GuiResourceItem; + class GuiResourceFolder; + class GuiResource; + class GuiResourcePathResolver; - template - void ConvertCustomTypeToJsonField(Ptr node, const wchar_t* name, const T& value) - { - auto field = Ptr(new glr::json::JsonObjectField); - field->name.value = WString::Unmanaged(name); - field->value = ConvertCustomTypeToJson(value); - node->fields.Add(field); - } +/*********************************************************************** +Helper Functions +***********************************************************************/ - template - struct JsonHelper>> - { - static Ptr ToJson(const Ptr>& value) - { - if (!value) - { - auto node = Ptr(new glr::json::JsonLiteral); - node->value = glr::json::JsonLiteralValue::Null; - return node; - } - else - { - auto node = Ptr(new glr::json::JsonArray); - for (auto&& item : *value.Obj()) - { - node->items.Add(ConvertCustomTypeToJson(item)); - } - return node; - } - } + /// Get the folder path from a file path. The result folder path is ended with a separator. + /// The folder path. + /// The file path. + extern WString GetFolderPath(const WString& filePath); + /// Get the file name from a file path. + /// The file name. + /// The file path. + extern WString GetFileName(const WString& filePath); + /// Load a text file. + /// Returns true if the operation succeeded. + /// The text file path. + /// The text file content, if succeeded. + extern bool LoadTextFile(const WString& filePath, WString& text); + /// Test is a text a resource url and extract the protocol and the path. + /// Returns true if the text is a resource url. + /// The text. + /// The extracted protocol. + /// The extracted path. + extern bool IsResourceUrl(const WString& text, WString& protocol, WString& path); - static void FromJson(Ptr node, Ptr>& value) + extern void HexToBinary(stream::IStream& binaryStream, const WString& hexText); + extern WString BinaryToHex(stream::IStream& binaryStream); + +/*********************************************************************** +Global String Key +***********************************************************************/ + + struct GlobalStringKey { -#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, Ptr>&)#" - if (auto jsonLiteral = node.Cast()) - { - if (jsonLiteral->value == glr::json::JsonLiteralValue::Null) - { - value = {}; - return; - } - } - else if (auto jsonArray = node.Cast()) - { - value = Ptr(new collections::List); - for (auto jsonItem : jsonArray->items) - { - T item; - ConvertJsonToCustomType(jsonItem, item); - value->Add(std::move(item)); - } - return; - } - CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); -#undef ERROR_MESSAGE_PREFIX - } - }; -} + public: + static GlobalStringKey Empty; + static GlobalStringKey _InferType; + static GlobalStringKey _Set; + static GlobalStringKey _Ref; + static GlobalStringKey _Bind; + static GlobalStringKey _Format; + static GlobalStringKey _Str; + static GlobalStringKey _Eval; + static GlobalStringKey _Uri; + static GlobalStringKey _ControlTemplate; + static GlobalStringKey _ItemTemplate; -#endif + private: + vint key = -1; + public: + GUI_DEFINE_COMPARE_OPERATORS(GlobalStringKey) + + static GlobalStringKey Get(const WString& string); + vint ToKey()const; + WString ToString()const; + }; /*********************************************************************** -.\PLATFORMPROVIDERS\REMOTE\PROTOCOL\GENERATED\GUIREMOTEPROTOCOLSCHEMA.H -***********************************************************************/ -/*********************************************************************** -This file is generated by : Vczh GacUI Remote Protocol Generator -Licensed under https ://github.com/vczh-libraries/License +Resource Image ***********************************************************************/ + + /// + /// Represnets an image to display. + /// + class GuiImageData : public Object, public Description + { + protected: + Ptr image; + vint frameIndex; -#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMA -#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMA + public: + /// Create an empty image data. + GuiImageData(); + /// Create an image data with a specified image and a frame index. + /// The specified image. + /// The specified frame index. + GuiImageData(Ptr _image, vint _frameIndex); + ~GuiImageData(); + /// Get the specified image. + /// The specified image. + Ptr GetImage(); + /// Get the specified frame index. + /// The specified frame index. + vint GetFrameIndex(); + }; -namespace vl::presentation::remoteprotocol -{ - enum class IOMouseButton - { - Left, - Middle, - Right, - }; +/*********************************************************************** +Resource String +***********************************************************************/ - struct FontConfig - { - ::vl::presentation::FontProperties defaultFont; - ::vl::Ptr<::vl::collections::List<::vl::WString>> supportedFonts; - }; + /// Represents a text resource. + class GuiTextData : public Object, public Description + { + protected: + WString text; - struct ScreenConfig - { - ::vl::presentation::NativeRect bounds; - ::vl::presentation::NativeRect clientBounds; - double scalingX; - double scalingY; - }; + public: + /// Create an empty text data. + GuiTextData(); + /// Create a text data with a specified text. + /// The specified text. + GuiTextData(const WString& _text); + + /// Get the specified text. + /// The specified text. + WString GetText(); + }; - struct IOMouseInfoWithButton - { - vl::presentation::remoteprotocol::IOMouseButton button; - ::vl::presentation::NativeWindowMouseInfo info; - }; +/*********************************************************************** +Resource Precompile Context +***********************************************************************/ - struct GlobalShortcutKey - { - ::vl::vint id; - bool ctrl; - bool shift; - bool alt; - ::vl::presentation::VKEY code; - }; + /// + /// CPU architecture + /// + enum class GuiResourceCpuArchitecture + { + x86, + x64, + Unspecified, + }; - struct WindowSizingConfig - { - ::vl::presentation::NativeRect bounds; - ::vl::presentation::NativeRect clientBounds; - ::vl::presentation::INativeWindow::WindowSizeState sizeState; - ::vl::presentation::NativeMargin customFramePadding; - }; + /// + /// Resource usage + /// + enum class GuiResourceUsage + { + DataOnly, + InstanceClass, + }; - struct WindowShowing - { - bool activate; - ::vl::presentation::INativeWindow::WindowSizeState sizeState; - }; + /// Provide a context for resource precompiling + struct GuiResourcePrecompileContext + { + typedef collections::Dictionary, Ptr> PropertyMap; - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseButton & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeWindow::WindowSizeState>(const ::vl::presentation::INativeWindow::WindowSizeState & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeCoordinate>(const ::vl::presentation::NativeCoordinate & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativePoint>(const ::vl::presentation::NativePoint & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeSize>(const ::vl::presentation::NativeSize & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeRect>(const ::vl::presentation::NativeRect & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeMargin>(const ::vl::presentation::NativeMargin & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::FontProperties>(const ::vl::presentation::FontProperties & value); - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::FontConfig & value); - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::ScreenConfig & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowMouseInfo>(const ::vl::presentation::NativeWindowMouseInfo & value); - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::IOMouseInfoWithButton & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowKeyInfo>(const ::vl::presentation::NativeWindowKeyInfo & value); - template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowCharInfo>(const ::vl::presentation::NativeWindowCharInfo & value); - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::GlobalShortcutKey & value); - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowSizingConfig & value); - template<> vl::Ptr ConvertCustomTypeToJson(const vl::presentation::remoteprotocol::WindowShowing & value); - - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseButton& value); - template<> void ConvertJsonToCustomType<::vl::presentation::INativeWindow::WindowSizeState>(vl::Ptr node, ::vl::presentation::INativeWindow::WindowSizeState& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(vl::Ptr node, ::vl::presentation::NativeCoordinate& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativePoint>(vl::Ptr node, ::vl::presentation::NativePoint& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeSize>(vl::Ptr node, ::vl::presentation::NativeSize& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeRect>(vl::Ptr node, ::vl::presentation::NativeRect& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeMargin>(vl::Ptr node, ::vl::presentation::NativeMargin& value); - template<> void ConvertJsonToCustomType<::vl::presentation::FontProperties>(vl::Ptr node, ::vl::presentation::FontProperties& value); - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::FontConfig& value); - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::ScreenConfig& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowMouseInfo>(vl::Ptr node, ::vl::presentation::NativeWindowMouseInfo& value); - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::IOMouseInfoWithButton& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowKeyInfo>(vl::Ptr node, ::vl::presentation::NativeWindowKeyInfo& value); - template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowCharInfo>(vl::Ptr node, ::vl::presentation::NativeWindowCharInfo& value); - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::GlobalShortcutKey& value); - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowSizingConfig& value); - template<> void ConvertJsonToCustomType(vl::Ptr node, vl::presentation::remoteprotocol::WindowShowing& value); - -#define GACUI_REMOTEPROTOCOL_MESSAGES(HANDLER)\ - HANDLER(ControllerGetFontConfig, void, vl::presentation::remoteprotocol::FontConfig, NOREQ, RES, NODROP)\ - HANDLER(ControllerGetScreenConfig, void, vl::presentation::remoteprotocol::ScreenConfig, NOREQ, RES, NODROP)\ - HANDLER(ControllerConnectionEstablished, void, void, NOREQ, NORES, NODROP)\ - HANDLER(ControllerConnectionStopped, void, void, NOREQ, NORES, NODROP)\ - HANDLER(IOUpdateGlobalShortcutKey, ::vl::Ptr<::vl::collections::List>, void, REQ, NORES, NODROP)\ - HANDLER(IORequireCapture, void, void, NOREQ, NORES, NODROP)\ - HANDLER(IOReleaseCapture, void, void, NOREQ, NORES, NODROP)\ - HANDLER(IOIsKeyPressing, ::vl::presentation::VKEY, bool, REQ, RES, NODROP)\ - HANDLER(IOIsKeyToggled, ::vl::presentation::VKEY, bool, REQ, RES, NODROP)\ - HANDLER(WindowGetBounds, void, vl::presentation::remoteprotocol::WindowSizingConfig, NOREQ, RES, NODROP)\ - HANDLER(WindowNotifySetTitle, ::vl::WString, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetEnabled, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetTopMost, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetShowInTaskBar, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetCustomFrameMode, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetMaximizedBox, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetMinimizedBox, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetBorder, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetSizeBox, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetIconVisible, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetTitleBar, bool, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetBounds, ::vl::presentation::NativeRect, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifySetClientSize, ::vl::presentation::NativeSize, void, REQ, NORES, DROPREP)\ - HANDLER(WindowNotifyActivate, void, void, NOREQ, NORES, DROPREP)\ - HANDLER(WindowNotifyShow, vl::presentation::remoteprotocol::WindowShowing, void, REQ, NORES, DROPREP)\ - -#define GACUI_REMOTEPROTOCOL_EVENTS(HANDLER)\ - HANDLER(ControllerConnect, void, NOREQ, NODROP)\ - HANDLER(ControllerDisconnect, void, NOREQ, NODROP)\ - HANDLER(ControllerRequestExit, void, NOREQ, NODROP)\ - HANDLER(ControllerForceExit, void, NOREQ, NODROP)\ - HANDLER(ControllerScreenUpdated, vl::presentation::remoteprotocol::ScreenConfig, REQ, DROPREP)\ - HANDLER(IOGlobalShortcutKey, ::vl::vint, REQ, NODROP)\ - HANDLER(IOButtonDown, vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ - HANDLER(IOButtonDoubleClick, vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ - HANDLER(IOButtonUp, vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ - HANDLER(IOHWheel, ::vl::presentation::NativeWindowMouseInfo, REQ, NODROP)\ - HANDLER(IOVWheel, ::vl::presentation::NativeWindowMouseInfo, REQ, NODROP)\ - HANDLER(IOMouseMoving, ::vl::presentation::NativeWindowMouseInfo, REQ, DROPCON)\ - HANDLER(IOMouseEntered, void, NOREQ, NODROP)\ - HANDLER(IOMouseLeaved, void, NOREQ, NODROP)\ - HANDLER(IOKeyDown, ::vl::presentation::NativeWindowKeyInfo, REQ, NODROP)\ - HANDLER(IOKeyUp, ::vl::presentation::NativeWindowKeyInfo, REQ, NODROP)\ - HANDLER(IOChar, ::vl::presentation::NativeWindowCharInfo, REQ, NODROP)\ - HANDLER(WindowBoundsUpdated, vl::presentation::remoteprotocol::WindowSizingConfig, REQ, DROPREP)\ - HANDLER(WindowActivatedUpdated, bool, REQ, DROPREP)\ - -} - -#endif + /// The target CPU architecture. + GuiResourceCpuArchitecture targetCpuArchitecture = GuiResourceCpuArchitecture::Unspecified; + /// Progress callback. + workflow::IWfCompilerCallback* compilerCallback = nullptr; + /// The folder to contain compiled objects. + Ptr targetFolder; + /// The root resource object. + GuiResource* rootResource = nullptr; + /// Indicate the pass index of this precompiling pass. + vint passIndex = -1; + /// The path resolver. This is only for delay load resource. + Ptr resolver; + /// Additional properties for resource item contents + PropertyMap additionalProperties; + }; + /// Provide a context for resource initializing + struct GuiResourceInitializeContext : GuiResourcePrecompileContext + { + GuiResourceUsage usage; + }; /*********************************************************************** -.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOL.H +Resource Structure ***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Remote Window -Interfaces: - IGuiRemoteProtocol - -***********************************************************************/ + /// Resource node base. + class GuiResourceNodeBase : public Object, public Description + { + friend class GuiResourceFolder; + protected: + GuiResourceFolder* parent; + WString name; + WString fileContentPath; + WString fileAbsolutePath; + + public: + GuiResourceNodeBase(); + ~GuiResourceNodeBase(); -#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEPROTOCOL -#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEPROTOCOL + /// Get the containing folder. Returns null means that this is the root resource node. + /// The containing folder. + GuiResourceFolder* GetParent(); + /// Get the name of this resource node. + /// The name of this resource node . + const WString& GetName(); + /// Get the resource path of this resource node + /// The resource path of this resource node . + WString GetResourcePath(); + /// Get the file content path of this resource node. When saving the resource, if the path is not empty, the path will be serialized instead of the content. + /// The file content path of this resource node . + const WString& GetFileContentPath(); + /// Get the absolute file content path of this resource node. This path points to an existing file containing the content. + /// The file absolute path of this resource node . + const WString& GetFileAbsolutePath(); + /// Set the file content path of this resource node. + /// The file content path of this resource node . + /// The file absolute path of this resource node . + void SetFileContentPath(const WString& content, const WString& absolute); + }; + struct GuiResourceLocation + { + WString resourcePath; + WString filePath; -namespace vl::presentation -{ -/*********************************************************************** -IGuiRemoteProtocolEvents -***********************************************************************/ + GuiResourceLocation() = default; + GuiResourceLocation(const WString& _resourcePath, const WString& _filePath); + GuiResourceLocation(Ptr node); - class IGuiRemoteProtocolEvents : public virtual Interface - { - public: -#define EVENT_NOREQ(NAME, REQUEST) virtual void On ## NAME() = 0; -#define EVENT_REQ(NAME, REQUEST) virtual void On ## NAME(const REQUEST& arguments) = 0; -#define EVENT_HANDLER(NAME, REQUEST, REQTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST) - GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) -#undef EVENT_HANDLER -#undef EVENT_REQ -#undef EVENT_NOREQ + GUI_DEFINE_COMPARE_OPERATORS(GuiResourceLocation) + }; -#define MESSAGE_NORES(NAME, RESPONSE) -#define MESSAGE_RES(NAME, RESPONSE) virtual void Respond ## NAME(vint id, const RESPONSE& arguments) = 0; -#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) - GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) -#undef MESSAGE_HANDLER -#undef MESSAGE_RES -#undef MESSAGE_NORES - }; + struct GuiResourceTextPos + { + GuiResourceLocation originalLocation; + vint row = glr::ParsingTextPos::UnknownValue; + vint column = glr::ParsingTextPos::UnknownValue; -/*********************************************************************** -IGuiRemoteProtocolMessages -***********************************************************************/ + GuiResourceTextPos() = default; + GuiResourceTextPos(GuiResourceLocation location, glr::ParsingTextPos position); - class IGuiRemoteProtocolMessages : public virtual Interface - { - public: -#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME() = 0; -#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(vint id) = 0; -#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(const REQUEST& arguments) = 0; -#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(vint id, const REQUEST& arguments) = 0; -#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE) - GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) -#undef MESSAGE_HANDLER -#undef MESSAGE_REQ_RES -#undef MESSAGE_REQ_NORES -#undef MESSAGE_NOREQ_RES -#undef MESSAGE_NOREQ_NORES - }; + GUI_DEFINE_COMPARE_OPERATORS(GuiResourceTextPos) + }; -/*********************************************************************** -IGuiRemoteProtocolConfig -***********************************************************************/ + struct GuiResourceError + { + public: + using List = collections::List; - class IGuiRemoteProtocolConfig : public virtual Interface - { - public: - virtual WString GetExecutablePath() = 0; - }; + GuiResourceLocation location; + GuiResourceTextPos position; + WString message; -/*********************************************************************** -IGuiRemoteProtocol -***********************************************************************/ + GuiResourceError() = default; + GuiResourceError(GuiResourceTextPos _position, const WString& _message); + GuiResourceError(GuiResourceLocation _location, const WString& _message); + GuiResourceError(GuiResourceLocation _location, GuiResourceTextPos _position, const WString& _message); - class IGuiRemoteProtocol - : public virtual IGuiRemoteProtocolConfig - , public virtual IGuiRemoteProtocolMessages - { - public: - virtual void Initialize(IGuiRemoteProtocolEvents* events) = 0; - virtual void Submit() = 0; - virtual void ProcessRemoteEvents() = 0; - }; -} + GUI_DEFINE_COMPARE_OPERATORS(GuiResourceError) -#endif + static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List& parsingErrors); + static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List& parsingErrors, glr::ParsingTextPos offset); + static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List& parsingErrors, GuiResourceTextPos offset); + static void SortAndLog(List& errors, collections::List& output, const WString& workingDirectory = WString::Empty); + }; -/*********************************************************************** -.\RESOURCES\GUIPLUGINMANAGER.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Resource + class DocumentModel; + class IGuiResourcePrecompileCallback; + + /// Resource item. + class GuiResourceItem : public GuiResourceNodeBase, public Description + { + friend class GuiResourceFolder; + protected: + Ptr content; + WString typeName; + + public: + /// Create a resource item. + GuiResourceItem(); + ~GuiResourceItem(); -Interfaces: -***********************************************************************/ + /// Get the type of this resource item. + /// The type name. + const WString& GetTypeName(); + + /// Get the contained object for this resource item. + /// The contained object. + Ptr GetContent(); + /// Set the containd object for this resource item. + /// The type name of this contained object. + /// The contained object. + void SetContent(const WString& _typeName, Ptr value); -#ifndef VCZH_PRESENTATION_RESOURCES_GUIPLUGINMANAGER -#define VCZH_PRESENTATION_RESOURCES_GUIPLUGINMANAGER + /// Get the contained object as an image. + /// The contained object. + Ptr AsImage(); + /// Get the contained object as an xml. + /// The contained object. + Ptr AsXml(); + /// Get the contained object as a string. + /// The contained object. + Ptr AsString(); + /// Get the contained object as a document model. + /// The contained object. + Ptr AsDocument(); + }; + + /// Resource folder. A resource folder contains many sub folders and sub items. + class GuiResourceFolder : public GuiResourceNodeBase, public Description + { + protected: + typedef collections::Dictionary> ItemMap; + typedef collections::Dictionary> FolderMap; + typedef collections::List> ItemList; + typedef collections::List> FolderList; + struct DelayLoading + { + WString type; + WString workingDirectory; + Ptr preloadResource; + }; -namespace vl -{ - namespace presentation - { + typedef collections::List DelayLoadingList; -/*********************************************************************** -Plugin -***********************************************************************/ + WString importUri; + ItemMap items; + FolderMap folders; - /// Represents a plugin for the gui. - class IGuiPlugin : public IDescriptable, public Description - { + void LoadResourceFolderFromXml(DelayLoadingList& delayLoadings, const WString& containingFolder, Ptr folderXml, GuiResourceError::List& errors); + void SaveResourceFolderToXml(Ptr xmlParent); + void CollectTypeNames(collections::List& typeNames); + void LoadResourceFolderFromBinary(DelayLoadingList& delayLoadings, stream::internal::ContextFreeReader& reader, collections::List& typeNames, GuiResourceError::List& errors); + void SaveResourceFolderToBinary(stream::internal::ContextFreeWriter& writer, collections::List& typeNames); + void PrecompileResourceFolder(GuiResourcePrecompileContext& context, IGuiResourcePrecompileCallback* callback, GuiResourceError::List& errors); + void InitializeResourceFolder(GuiResourceInitializeContext& context, GuiResourceError::List& errors); + void ImportFromUri(const WString& uri, GuiResourceTextPos position, GuiResourceError::List& errors); public: - /// Get the name of this plugin. - /// Returns the name of the plugin. - virtual WString GetName() = 0; - /// Get all dependencies of this plugin. - /// To receive all dependencies. - virtual void GetDependencies(collections::List& dependencies) = 0; - /// Called when the plugin manager want to load this plugin. - virtual void Load()=0; - /// Called when the plugin manager want to unload this plugin. - virtual void Unload()=0; - }; + /// Create a resource folder. + GuiResourceFolder(); + ~GuiResourceFolder(); - /// Represents a plugin manager. - class IGuiPluginManager : public IDescriptable, public Description - { - public: - /// Add a plugin before [F:vl.presentation.controls.IGuiPluginManager.Load] is called. - /// The plugin. - virtual void AddPlugin(Ptr plugin)=0; - /// Load all plugins, and check if dependencies of all plugins are ready. - virtual void Load()=0; - /// Unload all plugins. - virtual void Unload()=0; - /// Returns true if all plugins are loaded. - virtual bool IsLoaded()=0; + ///Get the import uri for this folder. + ///The import uri for this folder. Returns an empty string for non-import folders + const WString& GetImportUri(); + ///Set the import uri for this folder. + ///The import uri for this folder. Set an empty string for non-import folders + void SetImportUri(const WString& uri); + + /// Get all sub items. + /// All sub items. + const ItemList& GetItems(); + /// Get the item of a specified name. + /// The item of a specified name. + /// The specified name. + Ptr GetItem(const WString& name); + /// Add a resource item. + /// Returns true if this operation succeeded. + /// The name of this resource item. + /// The resource item. + bool AddItem(const WString& name, Ptr item); + /// Remove a resource item of a specified name. + /// Returns the removed resource item if this operation succeeded. + /// The name of this resource item. + Ptr RemoveItem(const WString& name); + /// Remove all resource item. + void ClearItems(); + + /// Get all sub folders. + /// All sub folders. + const FolderList& GetFolders(); + /// Get the folder of a specified name. + /// The folder of a specified name. + /// The specified name. + Ptr GetFolder(const WString& name); + /// Add a resource folder. + /// Returns true if this operation succeeded. + /// The name of this resource folder. + /// The resource folder. + bool AddFolder(const WString& name, Ptr folder); + /// Remove a resource folder of a specified name. + /// Returns the removed resource folder if this operation succeeded. + /// The name of this resource folder. + Ptr RemoveFolder(const WString& name); + /// Remove all resource folders. + void ClearFolders(); + + /// Get a contained resource object using a path like "Packages\Application\Name". + /// The containd resource object. + /// The path. + Ptr GetValueByPath(const WString& path); + /// Get a resource folder using a path like "Packages\Application\Name\". + /// The resource folder. + /// The path. + Ptr GetFolderByPath(const WString& path); + /// Create a contained resource object using a path like "Packages\Application\Name". + /// Returns true if this operation succeeded. + /// The path. + /// The type name of this contained object. + /// The contained object. + bool CreateValueByPath(const WString& path, const WString& typeName, Ptr value); }; /*********************************************************************** -Plugin Manager +Resource ***********************************************************************/ - struct GuiPluginDescriptor + /// Resource metadata. + class GuiResourceMetadata : public Object { - GuiPluginDescriptor* next = nullptr; + public: + WString name; + WString version; + collections::List dependencies; - virtual Ptr CreatePlugin() = 0; + void LoadFromXml(Ptr xml, GuiResourceLocation location, GuiResourceError::List& errors); + Ptr SaveToXml(); }; + + /// Resource. A resource is a root resource folder that does not have a name. + class GuiResource : public GuiResourceFolder, public Description + { + protected: + WString workingDirectory; + Ptr metadata; - /// Get the global object. - /// The global object. - extern IGuiPluginManager* GetPluginManager(); - - /// Register a plugin descriptor. Do not call this function directly, use GUI_REGISTER_PLUGIN macro instead. - /// The plugin descriptor. - extern void RegisterPluginDescriptor(GuiPluginDescriptor* pluginDescriptor); - - /// Destroy the global object. - extern void DestroyPluginManager(); - -#define GUI_REGISTER_PLUGIN(TYPE)\ - struct GuiRegisterPluginClass_##TYPE : private vl::presentation::GuiPluginDescriptor\ - {\ - private:\ - vl::Ptr CreatePlugin() override\ - {\ - return vl::Ptr(new TYPE);\ - }\ - public:\ - GuiRegisterPluginClass_##TYPE()\ - {\ - vl::presentation::RegisterPluginDescriptor(this);\ - }\ - } instance_GuiRegisterPluginClass_##TYPE;\ + static void ProcessDelayLoading(Ptr resource, DelayLoadingList& delayLoadings, GuiResourceError::List& errors); + public: + static const wchar_t* CurrentVersionString; -#define GUI_PLUGIN_NAME(NAME)\ - vl::WString GetName()override { return L ## #NAME; }\ - void GetDependencies(vl::collections::List& dependencies)override\ + /// Create a resource. + GuiResource(); + ~GuiResource(); -#define GUI_PLUGIN_DEPEND(NAME) dependencies.Add(L ## #NAME) - } -} + /// Get the metadata of the resource. + /// The metadata. + Ptr GetMetadata(); -#endif + /// Get the directory where the resource is load. + /// The directory. + WString GetWorkingDirectory(); -/*********************************************************************** -.\RESOURCES\GUIRESOURCE.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Resource + /// Load a resource from an xml file. If the xml file refers other files, they will be loaded as well. + /// The loaded resource. + /// The xml document. + /// The file path of the resource. + /// The working directory for loading external resources. + /// All collected errors during loading a resource. + static Ptr LoadFromXml(Ptr xml, const WString& filePath, const WString& workingDirectory, GuiResourceError::List& errors); -Interfaces: -***********************************************************************/ + /// Load a resource from an xml file. If the xml file refers other files, they will be loaded as well. + /// The loaded resource. + /// The file path of the xml file. + /// All collected errors during loading a resource. + static Ptr LoadFromXml(const WString& filePath, GuiResourceError::List& errors); -#ifndef VCZH_PRESENTATION_RESOURCES_GUIRESOURCE -#define VCZH_PRESENTATION_RESOURCES_GUIRESOURCE + /// Save the resource to xml. + /// The xml. + Ptr SaveToXml(); + + /// Load a precompiled resource from a stream. + /// The loaded resource. + /// The stream. + /// All collected errors during loading a resource. + static Ptr LoadPrecompiledBinary(stream::IStream& binaryStream, GuiResourceError::List& errors); + /// Load a precompiled resource from a stream. This function will hit an assert if there are errors. + /// The loaded resource. + /// The stream. + static Ptr LoadPrecompiledBinary(stream::IStream& binaryStream); + + /// Save the precompiled resource to a stream. + /// The stream. + void SavePrecompiledBinary(stream::IStream& binaryStream); -namespace vl -{ - namespace workflow - { - class IWfCompilerCallback; - } + /// Precompile this resource to improve performance. + /// The resource folder contains all precompiled result. The folder will be added to the resource if there is no error. + /// A callback to receive progress. + /// All collected errors during precompiling a resource. + Ptr Precompile(GuiResourceCpuArchitecture targetCpuArchitecture, IGuiResourcePrecompileCallback* callback, GuiResourceError::List& errors); - namespace presentation - { - class GuiResourceItem; - class GuiResourceFolder; - class GuiResource; - class GuiResourcePathResolver; + /// Initialize a precompiled resource. + /// In which role an application is initializing this resource. + /// All collected errors during initializing a resource. + void Initialize(GuiResourceUsage usage, GuiResourceError::List& errors); + + /// Get a contained document model using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. + /// The containd resource object. + /// The path. + Ptr GetDocumentByPath(const WString& path); + /// Get a contained image using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. + /// The containd resource object. + /// The path. + Ptr GetImageByPath(const WString& path); + /// Get a contained xml using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. + /// The containd resource object. + /// The path. + Ptr GetXmlByPath(const WString& path); + /// Get a contained string object using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. + /// The containd resource object. + /// The path. + WString GetStringByPath(const WString& path); + }; /*********************************************************************** -Helper Functions +Resource Path Resolver ***********************************************************************/ - /// Get the folder path from a file path. The result folder path is ended with a separator. - /// The folder path. - /// The file path. - extern WString GetFolderPath(const WString& filePath); - /// Get the file name from a file path. - /// The file name. - /// The file path. - extern WString GetFileName(const WString& filePath); - /// Load a text file. - /// Returns true if the operation succeeded. - /// The text file path. - /// The text file content, if succeeded. - extern bool LoadTextFile(const WString& filePath, WString& text); - /// Test is a text a resource url and extract the protocol and the path. - /// Returns true if the text is a resource url. - /// The text. - /// The extracted protocol. - /// The extracted path. - extern bool IsResourceUrl(const WString& text, WString& protocol, WString& path); - - extern void HexToBinary(stream::IStream& binaryStream, const WString& hexText); - extern WString BinaryToHex(stream::IStream& binaryStream); - -/*********************************************************************** -Global String Key -***********************************************************************/ - - struct GlobalStringKey + /// Represents a symbol resolver for loading a resource of a certain protocol. + class IGuiResourcePathResolver : public IDescriptable, public Description { public: - static GlobalStringKey Empty; - static GlobalStringKey _InferType; - static GlobalStringKey _Set; - static GlobalStringKey _Ref; - static GlobalStringKey _Bind; - static GlobalStringKey _Format; - static GlobalStringKey _Str; - static GlobalStringKey _Eval; - static GlobalStringKey _Uri; - static GlobalStringKey _ControlTemplate; - static GlobalStringKey _ItemTemplate; - - private: - vint key = -1; + /// Load a resource when the descriptor is something like a protocol-prefixed uri. + /// The loaded resource. Returns null if failed to load. + /// The path. + virtual Ptr ResolveResource(const WString& path)=0; + }; + /// Represents an factory. + class IGuiResourcePathResolverFactory : public IDescriptable, public Description + { public: - GUI_DEFINE_COMPARE_OPERATORS(GlobalStringKey) + /// Get the protocol for this resolver. + /// The protocol. + virtual WString GetProtocol()=0; - static GlobalStringKey Get(const WString& string); - vint ToKey()const; - WString ToString()const; + /// Create an object. + /// The created resolver. + /// The resource context. + /// The working directory context. + virtual Ptr CreateResolver(Ptr resource, const WString& workingDirectory)=0; }; - -/*********************************************************************** -Resource Image -***********************************************************************/ - - /// - /// Represnets an image to display. - /// - class GuiImageData : public Object, public Description + + /// Represents a symbol resolver for loading a resource. + class GuiResourcePathResolver : public Object, public Description { + typedef collections::Dictionary> ResolverMap; protected: - Ptr image; - vint frameIndex; + ResolverMap resolvers; + Ptr resource; + WString workingDirectory; public: - /// Create an empty image data. - GuiImageData(); - /// Create an image data with a specified image and a frame index. - /// The specified image. - /// The specified frame index. - GuiImageData(Ptr _image, vint _frameIndex); - ~GuiImageData(); + /// Create a resolver. + /// The resource context. + /// The working directory context. + GuiResourcePathResolver(Ptr _resource, const WString& _workingDirectory); + ~GuiResourcePathResolver(); - /// Get the specified image. - /// The specified image. - Ptr GetImage(); - /// Get the specified frame index. - /// The specified frame index. - vint GetFrameIndex(); + /// Load a resource when the descriptor is something like a protocol-prefixed uri. + /// The loaded resource. Returns null if failed to load. + /// The protocol. + /// The path. + Ptr ResolveResource(const WString& protocol, const WString& path); }; /*********************************************************************** -Resource String +Resource Type Resolver ***********************************************************************/ - /// Represents a text resource. - class GuiTextData : public Object, public Description - { - protected: - WString text; + class IGuiResourceTypeResolver_Precompile; + class IGuiResourceTypeResolver_Initialize; + class IGuiResourceTypeResolver_DirectLoadXml; + class IGuiResourceTypeResolver_DirectLoadStream; + class IGuiResourceTypeResolver_IndirectLoad; + /// Represents a symbol type for loading a resource. + class IGuiResourceTypeResolver : public virtual IDescriptable, public Description + { public: - /// Create an empty text data. - GuiTextData(); - /// Create a text data with a specified text. - /// The specified text. - GuiTextData(const WString& _text); + /// Get the type of the resource that load by this resolver. + /// The type. + virtual WString GetType() = 0; + /// Test is this resource able to serialize in an XML resource or not. + /// Returns true if this resource is able to serialize in an XML resource. + virtual bool XmlSerializable() = 0; + /// Test is this resource able to serialize in a precompiled binary resource or not. + /// Returns true if this resource is able to serialize in a precompiled binary resource. + virtual bool StreamSerializable() = 0; - /// Get the specified text. - /// The specified text. - WString GetText(); + /// Get the precompiler for the type resolver. + /// Returns null if the type resolve does not support precompiling. + virtual IGuiResourceTypeResolver_Precompile* Precompile(){ return nullptr; } + /// Get the initializer for the type resolver. + /// Returns null if the type resolve does not support initializing. + virtual IGuiResourceTypeResolver_Initialize* Initialize(){ return nullptr; } + /// Get the object for convert the resource between xml and object. + /// Returns null if the type resolver does not have this ability. + virtual IGuiResourceTypeResolver_DirectLoadXml* DirectLoadXml(){ return nullptr; } + /// Get the object for convert the resource between stream and object. + /// Returns null if the type resolver does not have this ability. + virtual IGuiResourceTypeResolver_DirectLoadStream* DirectLoadStream(){ return nullptr; } + /// Get the object for convert the resource between the preload type and the current type. + /// Returns null if the type resolver does not have this ability. + virtual IGuiResourceTypeResolver_IndirectLoad* IndirectLoad(){ return nullptr; } }; -/*********************************************************************** -Resource Precompile Context -***********************************************************************/ - /// - /// CPU architecture + /// Represents a precompiler for resources of a specified type. + /// Current resources that needs precompiling: + /// Workflow: + /// Pass 0: Collect workflow scripts / Compile localized strings / Generate ClassNameRecord + /// Pass 1: Compile workflow scripts + /// Instance: + /// Pass 2: Collect instance types / Compile animation types + /// Pass 3: Compile + /// Pass 4: Generate instance types with event handler functions to TemporaryClass / Compile animation types + /// Pass 5: Compile + /// Pass 6: Generate instance types with everything to InstanceCtor / Compile animation types / Compile localized strings injection + /// Pass 7: Compile /// - enum class GuiResourceCpuArchitecture + class IGuiResourceTypeResolver_Precompile : public virtual IDescriptable, public Description { - x86, - x64, - Unspecified, - }; + public: + enum PassNames + { + Workflow_Collect = 0, + Workflow_Compile = 1, + Workflow_Max = Workflow_Compile, - /// - /// Resource usage - /// - enum class GuiResourceUsage - { - DataOnly, - InstanceClass, - }; + Instance_CollectInstanceTypes = 2, + Instance_CompileInstanceTypes = 3, + Instance_CollectEventHandlers = 4, + Instance_CompileEventHandlers = 5, + Instance_GenerateInstanceClass = 6, + Instance_CompileInstanceClass = 7, + Instance_Max = Instance_CompileInstanceClass, - /// Provide a context for resource precompiling - struct GuiResourcePrecompileContext - { - typedef collections::Dictionary, Ptr> PropertyMap; + Everything_Max = Instance_Max, + }; - /// The target CPU architecture. - GuiResourceCpuArchitecture targetCpuArchitecture = GuiResourceCpuArchitecture::Unspecified; - /// Progress callback. - workflow::IWfCompilerCallback* compilerCallback = nullptr; - /// The folder to contain compiled objects. - Ptr targetFolder; - /// The root resource object. - GuiResource* rootResource = nullptr; - /// Indicate the pass index of this precompiling pass. - vint passIndex = -1; - /// The path resolver. This is only for delay load resource. - Ptr resolver; - /// Additional properties for resource item contents - PropertyMap additionalProperties; + enum PassSupport + { + NotSupported, + PerResource, + PerPass, + }; + + /// Get how this resolver supports precompiling. + /// The pass index. + /// Returns how this resolver supports precompiling. + virtual PassSupport GetPrecompilePassSupport(vint passIndex) = 0; + /// Precompile the resource item. + /// The resource to precompile. + /// The context for precompiling. + /// All collected errors during loading a resource. + virtual void PerResourcePrecompile(Ptr resource, GuiResourcePrecompileContext& context, GuiResourceError::List& errors) = 0; + /// Precompile for a pass. + /// The context for precompiling. + /// All collected errors during loading a resource. + virtual void PerPassPrecompile(GuiResourcePrecompileContext& context, GuiResourceError::List& errors) = 0; }; - /// Provide a context for resource initializing - struct GuiResourceInitializeContext : GuiResourcePrecompileContext + class IGuiResourcePrecompileCallback : public virtual IDescriptable, public Description { - GuiResourceUsage usage; + public: + virtual workflow::IWfCompilerCallback* GetCompilerCallback() = 0; + virtual void OnPerPass(vint passIndex) = 0; + virtual void OnPerResource(vint passIndex, Ptr resource) = 0; }; -/*********************************************************************** -Resource Structure -***********************************************************************/ - - /// Resource node base. - class GuiResourceNodeBase : public Object, public Description + /// + /// Represents a precompiler for resources of a specified type. + /// Current resources that needs precompiling: + /// Pass 0: Script (initialize view model scripts) + /// Pass 1: Script (initialize shared scripts) + /// Pass 2: Script (initialize instance scripts) + /// + class IGuiResourceTypeResolver_Initialize : public virtual IDescriptable, public Description { - friend class GuiResourceFolder; - protected: - GuiResourceFolder* parent; - WString name; - WString fileContentPath; - WString fileAbsolutePath; - public: - GuiResourceNodeBase(); - ~GuiResourceNodeBase(); + enum PassNames + { + Workflow_Initialize = 0, + Everything_Max = Workflow_Initialize, + }; - /// Get the containing folder. Returns null means that this is the root resource node. - /// The containing folder. - GuiResourceFolder* GetParent(); - /// Get the name of this resource node. - /// The name of this resource node . - const WString& GetName(); - /// Get the resource path of this resource node - /// The resource path of this resource node . - WString GetResourcePath(); - /// Get the file content path of this resource node. When saving the resource, if the path is not empty, the path will be serialized instead of the content. - /// The file content path of this resource node . - const WString& GetFileContentPath(); - /// Get the absolute file content path of this resource node. This path points to an existing file containing the content. - /// The file absolute path of this resource node . - const WString& GetFileAbsolutePath(); - /// Set the file content path of this resource node. - /// The file content path of this resource node . - /// The file absolute path of this resource node . - void SetFileContentPath(const WString& content, const WString& absolute); + /// Get how this resolver supports precompiling. + /// The pass index. + /// Returns how this resolver supports precompiling. + virtual bool GetInitializePassSupport(vint passIndex) = 0; + /// Initialize the resource item. + /// The resource to initializer. + /// The context for initializing. + /// All collected errors during initializing a resource. + virtual void Initialize(Ptr resource, GuiResourceInitializeContext& context, GuiResourceError::List& errors) = 0; }; - struct GuiResourceLocation + /// Represents a symbol type for loading a resource without a preload type. + class IGuiResourceTypeResolver_DirectLoadXml : public virtual IDescriptable, public Description { - WString resourcePath; - WString filePath; + public: + /// Serialize a resource to an xml element. This function is called if this type resolver does not have a preload type. + /// The serialized xml element. + /// The resource item containing the resource. + /// The object to serialize. + virtual Ptr Serialize(Ptr resource, Ptr content) = 0; - GuiResourceLocation() = default; - GuiResourceLocation(const WString& _resourcePath, const WString& _filePath); - GuiResourceLocation(Ptr node); + /// Load a resource for a type inside an xml element. + /// The resource. + /// The resource item containing the resource. + /// The xml element. + /// All collected errors during loading a resource. + virtual Ptr ResolveResource(Ptr resource, Ptr element, GuiResourceError::List& errors) = 0; - GUI_DEFINE_COMPARE_OPERATORS(GuiResourceLocation) + /// Load a resource for a type from a file. + /// The resource. + /// The resource item containing the resource. + /// The file path. + /// All collected errors during loading a resource. + virtual Ptr ResolveResource(Ptr resource, const WString& path, GuiResourceError::List& errors) = 0; }; - struct GuiResourceTextPos + /// Represents a symbol type for loading a resource without a preload type. + class IGuiResourceTypeResolver_DirectLoadStream : public virtual IDescriptable, public Description { - GuiResourceLocation originalLocation; - vint row = glr::ParsingTextPos::UnknownValue; - vint column = glr::ParsingTextPos::UnknownValue; - - GuiResourceTextPos() = default; - GuiResourceTextPos(GuiResourceLocation location, glr::ParsingTextPos position); + public: + /// Serialize a precompiled resource to a stream. + /// The resource item containing the resource. + /// The content to serialize. + /// The stream. + virtual void SerializePrecompiled(Ptr resource, Ptr content, stream::IStream& binaryStream) = 0; - GUI_DEFINE_COMPARE_OPERATORS(GuiResourceTextPos) + /// Load a precompiled resource from a stream. + /// The resource. + /// The resource item containing the resource. + /// The stream. + /// All collected errors during loading a resource. + virtual Ptr ResolveResourcePrecompiled(Ptr resource, stream::IStream& binaryStream, GuiResourceError::List& errors) = 0; }; - struct GuiResourceError + /// Represents a symbol type for loading a resource with a preload type. + class IGuiResourceTypeResolver_IndirectLoad : public virtual IDescriptable, public Description { public: - using List = collections::List; - - GuiResourceLocation location; - GuiResourceTextPos position; - WString message; - - GuiResourceError() = default; - GuiResourceError(GuiResourceTextPos _position, const WString& _message); - GuiResourceError(GuiResourceLocation _location, const WString& _message); - GuiResourceError(GuiResourceLocation _location, GuiResourceTextPos _position, const WString& _message); + /// Get the preload type to load the resource before loading itself. + /// The preload type. Returns an empty string to indicate that there is no preload type for this resolver. + virtual WString GetPreloadType() = 0; + /// Get the delay load feature for this resolver. + /// Returns true if this type need to delay load. + virtual bool IsDelayLoad() = 0; - GUI_DEFINE_COMPARE_OPERATORS(GuiResourceError) + /// Serialize a resource to a resource in preload type. + /// The serialized resource. + /// The resource item containing the resource. + /// The object to serialize. + virtual Ptr Serialize(Ptr resource, Ptr content) = 0; - static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List& parsingErrors); - static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List& parsingErrors, glr::ParsingTextPos offset); - static void Transform(GuiResourceLocation _location, GuiResourceError::List& errors, collections::List& parsingErrors, GuiResourceTextPos offset); - static void SortAndLog(List& errors, collections::List& output, const WString& workingDirectory = WString::Empty); + /// Load a resource for a type from a resource loaded by the preload type resolver. + /// The resource. + /// The resource item containing the resource. + /// The path resolver. This is only for delay load resource. + /// All collected errors during loading a resource. + virtual Ptr ResolveResource(Ptr resource, Ptr resolver, GuiResourceError::List& errors) = 0; }; - class DocumentModel; - class IGuiResourcePrecompileCallback; - - /// Resource item. - class GuiResourceItem : public GuiResourceNodeBase, public Description +/*********************************************************************** +Resource Resolver Manager +***********************************************************************/ + + /// A resource resolver manager. + class IGuiResourceResolverManager : public IDescriptable, public Description { - friend class GuiResourceFolder; - protected: - Ptr content; - WString typeName; - public: - /// Create a resource item. - GuiResourceItem(); - ~GuiResourceItem(); - - /// Get the type of this resource item. - /// The type name. - const WString& GetTypeName(); - - /// Get the contained object for this resource item. - /// The contained object. - Ptr GetContent(); - /// Set the containd object for this resource item. - /// The type name of this contained object. - /// The contained object. - void SetContent(const WString& _typeName, Ptr value); - - /// Get the contained object as an image. - /// The contained object. - Ptr AsImage(); - /// Get the contained object as an xml. - /// The contained object. - Ptr AsXml(); - /// Get the contained object as a string. - /// The contained object. - Ptr AsString(); - /// Get the contained object as a document model. - /// The contained object. - Ptr AsDocument(); + /// Get the for a protocol. + /// The factory. + /// The protocol. + virtual IGuiResourcePathResolverFactory* GetPathResolverFactory(const WString& protocol) = 0; + /// Set the for a protocol. + /// Returns true if this operation succeeded. + /// The factory. + virtual bool SetPathResolverFactory(Ptr factory) = 0; + /// Get the for a resource type. + /// The resolver. + /// The resource type. + virtual IGuiResourceTypeResolver* GetTypeResolver(const WString& type) = 0; + /// Set the for a resource type. + /// Returns true if this operation succeeded. + /// The resolver. + virtual bool SetTypeResolver(Ptr resolver) = 0; + /// Get names of all per resource resolvers for a pass. + /// The pass index. + /// Names of resolvers + virtual void GetPerResourceResolverNames(vint passIndex, collections::List& names) = 0; + /// Get names of all per pass resolvers for a pass. + /// The pass index. + /// Names of resolvers + virtual void GetPerPassResolverNames(vint passIndex, collections::List& names) = 0; }; - /// Resource folder. A resource folder contains many sub folders and sub items. - class GuiResourceFolder : public GuiResourceNodeBase, public Description - { - protected: - typedef collections::Dictionary> ItemMap; - typedef collections::Dictionary> FolderMap; - typedef collections::List> ItemList; - typedef collections::List> FolderList; + extern IGuiResourceResolverManager* GetResourceResolverManager(); + extern void DecompressStream(const char** buffer, bool compress, vint rows, vint block, vint remain, stream::IStream& outputStream); + } +} - struct DelayLoading - { - WString type; - WString workingDirectory; - Ptr preloadResource; - }; +#endif - typedef collections::List DelayLoadingList; +/*********************************************************************** +.\APPLICATION\CONTROLS\GUIINSTANCEROOTOBJECT.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Template System - WString importUri; - ItemMap items; - FolderMap folders; +Interfaces: +***********************************************************************/ - void LoadResourceFolderFromXml(DelayLoadingList& delayLoadings, const WString& containingFolder, Ptr folderXml, GuiResourceError::List& errors); - void SaveResourceFolderToXml(Ptr xmlParent); - void CollectTypeNames(collections::List& typeNames); - void LoadResourceFolderFromBinary(DelayLoadingList& delayLoadings, stream::internal::ContextFreeReader& reader, collections::List& typeNames, GuiResourceError::List& errors); - void SaveResourceFolderToBinary(stream::internal::ContextFreeWriter& writer, collections::List& typeNames); - void PrecompileResourceFolder(GuiResourcePrecompileContext& context, IGuiResourcePrecompileCallback* callback, GuiResourceError::List& errors); - void InitializeResourceFolder(GuiResourceInitializeContext& context, GuiResourceError::List& errors); - void ImportFromUri(const WString& uri, GuiResourceTextPos position, GuiResourceError::List& errors); - public: - /// Create a resource folder. - GuiResourceFolder(); - ~GuiResourceFolder(); +#ifndef VCZH_PRESENTATION_CONTROLS_TEMPLATES_GUIINSTANCEROOTOBJECT +#define VCZH_PRESENTATION_CONTROLS_TEMPLATES_GUIINSTANCEROOTOBJECT - ///Get the import uri for this folder. - ///The import uri for this folder. Returns an empty string for non-import folders - const WString& GetImportUri(); - ///Set the import uri for this folder. - ///The import uri for this folder. Set an empty string for non-import folders - void SetImportUri(const WString& uri); - /// Get all sub items. - /// All sub items. - const ItemList& GetItems(); - /// Get the item of a specified name. - /// The item of a specified name. - /// The specified name. - Ptr GetItem(const WString& name); - /// Add a resource item. - /// Returns true if this operation succeeded. - /// The name of this resource item. - /// The resource item. - bool AddItem(const WString& name, Ptr item); - /// Remove a resource item of a specified name. - /// Returns the removed resource item if this operation succeeded. - /// The name of this resource item. - Ptr RemoveItem(const WString& name); - /// Remove all resource item. - void ClearItems(); - - /// Get all sub folders. - /// All sub folders. - const FolderList& GetFolders(); - /// Get the folder of a specified name. - /// The folder of a specified name. - /// The specified name. - Ptr GetFolder(const WString& name); - /// Add a resource folder. - /// Returns true if this operation succeeded. - /// The name of this resource folder. - /// The resource folder. - bool AddFolder(const WString& name, Ptr folder); - /// Remove a resource folder of a specified name. - /// Returns the removed resource folder if this operation succeeded. - /// The name of this resource folder. - Ptr RemoveFolder(const WString& name); - /// Remove all resource folders. - void ClearFolders(); +namespace vl +{ + namespace presentation + { + namespace templates + { + class GuiTemplate; + } - /// Get a contained resource object using a path like "Packages\Application\Name". - /// The containd resource object. - /// The path. - Ptr GetValueByPath(const WString& path); - /// Get a resource folder using a path like "Packages\Application\Name\". - /// The resource folder. - /// The path. - Ptr GetFolderByPath(const WString& path); - /// Create a contained resource object using a path like "Packages\Application\Name". - /// Returns true if this operation succeeded. - /// The path. - /// The type name of this contained object. - /// The contained object. - bool CreateValueByPath(const WString& path, const WString& typeName, Ptr value); - }; + namespace controls + { + class GuiControlHost; + class GuiCustomControl; /*********************************************************************** -Resource +Component ***********************************************************************/ - /// Resource metadata. - class GuiResourceMetadata : public Object - { - public: - WString name; - WString version; - collections::List dependencies; - - void LoadFromXml(Ptr xml, GuiResourceLocation location, GuiResourceError::List& errors); - Ptr SaveToXml(); - }; - - /// Resource. A resource is a root resource folder that does not have a name. - class GuiResource : public GuiResourceFolder, public Description - { - protected: - WString workingDirectory; - Ptr metadata; + class GuiInstanceRootObject; - static void ProcessDelayLoading(Ptr resource, DelayLoadingList& delayLoadings, GuiResourceError::List& errors); - public: - static const wchar_t* CurrentVersionString; + /// + /// Represnets a component. + /// + class GuiComponent : public Object, public Description + { + public: + GuiComponent(); + ~GuiComponent(); - /// Create a resource. - GuiResource(); - ~GuiResource(); + virtual void Attach(GuiInstanceRootObject* rootObject); + virtual void Detach(GuiInstanceRootObject* rootObject); + }; - /// Get the metadata of the resource. - /// The metadata. - Ptr GetMetadata(); +/*********************************************************************** +Animation +***********************************************************************/ - /// Get the directory where the resource is load. - /// The directory. - WString GetWorkingDirectory(); + /// Animation. + class IGuiAnimation abstract : public virtual IDescriptable, public Description + { + public: + /// Called when the animation is about to play the first frame. + virtual void Start() = 0; - /// Load a resource from an xml file. If the xml file refers other files, they will be loaded as well. - /// The loaded resource. - /// The xml document. - /// The file path of the resource. - /// The working directory for loading external resources. - /// All collected errors during loading a resource. - static Ptr LoadFromXml(Ptr xml, const WString& filePath, const WString& workingDirectory, GuiResourceError::List& errors); + /// Called when the animation is about to pause. + virtual void Pause() = 0; - /// Load a resource from an xml file. If the xml file refers other files, they will be loaded as well. - /// The loaded resource. - /// The file path of the xml file. - /// All collected errors during loading a resource. - static Ptr LoadFromXml(const WString& filePath, GuiResourceError::List& errors); + /// Called when the animation is about to resume. + virtual void Resume() = 0; - /// Save the resource to xml. - /// The xml. - Ptr SaveToXml(); - - /// Load a precompiled resource from a stream. - /// The loaded resource. - /// The stream. - /// All collected errors during loading a resource. - static Ptr LoadPrecompiledBinary(stream::IStream& binaryStream, GuiResourceError::List& errors); + /// Play the animation. The animation should calculate the time itself to determine the content of the current state of animating objects. + virtual void Run() = 0; - /// Load a precompiled resource from a stream. This function will hit an assert if there are errors. - /// The loaded resource. - /// The stream. - static Ptr LoadPrecompiledBinary(stream::IStream& binaryStream); - - /// Save the precompiled resource to a stream. - /// The stream. - void SavePrecompiledBinary(stream::IStream& binaryStream); + /// Test if the animation has ended. + /// Returns true if the animation has ended. + virtual bool GetStopped() = 0; - /// Precompile this resource to improve performance. - /// The resource folder contains all precompiled result. The folder will be added to the resource if there is no error. - /// A callback to receive progress. - /// All collected errors during precompiling a resource. - Ptr Precompile(GuiResourceCpuArchitecture targetCpuArchitecture, IGuiResourcePrecompileCallback* callback, GuiResourceError::List& errors); + /// Create a finite animation. + /// Returns the created animation. + /// The animation callback for each frame. + /// The length of the animation. + static Ptr CreateAnimation(const Func& run, vuint64_t milliseconds); - /// Initialize a precompiled resource. - /// In which role an application is initializing this resource. - /// All collected errors during initializing a resource. - void Initialize(GuiResourceUsage usage, GuiResourceError::List& errors); - - /// Get a contained document model using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. - /// The containd resource object. - /// The path. - Ptr GetDocumentByPath(const WString& path); - /// Get a contained image using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. - /// The containd resource object. - /// The path. - Ptr GetImageByPath(const WString& path); - /// Get a contained xml using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. - /// The containd resource object. - /// The path. - Ptr GetXmlByPath(const WString& path); - /// Get a contained string object using a path like "Packages\Application\Name". If the path does not exists or the type does not match, an exception will be thrown. - /// The containd resource object. - /// The path. - WString GetStringByPath(const WString& path); - }; + /// Create an infinite animation. + /// Returns the created animation. + /// The animation callback for each frame. + static Ptr CreateAnimation(const Func& run); + }; /*********************************************************************** -Resource Path Resolver +Root Object ***********************************************************************/ - /// Represents a symbol resolver for loading a resource of a certain protocol. - class IGuiResourcePathResolver : public IDescriptable, public Description - { - public: - /// Load a resource when the descriptor is something like a protocol-prefixed uri. - /// The loaded resource. Returns null if failed to load. - /// The path. - virtual Ptr ResolveResource(const WString& path)=0; - }; + class RootObjectTimerCallback; - /// Represents an factory. - class IGuiResourcePathResolverFactory : public IDescriptable, public Description - { - public: - /// Get the protocol for this resolver. - /// The protocol. - virtual WString GetProtocol()=0; + /// Represnets a root GUI object. + class GuiInstanceRootObject abstract : public Description + { + friend class RootObjectTimerCallback; + typedef collections::List> SubscriptionList; + protected: + Ptr resourceResolver; + SubscriptionList subscriptions; + collections::SortedList components; + Ptr timerCallback; + collections::SortedList> runningAnimations; + collections::SortedList> pendingAnimations; + bool finalized = false; - /// Create an object. - /// The created resolver. - /// The resource context. - /// The working directory context. - virtual Ptr CreateResolver(Ptr resource, const WString& workingDirectory)=0; - }; - - /// Represents a symbol resolver for loading a resource. - class GuiResourcePathResolver : public Object, public Description - { - typedef collections::Dictionary> ResolverMap; - protected: - ResolverMap resolvers; - Ptr resource; - WString workingDirectory; + virtual controls::GuiControlHost* GetControlHostForInstance() = 0; + void InstallTimerCallback(controls::GuiControlHost* controlHost); + bool UninstallTimerCallback(controls::GuiControlHost* controlHost); + void OnControlHostForInstanceChanged(); + void StartPendingAnimations(); + public: + GuiInstanceRootObject(); + ~GuiInstanceRootObject(); - public: - /// Create a resolver. - /// The resource context. - /// The working directory context. - GuiResourcePathResolver(Ptr _resource, const WString& _workingDirectory); - ~GuiResourcePathResolver(); + /// Clear all subscriptions and components. + void FinalizeInstance(); - /// Load a resource when the descriptor is something like a protocol-prefixed uri. - /// The loaded resource. Returns null if failed to load. - /// The protocol. - /// The path. - Ptr ResolveResource(const WString& protocol, const WString& path); - }; + /// Test has the object been finalized. + /// Returns true if this object has been finalized. + bool IsFinalized(); -/*********************************************************************** -Resource Type Resolver -***********************************************************************/ + void FinalizeInstanceRecursively(templates::GuiTemplate* thisObject); + void FinalizeInstanceRecursively(GuiCustomControl* thisObject); + void FinalizeInstanceRecursively(GuiControlHost* thisObject); + void FinalizeGeneralInstance(GuiInstanceRootObject* thisObject); - class IGuiResourceTypeResolver_Precompile; - class IGuiResourceTypeResolver_Initialize; - class IGuiResourceTypeResolver_DirectLoadXml; - class IGuiResourceTypeResolver_DirectLoadStream; - class IGuiResourceTypeResolver_IndirectLoad; + /// Set the resource resolver to connect the current root object to the resource creating it. + /// The resource resolver + void SetResourceResolver(Ptr resolver); + /// Resolve a resource using the current resource resolver. + /// The loaded resource. Returns null if failed to load. + /// The protocol. + /// The path. + /// Set to true and it will throw an exception if the resource doesn't exist. + Ptr ResolveResource(const WString& protocol, const WString& path, bool ensureExist); - /// Represents a symbol type for loading a resource. - class IGuiResourceTypeResolver : public virtual IDescriptable, public Description - { - public: - /// Get the type of the resource that load by this resolver. - /// The type. - virtual WString GetType() = 0; - /// Test is this resource able to serialize in an XML resource or not. - /// Returns true if this resource is able to serialize in an XML resource. - virtual bool XmlSerializable() = 0; - /// Test is this resource able to serialize in a precompiled binary resource or not. - /// Returns true if this resource is able to serialize in a precompiled binary resource. - virtual bool StreamSerializable() = 0; - - /// Get the precompiler for the type resolver. - /// Returns null if the type resolve does not support precompiling. - virtual IGuiResourceTypeResolver_Precompile* Precompile(){ return nullptr; } - /// Get the initializer for the type resolver. - /// Returns null if the type resolve does not support initializing. - virtual IGuiResourceTypeResolver_Initialize* Initialize(){ return nullptr; } - /// Get the object for convert the resource between xml and object. - /// Returns null if the type resolver does not have this ability. - virtual IGuiResourceTypeResolver_DirectLoadXml* DirectLoadXml(){ return nullptr; } - /// Get the object for convert the resource between stream and object. - /// Returns null if the type resolver does not have this ability. - virtual IGuiResourceTypeResolver_DirectLoadStream* DirectLoadStream(){ return nullptr; } - /// Get the object for convert the resource between the preload type and the current type. - /// Returns null if the type resolver does not have this ability. - virtual IGuiResourceTypeResolver_IndirectLoad* IndirectLoad(){ return nullptr; } - }; + /// Add a subscription. When this control host is disposing, all attached subscriptions will be deleted. + /// Returns null if this operation failed. + /// The subscription to test. + Ptr AddSubscription(Ptr subscription); + /// Clear all subscriptions. + void UpdateSubscriptions(); - /// - /// Represents a precompiler for resources of a specified type. - /// Current resources that needs precompiling: - /// Workflow: - /// Pass 0: Collect workflow scripts / Compile localized strings / Generate ClassNameRecord - /// Pass 1: Compile workflow scripts - /// Instance: - /// Pass 2: Collect instance types / Compile animation types - /// Pass 3: Compile - /// Pass 4: Generate instance types with event handler functions to TemporaryClass / Compile animation types - /// Pass 5: Compile - /// Pass 6: Generate instance types with everything to InstanceCtor / Compile animation types / Compile localized strings injection - /// Pass 7: Compile - /// - class IGuiResourceTypeResolver_Precompile : public virtual IDescriptable, public Description - { - public: - enum PassNames - { - Workflow_Collect = 0, - Workflow_Compile = 1, - Workflow_Max = Workflow_Compile, + /// Add a component. When this control host is disposing, all attached components will be deleted. + /// Returns true if this operation succeeded. + /// The component to add. + bool AddComponent(GuiComponent* component); - Instance_CollectInstanceTypes = 2, - Instance_CompileInstanceTypes = 3, - Instance_CollectEventHandlers = 4, - Instance_CompileEventHandlers = 5, - Instance_GenerateInstanceClass = 6, - Instance_CompileInstanceClass = 7, - Instance_Max = Instance_CompileInstanceClass, + /// Add a control host as a component. When this control host is disposing, all attached components will be deleted. + /// Returns true if this operation succeeded. + /// The controlHost to add. + bool AddControlHostComponent(GuiControlHost* controlHost); - Everything_Max = Instance_Max, - }; + /// Add an animation. The animation will be paused if the root object is removed from a window. + /// Returns true if this operation succeeded. + /// The animation. + bool AddAnimation(Ptr animation); - enum PassSupport - { - NotSupported, - PerResource, - PerPass, + /// Kill an animation. + /// Returns true if this operation succeeded. + /// The animation. + bool KillAnimation(Ptr animation); }; + } + } +} - /// Get how this resolver supports precompiling. - /// The pass index. - /// Returns how this resolver supports precompiling. - virtual PassSupport GetPrecompilePassSupport(vint passIndex) = 0; - /// Precompile the resource item. - /// The resource to precompile. - /// The context for precompiling. - /// All collected errors during loading a resource. - virtual void PerResourcePrecompile(Ptr resource, GuiResourcePrecompileContext& context, GuiResourceError::List& errors) = 0; - /// Precompile for a pass. - /// The context for precompiling. - /// All collected errors during loading a resource. - virtual void PerPassPrecompile(GuiResourcePrecompileContext& context, GuiResourceError::List& errors) = 0; - }; +#endif - class IGuiResourcePrecompileCallback : public virtual IDescriptable, public Description - { - public: - virtual workflow::IWfCompilerCallback* GetCompilerCallback() = 0; - virtual void OnPerPass(vint passIndex) = 0; - virtual void OnPerResource(vint passIndex, Ptr resource) = 0; - }; +/*********************************************************************** +.\APPLICATION\CONTROLS\GUITHEMEMANAGER.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control Styles::Common Style Helpers - /// - /// Represents a precompiler for resources of a specified type. - /// Current resources that needs precompiling: - /// Pass 0: Script (initialize view model scripts) - /// Pass 1: Script (initialize shared scripts) - /// Pass 2: Script (initialize instance scripts) - /// - class IGuiResourceTypeResolver_Initialize : public virtual IDescriptable, public Description - { - public: - enum PassNames - { - Workflow_Initialize = 0, - Everything_Max = Workflow_Initialize, - }; +Interfaces: +***********************************************************************/ - /// Get how this resolver supports precompiling. - /// The pass index. - /// Returns how this resolver supports precompiling. - virtual bool GetInitializePassSupport(vint passIndex) = 0; - /// Initialize the resource item. - /// The resource to initializer. - /// The context for initializing. - /// All collected errors during initializing a resource. - virtual void Initialize(Ptr resource, GuiResourceInitializeContext& context, GuiResourceError::List& errors) = 0; - }; +#ifndef VCZH_PRESENTATION_CONTROLS_GUITHEMEMANAGER +#define VCZH_PRESENTATION_CONTROLS_GUITHEMEMANAGER - /// Represents a symbol type for loading a resource without a preload type. - class IGuiResourceTypeResolver_DirectLoadXml : public virtual IDescriptable, public Description + +namespace vl +{ + namespace presentation + { + namespace templates { - public: - /// Serialize a resource to an xml element. This function is called if this type resolver does not have a preload type. - /// The serialized xml element. - /// The resource item containing the resource. - /// The object to serialize. - virtual Ptr Serialize(Ptr resource, Ptr content) = 0; - /// Load a resource for a type inside an xml element. - /// The resource. - /// The resource item containing the resource. - /// The xml element. - /// All collected errors during loading a resource. - virtual Ptr ResolveResource(Ptr resource, Ptr element, GuiResourceError::List& errors) = 0; +/*********************************************************************** +Theme Builders +***********************************************************************/ - /// Load a resource for a type from a file. - /// The resource. - /// The resource item containing the resource. - /// The file path. - /// All collected errors during loading a resource. - virtual Ptr ResolveResource(Ptr resource, const WString& path, GuiResourceError::List& errors) = 0; - }; +#define GUI_TEMPLATE_PROPERTY_DECL(CLASS, TYPE, NAME, VALUE)\ + private:\ + TYPE NAME##_ = VALUE;\ + public:\ + TYPE Get##NAME();\ + void Set##NAME(TYPE const& value);\ + compositions::GuiNotifyEvent NAME##Changed;\ - /// Represents a symbol type for loading a resource without a preload type. - class IGuiResourceTypeResolver_DirectLoadStream : public virtual IDescriptable, public Description - { - public: - /// Serialize a precompiled resource to a stream. - /// The resource item containing the resource. - /// The content to serialize. - /// The stream. - virtual void SerializePrecompiled(Ptr resource, Ptr content, stream::IStream& binaryStream) = 0; +#define GUI_TEMPLATE_PROPERTY_IMPL(CLASS, TYPE, NAME, VALUE)\ + TYPE CLASS::Get##NAME()\ + {\ + return NAME##_;\ + }\ + void CLASS::Set##NAME(TYPE const& value)\ + {\ + if (NAME##_ != value)\ + {\ + NAME##_ = value;\ + NAME##Changed.Execute(compositions::GuiEventArgs(this));\ + }\ + }\ - /// Load a precompiled resource from a stream. - /// The resource. - /// The resource item containing the resource. - /// The stream. - /// All collected errors during loading a resource. - virtual Ptr ResolveResourcePrecompiled(Ptr resource, stream::IStream& binaryStream, GuiResourceError::List& errors) = 0; - }; +#define GUI_TEMPLATE_PROPERTY_EVENT_INIT(CLASS, TYPE, NAME, VALUE)\ + NAME##Changed.SetAssociatedComposition(this); - /// Represents a symbol type for loading a resource with a preload type. - class IGuiResourceTypeResolver_IndirectLoad : public virtual IDescriptable, public Description - { - public: - /// Get the preload type to load the resource before loading itself. - /// The preload type. Returns an empty string to indicate that there is no preload type for this resolver. - virtual WString GetPreloadType() = 0; - /// Get the delay load feature for this resolver. - /// Returns true if this type need to delay load. - virtual bool IsDelayLoad() = 0; +#define GUI_TEMPLATE_CLASS_FORWARD_DECL(CLASS, BASE)\ + class CLASS;\ - /// Serialize a resource to a resource in preload type. - /// The serialized resource. - /// The resource item containing the resource. - /// The object to serialize. - virtual Ptr Serialize(Ptr resource, Ptr content) = 0; +#define GUI_TEMPLATE_CLASS_DECL(CLASS, BASE)\ + class CLASS : public BASE, public AggregatableDescription\ + {\ + public:\ + CLASS();\ + ~CLASS();\ + CLASS ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)\ + };\ - /// Load a resource for a type from a resource loaded by the preload type resolver. - /// The resource. - /// The resource item containing the resource. - /// The path resolver. This is only for delay load resource. - /// All collected errors during loading a resource. - virtual Ptr ResolveResource(Ptr resource, Ptr resolver, GuiResourceError::List& errors) = 0; - }; +#define GUI_TEMPLATE_CLASS_IMPL(CLASS, BASE)\ + CLASS ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_IMPL)\ + CLASS::CLASS()\ + {\ + CLASS ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_EVENT_INIT)\ + }\ + CLASS::~CLASS()\ + {\ + FinalizeAggregation();\ + }\ /*********************************************************************** -Resource Resolver Manager +GuiTemplate ***********************************************************************/ - /// A resource resolver manager. - class IGuiResourceResolverManager : public IDescriptable, public Description + /// Represents a user customizable template. + class GuiTemplate : public compositions::GuiBoundsComposition, public controls::GuiInstanceRootObject, public Description + { + protected: + controls::GuiControlHost* GetControlHostForInstance()override; + void OnParentLineChanged()override; + public: + /// Create a template. + GuiTemplate(); + ~GuiTemplate(); + +#define GuiTemplate_PROPERTIES(F)\ + F(GuiTemplate, FontProperties, Font, {} )\ + F(GuiTemplate, description::Value, Context, {} )\ + F(GuiTemplate, WString, Text, {} )\ + F(GuiTemplate, bool, VisuallyEnabled, true)\ + + GuiTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL) + }; + +/*********************************************************************** +Core Themes +***********************************************************************/ + +#define GUI_CORE_CONTROL_TEMPLATE_DECL(F)\ + F(GuiControlTemplate, GuiTemplate) \ + F(GuiLabelTemplate, GuiControlTemplate) \ + F(GuiWindowTemplate, GuiControlTemplate) \ + +#define GuiControlTemplate_PROPERTIES(F)\ + F(GuiControlTemplate, compositions::GuiGraphicsComposition*, ContainerComposition, this)\ + F(GuiControlTemplate, compositions::GuiGraphicsComposition*, FocusableComposition, nullptr)\ + F(GuiControlTemplate, bool, Focused, false)\ + +#define GuiLabelTemplate_PROPERTIES(F)\ + F(GuiLabelTemplate, Color, DefaultTextColor, {})\ + F(GuiLabelTemplate, Color, TextColor, {})\ + +#define GuiWindowTemplate_PROPERTIES(F)\ + F(GuiWindowTemplate, BoolOption, MaximizedBoxOption, BoolOption::Customizable)\ + F(GuiWindowTemplate, BoolOption, MinimizedBoxOption, BoolOption::Customizable)\ + F(GuiWindowTemplate, BoolOption, BorderOption, BoolOption::Customizable)\ + F(GuiWindowTemplate, BoolOption, SizeBoxOption, BoolOption::Customizable)\ + F(GuiWindowTemplate, BoolOption, IconVisibleOption, BoolOption::Customizable)\ + F(GuiWindowTemplate, BoolOption, TitleBarOption, BoolOption::Customizable)\ + F(GuiWindowTemplate, bool, MaximizedBox, true)\ + F(GuiWindowTemplate, bool, MinimizedBox, true)\ + F(GuiWindowTemplate, bool, Border, true)\ + F(GuiWindowTemplate, bool, SizeBox, true)\ + F(GuiWindowTemplate, bool, IconVisible, true)\ + F(GuiWindowTemplate, bool, TitleBar, true)\ + F(GuiWindowTemplate, bool, Maximized, false)\ + F(GuiWindowTemplate, bool, Activated, false)\ + F(GuiWindowTemplate, TemplateProperty, TooltipTemplate, {})\ + F(GuiWindowTemplate, TemplateProperty, ShortcutKeyTemplate, {})\ + F(GuiWindowTemplate, bool, CustomFrameEnabled, true)\ + F(GuiWindowTemplate, Margin, CustomFramePadding, {})\ + F(GuiWindowTemplate, Ptr, Icon, {})\ + +/*********************************************************************** +Template Declarations +***********************************************************************/ + + GUI_CORE_CONTROL_TEMPLATE_DECL(GUI_TEMPLATE_CLASS_DECL) + } + +/*********************************************************************** +Theme Names +***********************************************************************/ + + namespace theme { - public: - /// Get the for a protocol. - /// The factory. - /// The protocol. - virtual IGuiResourcePathResolverFactory* GetPathResolverFactory(const WString& protocol) = 0; - /// Set the for a protocol. - /// Returns true if this operation succeeded. - /// The factory. - virtual bool SetPathResolverFactory(Ptr factory) = 0; - /// Get the for a resource type. - /// The resolver. - /// The resource type. - virtual IGuiResourceTypeResolver* GetTypeResolver(const WString& type) = 0; - /// Set the for a resource type. - /// Returns true if this operation succeeded. - /// The resolver. - virtual bool SetTypeResolver(Ptr resolver) = 0; - /// Get names of all per resource resolvers for a pass. - /// The pass index. - /// Names of resolvers - virtual void GetPerResourceResolverNames(vint passIndex, collections::List& names) = 0; - /// Get names of all per pass resolvers for a pass. - /// The pass index. - /// Names of resolvers - virtual void GetPerPassResolverNames(vint passIndex, collections::List& names) = 0; - }; - - extern IGuiResourceResolverManager* GetResourceResolverManager(); - extern void DecompressStream(const char** buffer, bool compress, vint rows, vint block, vint remain, stream::IStream& outputStream); + +#define GUI_CONTROL_TEMPLATE_TYPES(F) \ + F(WindowTemplate, SystemFrameWindow) \ + F(WindowTemplate, CustomFrameWindow) \ + F(ControlTemplate, CustomControl) \ + F(WindowTemplate, Tooltip) \ + F(LabelTemplate, Label) \ + F(LabelTemplate, ShortcutKey) \ + F(ScrollViewTemplate, ScrollView) \ + F(ControlTemplate, GroupBox) \ + F(TabTemplate, Tab) \ + F(ComboBoxTemplate, ComboBox) \ + F(MultilineTextBoxTemplate, MultilineTextBox) \ + F(SinglelineTextBoxTemplate, SinglelineTextBox) \ + F(DocumentViewerTemplate, DocumentViewer) \ + F(DocumentLabelTemplate, DocumentLabel) \ + F(DocumentLabelTemplate, DocumentTextBox) \ + F(ListViewTemplate, ListView) \ + F(TreeViewTemplate, TreeView) \ + F(TextListTemplate, TextList) \ + F(SelectableButtonTemplate, ListItemBackground) \ + F(SelectableButtonTemplate, TreeItemExpander) \ + F(SelectableButtonTemplate, CheckTextListItem) \ + F(SelectableButtonTemplate, RadioTextListItem) \ + F(MenuTemplate, Menu) \ + F(ControlTemplate, MenuBar) \ + F(ControlTemplate, MenuSplitter) \ + F(ToolstripButtonTemplate, MenuBarButton) \ + F(ToolstripButtonTemplate, MenuItemButton) \ + F(ControlTemplate, ToolstripToolBar) \ + F(ToolstripButtonTemplate, ToolstripButton) \ + F(ToolstripButtonTemplate, ToolstripDropdownButton) \ + F(ToolstripButtonTemplate, ToolstripSplitButton) \ + F(ControlTemplate, ToolstripSplitter) \ + F(RibbonTabTemplate, RibbonTab) \ + F(RibbonGroupTemplate, RibbonGroup) \ + F(RibbonGroupMenuTemplate, RibbonGroupMenu) \ + F(RibbonIconLabelTemplate, RibbonIconLabel) \ + F(RibbonIconLabelTemplate, RibbonSmallIconLabel) \ + F(RibbonButtonsTemplate, RibbonButtons) \ + F(RibbonToolstripsTemplate, RibbonToolstrips) \ + F(RibbonGalleryTemplate, RibbonGallery) \ + F(RibbonToolstripMenuTemplate, RibbonToolstripMenu) \ + F(RibbonGalleryListTemplate, RibbonGalleryList) \ + F(TextListTemplate, RibbonGalleryItemList) \ + F(ToolstripButtonTemplate, RibbonSmallButton) \ + F(ToolstripButtonTemplate, RibbonSmallDropdownButton) \ + F(ToolstripButtonTemplate, RibbonSmallSplitButton) \ + F(ToolstripButtonTemplate, RibbonLargeButton) \ + F(ToolstripButtonTemplate, RibbonLargeDropdownButton) \ + F(ToolstripButtonTemplate, RibbonLargeSplitButton) \ + F(ControlTemplate, RibbonSplitter) \ + F(ControlTemplate, RibbonToolstripHeader) \ + F(ButtonTemplate, Button) \ + F(SelectableButtonTemplate, CheckBox) \ + F(SelectableButtonTemplate, RadioButton) \ + F(DatePickerTemplate, DatePicker) \ + F(DateComboBoxTemplate, DateComboBox) \ + F(ScrollTemplate, HScroll) \ + F(ScrollTemplate, VScroll) \ + F(ScrollTemplate, HTracker) \ + F(ScrollTemplate, VTracker) \ + F(ScrollTemplate, ProgressBar) \ + + enum class ThemeName + { + Unknown, + Window, +#define GUI_DEFINE_THEME_NAME(TEMPLATE, CONTROL) CONTROL, + GUI_CONTROL_TEMPLATE_TYPES(GUI_DEFINE_THEME_NAME) +#undef GUI_DEFINE_THEME_NAME + }; + + /// Theme interface. A theme creates appropriate style controllers or style providers for default controls. Call [M:vl.presentation.theme.GetCurrentTheme] to access this interface. + class ITheme : public virtual IDescriptable, public Description + { + public: + virtual TemplateProperty CreateStyle(ThemeName themeName) = 0; + }; + + /// Get the current theme style factory object. Call or to change the default theme. + /// The current theme style factory object. + extern ITheme* GetCurrentTheme(); + extern void InitializeTheme(); + extern void FinalizeTheme(); + } } } #endif /*********************************************************************** -.\APPLICATION\CONTROLS\GUIINSTANCEROOTOBJECT.H +.\APPLICATION\CONTROLS\GUIBASICCONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) -GacUI::Template System +GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_TEMPLATES_GUIINSTANCEROOTOBJECT -#define VCZH_PRESENTATION_CONTROLS_TEMPLATES_GUIINSTANCEROOTOBJECT +#ifndef VCZH_PRESENTATION_CONTROLS_GUIBASICCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIBASICCONTROLS namespace vl { namespace presentation { - namespace templates + namespace theme { - class GuiTemplate; + enum class ThemeName; } namespace controls { - class GuiControlHost; - class GuiCustomControl; - -/*********************************************************************** -Component -***********************************************************************/ - - class GuiInstanceRootObject; + template + struct QueryServiceHelper; - /// - /// Represnets a component. - /// - class GuiComponent : public Object, public Description + template + struct QueryServiceHelper>> { - public: - GuiComponent(); - ~GuiComponent(); + static WString GetIdentifier() + { + return WString::Unmanaged(T::Identifier); + } + }; - virtual void Attach(GuiInstanceRootObject* rootObject); - virtual void Detach(GuiInstanceRootObject* rootObject); + template + struct QueryServiceHelper>> + { + static WString GetIdentifier() + { + return MoveValue(T::GetIdentifier()); + } }; /*********************************************************************** -Animation +Basic Construction ***********************************************************************/ - /// Animation. - class IGuiAnimation abstract : public virtual IDescriptable, public Description - { - public: - /// Called when the animation is about to play the first frame. - virtual void Start() = 0; - - /// Called when the animation is about to pause. - virtual void Pause() = 0; - - /// Called when the animation is about to resume. - virtual void Resume() = 0; - - /// Play the animation. The animation should calculate the time itself to determine the content of the current state of animating objects. - virtual void Run() = 0; - - /// Test if the animation has ended. - /// Returns true if the animation has ended. - virtual bool GetStopped() = 0; - - /// Create a finite animation. - /// Returns the created animation. - /// The animation callback for each frame. - /// The length of the animation. - static Ptr CreateAnimation(const Func& run, vuint64_t milliseconds); - - /// Create an infinite animation. - /// Returns the created animation. - /// The animation callback for each frame. - static Ptr CreateAnimation(const Func& run); - }; - -/*********************************************************************** -Root Object -***********************************************************************/ - - class RootObjectTimerCallback; - - /// Represnets a root GUI object. - class GuiInstanceRootObject abstract : public Description + /// + /// A helper object to test if a control has been deleted or not. + /// + class GuiDisposedFlag : public Object, public Description { - friend class RootObjectTimerCallback; - typedef collections::List> SubscriptionList; + friend class GuiControl; protected: - Ptr resourceResolver; - SubscriptionList subscriptions; - collections::SortedList components; - Ptr timerCallback; - collections::SortedList> runningAnimations; - collections::SortedList> pendingAnimations; - bool finalized = false; + GuiControl* owner = nullptr; + bool disposed = false; - virtual controls::GuiControlHost* GetControlHostForInstance() = 0; - void InstallTimerCallback(controls::GuiControlHost* controlHost); - bool UninstallTimerCallback(controls::GuiControlHost* controlHost); - void OnControlHostForInstanceChanged(); - void StartPendingAnimations(); + void SetDisposed(); public: - GuiInstanceRootObject(); - ~GuiInstanceRootObject(); - - /// Clear all subscriptions and components. - void FinalizeInstance(); + GuiDisposedFlag(GuiControl* _owner); + ~GuiDisposedFlag(); - /// Test has the object been finalized. - /// Returns true if this object has been finalized. - bool IsFinalized(); + bool IsDisposed(); + }; - void FinalizeInstanceRecursively(templates::GuiTemplate* thisObject); - void FinalizeInstanceRecursively(GuiCustomControl* thisObject); - void FinalizeInstanceRecursively(GuiControlHost* thisObject); - void FinalizeGeneralInstance(GuiInstanceRootObject* thisObject); + /// + /// The base class of all controls. + /// When the control is destroyed, it automatically destroys sub controls, and the bounds composition from the style controller. + /// If you want to manually destroy a control, you should first remove it from its parent. + /// The only way to remove a control from a parent control, is to remove the bounds composition from its parent composition. The same to inserting a control. + /// + class GuiControl + : public Object + , protected compositions::IGuiAltAction + , protected compositions::IGuiTabAction + , public Description + { + friend class compositions::GuiGraphicsComposition; - /// Set the resource resolver to connect the current root object to the resource creating it. - /// The resource resolver - void SetResourceResolver(Ptr resolver); - /// Resolve a resource using the current resource resolver. - /// The loaded resource. Returns null if failed to load. - /// The protocol. - /// The path. - /// Set to true and it will throw an exception if the resource doesn't exist. - Ptr ResolveResource(const WString& protocol, const WString& path, bool ensureExist); + protected: + using ControlList = collections::List; + using ControlServiceMap = collections::Dictionary>; + using ControlTemplatePropertyType = TemplateProperty; + using IGuiGraphicsEventHandler = compositions::IGuiGraphicsEventHandler; - /// Add a subscription. When this control host is disposing, all attached subscriptions will be deleted. - /// Returns null if this operation failed. - /// The subscription to test. - Ptr AddSubscription(Ptr subscription); - /// Clear all subscriptions. - void UpdateSubscriptions(); + private: + theme::ThemeName controlThemeName; + ControlTemplatePropertyType controlTemplate; + templates::GuiControlTemplate* controlTemplateObject = nullptr; + Ptr disposedFlag; - /// Add a component. When this control host is disposing, all attached components will be deleted. - /// Returns true if this operation succeeded. - /// The component to add. - bool AddComponent(GuiComponent* component); + public: + Ptr GetDisposedFlag(); - /// Add a control host as a component. When this control host is disposing, all attached components will be deleted. - /// Returns true if this operation succeeded. - /// The controlHost to add. - bool AddControlHostComponent(GuiControlHost* controlHost); + protected: + compositions::GuiBoundsComposition* boundsComposition = nullptr; + compositions::GuiBoundsComposition* containerComposition = nullptr; + compositions::GuiGraphicsComposition* focusableComposition = nullptr; + compositions::GuiGraphicsEventReceiver* eventReceiver = nullptr; - /// Add an animation. The animation will be paused if the root object is removed from a window. - /// Returns true if this operation succeeded. - /// The animation. - bool AddAnimation(Ptr animation); + bool isFocused = false; + Ptr gotFocusHandler; + Ptr lostFocusHandler; - /// Kill an animation. - /// Returns true if this operation succeeded. - /// The animation. - bool KillAnimation(Ptr animation); - }; - } - } -} + bool acceptTabInput = false; + vint tabPriority = -1; + bool isEnabled = true; + bool isVisuallyEnabled = true; + bool isVisible = true; + WString alt; + WString text; + Nullable font; + FontProperties displayFont; + description::Value context; + compositions::IGuiAltActionHost* activatingAltHost = nullptr; + ControlServiceMap controlServices; -#endif + GuiControl* parent = nullptr; + ControlList children; + description::Value tag; + GuiControl* tooltipControl = nullptr; + vint tooltipWidth = 0; -/*********************************************************************** -.\APPLICATION\CONTROLS\GUITHEMEMANAGER.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control Styles::Common Style Helpers + virtual void BeforeControlTemplateUninstalled(); + virtual void AfterControlTemplateInstalled(bool initialize); + virtual void CheckAndStoreControlTemplate(templates::GuiControlTemplate* value); + virtual void EnsureControlTemplateExists(); + virtual void RebuildControlTemplate(); + virtual void OnChildInserted(GuiControl* control); + virtual void OnChildRemoved(GuiControl* control); + virtual void OnParentChanged(GuiControl* oldParent, GuiControl* newParent); + virtual void OnParentLineChanged(); + virtual void OnServiceAdded(); + virtual void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget); + virtual void OnBeforeReleaseGraphicsHost(); + virtual void UpdateVisuallyEnabled(); + virtual void UpdateDisplayFont(); + void OnGotFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnLostFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void SetFocusableComposition(compositions::GuiGraphicsComposition* value); -Interfaces: -***********************************************************************/ + bool IsControlVisibleAndEnabled(); + bool IsAltEnabled()override; + bool IsAltAvailable()override; + compositions::GuiGraphicsComposition* GetAltComposition()override; + compositions::IGuiAltActionHost* GetActivatingAltHost()override; + void OnActiveAlt()override; + bool IsTabEnabled()override; + bool IsTabAvailable()override; -#ifndef VCZH_PRESENTATION_CONTROLS_GUITHEMEMANAGER -#define VCZH_PRESENTATION_CONTROLS_GUITHEMEMANAGER + static bool SharedPtrDestructorProc(DescriptableObject* obj, bool forceDisposing); + public: + using ControlTemplateType = templates::GuiControlTemplate; -namespace vl -{ - namespace presentation - { - namespace templates - { + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiControl(theme::ThemeName themeName); + ~GuiControl(); -/*********************************************************************** -Theme Builders -***********************************************************************/ + /// Theme name changed event. This event raises when the theme name is changed. + compositions::GuiNotifyEvent ControlThemeNameChanged; + /// Control template changed event. This event raises when the control template is changed. + compositions::GuiNotifyEvent ControlTemplateChanged; + /// Control signal trigerred. This raises be raised because of multiple reason specified in the argument. + compositions::GuiControlSignalEvent ControlSignalTrigerred; + /// Visible event. This event raises when the visibility state of the control is changed. + compositions::GuiNotifyEvent VisibleChanged; + /// Enabled event. This event raises when the enabling state of the control is changed. + compositions::GuiNotifyEvent EnabledChanged; + /// Focused event. This event raises when the focusing state of the control is changed. + compositions::GuiNotifyEvent FocusedChanged; + /// + /// Enabled event. This event raises when the visually enabling state of the control is changed. A visually enabling is combined by the enabling state and the parent's visually enabling state. + /// A control is rendered as disabled, not only when the control itself is disabled, but also when the parent control is rendered as disabled. + /// + compositions::GuiNotifyEvent VisuallyEnabledChanged; + /// Alt changed event. This event raises when the associated Alt-combined shortcut key of the control is changed. + compositions::GuiNotifyEvent AltChanged; + /// Text changed event. This event raises when the text of the control is changed. + compositions::GuiNotifyEvent TextChanged; + /// Font changed event. This event raises when the font of the control is changed. + compositions::GuiNotifyEvent FontChanged; + /// Display font changed event. This event raises when the display font of the control is changed. + compositions::GuiNotifyEvent DisplayFontChanged; + /// Context changed event. This event raises when the font of the control is changed. + compositions::GuiNotifyEvent ContextChanged; -#define GUI_TEMPLATE_PROPERTY_DECL(CLASS, TYPE, NAME, VALUE)\ - private:\ - TYPE NAME##_ = VALUE;\ - public:\ - TYPE Get##NAME();\ - void Set##NAME(TYPE const& value);\ - compositions::GuiNotifyEvent NAME##Changed;\ + void TryDelayExecuteIfNotDeleted(Func proc); -#define GUI_TEMPLATE_PROPERTY_IMPL(CLASS, TYPE, NAME, VALUE)\ - TYPE CLASS::Get##NAME()\ - {\ - return NAME##_;\ - }\ - void CLASS::Set##NAME(TYPE const& value)\ - {\ - if (NAME##_ != value)\ - {\ - NAME##_ = value;\ - NAME##Changed.Execute(compositions::GuiEventArgs(this));\ - }\ - }\ + /// A function to create the argument for notify events that raised by itself. + /// The created argument. + compositions::GuiEventArgs GetNotifyEventArguments(); + /// Get the associated theme name. + /// The theme name. + theme::ThemeName GetControlThemeName(); + /// Set the associated control theme name. + /// The theme name. + void SetControlThemeName(theme::ThemeName value); + /// Get the associated control template. + /// The control template. + ControlTemplatePropertyType GetControlTemplate(); + /// Set the associated control template. + /// The control template. + void SetControlTemplate(const ControlTemplatePropertyType& value); + /// Set the associated control theme name and template and the same time. + /// The theme name. + /// The control template. + void SetControlThemeNameAndTemplate(theme::ThemeName themeNameValue, const ControlTemplatePropertyType& controlTemplateValue); + /// Get the associated style controller. + /// The associated style controller. + templates::GuiControlTemplate* GetControlTemplateObject(); + /// Get the bounds composition for the control. + /// The bounds composition. + compositions::GuiBoundsComposition* GetBoundsComposition(); + /// Get the container composition for the control. + /// The container composition. + compositions::GuiGraphicsComposition* GetContainerComposition(); + /// Get the focusable composition for the control. A focusable composition is the composition to be focused when the control is focused. + /// The focusable composition. + compositions::GuiGraphicsComposition* GetFocusableComposition(); + /// Get the parent control. + /// The parent control. + GuiControl* GetParent(); + /// Get the number of child controls. + /// The number of child controls. + vint GetChildrenCount(); + /// Get the child control using a specified index. + /// The child control. + /// The specified index. + GuiControl* GetChild(vint index); + /// Put another control in the container composition of this control. + /// Returns true if this operation succeeded. + /// The control to put in this control. + bool AddChild(GuiControl* control); + /// Test if a control owned by this control. + /// Returns true if the control is owned by this control. + /// The control to test. + bool HasChild(GuiControl* control); + + /// Get the that contains this control. + /// The that contains this control. + virtual GuiControlHost* GetRelatedControlHost(); + /// Test if this control is rendered as enabled. + /// Returns true if this control is rendered as enabled. + virtual bool GetVisuallyEnabled(); + /// Test if this control is focused. + /// Returns true if this control is focused. + virtual bool GetFocused(); + /// Focus this control. + virtual void SetFocused(); + /// Test if this control accepts tab character input. + /// Returns true if this control accepts tab character input. + virtual bool GetAcceptTabInput()override; + /// Set if this control accepts tab character input. + /// Set to true to make this control accept tab character input. + void SetAcceptTabInput(bool value); + /// Get the tab priority associated with this control. + /// Returns he tab priority associated with this control. + virtual vint GetTabPriority()override; + /// Associate a tab priority with this control. + /// The tab priority to associate. TAB key will go through controls in the order of priority: 0, 1, 2, ..., -1. All negative numbers will be converted to -1. The priority of containers affects all children if it is not -1. + void SetTabPriority(vint value); + /// Test if this control is enabled. + /// Returns true if this control is enabled. + virtual bool GetEnabled(); + /// Make the control enabled or disabled. + /// Set to true to make the control enabled. + virtual void SetEnabled(bool value); + /// Test if this visible or invisible. + /// Returns true if this control is visible. + virtual bool GetVisible(); + /// Make the control visible or invisible. + /// Set to true to make the visible enabled. + virtual void SetVisible(bool value); + /// Get the Alt-combined shortcut key associated with this control. + /// The Alt-combined shortcut key associated with this control. + virtual const WString& GetAlt()override; + /// Associate a Alt-combined shortcut key with this control. + /// Returns true if this operation succeeded. + /// The Alt-combined shortcut key to associate. The key should contain only upper-case letters or digits. + virtual bool SetAlt(const WString& value); + /// Make the control as the parent of multiple Alt-combined shortcut key activatable controls. + /// The alt action host object. + void SetActivatingAltHost(compositions::IGuiAltActionHost* host); + /// Get the text to display on the control. + /// The text to display on the control. + virtual const WString& GetText(); + /// Set the text to display on the control. + /// The text to display on the control. + virtual void SetText(const WString& value); + /// Get the font of this control. + /// The font of this control. + virtual const Nullable& GetFont(); + /// Set the font of this control. + /// The font of this control. + virtual void SetFont(const Nullable& value); + /// Get the font to render the text. If the font of this control is null, then the display font is either the parent control's display font, or the system's default font when there is no parent control. + /// The font to render the text. + virtual const FontProperties& GetDisplayFont(); + /// Get the context of this control. The control template and all item templates (if it has) will see this context property. + /// The context of this control. + virtual description::Value GetContext(); + /// Set the context of this control. + /// The context of this control. + virtual void SetContext(const description::Value& value); -#define GUI_TEMPLATE_PROPERTY_EVENT_INIT(CLASS, TYPE, NAME, VALUE)\ - NAME##Changed.SetAssociatedComposition(this); + /// Get the tag object of the control. + /// The tag object of the control. + description::Value GetTag(); + /// Set the tag object of the control. + /// The tag object of the control. + void SetTag(const description::Value& value); + /// Get the tooltip control of the control. + /// The tooltip control of the control. + GuiControl* GetTooltipControl(); + /// Set the tooltip control of the control. The tooltip control will be released when this control is released. If you set a new tooltip control to replace the old one, the old one will not be owned by this control anymore, therefore user should release the old tooltip control manually. + /// The old tooltip control. + /// The tooltip control of the control. + GuiControl* SetTooltipControl(GuiControl* value); + /// Get the tooltip width of the control. + /// The tooltip width of the control. + vint GetTooltipWidth(); + /// Set the tooltip width of the control. + /// The tooltip width of the control. + void SetTooltipWidth(vint value); + /// Display the tooltip. + /// Returns true if this operation succeeded. + /// The relative location to specify the left-top position of the tooltip. + bool DisplayTooltip(Point location); + /// Close the tooltip that owned by this control. + void CloseTooltip(); -#define GUI_TEMPLATE_CLASS_FORWARD_DECL(CLASS, BASE)\ - class CLASS;\ + /// Query a service using an identifier. If you want to get a service of type IXXX, use IXXX::Identifier as the identifier. + /// The requested service. If the control doesn't support this service, it will be null. + /// The identifier. + virtual IDescriptable* QueryService(const WString& identifier); -#define GUI_TEMPLATE_CLASS_DECL(CLASS, BASE)\ - class CLASS : public BASE, public AggregatableDescription\ - {\ - public:\ - CLASS();\ - ~CLASS();\ - CLASS ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL)\ - };\ + template + T* QueryTypedService() + { + return dynamic_cast(QueryService(QueryServiceHelper::GetIdentifier())); + } -#define GUI_TEMPLATE_CLASS_IMPL(CLASS, BASE)\ - CLASS ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_IMPL)\ - CLASS::CLASS()\ - {\ - CLASS ## _PROPERTIES(GUI_TEMPLATE_PROPERTY_EVENT_INIT)\ - }\ - CLASS::~CLASS()\ - {\ - FinalizeAggregation();\ - }\ + templates::GuiControlTemplate* TypedControlTemplateObject(bool ensureExists) + { + if (ensureExists) + { + EnsureControlTemplateExists(); + } + return controlTemplateObject; + } -/*********************************************************************** -GuiTemplate -***********************************************************************/ + /// Add a service to this control dynamically. The added service cannot override existing services. + /// Returns true if this operation succeeded. + /// The identifier. You are suggested to fill this parameter using the value from the interface's GetIdentifier function, or will not work on this service. + /// The service. + bool AddService(const WString& identifier, Ptr value); + }; - /// Represents a user customizable template. - class GuiTemplate : public compositions::GuiBoundsComposition, public controls::GuiInstanceRootObject, public Description + /// Represnets a user customizable control. + class GuiCustomControl : public GuiControl, public GuiInstanceRootObject, public AggregatableDescription { protected: - controls::GuiControlHost* GetControlHostForInstance()override; - void OnParentLineChanged()override; + controls::GuiControlHost* GetControlHostForInstance()override; + void OnParentLineChanged()override; public: - /// Create a template. - GuiTemplate(); - ~GuiTemplate(); - -#define GuiTemplate_PROPERTIES(F)\ - F(GuiTemplate, FontProperties, Font, {} )\ - F(GuiTemplate, description::Value, Context, {} )\ - F(GuiTemplate, WString, Text, {} )\ - F(GuiTemplate, bool, VisuallyEnabled, true)\ - - GuiTemplate_PROPERTIES(GUI_TEMPLATE_PROPERTY_DECL) + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiCustomControl(theme::ThemeName themeName); + ~GuiCustomControl(); }; -/*********************************************************************** -Core Themes -***********************************************************************/ + template + class GuiObjectComponent : public GuiComponent + { + public: + Ptr object; -#define GUI_CORE_CONTROL_TEMPLATE_DECL(F)\ - F(GuiControlTemplate, GuiTemplate) \ - F(GuiLabelTemplate, GuiControlTemplate) \ - F(GuiWindowTemplate, GuiControlTemplate) \ + GuiObjectComponent() + { + } -#define GuiControlTemplate_PROPERTIES(F)\ - F(GuiControlTemplate, compositions::GuiGraphicsComposition*, ContainerComposition, this)\ - F(GuiControlTemplate, compositions::GuiGraphicsComposition*, FocusableComposition, nullptr)\ - F(GuiControlTemplate, bool, Focused, false)\ + GuiObjectComponent(Ptr _object) + :object(_object) + { + } + }; -#define GuiLabelTemplate_PROPERTIES(F)\ - F(GuiLabelTemplate, Color, DefaultTextColor, {})\ - F(GuiLabelTemplate, Color, TextColor, {})\ +#define GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_3(UNIQUE) controlTemplateObject ## UNIQUE +#define GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_2(UNIQUE) GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_3(UNIQUE) +#define GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_2(__LINE__) -#define GuiWindowTemplate_PROPERTIES(F)\ - F(GuiWindowTemplate, BoolOption, MaximizedBoxOption, BoolOption::Customizable)\ - F(GuiWindowTemplate, BoolOption, MinimizedBoxOption, BoolOption::Customizable)\ - F(GuiWindowTemplate, BoolOption, BorderOption, BoolOption::Customizable)\ - F(GuiWindowTemplate, BoolOption, SizeBoxOption, BoolOption::Customizable)\ - F(GuiWindowTemplate, BoolOption, IconVisibleOption, BoolOption::Customizable)\ - F(GuiWindowTemplate, BoolOption, TitleBarOption, BoolOption::Customizable)\ - F(GuiWindowTemplate, bool, MaximizedBox, true)\ - F(GuiWindowTemplate, bool, MinimizedBox, true)\ - F(GuiWindowTemplate, bool, Border, true)\ - F(GuiWindowTemplate, bool, SizeBox, true)\ - F(GuiWindowTemplate, bool, IconVisible, true)\ - F(GuiWindowTemplate, bool, TitleBar, true)\ - F(GuiWindowTemplate, bool, Maximized, false)\ - F(GuiWindowTemplate, bool, Activated, false)\ - F(GuiWindowTemplate, TemplateProperty, TooltipTemplate, {})\ - F(GuiWindowTemplate, TemplateProperty, ShortcutKeyTemplate, {})\ - F(GuiWindowTemplate, bool, CustomFrameEnabled, true)\ - F(GuiWindowTemplate, Margin, CustomFramePadding, {})\ - F(GuiWindowTemplate, Ptr, Icon, {})\ +#define GUI_SPECIFY_CONTROL_TEMPLATE_TYPE_2(TEMPLATE, BASE_TYPE, NAME) \ + public: \ + using ControlTemplateType = templates::Gui##TEMPLATE; \ + private: \ + templates::Gui##TEMPLATE* NAME = nullptr; \ + void BeforeControlTemplateUninstalled_(); \ + void AfterControlTemplateInstalled_(bool initialize); \ + protected: \ + void BeforeControlTemplateUninstalled()override \ + {\ + BeforeControlTemplateUninstalled_(); \ + BASE_TYPE::BeforeControlTemplateUninstalled(); \ + }\ + void AfterControlTemplateInstalled(bool initialize)override \ + {\ + BASE_TYPE::AfterControlTemplateInstalled(initialize); \ + AfterControlTemplateInstalled_(initialize); \ + }\ + void CheckAndStoreControlTemplate(templates::GuiControlTemplate* value)override \ + { \ + auto ct = dynamic_cast(value); \ + CHECK_ERROR(ct, L"The assigned control template is not vl::presentation::templates::Gui" L ## # TEMPLATE L"."); \ + NAME = ct; \ + BASE_TYPE::CheckAndStoreControlTemplate(value); \ + } \ + public: \ + templates::Gui##TEMPLATE* TypedControlTemplateObject(bool ensureExists) \ + { \ + if (ensureExists) \ + { \ + EnsureControlTemplateExists(); \ + } \ + return NAME; \ + } \ + private: \ -/*********************************************************************** -Template Declarations -***********************************************************************/ +#define GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(TEMPLATE, BASE_TYPE) GUI_SPECIFY_CONTROL_TEMPLATE_TYPE_2(TEMPLATE, BASE_TYPE, GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME) - GUI_CORE_CONTROL_TEMPLATE_DECL(GUI_TEMPLATE_CLASS_DECL) } + } +} + +#endif + /*********************************************************************** -Theme Names +.\APPLICATION\CONTROLS\GUILABELCONTROLS.H ***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System - namespace theme +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_CONTROLS_GUILABELCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUILABELCONTROLS + + +namespace vl +{ + namespace presentation + { + namespace controls { -#define GUI_CONTROL_TEMPLATE_TYPES(F) \ - F(WindowTemplate, SystemFrameWindow) \ - F(WindowTemplate, CustomFrameWindow) \ - F(ControlTemplate, CustomControl) \ - F(WindowTemplate, Tooltip) \ - F(LabelTemplate, Label) \ - F(LabelTemplate, ShortcutKey) \ - F(ScrollViewTemplate, ScrollView) \ - F(ControlTemplate, GroupBox) \ - F(TabTemplate, Tab) \ - F(ComboBoxTemplate, ComboBox) \ - F(MultilineTextBoxTemplate, MultilineTextBox) \ - F(SinglelineTextBoxTemplate, SinglelineTextBox) \ - F(DocumentViewerTemplate, DocumentViewer) \ - F(DocumentLabelTemplate, DocumentLabel) \ - F(DocumentLabelTemplate, DocumentTextBox) \ - F(ListViewTemplate, ListView) \ - F(TreeViewTemplate, TreeView) \ - F(TextListTemplate, TextList) \ - F(SelectableButtonTemplate, ListItemBackground) \ - F(SelectableButtonTemplate, TreeItemExpander) \ - F(SelectableButtonTemplate, CheckTextListItem) \ - F(SelectableButtonTemplate, RadioTextListItem) \ - F(MenuTemplate, Menu) \ - F(ControlTemplate, MenuBar) \ - F(ControlTemplate, MenuSplitter) \ - F(ToolstripButtonTemplate, MenuBarButton) \ - F(ToolstripButtonTemplate, MenuItemButton) \ - F(ControlTemplate, ToolstripToolBar) \ - F(ToolstripButtonTemplate, ToolstripButton) \ - F(ToolstripButtonTemplate, ToolstripDropdownButton) \ - F(ToolstripButtonTemplate, ToolstripSplitButton) \ - F(ControlTemplate, ToolstripSplitter) \ - F(RibbonTabTemplate, RibbonTab) \ - F(RibbonGroupTemplate, RibbonGroup) \ - F(RibbonGroupMenuTemplate, RibbonGroupMenu) \ - F(RibbonIconLabelTemplate, RibbonIconLabel) \ - F(RibbonIconLabelTemplate, RibbonSmallIconLabel) \ - F(RibbonButtonsTemplate, RibbonButtons) \ - F(RibbonToolstripsTemplate, RibbonToolstrips) \ - F(RibbonGalleryTemplate, RibbonGallery) \ - F(RibbonToolstripMenuTemplate, RibbonToolstripMenu) \ - F(RibbonGalleryListTemplate, RibbonGalleryList) \ - F(TextListTemplate, RibbonGalleryItemList) \ - F(ToolstripButtonTemplate, RibbonSmallButton) \ - F(ToolstripButtonTemplate, RibbonSmallDropdownButton) \ - F(ToolstripButtonTemplate, RibbonSmallSplitButton) \ - F(ToolstripButtonTemplate, RibbonLargeButton) \ - F(ToolstripButtonTemplate, RibbonLargeDropdownButton) \ - F(ToolstripButtonTemplate, RibbonLargeSplitButton) \ - F(ControlTemplate, RibbonSplitter) \ - F(ControlTemplate, RibbonToolstripHeader) \ - F(ButtonTemplate, Button) \ - F(SelectableButtonTemplate, CheckBox) \ - F(SelectableButtonTemplate, RadioButton) \ - F(DatePickerTemplate, DatePicker) \ - F(DateComboBoxTemplate, DateComboBox) \ - F(ScrollTemplate, HScroll) \ - F(ScrollTemplate, VScroll) \ - F(ScrollTemplate, HTracker) \ - F(ScrollTemplate, VTracker) \ - F(ScrollTemplate, ProgressBar) \ +/*********************************************************************** +Label +***********************************************************************/ - enum class ThemeName + /// A control to display a text. + class GuiLabel : public GuiControl, public Description { - Unknown, - Window, -#define GUI_DEFINE_THEME_NAME(TEMPLATE, CONTROL) CONTROL, - GUI_CONTROL_TEMPLATE_TYPES(GUI_DEFINE_THEME_NAME) -#undef GUI_DEFINE_THEME_NAME - }; + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(LabelTemplate, GuiControl) + protected: + Color textColor; + bool textColorConsisted = true; - /// Theme interface. A theme creates appropriate style controllers or style providers for default controls. Call [M:vl.presentation.theme.GetCurrentTheme] to access this interface. - class ITheme : public virtual IDescriptable, public Description - { public: - virtual TemplateProperty CreateStyle(ThemeName themeName) = 0; - }; + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiLabel(theme::ThemeName themeName); + ~GuiLabel(); - /// Get the current theme style factory object. Call or to change the default theme. - /// The current theme style factory object. - extern ITheme* GetCurrentTheme(); - extern void InitializeTheme(); - extern void FinalizeTheme(); + /// Get the text color. + /// The text color. + Color GetTextColor(); + /// Set the text color. + /// The text color. + void SetTextColor(Color value); + }; } } } #endif + /*********************************************************************** -.\APPLICATION\CONTROLS\GUIBASICCONTROLS.H +.\APPLICATION\CONTROLS\GUIWINDOWCONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -9760,753 +9848,258 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIBASICCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIBASICCONTROLS +#ifndef VCZH_PRESENTATION_CONTROLS_GUIWINDOWCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIWINDOWCONTROLS namespace vl { namespace presentation { - namespace theme + namespace compositions { - enum class ThemeName; + class IGuiShortcutKeyManager; + class GuiGraphicsTimerManager; } namespace controls { - template - struct QueryServiceHelper; - - template - struct QueryServiceHelper>> - { - static WString GetIdentifier() - { - return WString::Unmanaged(T::Identifier); - } - }; - - template - struct QueryServiceHelper>> - { - static WString GetIdentifier() - { - return MoveValue(T::GetIdentifier()); - } - }; /*********************************************************************** -Basic Construction +Control Host ***********************************************************************/ /// - /// A helper object to test if a control has been deleted or not. + /// Represents a control that host by a . /// - class GuiDisposedFlag : public Object, public Description + class GuiControlHost : public GuiControl, public GuiInstanceRootObject, protected INativeWindowListener, public Description { - friend class GuiControl; + friend class compositions::GuiGraphicsHost; protected: - GuiControl* owner = nullptr; - bool disposed = false; - - void SetDisposed(); - public: - GuiDisposedFlag(GuiControl* _owner); - ~GuiDisposedFlag(); + Func callbackAfterDeleteThis; + compositions::GuiGraphicsHost* host; + INativeWindow::WindowMode windowMode = INativeWindow::Normal; - bool IsDisposed(); - }; + void DeleteThis(); + virtual void OnNativeWindowChanged(); + virtual void OnVisualStatusChanged(); + protected: + static const vint TooltipDelayOpenTime = 500; + static const vint TooltipDelayCloseTime = 500; + static const vint TooltipDelayLifeTime = 5000; - /// - /// The base class of all controls. - /// When the control is destroyed, it automatically destroys sub controls, and the bounds composition from the style controller. - /// If you want to manually destroy a control, you should first remove it from its parent. - /// The only way to remove a control from a parent control, is to remove the bounds composition from its parent composition. The same to inserting a control. - /// - class GuiControl - : public Object - , protected compositions::IGuiAltAction - , protected compositions::IGuiTabAction - , public Description - { - friend class compositions::GuiGraphicsComposition; + Ptr tooltipOpenDelay; + Ptr tooltipCloseDelay; + Point tooltipLocation; - protected: - using ControlList = collections::List; - using ControlServiceMap = collections::Dictionary>; - using ControlTemplatePropertyType = TemplateProperty; - using IGuiGraphicsEventHandler = compositions::IGuiGraphicsEventHandler; + bool calledDestroyed = false; + bool deleteWhenDestroyed = false; - private: - theme::ThemeName controlThemeName; - ControlTemplatePropertyType controlTemplate; - templates::GuiControlTemplate* controlTemplateObject = nullptr; - Ptr disposedFlag; + controls::GuiControlHost* GetControlHostForInstance()override; + GuiControl* GetTooltipOwner(Point location); + void MoveIntoTooltipControl(GuiControl* tooltipControl, Point location); + void MouseMoving(const NativeWindowMouseInfo& info)override; + void MouseLeaved()override; + void Moved()override; + void Enabled()override; + void Disabled()override; + void GotFocus()override; + void LostFocus()override; + void RenderingAsActivated()override; + void RenderingAsDeactivated()override; + void Opened()override; + void BeforeClosing(bool& cancel)override; + void AfterClosing()override; + void Closed()override; + void Destroying()override; + void UpdateClientSize(Size value, bool updateNativeWindowOnly); + virtual void UpdateClientSizeAfterRendering(Size preferredSize, Size clientSize); public: - Ptr GetDisposedFlag(); + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + /// The window mode. + GuiControlHost(theme::ThemeName themeName, INativeWindow::WindowMode mode); + ~GuiControlHost(); + + /// Window got focus event. + compositions::GuiNotifyEvent WindowGotFocus; + /// Window lost focus event. + compositions::GuiNotifyEvent WindowLostFocus; + /// Window activated event. + compositions::GuiNotifyEvent WindowActivated; + /// Window deactivated event. + compositions::GuiNotifyEvent WindowDeactivated; + /// Window opened event. + compositions::GuiNotifyEvent WindowOpened; + /// Window closing event, raised to offer a chance to stop closing the window. + compositions::GuiRequestEvent WindowClosing; + /// Window ready to close event, raised when a window is about to close. + compositions::GuiNotifyEvent WindowReadyToClose; + /// Window closed event, raised when a window is closed. + compositions::GuiNotifyEvent WindowClosed; + /// Window destroying event. + compositions::GuiNotifyEvent WindowDestroying; - protected: - compositions::GuiBoundsComposition* boundsComposition = nullptr; - compositions::GuiBoundsComposition* containerComposition = nullptr; - compositions::GuiGraphicsComposition* focusableComposition = nullptr; - compositions::GuiGraphicsEventReceiver* eventReceiver = nullptr; + /// Delete this control host after processing all events. + /// The callback to call after the window is deleted. + void DeleteAfterProcessingAllEvents(const Func& callback); - bool isFocused = false; - Ptr gotFocusHandler; - Ptr lostFocusHandler; + /// Get the internal object to host the window content. + /// The internal object to host the window content. + compositions::GuiGraphicsHost* GetGraphicsHost(); + /// Get the main composition to host the window content. + /// The main composition to host the window content. + compositions::GuiGraphicsComposition* GetMainComposition(); + /// Get the internal object to host the content. + /// The the internal object to host the content. + INativeWindow* GetNativeWindow(); + /// Set the internal object to host the content. + /// The the internal object to host the content. + void SetNativeWindow(INativeWindow* window); + /// Force to calculate layout and size immediately + void ForceCalculateSizeImmediately(); + + /// Test is the window enabled. + /// Returns true if the window is enabled. + bool GetEnabled()override; + /// Enable or disable the window. + /// Set to true to enable the window. + void SetEnabled(bool value)override; + /// Test is the window focused. + /// Returns true if the window is focused. + bool GetFocused()override; + /// Focus the window. A window with activation disabled cannot receive focus. + void SetFocused()override; + /// Test is the window rendering as activated. + /// Returns true if the window is rendering as activated. + bool GetRenderingAsActivated(); + /// Test is the window icon shown in the task bar. + /// Returns true if the window is icon shown in the task bar. + bool GetShowInTaskBar(); + /// Show or hide the window icon in the task bar. + /// Set to true to show the window icon in the task bar. + void SetShowInTaskBar(bool value); + /// Test is the window allowed to be activated. + /// Returns true if the window is allowed to be activated. + bool GetEnabledActivate(); + /// + /// Allow or forbid the window to be activated. + /// Clicking a window with activation disabled doesn't bring activation and focus. + /// Activation will be automatically enabled by calling or . + /// + /// Set to true to allow the window to be activated. + void SetEnabledActivate(bool value); + /// + /// Test is the window always on top of the desktop. + /// + /// Returns true if the window is always on top of the desktop. + bool GetTopMost(); + /// + /// Make the window always or never on top of the desktop. + /// + /// True to make the window always on top of the desktop. + void SetTopMost(bool topmost); - bool acceptTabInput = false; - vint tabPriority = -1; - bool isEnabled = true; - bool isVisuallyEnabled = true; - bool isVisible = true; - WString alt; - WString text; - Nullable font; - FontProperties displayFont; - description::Value context; - compositions::IGuiAltActionHost* activatingAltHost = nullptr; - ControlServiceMap controlServices; + /// Get the attached with this control host. + /// The shortcut key manager. + compositions::IGuiShortcutKeyManager* GetShortcutKeyManager(); + /// Attach or detach the associated with this control host. When this control host is disposing, the associated shortcut key manager will be deleted if exists. + /// The shortcut key manager. Set to null to detach the previous shortcut key manager from this control host. + void SetShortcutKeyManager(compositions::IGuiShortcutKeyManager* value); + /// Get the timer manager. + /// The timer manager. + compositions::GuiGraphicsTimerManager* GetTimerManager(); - GuiControl* parent = nullptr; - ControlList children; - description::Value tag; - GuiControl* tooltipControl = nullptr; - vint tooltipWidth = 0; + /// Get the client size of the window. + /// The client size of the window. + Size GetClientSize(); + /// Set the client size of the window. + /// The client size of the window. + void SetClientSize(Size value); + /// Get the location of the window in screen space. + /// The location of the window. + NativePoint GetLocation(); + /// Set the location of the window in screen space. + /// The location of the window. + void SetLocation(NativePoint value); + /// Set the location in screen space and the client size of the window. + /// The location of the window. + /// The client size of the window. + void SetBounds(NativePoint location, Size size); - virtual void BeforeControlTemplateUninstalled(); - virtual void AfterControlTemplateInstalled(bool initialize); - virtual void CheckAndStoreControlTemplate(templates::GuiControlTemplate* value); - virtual void EnsureControlTemplateExists(); - virtual void RebuildControlTemplate(); - virtual void OnChildInserted(GuiControl* control); - virtual void OnChildRemoved(GuiControl* control); - virtual void OnParentChanged(GuiControl* oldParent, GuiControl* newParent); - virtual void OnParentLineChanged(); - virtual void OnServiceAdded(); - virtual void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget); - virtual void OnBeforeReleaseGraphicsHost(); - virtual void UpdateVisuallyEnabled(); - virtual void UpdateDisplayFont(); - void OnGotFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnLostFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void SetFocusableComposition(compositions::GuiGraphicsComposition* value); + GuiControlHost* GetRelatedControlHost()override; + const WString& GetText()override; + void SetText(const WString& value)override; - bool IsControlVisibleAndEnabled(); - bool IsAltEnabled()override; - bool IsAltAvailable()override; - compositions::GuiGraphicsComposition* GetAltComposition()override; - compositions::IGuiAltActionHost* GetActivatingAltHost()override; - void OnActiveAlt()override; - bool IsTabEnabled()override; - bool IsTabAvailable()override; + /// Get the screen that contains the window. + /// The screen that contains the window. + INativeScreen* GetRelatedScreen(); + /// + /// Show the window. + /// If the window disabled activation, this function enables it again. + /// + void Show(); + /// + /// Show the window without activation. + /// + void ShowDeactivated(); + /// + /// Restore the window. + /// + void ShowRestored(); + /// + /// Maximize the window. + /// + void ShowMaximized(); + /// + /// Minimize the window. + /// + void ShowMinimized(); + /// + /// Hide the window. + /// + void Hide(); + /// + /// Close the window and destroy the internal object. + /// + void Close(); + /// Test is the window opened. + /// Returns true if the window is opened. + bool GetOpening(); + }; - static bool SharedPtrDestructorProc(DescriptableObject* obj, bool forceDisposing); +/*********************************************************************** +Window +***********************************************************************/ - public: - using ControlTemplateType = templates::GuiControlTemplate; + /// + /// Represents a normal window. + /// + class GuiWindow : public GuiControlHost, protected compositions::GuiAltActionHostBase, public AggregatableDescription + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(WindowTemplate, GuiControlHost) + friend class GuiApplication; + protected: + bool registeredInApplication = false; - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiControl(theme::ThemeName themeName); - ~GuiControl(); - - /// Theme name changed event. This event raises when the theme name is changed. - compositions::GuiNotifyEvent ControlThemeNameChanged; - /// Control template changed event. This event raises when the control template is changed. - compositions::GuiNotifyEvent ControlTemplateChanged; - /// Control signal trigerred. This raises be raised because of multiple reason specified in the argument. - compositions::GuiControlSignalEvent ControlSignalTrigerred; - /// Visible event. This event raises when the visibility state of the control is changed. - compositions::GuiNotifyEvent VisibleChanged; - /// Enabled event. This event raises when the enabling state of the control is changed. - compositions::GuiNotifyEvent EnabledChanged; - /// Focused event. This event raises when the focusing state of the control is changed. - compositions::GuiNotifyEvent FocusedChanged; - /// - /// Enabled event. This event raises when the visually enabling state of the control is changed. A visually enabling is combined by the enabling state and the parent's visually enabling state. - /// A control is rendered as disabled, not only when the control itself is disabled, but also when the parent control is rendered as disabled. - /// - compositions::GuiNotifyEvent VisuallyEnabledChanged; - /// Alt changed event. This event raises when the associated Alt-combined shortcut key of the control is changed. - compositions::GuiNotifyEvent AltChanged; - /// Text changed event. This event raises when the text of the control is changed. - compositions::GuiNotifyEvent TextChanged; - /// Font changed event. This event raises when the font of the control is changed. - compositions::GuiNotifyEvent FontChanged; - /// Display font changed event. This event raises when the display font of the control is changed. - compositions::GuiNotifyEvent DisplayFontChanged; - /// Context changed event. This event raises when the font of the control is changed. - compositions::GuiNotifyEvent ContextChanged; - - void TryDelayExecuteIfNotDeleted(Func proc); - - /// A function to create the argument for notify events that raised by itself. - /// The created argument. - compositions::GuiEventArgs GetNotifyEventArguments(); - /// Get the associated theme name. - /// The theme name. - theme::ThemeName GetControlThemeName(); - /// Set the associated control theme name. - /// The theme name. - void SetControlThemeName(theme::ThemeName value); - /// Get the associated control template. - /// The control template. - ControlTemplatePropertyType GetControlTemplate(); - /// Set the associated control template. - /// The control template. - void SetControlTemplate(const ControlTemplatePropertyType& value); - /// Set the associated control theme name and template and the same time. - /// The theme name. - /// The control template. - void SetControlThemeNameAndTemplate(theme::ThemeName themeNameValue, const ControlTemplatePropertyType& controlTemplateValue); - /// Get the associated style controller. - /// The associated style controller. - templates::GuiControlTemplate* GetControlTemplateObject(); - /// Get the bounds composition for the control. - /// The bounds composition. - compositions::GuiBoundsComposition* GetBoundsComposition(); - /// Get the container composition for the control. - /// The container composition. - compositions::GuiGraphicsComposition* GetContainerComposition(); - /// Get the focusable composition for the control. A focusable composition is the composition to be focused when the control is focused. - /// The focusable composition. - compositions::GuiGraphicsComposition* GetFocusableComposition(); - /// Get the parent control. - /// The parent control. - GuiControl* GetParent(); - /// Get the number of child controls. - /// The number of child controls. - vint GetChildrenCount(); - /// Get the child control using a specified index. - /// The child control. - /// The specified index. - GuiControl* GetChild(vint index); - /// Put another control in the container composition of this control. - /// Returns true if this operation succeeded. - /// The control to put in this control. - bool AddChild(GuiControl* control); - /// Test if a control owned by this control. - /// Returns true if the control is owned by this control. - /// The control to test. - bool HasChild(GuiControl* control); - - /// Get the that contains this control. - /// The that contains this control. - virtual GuiControlHost* GetRelatedControlHost(); - /// Test if this control is rendered as enabled. - /// Returns true if this control is rendered as enabled. - virtual bool GetVisuallyEnabled(); - /// Test if this control is focused. - /// Returns true if this control is focused. - virtual bool GetFocused(); - /// Focus this control. - virtual void SetFocused(); - /// Test if this control accepts tab character input. - /// Returns true if this control accepts tab character input. - virtual bool GetAcceptTabInput()override; - /// Set if this control accepts tab character input. - /// Set to true to make this control accept tab character input. - void SetAcceptTabInput(bool value); - /// Get the tab priority associated with this control. - /// Returns he tab priority associated with this control. - virtual vint GetTabPriority()override; - /// Associate a tab priority with this control. - /// The tab priority to associate. TAB key will go through controls in the order of priority: 0, 1, 2, ..., -1. All negative numbers will be converted to -1. The priority of containers affects all children if it is not -1. - void SetTabPriority(vint value); - /// Test if this control is enabled. - /// Returns true if this control is enabled. - virtual bool GetEnabled(); - /// Make the control enabled or disabled. - /// Set to true to make the control enabled. - virtual void SetEnabled(bool value); - /// Test if this visible or invisible. - /// Returns true if this control is visible. - virtual bool GetVisible(); - /// Make the control visible or invisible. - /// Set to true to make the visible enabled. - virtual void SetVisible(bool value); - /// Get the Alt-combined shortcut key associated with this control. - /// The Alt-combined shortcut key associated with this control. - virtual const WString& GetAlt()override; - /// Associate a Alt-combined shortcut key with this control. - /// Returns true if this operation succeeded. - /// The Alt-combined shortcut key to associate. The key should contain only upper-case letters or digits. - virtual bool SetAlt(const WString& value); - /// Make the control as the parent of multiple Alt-combined shortcut key activatable controls. - /// The alt action host object. - void SetActivatingAltHost(compositions::IGuiAltActionHost* host); - /// Get the text to display on the control. - /// The text to display on the control. - virtual const WString& GetText(); - /// Set the text to display on the control. - /// The text to display on the control. - virtual void SetText(const WString& value); - /// Get the font of this control. - /// The font of this control. - virtual const Nullable& GetFont(); - /// Set the font of this control. - /// The font of this control. - virtual void SetFont(const Nullable& value); - /// Get the font to render the text. If the font of this control is null, then the display font is either the parent control's display font, or the system's default font when there is no parent control. - /// The font to render the text. - virtual const FontProperties& GetDisplayFont(); - /// Get the context of this control. The control template and all item templates (if it has) will see this context property. - /// The context of this control. - virtual description::Value GetContext(); - /// Set the context of this control. - /// The context of this control. - virtual void SetContext(const description::Value& value); - - /// Get the tag object of the control. - /// The tag object of the control. - description::Value GetTag(); - /// Set the tag object of the control. - /// The tag object of the control. - void SetTag(const description::Value& value); - /// Get the tooltip control of the control. - /// The tooltip control of the control. - GuiControl* GetTooltipControl(); - /// Set the tooltip control of the control. The tooltip control will be released when this control is released. If you set a new tooltip control to replace the old one, the old one will not be owned by this control anymore, therefore user should release the old tooltip control manually. - /// The old tooltip control. - /// The tooltip control of the control. - GuiControl* SetTooltipControl(GuiControl* value); - /// Get the tooltip width of the control. - /// The tooltip width of the control. - vint GetTooltipWidth(); - /// Set the tooltip width of the control. - /// The tooltip width of the control. - void SetTooltipWidth(vint value); - /// Display the tooltip. - /// Returns true if this operation succeeded. - /// The relative location to specify the left-top position of the tooltip. - bool DisplayTooltip(Point location); - /// Close the tooltip that owned by this control. - void CloseTooltip(); - - /// Query a service using an identifier. If you want to get a service of type IXXX, use IXXX::Identifier as the identifier. - /// The requested service. If the control doesn't support this service, it will be null. - /// The identifier. - virtual IDescriptable* QueryService(const WString& identifier); - - template - T* QueryTypedService() - { - return dynamic_cast(QueryService(QueryServiceHelper::GetIdentifier())); - } - - templates::GuiControlTemplate* TypedControlTemplateObject(bool ensureExists) - { - if (ensureExists) - { - EnsureControlTemplateExists(); - } - return controlTemplateObject; - } - - /// Add a service to this control dynamically. The added service cannot override existing services. - /// Returns true if this operation succeeded. - /// The identifier. You are suggested to fill this parameter using the value from the interface's GetIdentifier function, or will not work on this service. - /// The service. - bool AddService(const WString& identifier, Ptr value); - }; - - /// Represnets a user customizable control. - class GuiCustomControl : public GuiControl, public GuiInstanceRootObject, public AggregatableDescription - { - protected: - controls::GuiControlHost* GetControlHostForInstance()override; - void OnParentLineChanged()override; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiCustomControl(theme::ThemeName themeName); - ~GuiCustomControl(); - }; - - template - class GuiObjectComponent : public GuiComponent - { - public: - Ptr object; - - GuiObjectComponent() - { - } - - GuiObjectComponent(Ptr _object) - :object(_object) - { - } - }; - -#define GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_3(UNIQUE) controlTemplateObject ## UNIQUE -#define GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_2(UNIQUE) GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_3(UNIQUE) -#define GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME_2(__LINE__) - -#define GUI_SPECIFY_CONTROL_TEMPLATE_TYPE_2(TEMPLATE, BASE_TYPE, NAME) \ - public: \ - using ControlTemplateType = templates::Gui##TEMPLATE; \ - private: \ - templates::Gui##TEMPLATE* NAME = nullptr; \ - void BeforeControlTemplateUninstalled_(); \ - void AfterControlTemplateInstalled_(bool initialize); \ - protected: \ - void BeforeControlTemplateUninstalled()override \ - {\ - BeforeControlTemplateUninstalled_(); \ - BASE_TYPE::BeforeControlTemplateUninstalled(); \ - }\ - void AfterControlTemplateInstalled(bool initialize)override \ - {\ - BASE_TYPE::AfterControlTemplateInstalled(initialize); \ - AfterControlTemplateInstalled_(initialize); \ - }\ - void CheckAndStoreControlTemplate(templates::GuiControlTemplate* value)override \ - { \ - auto ct = dynamic_cast(value); \ - CHECK_ERROR(ct, L"The assigned control template is not vl::presentation::templates::Gui" L ## # TEMPLATE L"."); \ - NAME = ct; \ - BASE_TYPE::CheckAndStoreControlTemplate(value); \ - } \ - public: \ - templates::Gui##TEMPLATE* TypedControlTemplateObject(bool ensureExists) \ - { \ - if (ensureExists) \ - { \ - EnsureControlTemplateExists(); \ - } \ - return NAME; \ - } \ - private: \ - -#define GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(TEMPLATE, BASE_TYPE) GUI_SPECIFY_CONTROL_TEMPLATE_TYPE_2(TEMPLATE, BASE_TYPE, GUI_GENERATE_CONTROL_TEMPLATE_OBJECT_NAME) - - } - } -} - -#endif - - -/*********************************************************************** -.\APPLICATION\CONTROLS\GUILABELCONTROLS.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control System - -Interfaces: -***********************************************************************/ - -#ifndef VCZH_PRESENTATION_CONTROLS_GUILABELCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUILABELCONTROLS - - -namespace vl -{ - namespace presentation - { - namespace controls - { - -/*********************************************************************** -Label -***********************************************************************/ - - /// A control to display a text. - class GuiLabel : public GuiControl, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(LabelTemplate, GuiControl) - protected: - Color textColor; - bool textColorConsisted = true; - - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiLabel(theme::ThemeName themeName); - ~GuiLabel(); - - /// Get the text color. - /// The text color. - Color GetTextColor(); - /// Set the text color. - /// The text color. - void SetTextColor(Color value); - }; - } - } -} - -#endif - - -/*********************************************************************** -.\APPLICATION\CONTROLS\GUIWINDOWCONTROLS.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control System - -Interfaces: -***********************************************************************/ - -#ifndef VCZH_PRESENTATION_CONTROLS_GUIWINDOWCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIWINDOWCONTROLS - - -namespace vl -{ - namespace presentation - { - namespace compositions - { - class IGuiShortcutKeyManager; - class GuiGraphicsTimerManager; - } - - namespace controls - { - -/*********************************************************************** -Control Host -***********************************************************************/ - - /// - /// Represents a control that host by a . - /// - class GuiControlHost : public GuiControl, public GuiInstanceRootObject, protected INativeWindowListener, public Description - { - friend class compositions::GuiGraphicsHost; - protected: - Func callbackAfterDeleteThis; - compositions::GuiGraphicsHost* host; - INativeWindow::WindowMode windowMode = INativeWindow::Normal; - - void DeleteThis(); - virtual void OnNativeWindowChanged(); - virtual void OnVisualStatusChanged(); - protected: - static const vint TooltipDelayOpenTime = 500; - static const vint TooltipDelayCloseTime = 500; - static const vint TooltipDelayLifeTime = 5000; - - Ptr tooltipOpenDelay; - Ptr tooltipCloseDelay; - Point tooltipLocation; - - bool calledDestroyed = false; - bool deleteWhenDestroyed = false; - - controls::GuiControlHost* GetControlHostForInstance()override; - GuiControl* GetTooltipOwner(Point location); - void MoveIntoTooltipControl(GuiControl* tooltipControl, Point location); - void MouseMoving(const NativeWindowMouseInfo& info)override; - void MouseLeaved()override; - void Moved()override; - void Enabled()override; - void Disabled()override; - void GotFocus()override; - void LostFocus()override; - void RenderingAsActivated()override; - void RenderingAsDeactivated()override; - void Opened()override; - void BeforeClosing(bool& cancel)override; - void AfterClosing()override; - void Closed()override; - void Destroying()override; - - virtual void UpdateClientSizeAfterRendering(Size preferredSize, Size clientSize); - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - /// The window mode. - GuiControlHost(theme::ThemeName themeName, INativeWindow::WindowMode mode); - ~GuiControlHost(); - - /// Window got focus event. - compositions::GuiNotifyEvent WindowGotFocus; - /// Window lost focus event. - compositions::GuiNotifyEvent WindowLostFocus; - /// Window activated event. - compositions::GuiNotifyEvent WindowActivated; - /// Window deactivated event. - compositions::GuiNotifyEvent WindowDeactivated; - /// Window opened event. - compositions::GuiNotifyEvent WindowOpened; - /// Window closing event, raised to offer a chance to stop closing the window. - compositions::GuiRequestEvent WindowClosing; - /// Window ready to close event, raised when a window is about to close. - compositions::GuiNotifyEvent WindowReadyToClose; - /// Window closed event, raised when a window is closed. - compositions::GuiNotifyEvent WindowClosed; - /// Window destroying event. - compositions::GuiNotifyEvent WindowDestroying; - - /// Delete this control host after processing all events. - /// The callback to call after the window is deleted. - void DeleteAfterProcessingAllEvents(const Func& callback); - - /// Get the internal object to host the window content. - /// The internal object to host the window content. - compositions::GuiGraphicsHost* GetGraphicsHost(); - /// Get the main composition to host the window content. - /// The main composition to host the window content. - compositions::GuiGraphicsComposition* GetMainComposition(); - /// Get the internal object to host the content. - /// The the internal object to host the content. - INativeWindow* GetNativeWindow(); - /// Set the internal object to host the content. - /// The the internal object to host the content. - void SetNativeWindow(INativeWindow* window); - /// Force to calculate layout and size immediately - void ForceCalculateSizeImmediately(); - - /// Test is the window enabled. - /// Returns true if the window is enabled. - bool GetEnabled()override; - /// Enable or disable the window. - /// Set to true to enable the window. - void SetEnabled(bool value)override; - /// Test is the window focused. - /// Returns true if the window is focused. - bool GetFocused()override; - /// Focus the window. A window with activation disabled cannot receive focus. - void SetFocused()override; - /// Test is the window rendering as activated. - /// Returns true if the window is rendering as activated. - bool GetRenderingAsActivated(); - /// Test is the window icon shown in the task bar. - /// Returns true if the window is icon shown in the task bar. - bool GetShowInTaskBar(); - /// Show or hide the window icon in the task bar. - /// Set to true to show the window icon in the task bar. - void SetShowInTaskBar(bool value); - /// Test is the window allowed to be activated. - /// Returns true if the window is allowed to be activated. - bool GetEnabledActivate(); - /// - /// Allow or forbid the window to be activated. - /// Clicking a window with activation disabled doesn't bring activation and focus. - /// Activation will be automatically enabled by calling or . - /// - /// Set to true to allow the window to be activated. - void SetEnabledActivate(bool value); - /// - /// Test is the window always on top of the desktop. - /// - /// Returns true if the window is always on top of the desktop. - bool GetTopMost(); - /// - /// Make the window always or never on top of the desktop. - /// - /// True to make the window always on top of the desktop. - void SetTopMost(bool topmost); - - /// Get the attached with this control host. - /// The shortcut key manager. - compositions::IGuiShortcutKeyManager* GetShortcutKeyManager(); - /// Attach or detach the associated with this control host. When this control host is disposing, the associated shortcut key manager will be deleted if exists. - /// The shortcut key manager. Set to null to detach the previous shortcut key manager from this control host. - void SetShortcutKeyManager(compositions::IGuiShortcutKeyManager* value); - /// Get the timer manager. - /// The timer manager. - compositions::GuiGraphicsTimerManager* GetTimerManager(); - - /// Get the client size of the window. - /// The client size of the window. - Size GetClientSize(); - /// Set the client size of the window. - /// The client size of the window. - void SetClientSize(Size value); - /// Get the location of the window in screen space. - /// The location of the window. - NativePoint GetLocation(); - /// Set the location of the window in screen space. - /// The location of the window. - void SetLocation(NativePoint value); - /// Set the location in screen space and the client size of the window. - /// The location of the window. - /// The client size of the window. - void SetBounds(NativePoint location, Size size); - - GuiControlHost* GetRelatedControlHost()override; - const WString& GetText()override; - void SetText(const WString& value)override; - - /// Get the screen that contains the window. - /// The screen that contains the window. - INativeScreen* GetRelatedScreen(); - /// - /// Show the window. - /// If the window disabled activation, this function enables it again. - /// - void Show(); - /// - /// Show the window without activation. - /// - void ShowDeactivated(); - /// - /// Restore the window. - /// - void ShowRestored(); - /// - /// Maximize the window. - /// - void ShowMaximized(); - /// - /// Minimize the window. - /// - void ShowMinimized(); - /// - /// Hide the window. - /// - void Hide(); - /// - /// Close the window and destroy the internal object. - /// - void Close(); - /// Test is the window opened. - /// Returns true if the window is opened. - bool GetOpening(); - }; - -/*********************************************************************** -Window -***********************************************************************/ - - /// - /// Represents a normal window. - /// - class GuiWindow : public GuiControlHost, protected compositions::GuiAltActionHostBase, public AggregatableDescription - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(WindowTemplate, GuiControlHost) - friend class GuiApplication; - protected: - bool registeredInApplication = false; - - protected: - compositions::IGuiAltActionHost* previousAltHost = nullptr; - const NativeWindowFrameConfig* frameConfig = nullptr; - bool hasMaximizedBox = true; - bool hasMinimizedBox = true; - bool hasBorder = true; - bool hasSizeBox = true; - bool isIconVisible = true; - bool hasTitleBar = true; - Ptr icon; - - void UpdateIcon(INativeWindow* window, templates::GuiWindowTemplate* ct); - void UpdateCustomFramePadding(INativeWindow* window, templates::GuiWindowTemplate* ct); - void SetControlTemplateProperties(); - void SetNativeWindowFrameProperties(); - bool ApplyFrameConfigOnVariable(BoolOption frameConfig, BoolOption templateConfig, bool& variable); - void ApplyFrameConfig(); + protected: + compositions::IGuiAltActionHost* previousAltHost = nullptr; + const NativeWindowFrameConfig* frameConfig = nullptr; + bool hasMaximizedBox = true; + bool hasMinimizedBox = true; + bool hasBorder = true; + bool hasSizeBox = true; + bool isIconVisible = true; + bool hasTitleBar = true; + Ptr icon; + + void UpdateIcon(INativeWindow* window, templates::GuiWindowTemplate* ct); + void UpdateCustomFramePadding(INativeWindow* window, templates::GuiWindowTemplate* ct); + void SetControlTemplateProperties(); + void SetNativeWindowFrameProperties(); + bool ApplyFrameConfigOnVariable(BoolOption frameConfig, BoolOption templateConfig, bool& variable); + void ApplyFrameConfig(); void Moved()override; void Opened()override; @@ -11869,8 +11462,8 @@ Elements struct ElementShape { ElementShapeType shapeType = ElementShapeType::Rectangle; - int radiusX = 0; - int radiusY = 0; + vint radiusX = 0; + vint radiusY = 0; GUI_DEFINE_COMPARE_OPERATORS(ElementShape) }; @@ -11880,7 +11473,8 @@ Elements /// class GuiFocusRectangleElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiFocusRectangleElement, L"FocusRectangle") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"FocusRectangle"; protected: GuiFocusRectangleElement(); @@ -11892,7 +11486,8 @@ Elements /// class GuiSolidBorderElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiSolidBorderElement, L"SolidBorder") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"SolidBorder"; protected: Color color; ElementShape shape; @@ -11926,7 +11521,8 @@ Elements /// class Gui3DBorderElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(Gui3DBorderElement, L"3DBorder") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"3DBorder"; protected: Color color1; Color color2; @@ -11966,7 +11562,8 @@ Elements /// class Gui3DSplitterElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(Gui3DSplitterElement, L"3DSplitter") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"3DSplitter"; public: /// /// Defines a direction of the . @@ -12029,7 +11626,8 @@ Elements /// class GuiSolidBackgroundElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiSolidBackgroundElement, L"SolidBackground") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"SolidBackground"; protected: Color color; ElementShape shape; @@ -12037,14 +11635,14 @@ Elements GuiSolidBackgroundElement(); public: /// - /// Get the border color. + /// Get the background color. /// - /// The border color. + /// The background color. Color GetColor(); /// - /// Set the border color. + /// Set the background color. /// - /// The new border color. + /// The new background color. void SetColor(Color value); /// /// Get the shape. @@ -12063,7 +11661,8 @@ Elements /// class GuiGradientBackgroundElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiGradientBackgroundElement, L"GradientBackground") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"GradientBackground"; public: /// /// Defines a direction of the . @@ -12141,7 +11740,8 @@ Elements /// class GuiInnerShadowElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiInnerShadowElement, L"InnerShadow") + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"InnerShadow"; protected: Color color; vint thickness = 0; @@ -12176,7 +11776,8 @@ Elements /// class GuiSolidLabelElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiSolidLabelElement, L"SolidLabel"); + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"SolidLabel"; protected: Color color; FontProperties fontProperties; @@ -12300,7 +11901,8 @@ Elements /// class GuiImageFrameElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiImageFrameElement, L"ImageFrame"); + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"ImageFrame"; protected: Ptr image; vint frameIndex; @@ -12393,9 +11995,10 @@ Elements /// class GuiPolygonElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiPolygonElement, L"Polygon"); + friend class GuiElementBase; typedef collections::Array PointArray; + static constexpr const wchar_t* ElementTypeName = L"Polygon"; protected: Size size; PointArray points; @@ -12506,7 +12109,8 @@ Rich Content Document (element) /// Defines a rich text document element for rendering complex styled document. class GuiDocumentElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiDocumentElement, L"RichDocument"); + friend class GuiElementBase; + static constexpr const wchar_t* ElementTypeName = L"RichDocument"; public: /// Callback interface for this element. class ICallback : public virtual IDescriptable, public Description @@ -12525,11 +12129,10 @@ Rich Content Document (element) virtual Size OnRenderEmbeddedObject(const WString& name, const Rect& location) = 0; }; - class GuiDocumentElementRenderer : public Object, public IGuiGraphicsRenderer, private IGuiGraphicsParagraphCallback + class GuiDocumentElementRenderer : public GuiElementRendererBase, private IGuiGraphicsParagraphCallback { friend class visitors::SetPropertiesVisitor; - - DEFINE_GUI_GRAPHICS_RENDERER(GuiDocumentElement, GuiDocumentElementRenderer, IGuiGraphicsRenderTarget) + friend class GuiElementRendererBase; protected: struct EmbeddedObject { @@ -13250,10 +12853,11 @@ Colorized Plain Text (element) /// class GuiColorizedTextElement : public GuiElementBase { - DEFINE_GUI_GRAPHICS_ELEMENT(GuiColorizedTextElement, L"ColorizedText"); - + friend class GuiElementBase; friend class text::TextLines; + typedef collections::Array ColorArray; + static constexpr const wchar_t* ElementTypeName = L"ColorizedText"; public: /// /// An callback interface. Member functions will be called when colors or fonts of a changed. @@ -16948,121 +16552,542 @@ GuiDocumentCommonInterface /// The end position of the range. Nullable SummarizeParagraphAlignment(TextPos begin, TextPos end); - //================ editing control + //================ editing control + + /// Get the href attribute of the active hyperlink. + /// The href attribute of the active hyperlink. + WString GetActiveHyperlinkReference(); + /// Get the edit mode of this control. + /// The edit mode. + EditMode GetEditMode(); + /// Set the edit mode of this control. + /// The edit mode. + void SetEditMode(EditMode value); + + //================ selection operations + + /// Select all text. + void SelectAll(); + /// Get the selected text. + /// The selected text. + WString GetSelectionText(); + /// Set the selected text. + /// The selected text. + void SetSelectionText(const WString& value); + /// Get the selected model. + /// The selected model. + Ptr GetSelectionModel(); + /// Set the selected model. + /// The selected model. + void SetSelectionModel(Ptr value); + + //================ clipboard operations + + /// Test can the selection be cut. + /// Returns true if the selection can be cut. + bool CanCut(); + /// Test can the selection be copied. + /// Returns true if the selection can be cut. + bool CanCopy(); + /// Test can the content in the clipboard be pasted. + /// Returns true if the content in the clipboard can be pasted. + bool CanPaste(); + /// Cut the selection text. + /// Returns true if this operation succeeded. + bool Cut(); + /// Copy the selection text. + /// Returns true if this operation succeeded. + bool Copy(); + /// Paste the content from the clipboard and replace the selected text. + /// Returns true if this operation succeeded. + bool Paste(); + + //================ undo redo control + + /// Test can undo. + /// Returns true if this action can be performed. + bool CanUndo(); + /// Test can redo. + /// Returns true if this action can be performed. + bool CanRedo(); + /// Clear all undo and redo information. + void ClearUndoRedo(); + /// Test is the text box modified. + /// Returns true if the text box is modified. + bool GetModified(); + /// Notify the text box that the current status is considered saved. + void NotifyModificationSaved(); + /// Perform the undo action. + /// Returns true if this operation succeeded. + bool Undo(); + /// Perform the redo action. + /// Returns true if this operation succeeded. + bool Redo(); + }; + +/*********************************************************************** +GuiDocumentViewer +***********************************************************************/ + + /// Scrollable document viewer for displaying . + class GuiDocumentViewer : public GuiScrollContainer, public GuiDocumentCommonInterface, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DocumentViewerTemplate, GuiScrollContainer) + protected: + + void UpdateDisplayFont()override; + Point GetDocumentViewPosition()override; + void EnsureRectVisible(Rect bounds)override; + public: + /// Create a control with a specified style provider. + /// The theme name for retriving a default control template. + GuiDocumentViewer(theme::ThemeName themeName); + ~GuiDocumentViewer(); + + const WString& GetText()override; + void SetText(const WString& value)override; + }; + +/*********************************************************************** +GuiDocumentViewer +***********************************************************************/ + + /// Static document viewer for displaying . + class GuiDocumentLabel : public GuiControl, public GuiDocumentCommonInterface, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DocumentLabelTemplate, GuiControl) + protected: + + void UpdateDisplayFont()override; + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiDocumentLabel(theme::ThemeName themeName); + ~GuiDocumentLabel(); + + const WString& GetText()override; + void SetText(const WString& value)override; + }; + } + } +} + +#endif + + +/*********************************************************************** +.\CONTROLS\TEXTEDITORPACKAGE\GUITEXTCOMMONINTERFACE.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System + +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_CONTROLS_GUITEXTCOMMONINTERFACE +#define VCZH_PRESENTATION_CONTROLS_GUITEXTCOMMONINTERFACE + + +namespace vl +{ + namespace presentation + { + namespace compositions + { + class GuiShortcutKeyManager; + } + + namespace controls + { + +/*********************************************************************** +Common Interface +***********************************************************************/ + + /// Common interface for text box controls. + class GuiTextBoxCommonInterface abstract : public Description + { + typedef collections::Array ColorArray; + protected: + class ICallback : public virtual IDescriptable, public Description + { + public: + virtual TextPos GetLeftWord(TextPos pos)=0; + virtual TextPos GetRightWord(TextPos pos)=0; + virtual void GetWord(TextPos pos, TextPos& begin, TextPos& end)=0; + virtual vint GetPageRows()=0; + virtual bool BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)=0; + virtual void AfterModify(TextPos originalStart, TextPos originalEnd, const WString& originalText, TextPos inputStart, TextPos inputEnd, const WString& inputText)=0; + virtual void ScrollToView(Point point)=0; + virtual vint GetTextMargin()=0; + }; + + class DefaultCallback : public Object, public ICallback, public Description + { + protected: + elements::GuiColorizedTextElement* textElement; + compositions::GuiGraphicsComposition* textComposition; + bool readonly; + public: + DefaultCallback(elements::GuiColorizedTextElement* _textElement, compositions::GuiGraphicsComposition* _textComposition); + ~DefaultCallback(); - /// Get the href attribute of the active hyperlink. - /// The href attribute of the active hyperlink. - WString GetActiveHyperlinkReference(); - /// Get the edit mode of this control. - /// The edit mode. - EditMode GetEditMode(); - /// Set the edit mode of this control. - /// The edit mode. - void SetEditMode(EditMode value); + TextPos GetLeftWord(TextPos pos)override; + TextPos GetRightWord(TextPos pos)override; + void GetWord(TextPos pos, TextPos& begin, TextPos& end)override; + vint GetPageRows()override; + bool BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)override; + }; + private: + elements::GuiColorizedTextElement* textElement; + compositions::GuiGraphicsComposition* textComposition; + vuint editVersion; + GuiControl* textControl; + ICallback* callback; + bool dragging; + bool readonly; + Ptr colorizer; + Ptr autoComplete; + Ptr undoRedoProcessor; - //================ selection operations + bool filledDefaultColors = false; + ColorArray defaultColors; - /// Select all text. - void SelectAll(); - /// Get the selected text. - /// The selected text. - WString GetSelectionText(); - /// Set the selected text. - /// The selected text. - void SetSelectionText(const WString& value); - /// Get the selected model. - /// The selected model. - Ptr GetSelectionModel(); - /// Set the selected model. - /// The selected model. - void SetSelectionModel(Ptr value); + SpinLock elementModifyLock; + collections::List> textEditCallbacks; + Ptr internalShortcutKeyManager; + bool preventEnterDueToAutoComplete; + + void InvokeUndoRedoChanged(); + void InvokeModifiedChanged(); + void UpdateCaretPoint(); + void Move(TextPos pos, bool shift); + void Modify(TextPos start, TextPos end, const WString& input, bool asKeyInput); + bool ProcessKey(VKEY code, bool shift, bool ctrl); + + void OnGotFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnLostFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnCaretNotify(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + + void OnLeftButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void OnLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void OnMouseMove(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); + void OnCharInput(compositions::GuiGraphicsComposition* sender, compositions::GuiCharEventArgs& arguments); + + protected: + + void Install(elements::GuiColorizedTextElement* _textElement, compositions::GuiGraphicsComposition* _textComposition, GuiControl* _textControl, compositions::GuiGraphicsComposition* eventComposition, compositions::GuiGraphicsComposition* focusableComposition); + ICallback* GetCallback(); + void SetCallback(ICallback* value); + bool AttachTextEditCallback(Ptr value); + bool DetachTextEditCallback(Ptr value); + void AddShortcutCommand(VKEY key, const Func& eventHandler); + elements::GuiColorizedTextElement* GetTextElement(); + void UnsafeSetText(const WString& value); + + public: + GuiTextBoxCommonInterface(); + ~GuiTextBoxCommonInterface(); + + /// Selection changed event. + compositions::GuiNotifyEvent SelectionChanged; + /// Undo redo status changed event. + compositions::GuiNotifyEvent UndoRedoChanged; + /// Modified status changed event. + compositions::GuiNotifyEvent ModifiedChanged; //================ clipboard operations /// Test can the selection be cut. /// Returns true if the selection can be cut. - bool CanCut(); + bool CanCut(); /// Test can the selection be copied. /// Returns true if the selection can be cut. - bool CanCopy(); + bool CanCopy(); /// Test can the content in the clipboard be pasted. /// Returns true if the content in the clipboard can be pasted. - bool CanPaste(); + bool CanPaste(); /// Cut the selection text. /// Returns true if this operation succeeded. - bool Cut(); + bool Cut(); /// Copy the selection text. /// Returns true if this operation succeeded. - bool Copy(); + bool Copy(); /// Paste the content from the clipboard and replace the selected text. /// Returns true if this operation succeeded. - bool Paste(); + bool Paste(); + + //================ editing control + + /// Get the readonly mode. + /// Returns true if the text box is readonly. + bool GetReadonly(); + /// Set the readonly mode. + /// Set to true to make the texg box readonly. + void SetReadonly(bool value); + + //================ text operations + + /// Select all text. + void SelectAll(); + /// Select (highlight) a part of text. + /// The begin position. + /// The end position. This is also the caret position. + void Select(TextPos begin, TextPos end); + /// Get the selected text. + /// The selected text. + WString GetSelectionText(); + /// Set the selected text. + /// The selected text. + void SetSelectionText(const WString& value); + /// Set the selected text and let to text box treat this changing as input by the keyboard. + /// The selected text. + void SetSelectionTextAsKeyInput(const WString& value); + + /// Get the text from a specified row number. + /// The text from a specified row number. + /// The specified row number. + WString GetRowText(vint row); + /// Get the number of rows. + /// The number of rows. + vint GetRowCount(); + /// Get the text from a specified range. + /// The text from a specified range. + /// The specified start position. + /// The specified end position. + WString GetFragmentText(TextPos start, TextPos end); + + /// Get the begin text position of the selection. + /// The begin text position of the selection. + TextPos GetCaretBegin(); + /// Get the end text position of the selection. + /// The end text position of the selection. + TextPos GetCaretEnd(); + /// Get the left-top text position of the selection. + /// The left-top text position of the selection. + TextPos GetCaretSmall(); + /// Get the right-bottom text position of the selection. + /// The right-bottom text position of the selection. + TextPos GetCaretLarge(); + + //================ position query + + /// Get the width of a row. + /// The width of a row in pixel. + /// The specified row number + vint GetRowWidth(vint row); + /// Get the height of a row. + /// The height of a row in pixel. + vint GetRowHeight(); + /// Get the maximum width of all rows. + /// The maximum width of all rows. + vint GetMaxWidth(); + /// Get the total height of all rows. + /// The total height of all rows. + vint GetMaxHeight(); + /// Get the nearest position of a character from a specified display position. + /// Get the nearest position of a character. + /// The specified display position. + TextPos GetTextPosFromPoint(Point point); + /// Get the display position of a character from a specified text position. + /// Get the display position of a character. + /// The specified text position. + Point GetPointFromTextPos(TextPos pos); + /// Get the display bounds of a character from a specified text position. + /// Get the display bounds of a character. + /// The specified text position. + Rect GetRectFromTextPos(TextPos pos); + /// Get the nearest text position from a specified display position. + /// Get the nearest text position. + /// The specified display position. + TextPos GetNearestTextPos(Point point); + + //================ colorizing + + /// Get the current colorizer. + /// The current colorizer. + Ptr GetColorizer(); + /// Set the current colorizer. + /// The current colorizer. + void SetColorizer(Ptr value); + + //================ auto complete + + /// Get the current auto complete controller. + /// The current auto complete controller. + Ptr GetAutoComplete(); + /// Set the current auto complete controller. + /// The current auto complete controller. + void SetAutoComplete(Ptr value); //================ undo redo control + /// Get the current edit version. When the control is modified, the edit version increased. Calling will not reset the edit version. + /// The current edit version. + vuint GetEditVersion(); /// Test can undo. /// Returns true if this action can be performed. - bool CanUndo(); + bool CanUndo(); /// Test can redo. /// Returns true if this action can be performed. - bool CanRedo(); + bool CanRedo(); /// Clear all undo and redo information. - void ClearUndoRedo(); + void ClearUndoRedo(); /// Test is the text box modified. /// Returns true if the text box is modified. - bool GetModified(); + bool GetModified(); /// Notify the text box that the current status is considered saved. - void NotifyModificationSaved(); + void NotifyModificationSaved(); /// Perform the undo action. /// Returns true if this operation succeeded. - bool Undo(); + bool Undo(); /// Perform the redo action. /// Returns true if this operation succeeded. - bool Redo(); + bool Redo(); }; + } + } +} + +#endif + +/*********************************************************************** +.\CONTROLS\TEXTEDITORPACKAGE\GUITEXTCONTROLS.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System + +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_CONTROLS_GUITEXTCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUITEXTCONTROLS + + +namespace vl +{ + namespace presentation + { + namespace controls + { /*********************************************************************** -GuiDocumentViewer +MultilineTextBox ***********************************************************************/ - - /// Scrollable document viewer for displaying . - class GuiDocumentViewer : public GuiScrollContainer, public GuiDocumentCommonInterface, public Description + + /// Multiline text box control. + class GuiMultilineTextBox : public GuiScrollView, public GuiTextBoxCommonInterface, public Description { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DocumentViewerTemplate, GuiScrollContainer) + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(MultilineTextBoxTemplate, GuiScrollView) + public: + static const vint TextMargin=3; + + class CommandExecutor : public Object, public ITextBoxCommandExecutor + { + protected: + GuiMultilineTextBox* textBox; + + public: + CommandExecutor(GuiMultilineTextBox* _textBox); + ~CommandExecutor(); + + void UnsafeSetText(const WString& value)override; + }; + + protected: + class TextElementOperatorCallback : public GuiTextBoxCommonInterface::DefaultCallback, public Description + { + protected: + GuiMultilineTextBox* textControl; + public: + TextElementOperatorCallback(GuiMultilineTextBox* _textControl); + + void AfterModify(TextPos originalStart, TextPos originalEnd, const WString& originalText, TextPos inputStart, TextPos inputEnd, const WString& inputText)override; + void ScrollToView(Point point)override; + vint GetTextMargin()override; + }; + protected: + Ptr callback; + Ptr commandExecutor; + elements::GuiColorizedTextElement* textElement = nullptr; + compositions::GuiBoundsComposition* textComposition = nullptr; + void UpdateVisuallyEnabled()override; void UpdateDisplayFont()override; - Point GetDocumentViewPosition()override; - void EnsureRectVisible(Rect bounds)override; + void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget)override; + Size QueryFullSize()override; + void UpdateView(Rect viewBounds)override; + void CalculateViewAndSetScroll(); + void OnBoundsMouseButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); public: /// Create a control with a specified style provider. /// The theme name for retriving a default control template. - GuiDocumentViewer(theme::ThemeName themeName); - ~GuiDocumentViewer(); + GuiMultilineTextBox(theme::ThemeName themeName); + ~GuiMultilineTextBox(); const WString& GetText()override; void SetText(const WString& value)override; }; /*********************************************************************** -GuiDocumentViewer +SinglelineTextBox ***********************************************************************/ - /// Static document viewer for displaying . - class GuiDocumentLabel : public GuiControl, public GuiDocumentCommonInterface, public Description + /// Single text box control. + class GuiSinglelineTextBox : public GuiControl, public GuiTextBoxCommonInterface, public Description { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DocumentLabelTemplate, GuiControl) + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(SinglelineTextBoxTemplate, GuiControl) + public: + static const vint TextMargin=2; + protected: + class TextElementOperatorCallback : public GuiTextBoxCommonInterface::DefaultCallback, public Description + { + public: + TextElementOperatorCallback(GuiSinglelineTextBox* _textControl); + + bool BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)override; + void AfterModify(TextPos originalStart, TextPos originalEnd, const WString& originalText, TextPos inputStart, TextPos inputEnd, const WString& inputText)override; + void ScrollToView(Point point)override; + vint GetTextMargin()override; + }; + protected: + Ptr callback; + elements::GuiColorizedTextElement* textElement = nullptr; + compositions::GuiTableComposition* textCompositionTable = nullptr; + compositions::GuiCellComposition* textComposition = nullptr; + + void UpdateVisuallyEnabled()override; void UpdateDisplayFont()override; + void RearrangeTextElement(); + void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget)override; + void OnBoundsMouseButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); public: - /// Create a control with a specified default theme. + /// Create a control with a specified style provider. /// The theme name for retriving a default control template. - GuiDocumentLabel(theme::ThemeName themeName); - ~GuiDocumentLabel(); - + GuiSinglelineTextBox(theme::ThemeName themeName); + ~GuiSinglelineTextBox(); + const WString& GetText()override; void SetText(const WString& value)override; + + /// + /// Get the password mode displaying character. + /// + /// The password mode displaying character. Returns L'\0' means the password mode is not activated. + wchar_t GetPasswordChar(); + /// + /// Set the password mode displaying character. + /// + /// The password mode displaying character. Set to L'\0' to deactivate the password mode. + void SetPasswordChar(wchar_t value); }; } } @@ -17070,9 +17095,8 @@ GuiDocumentViewer #endif - /*********************************************************************** -.\CONTROLS\TEXTEDITORPACKAGE\GUITEXTCOMMONINTERFACE.H +.\CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGEOPERATIONS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -17082,267 +17106,306 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUITEXTCOMMONINTERFACE -#define VCZH_PRESENTATION_CONTROLS_GUITEXTCOMMONINTERFACE +#ifndef VCZH_PRESENTATION_CONTROLS_GUILANGUAGEOPERATIONS +#define VCZH_PRESENTATION_CONTROLS_GUILANGUAGEOPERATIONS namespace vl { namespace presentation { - namespace compositions - { - class GuiShortcutKeyManager; - } - namespace controls { /*********************************************************************** -Common Interface +ParsingInput ***********************************************************************/ - /// Common interface for text box controls. - class GuiTextBoxCommonInterface abstract : public Description + class RepeatingParsingExecutor; + + /// A data structure storing the parsing input for text box control. + struct RepeatingParsingInput { - typedef collections::Array ColorArray; - protected: - class ICallback : public virtual IDescriptable, public Description - { - public: - virtual TextPos GetLeftWord(TextPos pos)=0; - virtual TextPos GetRightWord(TextPos pos)=0; - virtual void GetWord(TextPos pos, TextPos& begin, TextPos& end)=0; - virtual vint GetPageRows()=0; - virtual bool BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)=0; - virtual void AfterModify(TextPos originalStart, TextPos originalEnd, const WString& originalText, TextPos inputStart, TextPos inputEnd, const WString& inputText)=0; - virtual void ScrollToView(Point point)=0; - virtual vint GetTextMargin()=0; - }; + /// The text box edit version of the code. + vuint editVersion = 0; + /// The code. + WString code; + }; - class DefaultCallback : public Object, public ICallback, public Description - { - protected: - elements::GuiColorizedTextElement* textElement; - compositions::GuiGraphicsComposition* textComposition; - bool readonly; - public: - DefaultCallback(elements::GuiColorizedTextElement* _textElement, compositions::GuiGraphicsComposition* _textComposition); - ~DefaultCallback(); +/*********************************************************************** +ParsingOutput +***********************************************************************/ - TextPos GetLeftWord(TextPos pos)override; - TextPos GetRightWord(TextPos pos)override; - void GetWord(TextPos pos, TextPos& begin, TextPos& end)override; - vint GetPageRows()override; - bool BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)override; - }; - private: - elements::GuiColorizedTextElement* textElement; - compositions::GuiGraphicsComposition* textComposition; - vuint editVersion; - GuiControl* textControl; - ICallback* callback; - bool dragging; - bool readonly; - Ptr colorizer; - Ptr autoComplete; - Ptr undoRedoProcessor; + /// A data structure storing the parsing result for text box control. + struct RepeatingParsingOutput + { + /// The parsed syntax tree. + Ptr node; + /// The text box edit version of the code. + vuint editVersion = 0; + /// The code. + WString code; + /// The cache created from [T:vl.presentation.controls.RepeatingParsingExecutor.IParsingAnalyzer]. + Ptr cache; + }; - bool filledDefaultColors = false; - ColorArray defaultColors; +/*********************************************************************** +PartialParsingOutput +***********************************************************************/ + + /// A data structure storing the parsing result for partial updating when a text box control is modified. + struct RepeatingPartialParsingOutput + { + /// The input data. + RepeatingParsingOutput input; + /// The rule name that can parse the code of the selected context. + WString rule; + /// Range of the original context in the input. + parsing::ParsingTextRange originalRange; + /// The original context in the syntax tree. + Ptr originalNode; + /// The modified context in the syntax tree. + Ptr modifiedNode; + /// The modified code of the selected context. + WString modifiedCode; + }; - SpinLock elementModifyLock; - collections::List> textEditCallbacks; - Ptr internalShortcutKeyManager; - bool preventEnterDueToAutoComplete; +/*********************************************************************** +PartialParsingOutput +***********************************************************************/ - void InvokeUndoRedoChanged(); - void InvokeModifiedChanged(); - void UpdateCaretPoint(); - void Move(TextPos pos, bool shift); - void Modify(TextPos start, TextPos end, const WString& input, bool asKeyInput); - bool ProcessKey(VKEY code, bool shift, bool ctrl); - - void OnGotFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnLostFocus(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnCaretNotify(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + /// A data structure storing the information for a candidate item. + struct ParsingCandidateItem + { + /// Semantic id. + vint semanticId = -1; + /// Display name. + WString name; + /// Tag object for any purpose, e.g., data binding. + description::Value tag; + }; - void OnLeftButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void OnLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void OnMouseMove(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); - void OnCharInput(compositions::GuiGraphicsComposition* sender, compositions::GuiCharEventArgs& arguments); +/*********************************************************************** +ParsingContext +***********************************************************************/ + + /// A data structure storing the context of a token. + struct ParsingTokenContext + { + /// Token syntax tree for the selected token. + parsing::ParsingTreeToken* foundToken = nullptr; + /// The object syntax tree parent of the token. + parsing::ParsingTreeObject* tokenParent = nullptr; + /// Type of the parent. + WString type; + /// Field of the parent that contains the token. + WString field; + /// All acceptable semantic ids. + Ptr> acceptableSemanticIds; - protected: + static bool RetriveContext(ParsingTokenContext& output, parsing::ParsingTreeNode* foundNode, RepeatingParsingExecutor* executor); + static bool RetriveContext(ParsingTokenContext& output, parsing::ParsingTextPos pos, parsing::ParsingTreeObject* rootNode, RepeatingParsingExecutor* executor); + static bool RetriveContext(ParsingTokenContext& output, parsing::ParsingTextRange range, parsing::ParsingTreeObject* rootNode, RepeatingParsingExecutor* executor); + }; - void Install(elements::GuiColorizedTextElement* _textElement, compositions::GuiGraphicsComposition* _textComposition, GuiControl* _textControl, compositions::GuiGraphicsComposition* eventComposition, compositions::GuiGraphicsComposition* focusableComposition); - ICallback* GetCallback(); - void SetCallback(ICallback* value); - bool AttachTextEditCallback(Ptr value); - bool DetachTextEditCallback(Ptr value); - void AddShortcutCommand(VKEY key, const Func& eventHandler); - elements::GuiColorizedTextElement* GetTextElement(); - void UnsafeSetText(const WString& value); +/*********************************************************************** +RepeatingParsingExecutor +***********************************************************************/ + /// Repeating parsing executor. + class RepeatingParsingExecutor : public RepeatingTaskExecutor, public Description + { public: - GuiTextBoxCommonInterface(); - ~GuiTextBoxCommonInterface(); + /// Callback. + class ICallback : public virtual Interface + { + public: + /// Callback when a parsing task is finished. + /// the result of the parsing. + virtual void OnParsingFinishedAsync(const RepeatingParsingOutput& output)=0; + /// Callback when requires enabling or disabling automatically repeating calling to the SubmitTask function. + /// Set to true to require an automatically repeating calling to the SubmitTask function + virtual void RequireAutoSubmitTask(bool enabled)=0; + }; - /// Selection changed event. - compositions::GuiNotifyEvent SelectionChanged; - /// Undo redo status changed event. - compositions::GuiNotifyEvent UndoRedoChanged; - /// Modified status changed event. - compositions::GuiNotifyEvent ModifiedChanged; + /// Parsing analyzer. + class IParsingAnalyzer : public virtual Interface + { + private: + parsing::ParsingTreeNode* ToParent(parsing::ParsingTreeNode* node, const RepeatingPartialParsingOutput* output); + parsing::ParsingTreeObject* ToChild(parsing::ParsingTreeObject* node, const RepeatingPartialParsingOutput* output); + Ptr ToChild(Ptr node, const RepeatingPartialParsingOutput* output); - //================ clipboard operations + protected: + /// Get a syntax tree node's parent when the whole tree is in a partial modified state. You should use this function instead of ParsingTreeNode::GetParent when implementing this interface. + /// Returns the parent node. + /// The node. + /// The partial parsing output, which describes how the whole tree is partial modified. + parsing::ParsingTreeNode* GetParent(parsing::ParsingTreeNode* node, const RepeatingPartialParsingOutput* output); + /// Get a syntax tree node's member when the whole tree is in a partial modified state. You should use this function instead of ParsingTreeObject::GetMember when implementing this interface. + /// Returns the member node. + /// The node. + /// The name of the member. + /// The partial parsing output, which describes how the whole tree is partial modified. + Ptr GetMember(parsing::ParsingTreeObject* node, const WString& name, const RepeatingPartialParsingOutput* output); + /// Get a syntax tree node's item when the whole tree is in a partial modified state. You should use this function instead of ParsingTreeArray::GetItem when implementing this interface. + /// Returns the item node. + /// The node. + /// The index of the item. + /// The partial parsing output, which describes how the whole tree is partial modified. + Ptr GetItem(parsing::ParsingTreeArray* node, vint index, const RepeatingPartialParsingOutput* output); - /// Test can the selection be cut. - /// Returns true if the selection can be cut. - bool CanCut(); - /// Test can the selection be copied. - /// Returns true if the selection can be cut. - bool CanCopy(); - /// Test can the content in the clipboard be pasted. - /// Returns true if the content in the clipboard can be pasted. - bool CanPaste(); - /// Cut the selection text. - /// Returns true if this operation succeeded. - bool Cut(); - /// Copy the selection text. - /// Returns true if this operation succeeded. - bool Copy(); - /// Paste the content from the clipboard and replace the selected text. - /// Returns true if this operation succeeded. - bool Paste(); + public: + /// Called when a is created. + /// The releated . + virtual void Attach(RepeatingParsingExecutor* executor) = 0; - //================ editing control + /// Called when a is destroyed. + /// The releated . + virtual void Detach(RepeatingParsingExecutor* executor) = 0; - /// Get the readonly mode. - /// Returns true if the text box is readonly. - bool GetReadonly(); - /// Set the readonly mode. - /// Set to true to make the texg box readonly. - void SetReadonly(bool value); + /// Called when a new parsing result is produced. A parsing analyzer can create a cache to be attached to the output containing anything necessary. This function does not run in UI thread. + /// The new parsing result. + /// The created cache object, which can be null. + virtual Ptr CreateCacheAsync(const RepeatingParsingOutput& output) = 0; - //================ text operations + /// Called when an semantic id for a token is needed. If an semantic id is returned, a context sensitive color can be assigned to this token. This functio does not run in UI thread, but it will only be called (for several times) after the cache object is initialized. + /// The token context. + /// The current parsing result. + /// The semantic id. + virtual vint GetSemanticIdForTokenAsync(const ParsingTokenContext& tokenContext, const RepeatingParsingOutput& output) = 0; - /// Select all text. - void SelectAll(); - /// Select (highlight) a part of text. - /// The begin position. - /// The end position. This is also the caret position. - void Select(TextPos begin, TextPos end); - /// Get the selected text. - /// The selected text. - WString GetSelectionText(); - /// Set the selected text. - /// The selected text. - void SetSelectionText(const WString& value); - /// Set the selected text and let to text box treat this changing as input by the keyboard. - /// The selected text. - void SetSelectionTextAsKeyInput(const WString& value); - - /// Get the text from a specified row number. - /// The text from a specified row number. - /// The specified row number. - WString GetRowText(vint row); - /// Get the number of rows. - /// The number of rows. - vint GetRowCount(); - /// Get the text from a specified range. - /// The text from a specified range. - /// The specified start position. - /// The specified end position. - WString GetFragmentText(TextPos start, TextPos end); + /// Called when multiple auto complete candidate items for a token is needed. If nothing is written into the "candidateItems" parameter and the grammar also doesn't provide static candidate items, nothing will popup. This functio does not run in UI thread, but it will only be called (for several times) after the cache object is initialized. + /// The token context. + /// The partial parsing result. It contains the current parsing result, and an incremental parsing result. If the calculation of candidate items are is very context sensitive, then you should be very careful when traversing the syntax tree, by carefully looking at the "originalNode" and the "modifiedNode" in the "partialOutput" parameter. + /// The candidate items. + virtual void GetCandidateItemsAsync(const ParsingTokenContext& tokenContext, const RepeatingPartialParsingOutput& partialOutput, collections::List& candidateItems) = 0; - /// Get the begin text position of the selection. - /// The begin text position of the selection. - TextPos GetCaretBegin(); - /// Get the end text position of the selection. - /// The end text position of the selection. - TextPos GetCaretEnd(); - /// Get the left-top text position of the selection. - /// The left-top text position of the selection. - TextPos GetCaretSmall(); - /// Get the right-bottom text position of the selection. - /// The right-bottom text position of the selection. - TextPos GetCaretLarge(); + /// Create a tag object for a candidate item without a tag object. An candidate item without a tag maybe created by calling or any token marked by a @Candidate attribute in the grammar. + /// The candidate item. + /// The tag object. In most of the case this object is used for data binding or any other purpose when you want to customize the auto complete control. Returns null if the specified [T.vl.presentation.controls.GuiTextBoxAutoCompleteBase.IAutoCompleteControlProvider] can handle null tag correctly. + virtual description::Value CreateTagForCandidateItem(ParsingCandidateItem& item) = 0; + }; - //================ position query + /// A base class for implementing a callback. + class CallbackBase : public virtual ICallback, public virtual ICommonTextEditCallback + { + private: + bool callbackAutoPushing; + elements::GuiColorizedTextElement* callbackElement; + SpinLock* callbackElementModifyLock; - /// Get the width of a row. - /// The width of a row in pixel. - /// The specified row number - vint GetRowWidth(vint row); - /// Get the height of a row. - /// The height of a row in pixel. - vint GetRowHeight(); - /// Get the maximum width of all rows. - /// The maximum width of all rows. - vint GetMaxWidth(); - /// Get the total height of all rows. - /// The total height of all rows. - vint GetMaxHeight(); - /// Get the nearest position of a character from a specified display position. - /// Get the nearest position of a character. - /// The specified display position. - TextPos GetTextPosFromPoint(Point point); - /// Get the display position of a character from a specified text position. - /// Get the display position of a character. - /// The specified text position. - Point GetPointFromTextPos(TextPos pos); - /// Get the display bounds of a character from a specified text position. - /// Get the display bounds of a character. - /// The specified text position. - Rect GetRectFromTextPos(TextPos pos); - /// Get the nearest text position from a specified display position. - /// Get the nearest text position. - /// The specified display position. - TextPos GetNearestTextPos(Point point); + protected: + Ptr parsingExecutor; - //================ colorizing + public: + CallbackBase(Ptr _parsingExecutor); + ~CallbackBase(); - /// Get the current colorizer. - /// The current colorizer. - Ptr GetColorizer(); - /// Set the current colorizer. - /// The current colorizer. - void SetColorizer(Ptr value); + void RequireAutoSubmitTask(bool enabled)override; + void Attach(elements::GuiColorizedTextElement* _element, SpinLock& _elementModifyLock, compositions::GuiGraphicsComposition* _ownerComposition, vuint editVersion)override; + void Detach()override; + void TextEditPreview(TextEditPreviewStruct& arguments)override; + void TextEditNotify(const TextEditNotifyStruct& arguments)override; + void TextCaretChanged(const TextCaretChangedStruct& arguments)override; + void TextEditFinished(vuint editVersion)override; + }; - //================ auto complete + struct TokenMetaData + { + vint tableTokenIndex; + vint lexerTokenIndex; + vint defaultColorIndex; + bool hasContextColor; + bool hasAutoComplete; + bool isCandidate; + WString unescapedRegexText; + }; - /// Get the current auto complete controller. - /// The current auto complete controller. - Ptr GetAutoComplete(); - /// Set the current auto complete controller. - /// The current auto complete controller. - void SetAutoComplete(Ptr value); + struct FieldMetaData + { + vint colorIndex; + Ptr> semantics; + }; + private: + Ptr grammarParser; + WString grammarRule; + Ptr analyzer; + collections::List callbacks; + collections::List activatedCallbacks; + ICallback* autoPushingCallback; - //================ undo redo control + typedef collections::Pair FieldDesc; + collections::Dictionary tokenIndexMap; + collections::SortedList semanticIndexMap; + collections::Dictionary tokenMetaDatas; + collections::Dictionary fieldMetaDatas; + + protected: + + void Execute(const RepeatingParsingInput& input)override; + void PrepareMetaData(); - /// Get the current edit version. When the control is modified, the edit version increased. Calling will not reset the edit version. - /// The current edit version. - vuint GetEditVersion(); - /// Test can undo. - /// Returns true if this action can be performed. - bool CanUndo(); - /// Test can redo. - /// Returns true if this action can be performed. - bool CanRedo(); - /// Clear all undo and redo information. - void ClearUndoRedo(); - /// Test is the text box modified. - /// Returns true if the text box is modified. - bool GetModified(); - /// Notify the text box that the current status is considered saved. - void NotifyModificationSaved(); - /// Perform the undo action. + /// Called when semantic analyzing is needed. It is encouraged to set the "cache" fields in "context" argument. If there is an binded to the , this function can be automatically done. + /// The parsing result. + virtual void OnContextFinishedAsync(RepeatingParsingOutput& context); + public: + /// Initialize the parsing executor. + /// Parser generated from a grammar. + /// The rule name to parse a complete code. + /// The parsing analyzer to create semantic metadatas, it can be null. + RepeatingParsingExecutor(Ptr _grammarParser, const WString& _grammarRule, Ptr _analyzer = 0); + ~RepeatingParsingExecutor(); + + /// Get the internal parser that parse the text. + /// The internal parser. + Ptr GetParser(); + /// Detach callback. /// Returns true if this operation succeeded. - bool Undo(); - /// Perform the redo action. + /// The callback. + bool AttachCallback(ICallback* value); + /// Detach callback. /// Returns true if this operation succeeded. - bool Redo(); + /// The callback. + bool DetachCallback(ICallback* value); + /// Activate a callback. Activating a callback means that the callback owner has an ability to watch a text box modification, e.g., an attached that is also an . The may require one of the activated callback to push code for parsing automatically via a call to . + /// Returns true if this operation succeeded. + /// The callback. + bool ActivateCallback(ICallback* value); + /// Deactivate a callback. See for deatils. + /// Returns true if this operation succeeded. + /// The callback. + bool DeactivateCallback(ICallback* value); + /// Get the parsing analyzer. + /// The parsing analyzer. + Ptr GetAnalyzer(); + + vint GetTokenIndex(const WString& tokenName); + vint GetSemanticId(const WString& name); + WString GetSemanticName(vint id); + const TokenMetaData& GetTokenMetaData(vint regexTokenIndex); + const FieldMetaData& GetFieldMetaData(const WString& type, const WString& field); + + Ptr GetAttribute(vint index, const WString& name, vint argumentCount); + Ptr GetColorAttribute(vint index); + Ptr GetContextColorAttribute(vint index); + Ptr GetSemanticAttribute(vint index); + Ptr GetCandidateAttribute(vint index); + Ptr GetAutoCompleteAttribute(vint index); + + /* + @Color(ColorName) + field: color of the token field when the token type is marked with @ContextColor + token: color of the token + @ContextColor() + token: the color of the token may be changed if the token field is marked with @Color or @Semantic + @Semantic(Type1, Type2, ...) + field: After resolved symbols for this field, only types of symbols that specified in the arguments are acceptable. + @Candidate() + token: when the token can be available after the editing caret, than it will be in the auto complete list. + @AutoComplete() + token: when the token is editing, an auto complete list will appear if possible + */ }; } } @@ -17351,7 +17414,7 @@ Common Interface #endif /*********************************************************************** -.\CONTROLS\TEXTEDITORPACKAGE\GUITEXTCONTROLS.H +.\CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGEAUTOCOMPLETE.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -17361,9 +17424,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUITEXTCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUITEXTCONTROLS - +#ifndef VCZH_PRESENTATION_CONTROLS_GUILANGUAGEAUTOCOMPLETE +#define VCZH_PRESENTATION_CONTROLS_GUILANGUAGEAUTOCOMPLETE namespace vl { @@ -17373,117 +17435,109 @@ namespace vl { /*********************************************************************** -MultilineTextBox +GuiGrammarAutoComplete ***********************************************************************/ - - /// Multiline text box control. - class GuiMultilineTextBox : public GuiScrollView, public GuiTextBoxCommonInterface, public Description + + /// Grammar based auto complete controller. + class GuiGrammarAutoComplete + : public GuiTextBoxAutoCompleteBase + , protected RepeatingParsingExecutor::CallbackBase + , private RepeatingTaskExecutor { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(MultilineTextBoxTemplate, GuiScrollView) public: - static const vint TextMargin=3; - class CommandExecutor : public Object, public ITextBoxCommandExecutor + /// The auto complete list data. + struct AutoCompleteData : ParsingTokenContext { - protected: - GuiMultilineTextBox* textBox; - - public: - CommandExecutor(GuiMultilineTextBox* _textBox); - ~CommandExecutor(); - - void UnsafeSetText(const WString& value)override; + /// Available candidate tokens (in lexer token index). + collections::List candidates; + /// Available candidate tokens (in lexer token index) that marked with @AutoCompleteCandidate(). + collections::List shownCandidates; + /// Candidate items. + collections::List candidateItems; + /// The start position of the editing token in global coordination. + TextPos startPosition; }; - protected: - class TextElementOperatorCallback : public GuiTextBoxCommonInterface::DefaultCallback, public Description + /// The analysed data from an input code. + struct AutoCompleteContext : RepeatingPartialParsingOutput { - protected: - GuiMultilineTextBox* textControl; - public: - TextElementOperatorCallback(GuiMultilineTextBox* _textControl); - - void AfterModify(TextPos originalStart, TextPos originalEnd, const WString& originalText, TextPos inputStart, TextPos inputEnd, const WString& inputText)override; - void ScrollToView(Point point)override; - vint GetTextMargin()override; + /// The edit version of modified code. + vuint modifiedEditVersion = 0; + /// The analysed auto complete list data. + Ptr autoComplete; }; + private: + Ptr grammarParser; + collections::SortedList leftRecursiveRules; + bool editing; - protected: - Ptr callback; - Ptr commandExecutor; - elements::GuiColorizedTextElement* textElement = nullptr; - compositions::GuiBoundsComposition* textComposition = nullptr; + SpinLock editTraceLock; + collections::List editTrace; - void UpdateVisuallyEnabled()override; - void UpdateDisplayFont()override; - void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget)override; - Size QueryFullSize()override; - void UpdateView(Rect viewBounds)override; - void CalculateViewAndSetScroll(); - void OnBoundsMouseButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - public: - /// Create a control with a specified style provider. - /// The theme name for retriving a default control template. - GuiMultilineTextBox(theme::ThemeName themeName); - ~GuiMultilineTextBox(); + SpinLock contextLock; + AutoCompleteContext context; + + void Attach(elements::GuiColorizedTextElement* _element, SpinLock& _elementModifyLock, compositions::GuiGraphicsComposition* _ownerComposition, vuint editVersion)override; + void Detach()override; + void TextEditPreview(TextEditPreviewStruct& arguments)override; + void TextEditNotify(const TextEditNotifyStruct& arguments)override; + void TextCaretChanged(const TextCaretChangedStruct& arguments)override; + void TextEditFinished(vuint editVersion)override; + void OnParsingFinishedAsync(const RepeatingParsingOutput& output)override; + void CollectLeftRecursiveRules(); - const WString& GetText()override; - void SetText(const WString& value)override; - }; + vint UnsafeGetEditTraceIndex(vuint editVersion); + TextPos ChooseCorrectTextPos(TextPos pos, const regex::RegexTokens& tokens); + void ExecuteRefresh(AutoCompleteContext& newContext); -/*********************************************************************** -SinglelineTextBox -***********************************************************************/ - - /// Single text box control. - class GuiSinglelineTextBox : public GuiControl, public GuiTextBoxCommonInterface, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(SinglelineTextBoxTemplate, GuiControl) - public: - static const vint TextMargin=2; - - protected: - class TextElementOperatorCallback : public GuiTextBoxCommonInterface::DefaultCallback, public Description - { - public: - TextElementOperatorCallback(GuiSinglelineTextBox* _textControl); + bool NormalizeTextPos(AutoCompleteContext& newContext, elements::text::TextLines& lines, TextPos& pos); + void ExecuteEdit(AutoCompleteContext& newContext); - bool BeforeModify(TextPos start, TextPos end, const WString& originalText, WString& inputText)override; - void AfterModify(TextPos originalStart, TextPos originalEnd, const WString& originalText, TextPos inputStart, TextPos inputEnd, const WString& inputText)override; - void ScrollToView(Point point)override; - vint GetTextMargin()override; - }; + void DeleteFutures(collections::List& futures); + regex::RegexToken* TraverseTransitions( + parsing::tabling::ParsingState& state, + parsing::tabling::ParsingTransitionCollector& transitionCollector, + TextPos stopPosition, + collections::List& nonRecoveryFutures, + collections::List& recoveryFutures + ); + regex::RegexToken* SearchValidInputToken( + parsing::tabling::ParsingState& state, + parsing::tabling::ParsingTransitionCollector& transitionCollector, + TextPos stopPosition, + AutoCompleteContext& newContext, + collections::SortedList& tableTokenIndices + ); + + TextPos GlobalTextPosToModifiedTextPos(AutoCompleteContext& newContext, TextPos pos); + TextPos ModifiedTextPosToGlobalTextPos(AutoCompleteContext& newContext, TextPos pos); + void ExecuteCalculateList(AutoCompleteContext& newContext); + void Execute(const RepeatingParsingOutput& input)override; + void PostList(const AutoCompleteContext& newContext, bool byGlobalCorrection); + void Initialize(); protected: - Ptr callback; - elements::GuiColorizedTextElement* textElement = nullptr; - compositions::GuiTableComposition* textCompositionTable = nullptr; - compositions::GuiCellComposition* textComposition = nullptr; - - void UpdateVisuallyEnabled()override; - void UpdateDisplayFont()override; - void RearrangeTextElement(); - void OnRenderTargetChanged(elements::IGuiGraphicsRenderTarget* renderTarget)override; - void OnBoundsMouseButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - public: - /// Create a control with a specified style provider. - /// The theme name for retriving a default control template. - GuiSinglelineTextBox(theme::ThemeName themeName); - ~GuiSinglelineTextBox(); - const WString& GetText()override; - void SetText(const WString& value)override; + /// Called when the context of the code is selected. It is encouraged to set the "candidateItems" field in "context.autoComplete" during the call. If there is an binded to the , this function can be automatically done. + /// The selected context. + virtual void OnContextFinishedAsync(AutoCompleteContext& context); - /// - /// Get the password mode displaying character. - /// - /// The password mode displaying character. Returns L'\0' means the password mode is not activated. - wchar_t GetPasswordChar(); - /// - /// Set the password mode displaying character. - /// - /// The password mode displaying character. Set to L'\0' to deactivate the password mode. - void SetPasswordChar(wchar_t value); + /// Call this function in the derived class's destructor when it overrided . + void EnsureAutoCompleteFinished(); + public: + /// Create the auto complete controller with a created parsing executor. + /// The parsing executor. + GuiGrammarAutoComplete(Ptr _parsingExecutor); + /// Create the auto complete controller with a specified grammar and start rule to create a . + /// Parser generated from a grammar. + /// + GuiGrammarAutoComplete(Ptr _grammarParser, const WString& _grammarRule); + ~GuiGrammarAutoComplete(); + + /// Get the internal parsing executor. + /// The parsing executor. + Ptr GetParsingExecutor(); }; } } @@ -17492,7 +17546,7 @@ SinglelineTextBox #endif /*********************************************************************** -.\CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGEOPERATIONS.H +.\CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGECOLORIZER.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -17502,8 +17556,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUILANGUAGEOPERATIONS -#define VCZH_PRESENTATION_CONTROLS_GUILANGUAGEOPERATIONS +#ifndef VCZH_PRESENTATION_CONTROLS_GUILANGUAGECOLORIZER +#define VCZH_PRESENTATION_CONTROLS_GUILANGUAGECOLORIZER namespace vl @@ -17514,294 +17568,370 @@ namespace vl { /*********************************************************************** -ParsingInput +GuiGrammarColorizer ***********************************************************************/ - class RepeatingParsingExecutor; - - /// A data structure storing the parsing input for text box control. - struct RepeatingParsingInput + /// Grammar based colorizer. + class GuiGrammarColorizer : public GuiTextBoxRegexColorizer, protected RepeatingParsingExecutor::CallbackBase { - /// The text box edit version of the code. - vuint editVersion = 0; - /// The code. - WString code; - }; + typedef collections::Pair FieldDesc; + typedef collections::Dictionary FieldContextColors; + typedef collections::Dictionary FieldSemanticColors; + typedef elements::text::ColorEntry ColorEntry; + public: + /// Context for doing semantic colorizing. + struct SemanticColorizeContext : ParsingTokenContext + { + /// Output semantic id that comes from one the argument in the @Semantic attribute. + vint semanticId; + }; + private: + collections::Dictionary colorSettings; + collections::Dictionary semanticColorMap; -/*********************************************************************** -ParsingOutput -***********************************************************************/ + SpinLock contextLock; + RepeatingParsingOutput context; - /// A data structure storing the parsing result for text box control. - struct RepeatingParsingOutput - { - /// The parsed syntax tree. - Ptr node; - /// The text box edit version of the code. - vuint editVersion = 0; - /// The code. - WString code; - /// The cache created from [T:vl.presentation.controls.RepeatingParsingExecutor.IParsingAnalyzer]. - Ptr cache; - }; + void OnParsingFinishedAsync(const RepeatingParsingOutput& output)override; + protected: + /// Called when the node is parsed successfully before restarting colorizing. + /// The result of the parsing. + virtual void OnContextFinishedAsync(const RepeatingParsingOutput& context); -/*********************************************************************** -PartialParsingOutput -***********************************************************************/ - - /// A data structure storing the parsing result for partial updating when a text box control is modified. - struct RepeatingPartialParsingOutput - { - /// The input data. - RepeatingParsingOutput input; - /// The rule name that can parse the code of the selected context. - WString rule; - /// Range of the original context in the input. - parsing::ParsingTextRange originalRange; - /// The original context in the syntax tree. - Ptr originalNode; - /// The modified context in the syntax tree. - Ptr modifiedNode; - /// The modified code of the selected context. - WString modifiedCode; - }; + void Attach(elements::GuiColorizedTextElement* _element, SpinLock& _elementModifyLock, compositions::GuiGraphicsComposition* _ownerComposition, vuint editVersion)override; + void Detach()override; + void TextEditPreview(TextEditPreviewStruct& arguments)override; + void TextEditNotify(const TextEditNotifyStruct& arguments)override; + void TextCaretChanged(const TextCaretChangedStruct& arguments)override; + void TextEditFinished(vuint editVersion)override; -/*********************************************************************** -PartialParsingOutput -***********************************************************************/ + /// Called when a @SemanticColor attribute in a grammar is activated during colorizing to determine a color for the token. If there is an binded to the , this function can be automatically done. + /// Context for doing semantic colorizing. + /// The corressponding result from the . + virtual void OnSemanticColorize(SemanticColorizeContext& context, const RepeatingParsingOutput& input); - /// A data structure storing the information for a candidate item. - struct ParsingCandidateItem - { - /// Semantic id. - vint semanticId = -1; - /// Display name. - WString name; - /// Tag object for any purpose, e.g., data binding. - description::Value tag; + /// Call this function in the derived class's destructor when it overrided . + void EnsureColorizerFinished(); + public: + /// Create the colorizer with a created parsing executor. + /// The parsing executor. + GuiGrammarColorizer(Ptr _parsingExecutor); + /// Create the colorizer with a specified grammar and start rule to create a . + /// Parser generated from a grammar. + /// + GuiGrammarColorizer(Ptr _grammarParser, const WString& _grammarRule); + ~GuiGrammarColorizer(); + + /// Reset all color settings. + void BeginSetColors(); + /// Get all color names. + /// All color names. + const collections::SortedList& GetColorNames(); + /// Get the color for a token theme name (@Color or @ContextColor("theme-name") in the grammar). + /// The color. + /// The token theme name. + ColorEntry GetColor(const WString& name); + /// Set a color for a token theme name (@Color or @ContextColor("theme-name") in the grammar). + /// The token theme name. + /// The color. + void SetColor(const WString& name, const ColorEntry& entry); + /// Set a color for a token theme name (@Color or @ContextColor("theme-name") in the grammar). + /// The token theme name. + /// The color. + void SetColor(const WString& name, const Color& color); + /// Submit all color settings. + void EndSetColors(); + void ColorizeTokenContextSensitive(vint lineIndex, const wchar_t* text, vint start, vint length, vint& token, vint& contextState)override; + + /// Get the internal parsing executor. + /// The parsing executor. + Ptr GetParsingExecutor(); }; + } + } +} + +#endif /*********************************************************************** -ParsingContext +.\CONTROLS\TOOLSTRIPPACKAGE\GUIMENUCONTROLS.H ***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System - /// A data structure storing the context of a token. - struct ParsingTokenContext - { - /// Token syntax tree for the selected token. - parsing::ParsingTreeToken* foundToken = nullptr; - /// The object syntax tree parent of the token. - parsing::ParsingTreeObject* tokenParent = nullptr; - /// Type of the parent. - WString type; - /// Field of the parent that contains the token. - WString field; - /// All acceptable semantic ids. - Ptr> acceptableSemanticIds; +Interfaces: +***********************************************************************/ - static bool RetriveContext(ParsingTokenContext& output, parsing::ParsingTreeNode* foundNode, RepeatingParsingExecutor* executor); - static bool RetriveContext(ParsingTokenContext& output, parsing::ParsingTextPos pos, parsing::ParsingTreeObject* rootNode, RepeatingParsingExecutor* executor); - static bool RetriveContext(ParsingTokenContext& output, parsing::ParsingTextRange range, parsing::ParsingTreeObject* rootNode, RepeatingParsingExecutor* executor); - }; +#ifndef VCZH_PRESENTATION_CONTROLS_GUIMENUCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIMENUCONTROLS + + +namespace vl +{ + namespace presentation + { + namespace controls + { /*********************************************************************** -RepeatingParsingExecutor +Menu Service ***********************************************************************/ - /// Repeating parsing executor. - class RepeatingParsingExecutor : public RepeatingTaskExecutor, public Description + class GuiMenu; + + /// IGuiMenuService is a required service for menu item container. + class IGuiMenuService : public virtual IDescriptable, public Description { public: - /// Callback. - class ICallback : public virtual Interface + /// The identifier for this service. + static const wchar_t* const Identifier; + + /// Direction to decide the position for a menu with specified control. + enum Direction { - public: - /// Callback when a parsing task is finished. - /// the result of the parsing. - virtual void OnParsingFinishedAsync(const RepeatingParsingOutput& output)=0; - /// Callback when requires enabling or disabling automatically repeating calling to the SubmitTask function. - /// Set to true to require an automatically repeating calling to the SubmitTask function - virtual void RequireAutoSubmitTask(bool enabled)=0; + /// Aligned to the top or bottom side. + Horizontal, + /// Aligned to the left or right side. + Vertical, }; + protected: + GuiMenu* openingMenu; + public: + IGuiMenuService(); - /// Parsing analyzer. - class IParsingAnalyzer : public virtual Interface - { - private: - parsing::ParsingTreeNode* ToParent(parsing::ParsingTreeNode* node, const RepeatingPartialParsingOutput* output); - parsing::ParsingTreeObject* ToChild(parsing::ParsingTreeObject* node, const RepeatingPartialParsingOutput* output); - Ptr ToChild(Ptr node, const RepeatingPartialParsingOutput* output); + /// Get the parent service. This service represents the parent menu that host the menu item control that contains this menu. + /// The parent service. + virtual IGuiMenuService* GetParentMenuService()=0; + /// Get the preferred direction to open the sub menu. + /// The preferred direction to open the sub menu. + virtual Direction GetPreferredDirection()=0; + /// Test is this menu is active. When an menu is active, the sub menu is automatically opened when the corresponding menu item is opened. + /// Returns true if this menu is active. + virtual bool IsActiveState()=0; + /// Test all sub menu items are actived by mouse down. + /// Returns true if all sub menu items are actived by mouse down. + virtual bool IsSubMenuActivatedByMouseDown()=0; - protected: - /// Get a syntax tree node's parent when the whole tree is in a partial modified state. You should use this function instead of ParsingTreeNode::GetParent when implementing this interface. - /// Returns the parent node. - /// The node. - /// The partial parsing output, which describes how the whole tree is partial modified. - parsing::ParsingTreeNode* GetParent(parsing::ParsingTreeNode* node, const RepeatingPartialParsingOutput* output); - /// Get a syntax tree node's member when the whole tree is in a partial modified state. You should use this function instead of ParsingTreeObject::GetMember when implementing this interface. - /// Returns the member node. - /// The node. - /// The name of the member. - /// The partial parsing output, which describes how the whole tree is partial modified. - Ptr GetMember(parsing::ParsingTreeObject* node, const WString& name, const RepeatingPartialParsingOutput* output); - /// Get a syntax tree node's item when the whole tree is in a partial modified state. You should use this function instead of ParsingTreeArray::GetItem when implementing this interface. - /// Returns the item node. - /// The node. - /// The index of the item. - /// The partial parsing output, which describes how the whole tree is partial modified. - Ptr GetItem(parsing::ParsingTreeArray* node, vint index, const RepeatingPartialParsingOutput* output); + /// Called when the menu item is executed. + virtual void MenuItemExecuted(); + /// Get the opening sub menu. + /// The opening sub menu. + virtual GuiMenu* GetOpeningMenu(); + /// Called when the sub menu is opened. + /// The sub menu. + virtual void MenuOpened(GuiMenu* menu); + /// Called when the sub menu is closed. + /// The sub menu. + virtual void MenuClosed(GuiMenu* menu); + }; - public: - /// Called when a is created. - /// The releated . - virtual void Attach(RepeatingParsingExecutor* executor) = 0; + /// IGuiMenuService is a required service to tell a ribbon group that this control has a dropdown to display. + class IGuiMenuDropdownProvider : public virtual IDescriptable, public Description + { + public: + /// The identifier for this service. + static const wchar_t* const Identifier; - /// Called when a is destroyed. - /// The releated . - virtual void Detach(RepeatingParsingExecutor* executor) = 0; + /// Get the dropdown to display. + /// The dropdown to display. Returns null to indicate the dropdown cannot be displaied temporary. + virtual GuiMenu* ProvideDropdownMenu() = 0; + }; - /// Called when a new parsing result is produced. A parsing analyzer can create a cache to be attached to the output containing anything necessary. This function does not run in UI thread. - /// The new parsing result. - /// The created cache object, which can be null. - virtual Ptr CreateCacheAsync(const RepeatingParsingOutput& output) = 0; +/*********************************************************************** +Menu +***********************************************************************/ - /// Called when an semantic id for a token is needed. If an semantic id is returned, a context sensitive color can be assigned to this token. This functio does not run in UI thread, but it will only be called (for several times) after the cache object is initialized. - /// The token context. - /// The current parsing result. - /// The semantic id. - virtual vint GetSemanticIdForTokenAsync(const ParsingTokenContext& tokenContext, const RepeatingParsingOutput& output) = 0; + /// Popup menu. + class GuiMenu : public GuiPopup, protected IGuiMenuService, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(MenuTemplate, GuiPopup) + private: + IGuiMenuService* parentMenuService = nullptr; + bool hideOnDeactivateAltHost = true; + Size preferredMenuClientSizeBeforeUpdating; + Size preferredMenuClientSize; - /// Called when multiple auto complete candidate items for a token is needed. If nothing is written into the "candidateItems" parameter and the grammar also doesn't provide static candidate items, nothing will popup. This functio does not run in UI thread, but it will only be called (for several times) after the cache object is initialized. - /// The token context. - /// The partial parsing result. It contains the current parsing result, and an incremental parsing result. If the calculation of candidate items are is very context sensitive, then you should be very careful when traversing the syntax tree, by carefully looking at the "originalNode" and the "modifiedNode" in the "partialOutput" parameter. - /// The candidate items. - virtual void GetCandidateItemsAsync(const ParsingTokenContext& tokenContext, const RepeatingPartialParsingOutput& partialOutput, collections::List& candidateItems) = 0; + IGuiMenuService* GetParentMenuService()override; + Direction GetPreferredDirection()override; + bool IsActiveState()override; + bool IsSubMenuActivatedByMouseDown()override; + void MenuItemExecuted()override; - /// Create a tag object for a candidate item without a tag object. An candidate item without a tag maybe created by calling or any token marked by a @Candidate attribute in the grammar. - /// The candidate item. - /// The tag object. In most of the case this object is used for data binding or any other purpose when you want to customize the auto complete control. Returns null if the specified [T.vl.presentation.controls.GuiTextBoxAutoCompleteBase.IAutoCompleteControlProvider] can handle null tag correctly. - virtual description::Value CreateTagForCandidateItem(ParsingCandidateItem& item) = 0; - }; + void Moving(NativeRect& bounds, bool fixSizeOnly, bool draggingBorder)override; + void UpdateClientSizeAfterRendering(Size preferredSize, Size clientSize)override; + protected: + GuiControl* owner; - /// A base class for implementing a callback. - class CallbackBase : public virtual ICallback, public virtual ICommonTextEditCallback - { - private: - bool callbackAutoPushing; - elements::GuiColorizedTextElement* callbackElement; - SpinLock* callbackElementModifyLock; + void OnDeactivatedAltHost()override; + void OnWindowOpened(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnWindowClosed(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + /// The owner menu item of the parent menu. + GuiMenu(theme::ThemeName themeName, GuiControl* _owner); + ~GuiMenu(); - protected: - Ptr parsingExecutor; + /// Update the reference to the parent . This function is not required to call outside the menu or menu item control. + void UpdateMenuService(); + IDescriptable* QueryService(const WString& identifier)override; - public: - CallbackBase(Ptr _parsingExecutor); - ~CallbackBase(); + /// Test if this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. + /// Returns true if this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. + bool GetHideOnDeactivateAltHost(); + /// Set if this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. + /// Set to true to make this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. + void SetHideOnDeactivateAltHost(bool value); - void RequireAutoSubmitTask(bool enabled)override; - void Attach(elements::GuiColorizedTextElement* _element, SpinLock& _elementModifyLock, compositions::GuiGraphicsComposition* _ownerComposition, vuint editVersion)override; - void Detach()override; - void TextEditPreview(TextEditPreviewStruct& arguments)override; - void TextEditNotify(const TextEditNotifyStruct& arguments)override; - void TextCaretChanged(const TextCaretChangedStruct& arguments)override; - void TextEditFinished(vuint editVersion)override; - }; + /// Get the preferred client size for the menu. + /// The preferred client size for the menu. + Size GetPreferredMenuClientSize(); + /// Set the preferred client size for the menu. + /// The preferred client size for the menu. + void SetPreferredMenuClientSize(Size value); + }; + + /// Menu bar. + class GuiMenuBar : public GuiControl, protected IGuiMenuService, public Description + { + private: + IGuiMenuService* GetParentMenuService()override; + Direction GetPreferredDirection()override; + bool IsActiveState()override; + bool IsSubMenuActivatedByMouseDown()override; - struct TokenMetaData - { - vint tableTokenIndex; - vint lexerTokenIndex; - vint defaultColorIndex; - bool hasContextColor; - bool hasAutoComplete; - bool isCandidate; - WString unescapedRegexText; - }; + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiMenuBar(theme::ThemeName themeName); + ~GuiMenuBar(); + + IDescriptable* QueryService(const WString& identifier)override; + }; - struct FieldMetaData - { - vint colorIndex; - Ptr> semantics; - }; - private: - Ptr grammarParser; - WString grammarRule; - Ptr analyzer; - collections::List callbacks; - collections::List activatedCallbacks; - ICallback* autoPushingCallback; +/*********************************************************************** +MenuButton +***********************************************************************/ - typedef collections::Pair FieldDesc; - collections::Dictionary tokenIndexMap; - collections::SortedList semanticIndexMap; - collections::Dictionary tokenMetaDatas; - collections::Dictionary fieldMetaDatas; + /// Menu item. + class GuiMenuButton : public GuiSelectableButton, private IGuiMenuDropdownProvider, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ToolstripButtonTemplate, GuiSelectableButton) + using IEventHandler = compositions::IGuiGraphicsEventHandler; protected: + Ptr subMenuDisposeFlag; + Ptr subMenuWindowOpenedHandler; + Ptr subMenuWindowClosedHandler; + Ptr hostClickedHandler; + Ptr hostMouseEnterHandler; + Ptr image; + Ptr largeImage; + WString shortcutText; + GuiMenu* subMenu; + bool ownedSubMenu; + Size preferredMenuClientSize; + IGuiMenuService* ownerMenuService; + bool cascadeAction; - void Execute(const RepeatingParsingInput& input)override; - void PrepareMetaData(); + GuiButton* GetSubMenuHost(); + bool OpenSubMenuInternal(); + void OnParentLineChanged()override; + compositions::IGuiAltActionHost* GetActivatingAltHost()override; + + void OnSubMenuWindowOpened(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnSubMenuWindowClosed(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnMouseEnter(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + + virtual IGuiMenuService::Direction GetSubMenuDirection(); + + private: + void DetachSubMenu(); + GuiMenu* ProvideDropdownMenu()override; - /// Called when semantic analyzing is needed. It is encouraged to set the "cache" fields in "context" argument. If there is an binded to the , this function can be automatically done. - /// The parsing result. - virtual void OnContextFinishedAsync(RepeatingParsingOutput& context); public: - /// Initialize the parsing executor. - /// Parser generated from a grammar. - /// The rule name to parse a complete code. - /// The parsing analyzer to create semantic metadatas, it can be null. - RepeatingParsingExecutor(Ptr _grammarParser, const WString& _grammarRule, Ptr _analyzer = 0); - ~RepeatingParsingExecutor(); - - /// Get the internal parser that parse the text. - /// The internal parser. - Ptr GetParser(); - /// Detach callback. - /// Returns true if this operation succeeded. - /// The callback. - bool AttachCallback(ICallback* value); - /// Detach callback. - /// Returns true if this operation succeeded. - /// The callback. - bool DetachCallback(ICallback* value); - /// Activate a callback. Activating a callback means that the callback owner has an ability to watch a text box modification, e.g., an attached that is also an . The may require one of the activated callback to push code for parsing automatically via a call to . - /// Returns true if this operation succeeded. - /// The callback. - bool ActivateCallback(ICallback* value); - /// Deactivate a callback. See for deatils. - /// Returns true if this operation succeeded. - /// The callback. - bool DeactivateCallback(ICallback* value); - /// Get the parsing analyzer. - /// The parsing analyzer. - Ptr GetAnalyzer(); + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiMenuButton(theme::ThemeName themeName); + ~GuiMenuButton(); + + /// Before sub menu opening event. + compositions::GuiNotifyEvent BeforeSubMenuOpening; + /// After sub menu opening event. + compositions::GuiNotifyEvent AfterSubMenuOpening; + /// Sub menu opening changed event. + compositions::GuiNotifyEvent SubMenuOpeningChanged; + /// Large image changed event. + compositions::GuiNotifyEvent LargeImageChanged; + /// Image changed event. + compositions::GuiNotifyEvent ImageChanged; + /// Shortcut text changed event. + compositions::GuiNotifyEvent ShortcutTextChanged; + + /// Get the large image for the menu button. + /// The large image for the menu button. + Ptr GetLargeImage(); + /// Set the large image for the menu button. + /// The large image for the menu button. + void SetLargeImage(Ptr value); + /// Get the image for the menu button. + /// The image for the menu button. + Ptr GetImage(); + /// Set the image for the menu button. + /// The image for the menu button. + void SetImage(Ptr value); + /// Get the shortcut key text for the menu button. + /// The shortcut key text for the menu button. + const WString& GetShortcutText(); + /// Set the shortcut key text for the menu button. + /// The shortcut key text for the menu button. + void SetShortcutText(const WString& value); - vint GetTokenIndex(const WString& tokenName); - vint GetSemanticId(const WString& name); - WString GetSemanticName(vint id); - const TokenMetaData& GetTokenMetaData(vint regexTokenIndex); - const FieldMetaData& GetFieldMetaData(const WString& type, const WString& field); + /// Test does the sub menu exist. + /// Returns true if the sub menu exists. + bool IsSubMenuExists(); + /// Get the sub menu. If the sub menu is not created, it returns null. + /// The sub menu. + GuiMenu* GetSubMenu(); + /// Create the sub menu if necessary. The created sub menu is owned by this menu button. + /// The created sub menu. + /// The style controller for the sub menu. Set to null to use the default control template. + GuiMenu* CreateSubMenu(TemplateProperty subMenuTemplate = {}); + /// Associate a sub menu if there is no sub menu binded in this menu button. The associated sub menu is not owned by this menu button if the "owned" argument is set to false. + /// The sub menu to associate. + /// Set to true if the menu is expected to be owned. + void SetSubMenu(GuiMenu* value, bool owned); + /// Destroy the sub menu if necessary. + void DestroySubMenu(); + /// Test is the sub menu owned by this menu button. If the sub menu is owned, both deleting this menu button or calling will delete the sub menu. + /// Returns true if the sub menu is owned by this menu button. + bool GetOwnedSubMenu(); - Ptr GetAttribute(vint index, const WString& name, vint argumentCount); - Ptr GetColorAttribute(vint index); - Ptr GetContextColorAttribute(vint index); - Ptr GetSemanticAttribute(vint index); - Ptr GetCandidateAttribute(vint index); - Ptr GetAutoCompleteAttribute(vint index); + /// Test is the sub menu opened. + /// Returns true if the sub menu is opened. + bool GetSubMenuOpening(); + /// Open or close the sub menu. + /// Set to true to open the sub menu. + void SetSubMenuOpening(bool value); - /* - @Color(ColorName) - field: color of the token field when the token type is marked with @ContextColor - token: color of the token - @ContextColor() - token: the color of the token may be changed if the token field is marked with @Color or @Semantic - @Semantic(Type1, Type2, ...) - field: After resolved symbols for this field, only types of symbols that specified in the arguments are acceptable. - @Candidate() - token: when the token can be available after the editing caret, than it will be in the auto complete list. - @AutoComplete() - token: when the token is editing, an auto complete list will appear if possible - */ + /// Get the preferred client size for the sub menu. + /// The preferred client size for the sub menu. + Size GetPreferredMenuClientSize(); + /// Set the preferred client size for the sub menu. + /// The preferred client size for the sub menu. + void SetPreferredMenuClientSize(Size value); + + /// Test is cascade action enabled. If the cascade action is enabled, when the mouse enter this menu button, the sub menu will be automatically opened if the parent menu is in an active state (see ), closing the sub menu will also close the parent menu. + /// Returns true if cascade action is enabled. + bool GetCascadeAction(); + /// Enable or disable cascade action. + /// Set to true to enable cascade action. + void SetCascadeAction(bool value); + + IDescriptable* QueryService(const WString& identifier)override; }; } } @@ -17810,7 +17940,7 @@ RepeatingParsingExecutor #endif /*********************************************************************** -.\CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGEAUTOCOMPLETE.H +.\CONTROLS\LISTCONTROLPACKAGE\GUICOMBOCONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -17820,8 +17950,9 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUILANGUAGEAUTOCOMPLETE -#define VCZH_PRESENTATION_CONTROLS_GUILANGUAGEAUTOCOMPLETE +#ifndef VCZH_PRESENTATION_CONTROLS_GUICOMBOCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUICOMBOCONTROLS + namespace vl { @@ -17831,109 +17962,120 @@ namespace vl { /*********************************************************************** -GuiGrammarAutoComplete +ComboBox Base ***********************************************************************/ - - /// Grammar based auto complete controller. - class GuiGrammarAutoComplete - : public GuiTextBoxAutoCompleteBase - , protected RepeatingParsingExecutor::CallbackBase - , private RepeatingTaskExecutor + + /// The base class of combo box control. + class GuiComboBoxBase : public GuiMenuButton, public Description { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ComboBoxTemplate, GuiMenuButton) + protected: + + IGuiMenuService::Direction GetSubMenuDirection()override; + void OnCachedBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiComboBoxBase(theme::ThemeName themeName); + ~GuiComboBoxBase(); + }; - /// The auto complete list data. - struct AutoCompleteData : ParsingTokenContext - { - /// Available candidate tokens (in lexer token index). - collections::List candidates; - /// Available candidate tokens (in lexer token index) that marked with @AutoCompleteCandidate(). - collections::List shownCandidates; - /// Candidate items. - collections::List candidateItems; - /// The start position of the editing token in global coordination. - TextPos startPosition; - }; - - /// The analysed data from an input code. - struct AutoCompleteContext : RepeatingPartialParsingOutput - { - /// The edit version of modified code. - vuint modifiedEditVersion = 0; - /// The analysed auto complete list data. - Ptr autoComplete; - }; - private: - Ptr grammarParser; - collections::SortedList leftRecursiveRules; - bool editing; - - SpinLock editTraceLock; - collections::List editTrace; - - SpinLock contextLock; - AutoCompleteContext context; - - void Attach(elements::GuiColorizedTextElement* _element, SpinLock& _elementModifyLock, compositions::GuiGraphicsComposition* _ownerComposition, vuint editVersion)override; - void Detach()override; - void TextEditPreview(TextEditPreviewStruct& arguments)override; - void TextEditNotify(const TextEditNotifyStruct& arguments)override; - void TextCaretChanged(const TextCaretChangedStruct& arguments)override; - void TextEditFinished(vuint editVersion)override; - void OnParsingFinishedAsync(const RepeatingParsingOutput& output)override; - void CollectLeftRecursiveRules(); +/*********************************************************************** +ComboBox with GuiControl +***********************************************************************/ - vint UnsafeGetEditTraceIndex(vuint editVersion); - TextPos ChooseCorrectTextPos(TextPos pos, const regex::RegexTokens& tokens); - void ExecuteRefresh(AutoCompleteContext& newContext); + /// Combo box control. This control is a combo box with a control in its popup. + class GuiComboButton + : public GuiComboBoxBase + , public Description + { + protected: + GuiControl* dropdownControl = nullptr; - bool NormalizeTextPos(AutoCompleteContext& newContext, elements::text::TextLines& lines, TextPos& pos); - void ExecuteEdit(AutoCompleteContext& newContext); + public: + /// Create a control with a specified default theme and a control that will be put in the popup control. + /// The theme name for retriving a default control template. + /// The contained control. + GuiComboButton(theme::ThemeName themeName, GuiControl* _dropdownControl); + ~GuiComboButton(); + }; - void DeleteFutures(collections::List& futures); - regex::RegexToken* TraverseTransitions( - parsing::tabling::ParsingState& state, - parsing::tabling::ParsingTransitionCollector& transitionCollector, - TextPos stopPosition, - collections::List& nonRecoveryFutures, - collections::List& recoveryFutures - ); - regex::RegexToken* SearchValidInputToken( - parsing::tabling::ParsingState& state, - parsing::tabling::ParsingTransitionCollector& transitionCollector, - TextPos stopPosition, - AutoCompleteContext& newContext, - collections::SortedList& tableTokenIndices - ); +/*********************************************************************** +ComboBox with GuiListControl +***********************************************************************/ - TextPos GlobalTextPosToModifiedTextPos(AutoCompleteContext& newContext, TextPos pos); - TextPos ModifiedTextPosToGlobalTextPos(AutoCompleteContext& newContext, TextPos pos); - void ExecuteCalculateList(AutoCompleteContext& newContext); + /// Combo box list control. This control is a combo box with a list control in its popup. + class GuiComboBoxListControl + : public GuiComboBoxBase + , private GuiListControl::IItemProviderCallback + , public Description + { + public: + using ItemStyleProperty = TemplateProperty; - void Execute(const RepeatingParsingOutput& input)override; - void PostList(const AutoCompleteContext& newContext, bool byGlobalCorrection); - void Initialize(); protected: + GuiSelectableListControl* containedListControl = nullptr; + vint selectedIndex = -1; + ItemStyleProperty itemStyleProperty; + templates::GuiTemplate* itemStyleController = nullptr; + Ptr boundsChangedHandler; - /// Called when the context of the code is selected. It is encouraged to set the "candidateItems" field in "context.autoComplete" during the call. If there is an binded to the , this function can be automatically done. - /// The selected context. - virtual void OnContextFinishedAsync(AutoCompleteContext& context); + void UpdateDisplayFont()override; + void BeforeControlTemplateUninstalled()override; + void AfterControlTemplateInstalled(bool initialize)override; + void RemoveStyleController(); + void InstallStyleController(vint itemIndex); + virtual void DisplaySelectedContent(vint itemIndex); + void AdoptSubMenuSize(); + void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnVisuallyEnabledChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnAfterSubMenuOpening(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnListControlAdoptedSizeInvalidated(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnListControlItemMouseDown(compositions::GuiGraphicsComposition* sender, compositions::GuiItemMouseEventArgs& arguments); + void OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); - /// Call this function in the derived class's destructor when it overrided . - void EnsureAutoCompleteFinished(); + private: + // ===================== GuiListControl::IItemProviderCallback ===================== + + void OnAttached(GuiListControl::IItemProvider* provider)override; + void OnItemModified(vint start, vint count, vint newCount, bool itemReferenceUpdated)override; public: - /// Create the auto complete controller with a created parsing executor. - /// The parsing executor. - GuiGrammarAutoComplete(Ptr _parsingExecutor); - /// Create the auto complete controller with a specified grammar and start rule to create a . - /// Parser generated from a grammar. - /// - GuiGrammarAutoComplete(Ptr _grammarParser, const WString& _grammarRule); - ~GuiGrammarAutoComplete(); + /// Create a control with a specified default theme and a list control that will be put in the popup control to show all items. + /// The theme name for retriving a default control template. + /// The list control. + GuiComboBoxListControl(theme::ThemeName themeName, GuiSelectableListControl* _containedListControl); + ~GuiComboBoxListControl(); + + /// Style provider changed event. + compositions::GuiNotifyEvent ItemTemplateChanged; + /// Selected index changed event. + compositions::GuiNotifyEvent SelectedIndexChanged; + + /// Get the list control. + /// The list control. + GuiSelectableListControl* GetContainedListControl(); - /// Get the internal parsing executor. - /// The parsing executor. - Ptr GetParsingExecutor(); + /// Get the item style provider. + /// The item style provider. + virtual ItemStyleProperty GetItemTemplate(); + /// Set the item style provider + /// The new item style provider + virtual void SetItemTemplate(ItemStyleProperty value); + + /// Get the selected index. + /// The selected index. + vint GetSelectedIndex(); + /// Set the selected index. + /// The selected index. + void SetSelectedIndex(vint value); + + /// Get the selected item. + /// The selected item. + description::Value GetSelectedItem(); + /// Get the item provider in the list control. + /// The item provider in the list control. + GuiListControl::IItemProvider* GetItemProvider(); }; } } @@ -17942,7 +18084,7 @@ GuiGrammarAutoComplete #endif /*********************************************************************** -.\CONTROLS\TEXTEDITORPACKAGE\LANGUAGESERVICE\GUILANGUAGECOLORIZER.H +.\CONTROLS\GUIDATETIMECONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -17952,8 +18094,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUILANGUAGECOLORIZER -#define VCZH_PRESENTATION_CONTROLS_GUILANGUAGECOLORIZER +#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATETIMECONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIDATETIMECONTROLS namespace vl @@ -17964,84 +18106,115 @@ namespace vl { /*********************************************************************** -GuiGrammarColorizer +DatePicker ***********************************************************************/ - /// Grammar based colorizer. - class GuiGrammarColorizer : public GuiTextBoxRegexColorizer, protected RepeatingParsingExecutor::CallbackBase + /// Date picker control that display a calendar. + class GuiDatePicker : public GuiControl, protected compositions::GuiAltActionHostBase, public Description { - typedef collections::Pair FieldDesc; - typedef collections::Dictionary FieldContextColors; - typedef collections::Dictionary FieldSemanticColors; - typedef elements::text::ColorEntry ColorEntry; - public: - /// Context for doing semantic colorizing. - struct SemanticColorizeContext : ParsingTokenContext + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DatePickerTemplate, GuiControl) + protected: + class CommandExecutor : public Object, public IDatePickerCommandExecutor { - /// Output semantic id that comes from one the argument in the @Semantic attribute. - vint semanticId; - }; - private: - collections::Dictionary colorSettings; - collections::Dictionary semanticColorMap; - - SpinLock contextLock; - RepeatingParsingOutput context; + protected: + GuiDatePicker* datePicker; + public: + CommandExecutor(GuiDatePicker* _datePicker); + ~CommandExecutor(); - void OnParsingFinishedAsync(const RepeatingParsingOutput& output)override; - protected: - /// Called when the node is parsed successfully before restarting colorizing. - /// The result of the parsing. - virtual void OnContextFinishedAsync(const RepeatingParsingOutput& context); + void NotifyDateChanged()override; + void NotifyDateNavigated()override; + void NotifyDateSelected()override; + }; - void Attach(elements::GuiColorizedTextElement* _element, SpinLock& _elementModifyLock, compositions::GuiGraphicsComposition* _ownerComposition, vuint editVersion)override; - void Detach()override; - void TextEditPreview(TextEditPreviewStruct& arguments)override; - void TextEditNotify(const TextEditNotifyStruct& arguments)override; - void TextCaretChanged(const TextCaretChangedStruct& arguments)override; - void TextEditFinished(vuint editVersion)override; + Ptr commandExecutor; + DateTime date; + WString dateFormat; + Locale dateLocale; + compositions::IGuiAltActionHost* previousAltHost = nullptr; + bool nestedAlt = false; - /// Called when a @SemanticColor attribute in a grammar is activated during colorizing to determine a color for the token. If there is an binded to the , this function can be automatically done. - /// Context for doing semantic colorizing. - /// The corressponding result from the . - virtual void OnSemanticColorize(SemanticColorizeContext& context, const RepeatingParsingOutput& input); + void UpdateText(); + bool IsAltAvailable()override; + compositions::IGuiAltActionHost* GetActivatingAltHost()override; - /// Call this function in the derived class's destructor when it overrided . - void EnsureColorizerFinished(); public: - /// Create the colorizer with a created parsing executor. - /// The parsing executor. - GuiGrammarColorizer(Ptr _parsingExecutor); - /// Create the colorizer with a specified grammar and start rule to create a . - /// Parser generated from a grammar. - /// - GuiGrammarColorizer(Ptr _grammarParser, const WString& _grammarRule); - ~GuiGrammarColorizer(); + /// Create a control with a specified style provider. + /// The theme name for retriving a default control template. + /// Set to true to make this date picker an . + GuiDatePicker(theme::ThemeName themeName, bool _nestedAlt = true); + ~GuiDatePicker(); - /// Reset all color settings. - void BeginSetColors(); - /// Get all color names. - /// All color names. - const collections::SortedList& GetColorNames(); - /// Get the color for a token theme name (@Color or @ContextColor("theme-name") in the grammar). - /// The color. - /// The token theme name. - ColorEntry GetColor(const WString& name); - /// Set a color for a token theme name (@Color or @ContextColor("theme-name") in the grammar). - /// The token theme name. - /// The color. - void SetColor(const WString& name, const ColorEntry& entry); - /// Set a color for a token theme name (@Color or @ContextColor("theme-name") in the grammar). - /// The token theme name. - /// The color. - void SetColor(const WString& name, const Color& color); - /// Submit all color settings. - void EndSetColors(); - void ColorizeTokenContextSensitive(vint lineIndex, const wchar_t* text, vint start, vint length, vint& token, vint& contextState)override; + /// Date changed event. + compositions::GuiNotifyEvent DateChanged; + /// Date navigated event. Called when the current month is changed. + compositions::GuiNotifyEvent DateNavigated; + /// Date selected event. Called when a day button is selected. + compositions::GuiNotifyEvent DateSelected; + /// Date format changed event. + compositions::GuiNotifyEvent DateFormatChanged; + /// Date locale changed event. + compositions::GuiNotifyEvent DateLocaleChanged; + + /// Get the displayed date. + /// The date. + const DateTime& GetDate(); + /// Display a date. + /// The date. + void SetDate(const DateTime& value); + /// Get the format. + /// The format. + const WString& GetDateFormat(); + /// Set the format for the text of this control. + /// The format. + void SetDateFormat(const WString& value); + /// Get the locale. + /// The locale. + const Locale& GetDateLocale(); + /// Set the locale to display texts. + /// The locale. + void SetDateLocale(const Locale& value); - /// Get the internal parsing executor. - /// The parsing executor. - Ptr GetParsingExecutor(); + void SetText(const WString& value)override; + }; + +/*********************************************************************** +DateComboBox +***********************************************************************/ + + /// A combo box control with a date picker control. + class GuiDateComboBox : public GuiComboBoxBase, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DateComboBoxTemplate, GuiComboBoxBase) + protected: + GuiDatePicker* datePicker; + DateTime selectedDate; + + void UpdateText(); + void NotifyUpdateSelectedDate(); + void OnSubMenuOpeningChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void datePicker_DateLocaleChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void datePicker_DateFormatChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void datePicker_DateSelected(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + /// Create a control with a specified style provider. + /// The theme name for retriving a default control template. + GuiDateComboBox(theme::ThemeName themeName); + ~GuiDateComboBox(); + + /// Selected data changed event. + compositions::GuiNotifyEvent SelectedDateChanged; + + void SetFont(const Nullable& value)override; + /// Get the displayed date. + /// The date. + const DateTime& GetSelectedDate(); + /// Display a date. + /// The date. + void SetSelectedDate(const DateTime& value); + /// Get the date picker control. + /// The date picker control. + GuiDatePicker* GetDatePicker(); }; } } @@ -18050,428 +18223,533 @@ GuiGrammarColorizer #endif /*********************************************************************** -.\CONTROLS\TOOLSTRIPPACKAGE\GUIMENUCONTROLS.H +.\CONTROLS\LISTCONTROLPACKAGE\GUILISTVIEWCONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) -GacUI::Control System - -Interfaces: -***********************************************************************/ - -#ifndef VCZH_PRESENTATION_CONTROLS_GUIMENUCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIMENUCONTROLS - - -namespace vl -{ - namespace presentation - { - namespace controls - { - -/*********************************************************************** -Menu Service -***********************************************************************/ - - class GuiMenu; - - /// IGuiMenuService is a required service for menu item container. - class IGuiMenuService : public virtual IDescriptable, public Description - { - public: - /// The identifier for this service. - static const wchar_t* const Identifier; - - /// Direction to decide the position for a menu with specified control. - enum Direction - { - /// Aligned to the top or bottom side. - Horizontal, - /// Aligned to the left or right side. - Vertical, - }; - protected: - GuiMenu* openingMenu; - public: - IGuiMenuService(); - - /// Get the parent service. This service represents the parent menu that host the menu item control that contains this menu. - /// The parent service. - virtual IGuiMenuService* GetParentMenuService()=0; - /// Get the preferred direction to open the sub menu. - /// The preferred direction to open the sub menu. - virtual Direction GetPreferredDirection()=0; - /// Test is this menu is active. When an menu is active, the sub menu is automatically opened when the corresponding menu item is opened. - /// Returns true if this menu is active. - virtual bool IsActiveState()=0; - /// Test all sub menu items are actived by mouse down. - /// Returns true if all sub menu items are actived by mouse down. - virtual bool IsSubMenuActivatedByMouseDown()=0; - - /// Called when the menu item is executed. - virtual void MenuItemExecuted(); - /// Get the opening sub menu. - /// The opening sub menu. - virtual GuiMenu* GetOpeningMenu(); - /// Called when the sub menu is opened. - /// The sub menu. - virtual void MenuOpened(GuiMenu* menu); - /// Called when the sub menu is closed. - /// The sub menu. - virtual void MenuClosed(GuiMenu* menu); - }; - - /// IGuiMenuService is a required service to tell a ribbon group that this control has a dropdown to display. - class IGuiMenuDropdownProvider : public virtual IDescriptable, public Description - { - public: - /// The identifier for this service. - static const wchar_t* const Identifier; - - /// Get the dropdown to display. - /// The dropdown to display. Returns null to indicate the dropdown cannot be displaied temporary. - virtual GuiMenu* ProvideDropdownMenu() = 0; - }; +GacUI::Control System -/*********************************************************************** -Menu +Interfaces: ***********************************************************************/ - /// Popup menu. - class GuiMenu : public GuiPopup, protected IGuiMenuService, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(MenuTemplate, GuiPopup) - private: - IGuiMenuService* parentMenuService = nullptr; - bool hideOnDeactivateAltHost = true; - Size preferredMenuClientSizeBeforeUpdating; - Size preferredMenuClientSize; +#ifndef VCZH_PRESENTATION_CONTROLS_GUILISTVIEWCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUILISTVIEWCONTROLS - IGuiMenuService* GetParentMenuService()override; - Direction GetPreferredDirection()override; - bool IsActiveState()override; - bool IsSubMenuActivatedByMouseDown()override; - void MenuItemExecuted()override; - void Moving(NativeRect& bounds, bool fixSizeOnly, bool draggingBorder)override; - void UpdateClientSizeAfterRendering(Size preferredSize, Size clientSize)override; +namespace vl +{ + namespace presentation + { + namespace controls + { + ///List view column header control for detailed view. + class GuiListViewColumnHeader : public GuiMenuButton, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ListViewColumnHeaderTemplate, GuiMenuButton) protected: - GuiControl* owner; + ColumnSortingState columnSortingState = ColumnSortingState::NotSorted; - void OnDeactivatedAltHost()override; - void OnWindowOpened(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnWindowClosed(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: /// Create a control with a specified default theme. /// The theme name for retriving a default control template. - /// The owner menu item of the parent menu. - GuiMenu(theme::ThemeName themeName, GuiControl* _owner); - ~GuiMenu(); - - /// Update the reference to the parent . This function is not required to call outside the menu or menu item control. - void UpdateMenuService(); - IDescriptable* QueryService(const WString& identifier)override; + GuiListViewColumnHeader(theme::ThemeName themeName); + ~GuiListViewColumnHeader(); - /// Test if this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. - /// Returns true if this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. - bool GetHideOnDeactivateAltHost(); - /// Set if this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. - /// Set to true to make this menu hide after pressing ESC key to exit to the upper level of ALT shortcuts. - void SetHideOnDeactivateAltHost(bool value); + bool IsAltAvailable()override; - /// Get the preferred client size for the menu. - /// The preferred client size for the menu. - Size GetPreferredMenuClientSize(); - /// Set the preferred client size for the menu. - /// The preferred client size for the menu. - void SetPreferredMenuClientSize(Size value); + /// Get the column sorting state. + /// The column sorting state. + ColumnSortingState GetColumnSortingState(); + /// Set the column sorting state. + /// The new column sorting state. + void SetColumnSortingState(ColumnSortingState value); }; - - /// Menu bar. - class GuiMenuBar : public GuiControl, protected IGuiMenuService, public Description - { - private: - IGuiMenuService* GetParentMenuService()override; - Direction GetPreferredDirection()override; - bool IsActiveState()override; - bool IsSubMenuActivatedByMouseDown()override; + /// List view base control. All list view controls inherit from this class. + class GuiListViewBase : public GuiSelectableListControl, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ListViewTemplate, GuiSelectableListControl) public: - /// Create a control with a specified default theme. + /// Create a list view base control. /// The theme name for retriving a default control template. - GuiMenuBar(theme::ThemeName themeName); - ~GuiMenuBar(); - - IDescriptable* QueryService(const WString& identifier)override; + /// The item provider for this control. + GuiListViewBase(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider); + ~GuiListViewBase(); + + /// Column clicked event. + compositions::GuiItemNotifyEvent ColumnClicked; }; /*********************************************************************** -MenuButton +ListView ItemStyleProvider ***********************************************************************/ - /// Menu item. - class GuiMenuButton : public GuiSelectableButton, private IGuiMenuDropdownProvider, public Description + namespace list { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ToolstripButtonTemplate, GuiSelectableButton) + /// The required view for . + class IListViewItemView : public virtual IDescriptable, public Description + { + public: + /// The identifier for this view. + static const wchar_t* const Identifier; + + /// Get the small image of an item. + /// The small image. + /// The index of the item. + virtual Ptr GetSmallImage(vint itemIndex) = 0; + /// Get the large image of an item. + /// The large image. + /// The index of the item. + virtual Ptr GetLargeImage(vint itemIndex) = 0; + /// Get the text of an item. + /// The text. + /// The index of the item. + virtual WString GetText(vint itemIndex) = 0; + /// Get the sub item text of an item. If the sub item index out of range, it returns an empty string. + /// The sub item text. + /// The index of the item. + /// The sub item index of the item. + virtual WString GetSubItem(vint itemIndex, vint index) = 0; + + /// Get the number of data columns. + /// The number of data columns. + virtual vint GetDataColumnCount() = 0; + /// Get the column index of the index-th data column. + /// The column index. + /// The order of the data column. + virtual vint GetDataColumn(vint index) = 0; + + /// Get the number of all columns. + /// The number of all columns. + virtual vint GetColumnCount() = 0; + /// Get the text of the column. + /// The text of the column. + /// The index of the column. + virtual WString GetColumnText(vint index) = 0; + }; + +/*********************************************************************** +ListViewColumnItemArranger +***********************************************************************/ + + /// List view column item arranger. This arranger contains column headers. When an column header is resized, all items will be notified via the [T:vl.presentation.controls.list.ListViewColumnItemArranger.IColumnItemView] for . + class ListViewColumnItemArranger : public VirtualRepeatRangedItemArrangerBase, public Description + { + using TBase = VirtualRepeatRangedItemArrangerBase; + typedef collections::List ColumnHeaderButtonList; + typedef collections::List ColumnHeaderSplitterList; + public: + static const vint SplitterWidth = 8; + + /// Callback for [T:vl.presentation.controls.list.ListViewColumnItemArranger.IColumnItemView]. Column item view use this interface to notify column related modification. + class IColumnItemViewCallback : public virtual IDescriptable, public Description + { + public: + /// Called when any column object is changed (inserted, removed, updated binding, etc.). + virtual void OnColumnRebuilt()=0; + + /// Called when any property of a column is changed (size changed, text changed, etc.). + virtual void OnColumnChanged(bool needToRefreshItems)=0; + }; + + /// The required view for . + class IColumnItemView : public virtual IDescriptable, public Description + { + public: + /// The identifier for this view. + static const wchar_t* const Identifier; + + /// Attach an column item view callback to this view. + /// Returns true if this operation succeeded. + /// The column item view callback. + virtual bool AttachCallback(IColumnItemViewCallback* value)=0; + /// Detach an column item view callback from this view. + /// Returns true if this operation succeeded. + /// The column item view callback. + virtual bool DetachCallback(IColumnItemViewCallback* value)=0; + + /// Get the size of the column. + /// The size of the column. + /// The index of the column. + virtual vint GetColumnSize(vint index)=0; + /// Set the size of the column. + /// The index of the column. + /// The new size of the column. + virtual void SetColumnSize(vint index, vint value)=0; + + /// Get the popup binded to the column. + /// The popup binded to the column. + /// The index of the column. + virtual GuiMenu* GetDropdownPopup(vint index)=0; + /// Get the sorting state of the column. + /// The sorting state of the column. + /// The index of the column. + virtual ColumnSortingState GetSortingState(vint index)=0; + }; + protected: + class ColumnItemViewCallback : public Object, public virtual IColumnItemViewCallback + { + protected: + ListViewColumnItemArranger* arranger = nullptr; + + public: + ColumnItemViewCallback(ListViewColumnItemArranger* _arranger); + ~ColumnItemViewCallback(); + + void OnColumnRebuilt() override; + void OnColumnChanged(bool needToRefreshItems) override; + }; + + class ColumnItemArrangerRepeatComposition : public TBase::ArrangerRepeatComposition + { + protected: + ListViewColumnItemArranger* arranger = nullptr; + + void Layout_EndLayout(bool totalSizeUpdated) override; + void Layout_CalculateTotalSize(Size& full, Size& minimum) override; + public: + ColumnItemArrangerRepeatComposition(ListViewColumnItemArranger* _arranger); + }; + + GuiListViewBase* listView = nullptr; + IListViewItemView* listViewItemView = nullptr; + IColumnItemView* columnItemView = nullptr; + Ptr columnItemViewCallback; + compositions::GuiStackComposition* columnHeaders = nullptr; + ColumnHeaderButtonList columnHeaderButtons; + ColumnHeaderSplitterList columnHeaderSplitters; + bool splitterDragging = false; + vint splitterLatestX = 0; + + void OnViewLocationChanged(compositions::GuiGraphicsComposition* composition, compositions::GuiEventArgs& arguments); + void ColumnClicked(vint index, compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void ColumnCachedBoundsChanged(vint index, compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void ColumnHeaderSplitterLeftButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void ColumnHeaderSplitterLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void ColumnHeaderSplitterMouseMove(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + + void FixColumnsAfterViewLocationChanged(); + void FixColumnsAfterLayout(); + vint GetColumnsWidth(); + vint GetColumnsYOffset(); + void DeleteColumnButtons(); + void RebuildColumns(); + void RefreshColumns(); + public: + ListViewColumnItemArranger(); + ~ListViewColumnItemArranger(); + + Size GetTotalSize()override; + void AttachListControl(GuiListControl* value)override; + void DetachListControl()override; + }; + } + +/*********************************************************************** +ListViewItemProvider +***********************************************************************/ - using IEventHandler = compositions::IGuiGraphicsEventHandler; - protected: - Ptr subMenuDisposeFlag; - Ptr subMenuWindowOpenedHandler; - Ptr subMenuWindowClosedHandler; - Ptr hostClickedHandler; - Ptr hostMouseEnterHandler; - Ptr image; - Ptr largeImage; - WString shortcutText; - GuiMenu* subMenu; - bool ownedSubMenu; - Size preferredMenuClientSize; - IGuiMenuService* ownerMenuService; - bool cascadeAction; + namespace list + { + class ListViewItem; - GuiButton* GetSubMenuHost(); - bool OpenSubMenuInternal(); - void OnParentLineChanged()override; - compositions::IGuiAltActionHost* GetActivatingAltHost()override; + class ListViewSubItems : public collections::ObservableListBase + { + friend class ListViewItem; + protected: + ListViewItem* owner; + + void NotifyUpdateInternal(vint start, vint count, vint newCount)override; + public: + }; - void OnSubMenuWindowOpened(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnSubMenuWindowClosed(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnMouseEnter(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + class ListViewItemProvider; - virtual IGuiMenuService::Direction GetSubMenuDirection(); + /// List view item. + class ListViewItem : public Object, public Description + { + friend class ListViewSubItems; + friend class ListViewItemProvider; + protected: + ListViewItemProvider* owner; + ListViewSubItems subItems; + Ptr smallImage; + Ptr largeImage; + WString text; + description::Value tag; + + void NotifyUpdate(); + public: + /// Create a list view item. + ListViewItem(); + + /// Get all sub items of this item. + /// All sub items of this item. + ListViewSubItems& GetSubItems(); + /// Get the small image of this item. + /// The small image of this item. + Ptr GetSmallImage(); + /// Set the small image of this item. + /// The small image of this item. + void SetSmallImage(Ptr value); + /// Get the large image of this item. + /// The large image of this item. + Ptr GetLargeImage(); + /// Set the large image of this item. + /// The large image of this item. + void SetLargeImage(Ptr value); + /// Get the text of this item. + /// The text of this item. + const WString& GetText(); + /// Set the text of this item. + /// The text of this item. + void SetText(const WString& value); + /// Get the tag of this item. + /// The tag of this item. + description::Value GetTag(); + /// Set the tag of this item. + /// The tag of this item. + void SetTag(const description::Value& value); + }; - private: - void DetachSubMenu(); - GuiMenu* ProvideDropdownMenu()override; + class ListViewColumns; + + /// List view column. + class ListViewColumn : public Object, public Description + { + friend class ListViewColumns; + protected: + ListViewColumns* owner = nullptr; + WString text; + ItemProperty textProperty; + vint size; + bool ownPopup = true; + GuiMenu* dropdownPopup = nullptr; + ColumnSortingState sortingState = ColumnSortingState::NotSorted; + + void NotifyRebuilt(); + void NotifyChanged(bool needToRefreshItems); + public: + /// Create a column with the specified text and size. + /// The specified text. + /// The specified size. + ListViewColumn(const WString& _text=L"", vint _size=160); + ~ListViewColumn(); + + /// Get the text of this item. + /// The text of this item. + const WString& GetText(); + /// Set the text of this item. + /// The text of this item. + void SetText(const WString& value); + /// Get the text property of this item. + /// The text property of this item. + ItemProperty GetTextProperty(); + /// Set the text property of this item. + /// The text property of this item. + void SetTextProperty(const ItemProperty& value); + /// Get the size of this item. + /// The size of this item. + vint GetSize(); + /// Set the size of this item. + /// The size of this item. + void SetSize(vint value); + /// Test if the column owns the popup. Owned popup will be deleted in the destructor. + /// Returns true if the column owns the popup. + bool GetOwnPopup(); + /// Set if the column owns the popup. + /// Set to true to let the column own the popup. + void SetOwnPopup(bool value); + /// Get the dropdown context menu of this item. + /// The dropdown context menu of this item. + GuiMenu* GetDropdownPopup(); + /// Set the dropdown context menu of this item. + /// The dropdown context menu of this item. + void SetDropdownPopup(GuiMenu* value); + /// Get the sorting state of this item. + /// The sorting state of this item. + ColumnSortingState GetSortingState(); + /// Set the sorting state of this item. + /// The sorting state of this item. + void SetSortingState(ColumnSortingState value); + }; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiMenuButton(theme::ThemeName themeName); - ~GuiMenuButton(); + class IListViewItemProvider : public virtual Interface + { + public: + virtual void RebuildAllItems() = 0; + virtual void RefreshAllItems() = 0; + virtual void NotifyColumnRebuilt() = 0; + virtual void NotifyColumnChanged() = 0; + }; - /// Before sub menu opening event. - compositions::GuiNotifyEvent BeforeSubMenuOpening; - /// After sub menu opening event. - compositions::GuiNotifyEvent AfterSubMenuOpening; - /// Sub menu opening changed event. - compositions::GuiNotifyEvent SubMenuOpeningChanged; - /// Large image changed event. - compositions::GuiNotifyEvent LargeImageChanged; - /// Image changed event. - compositions::GuiNotifyEvent ImageChanged; - /// Shortcut text changed event. - compositions::GuiNotifyEvent ShortcutTextChanged; + /// List view data column container. + class ListViewDataColumns : public collections::ObservableListBase + { + protected: + IListViewItemProvider* itemProvider; - /// Get the large image for the menu button. - /// The large image for the menu button. - Ptr GetLargeImage(); - /// Set the large image for the menu button. - /// The large image for the menu button. - void SetLargeImage(Ptr value); - /// Get the image for the menu button. - /// The image for the menu button. - Ptr GetImage(); - /// Set the image for the menu button. - /// The image for the menu button. - void SetImage(Ptr value); - /// Get the shortcut key text for the menu button. - /// The shortcut key text for the menu button. - const WString& GetShortcutText(); - /// Set the shortcut key text for the menu button. - /// The shortcut key text for the menu button. - void SetShortcutText(const WString& value); + void NotifyUpdateInternal(vint start, vint count, vint newCount)override; + public: + /// Create a container. + /// The item provider in the same control to receive notifications. + ListViewDataColumns(IListViewItemProvider* _itemProvider); + ~ListViewDataColumns(); + }; + + /// List view column container. + class ListViewColumns : public collections::ObservableListBase> + { + friend class ListViewColumn; + protected: + IListViewItemProvider* itemProvider; + bool affectItemFlag = true; - /// Test does the sub menu exist. - /// Returns true if the sub menu exists. - bool IsSubMenuExists(); - /// Get the sub menu. If the sub menu is not created, it returns null. - /// The sub menu. - GuiMenu* GetSubMenu(); - /// Create the sub menu if necessary. The created sub menu is owned by this menu button. - /// The created sub menu. - /// The style controller for the sub menu. Set to null to use the default control template. - GuiMenu* CreateSubMenu(TemplateProperty subMenuTemplate = {}); - /// Associate a sub menu if there is no sub menu binded in this menu button. The associated sub menu is not owned by this menu button if the "owned" argument is set to false. - /// The sub menu to associate. - /// Set to true if the menu is expected to be owned. - void SetSubMenu(GuiMenu* value, bool owned); - /// Destroy the sub menu if necessary. - void DestroySubMenu(); - /// Test is the sub menu owned by this menu button. If the sub menu is owned, both deleting this menu button or calling will delete the sub menu. - /// Returns true if the sub menu is owned by this menu button. - bool GetOwnedSubMenu(); + void NotifyColumnRebuilt(vint column); + void NotifyColumnChanged(vint column, bool needToRefreshItems); + void AfterInsert(vint index, const Ptr& value)override; + void BeforeRemove(vint index, const Ptr& value)override; + void NotifyUpdateInternal(vint start, vint count, vint newCount)override; + public: + /// Create a container. + /// The item provider in the same control to receive notifications. + ListViewColumns(IListViewItemProvider* _itemProvider); + ~ListViewColumns(); + }; + + /// Item provider for . + class ListViewItemProvider + : public ListProvider> + , protected virtual IListViewItemProvider + , public virtual IListViewItemView + , public virtual ListViewColumnItemArranger::IColumnItemView + , public Description + { + friend class ListViewItem; + friend class ListViewColumns; + friend class ListViewDataColumns; + typedef collections::List ColumnItemViewCallbackList; + protected: + ListViewDataColumns dataColumns; + ListViewColumns columns; + ColumnItemViewCallbackList columnItemViewCallbacks; - /// Test is the sub menu opened. - /// Returns true if the sub menu is opened. - bool GetSubMenuOpening(); - /// Open or close the sub menu. - /// Set to true to open the sub menu. - void SetSubMenuOpening(bool value); + void AfterInsert(vint index, const Ptr& value)override; + void BeforeRemove(vint index, const Ptr& value)override; - /// Get the preferred client size for the sub menu. - /// The preferred client size for the sub menu. - Size GetPreferredMenuClientSize(); - /// Set the preferred client size for the sub menu. - /// The preferred client size for the sub menu. - void SetPreferredMenuClientSize(Size value); + // ===================== list::IListViewItemProvider ===================== - /// Test is cascade action enabled. If the cascade action is enabled, when the mouse enter this menu button, the sub menu will be automatically opened if the parent menu is in an active state (see ), closing the sub menu will also close the parent menu. - /// Returns true if cascade action is enabled. - bool GetCascadeAction(); - /// Enable or disable cascade action. - /// Set to true to enable cascade action. - void SetCascadeAction(bool value); + void RebuildAllItems() override; + void RefreshAllItems() override; + void NotifyColumnRebuilt() override; + void NotifyColumnChanged() override; - IDescriptable* QueryService(const WString& identifier)override; - }; - } - } -} + public: + ListViewItemProvider(); + ~ListViewItemProvider(); -#endif + // ===================== GuiListControl::IItemProvider ===================== -/*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUICOMBOCONTROLS.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control System + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; + IDescriptable* RequestView(const WString& identifier)override; -Interfaces: -***********************************************************************/ + // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== -#ifndef VCZH_PRESENTATION_CONTROLS_GUICOMBOCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUICOMBOCONTROLS + Ptr GetSmallImage(vint itemIndex)override; + Ptr GetLargeImage(vint itemIndex)override; + WString GetText(vint itemIndex)override; + WString GetSubItem(vint itemIndex, vint index)override; + vint GetDataColumnCount()override; + vint GetDataColumn(vint index)override; + vint GetColumnCount()override; + WString GetColumnText(vint index)override; + // ===================== list::ListViewColumnItemArranger::IColumnItemView ===================== -namespace vl -{ - namespace presentation - { - namespace controls - { + bool AttachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; + bool DetachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; + vint GetColumnSize(vint index)override; + void SetColumnSize(vint index, vint value)override; + GuiMenu* GetDropdownPopup(vint index)override; + ColumnSortingState GetSortingState(vint index)override; + + /// Get all data columns indices in columns. + /// All data columns indices in columns. + ListViewDataColumns& GetDataColumns(); + /// Get all columns. + /// All columns. + ListViewColumns& GetColumns(); + }; + } /*********************************************************************** -ComboBox Base +GuiVirtualListView ***********************************************************************/ - /// The base class of combo box control. - class GuiComboBoxBase : public GuiMenuButton, public Description + enum class ListViewView { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ComboBoxTemplate, GuiMenuButton) - protected: - - IGuiMenuService::Direction GetSubMenuDirection()override; - void OnCachedBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiComboBoxBase(theme::ThemeName themeName); - ~GuiComboBoxBase(); + BigIcon, + SmallIcon, + List, + Tile, + Information, + Detail, + Unknown, }; - -/*********************************************************************** -ComboBox with GuiControl -***********************************************************************/ - - /// Combo box control. This control is a combo box with a control in its popup. - class GuiComboButton - : public GuiComboBoxBase - , public Description + + /// List view control in virtual mode. + class GuiVirtualListView : public GuiListViewBase, public Description { protected: - GuiControl* dropdownControl = nullptr; + ListViewView view = ListViewView::Unknown; + void OnStyleInstalled(vint itemIndex, ItemStyle* style, bool refreshPropertiesOnly)override; + void OnItemTemplateChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: - /// Create a control with a specified default theme and a control that will be put in the popup control. + /// Create a list view control in virtual mode. /// The theme name for retriving a default control template. - /// The contained control. - GuiComboButton(theme::ThemeName themeName, GuiControl* _dropdownControl); - ~GuiComboButton(); + /// The item provider for this control. + GuiVirtualListView(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider); + ~GuiVirtualListView(); + + /// Get the current view. + /// The current view. After [M:vl.presentation.controls.GuiListControl.SetItemTemplate] is called, the current view is reset to Unknown. + ListViewView GetView(); + /// Set the current view. + /// The current view. + void SetView(ListViewView _view); }; /*********************************************************************** -ComboBox with GuiListControl +GuiListView ***********************************************************************/ - - /// Combo box list control. This control is a combo box with a list control in its popup. - class GuiComboBoxListControl - : public GuiComboBoxBase - , private GuiListControl::IItemProviderCallback - , public Description + + /// List view control in virtual mode. + class GuiListView : public GuiVirtualListView, public Description { - public: - using ItemStyleProperty = TemplateProperty; - protected: - GuiSelectableListControl* containedListControl = nullptr; - vint selectedIndex = -1; - ItemStyleProperty itemStyleProperty; - templates::GuiTemplate* itemStyleController = nullptr; - Ptr boundsChangedHandler; - - void UpdateDisplayFont()override; - void BeforeControlTemplateUninstalled()override; - void AfterControlTemplateInstalled(bool initialize)override; - void RemoveStyleController(); - void InstallStyleController(vint itemIndex); - virtual void DisplaySelectedContent(vint itemIndex); - void AdoptSubMenuSize(); - void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnVisuallyEnabledChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnAfterSubMenuOpening(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnListControlAdoptedSizeInvalidated(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnListControlItemMouseDown(compositions::GuiGraphicsComposition* sender, compositions::GuiItemMouseEventArgs& arguments); - void OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); - - private: - // ===================== GuiListControl::IItemProviderCallback ===================== - - void OnAttached(GuiListControl::IItemProvider* provider)override; - void OnItemModified(vint start, vint count, vint newCount, bool itemReferenceUpdated)override; + list::ListViewItemProvider* items; public: - /// Create a control with a specified default theme and a list control that will be put in the popup control to show all items. + /// Create a list view control. /// The theme name for retriving a default control template. - /// The list control. - GuiComboBoxListControl(theme::ThemeName themeName, GuiSelectableListControl* _containedListControl); - ~GuiComboBoxListControl(); - - /// Style provider changed event. - compositions::GuiNotifyEvent ItemTemplateChanged; - /// Selected index changed event. - compositions::GuiNotifyEvent SelectedIndexChanged; - - /// Get the list control. - /// The list control. - GuiSelectableListControl* GetContainedListControl(); - - /// Get the item style provider. - /// The item style provider. - virtual ItemStyleProperty GetItemTemplate(); - /// Set the item style provider - /// The new item style provider - virtual void SetItemTemplate(ItemStyleProperty value); + GuiListView(theme::ThemeName themeName); + ~GuiListView(); - /// Get the selected index. - /// The selected index. - vint GetSelectedIndex(); - /// Set the selected index. - /// The selected index. - void SetSelectedIndex(vint value); + /// Get all list view items. + /// All list view items. + list::ListViewItemProvider& GetItems(); + /// Get all data columns indices in columns. + /// All data columns indices in columns. + list::ListViewDataColumns& GetDataColumns(); + /// Get all columns. + /// All columns. + list::ListViewColumns& GetColumns(); /// Get the selected item. - /// The selected item. - description::Value GetSelectedItem(); - /// Get the item provider in the list control. - /// The item provider in the list control. - GuiListControl::IItemProvider* GetItemProvider(); + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + Ptr GetSelectedItem(); }; } } @@ -18480,7 +18758,7 @@ ComboBox with GuiListControl #endif /*********************************************************************** -.\CONTROLS\GUIDATETIMECONTROLS.H +.\CONTROLS\LISTCONTROLPACKAGE\GUIBINDABLELISTCONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -18490,671 +18768,620 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATETIMECONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIDATETIMECONTROLS +#ifndef VCZH_PRESENTATION_CONTROLS_GUIBINDABLELISTCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIBINDABLELISTCONTROLS + + +namespace vl +{ + namespace presentation + { + namespace controls + { + template + struct DefaultValueOf + { + static T Get() + { + return reflection::description::TypedValueSerializerProvider::GetDefaultValue(); + } + }; + + template + struct DefaultValueOf> + { + static Ptr Get() + { + return nullptr; + } + }; + + template<> + struct DefaultValueOf + { + static description::Value Get() + { + return description::Value(); + } + }; + + template + T ReadProperty(const description::Value& thisObject, const ItemProperty& propertyName) + { + if (!thisObject.IsNull() && propertyName) + { + return propertyName(thisObject); + } + else + { + return DefaultValueOf::Get(); + } + } + template + T ReadProperty(const description::Value& thisObject, const WritableItemProperty& propertyName) + { + auto defaultValue = DefaultValueOf::Get(); + if (!thisObject.IsNull() && propertyName) + { + return propertyName(thisObject, defaultValue, false); + } + else + { + return defaultValue; + } + } -namespace vl -{ - namespace presentation - { - namespace controls - { + template + void WriteProperty(const description::Value& thisObject, const WritableItemProperty& propertyName, const T& value) + { + if (!thisObject.IsNull() && propertyName) + { + propertyName(thisObject, value, true); + } + } /*********************************************************************** -DatePicker +GuiBindableTextList ***********************************************************************/ - /// Date picker control that display a calendar. - class GuiDatePicker : public GuiControl, protected compositions::GuiAltActionHostBase, public Description + /// A bindable Text list control. + class GuiBindableTextList : public GuiVirtualTextList, public Description { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DatePickerTemplate, GuiControl) protected: - class CommandExecutor : public Object, public IDatePickerCommandExecutor + class ItemSource + : public list::ItemProviderBase + , protected list::ITextItemView { protected: - GuiDatePicker* datePicker; + Ptr itemChangedEventHandler; + Ptr itemSource; + public: - CommandExecutor(GuiDatePicker* _datePicker); - ~CommandExecutor(); + ItemProperty textProperty; + WritableItemProperty checkedProperty; - void NotifyDateChanged()override; - void NotifyDateNavigated()override; - void NotifyDateSelected()override; - }; + public: + ItemSource(); + ~ItemSource(); - Ptr commandExecutor; - DateTime date; - WString dateFormat; - Locale dateLocale; - compositions::IGuiAltActionHost* previousAltHost = nullptr; - bool nestedAlt = false; + Ptr GetItemSource(); + void SetItemSource(Ptr _itemSource); - void UpdateText(); - bool IsAltAvailable()override; - compositions::IGuiAltActionHost* GetActivatingAltHost()override; + description::Value Get(vint index); + void UpdateBindingProperties(); + bool NotifyUpdate(vint start, vint count, bool itemReferenceUpdated); + + // ===================== GuiListControl::IItemProvider ===================== + + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; + vint Count()override; + IDescriptable* RequestView(const WString& identifier)override; + + // ===================== list::TextItemStyleProvider::ITextItemView ===================== + + bool GetChecked(vint itemIndex)override; + void SetChecked(vint itemIndex, bool value)override; + }; + + protected: + ItemSource* itemSource; public: - /// Create a control with a specified style provider. + /// Create a bindable Text list control. /// The theme name for retriving a default control template. - /// Set to true to make this date picker an . - GuiDatePicker(theme::ThemeName themeName, bool _nestedAlt = true); - ~GuiDatePicker(); + GuiBindableTextList(theme::ThemeName themeName); + ~GuiBindableTextList(); + + /// Text property name changed event. + compositions::GuiNotifyEvent TextPropertyChanged; + /// Checked property name changed event. + compositions::GuiNotifyEvent CheckedPropertyChanged; - /// Date changed event. - compositions::GuiNotifyEvent DateChanged; - /// Date navigated event. Called when the current month is changed. - compositions::GuiNotifyEvent DateNavigated; - /// Date selected event. Called when a day button is selected. - compositions::GuiNotifyEvent DateSelected; - /// Date format changed event. - compositions::GuiNotifyEvent DateFormatChanged; - /// Date locale changed event. - compositions::GuiNotifyEvent DateLocaleChanged; + /// Get the item source. + /// The item source. + Ptr GetItemSource(); + /// Set the item source. + /// The item source. Null is acceptable if you want to clear all data. + void SetItemSource(Ptr _itemSource); - /// Get the displayed date. - /// The date. - const DateTime& GetDate(); - /// Display a date. - /// The date. - void SetDate(const DateTime& value); - /// Get the format. - /// The format. - const WString& GetDateFormat(); - /// Set the format for the text of this control. - /// The format. - void SetDateFormat(const WString& value); - /// Get the locale. - /// The locale. - const Locale& GetDateLocale(); - /// Set the locale to display texts. - /// The locale. - void SetDateLocale(const Locale& value); + /// Get the text property name to get the item text from an item. + /// The text property name. + ItemProperty GetTextProperty(); + /// Set the text property name to get the item text from an item. + /// The text property name. + void SetTextProperty(const ItemProperty& value); + + /// Get the checked property name to get the check state from an item. + /// The checked property name. + WritableItemProperty GetCheckedProperty(); + /// Set the checked property name to get the check state from an item. + /// The checked property name. + void SetCheckedProperty(const WritableItemProperty& value); - void SetText(const WString& value)override; + /// Get the selected item. + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + description::Value GetSelectedItem(); + + /// Notify the control that data in some items are modified. + /// The index of the first item. + /// The number of items + /// Returns true if this operation succeeded. + bool NotifyItemDataModified(vint start, vint count); }; /*********************************************************************** -DateComboBox +GuiBindableListView ***********************************************************************/ - /// A combo box control with a date picker control. - class GuiDateComboBox : public GuiComboBoxBase, public Description + /// A bindable List view control. + class GuiBindableListView : public GuiVirtualListView, public Description { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(DateComboBoxTemplate, GuiComboBoxBase) protected: - GuiDatePicker* datePicker; - DateTime selectedDate; - - void UpdateText(); - void NotifyUpdateSelectedDate(); - void OnSubMenuOpeningChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void datePicker_DateLocaleChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void datePicker_DateFormatChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void datePicker_DateSelected(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - /// Create a control with a specified style provider. - /// The theme name for retriving a default control template. - GuiDateComboBox(theme::ThemeName themeName); - ~GuiDateComboBox(); - - /// Selected data changed event. - compositions::GuiNotifyEvent SelectedDateChanged; - - void SetFont(const Nullable& value)override; - /// Get the displayed date. - /// The date. - const DateTime& GetSelectedDate(); - /// Display a date. - /// The date. - void SetSelectedDate(const DateTime& value); - /// Get the date picker control. - /// The date picker control. - GuiDatePicker* GetDatePicker(); - }; - } - } -} + class ItemSource + : public list::ItemProviderBase + , protected virtual list::IListViewItemProvider + , public virtual list::IListViewItemView + , public virtual list::ListViewColumnItemArranger::IColumnItemView + { + typedef collections::List ColumnItemViewCallbackList; + protected: + list::ListViewDataColumns dataColumns; + list::ListViewColumns columns; + ColumnItemViewCallbackList columnItemViewCallbacks; + Ptr itemChangedEventHandler; + Ptr itemSource; -#endif + public: + ItemProperty> largeImageProperty; + ItemProperty> smallImageProperty; -/*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUILISTVIEWCONTROLS.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control System + public: + ItemSource(); + ~ItemSource(); + + Ptr GetItemSource(); + void SetItemSource(Ptr _itemSource); + + description::Value Get(vint index); + void UpdateBindingProperties(); + bool NotifyUpdate(vint start, vint count, bool itemReferenceUpdated); + list::ListViewDataColumns& GetDataColumns(); + list::ListViewColumns& GetColumns(); + + // ===================== list::IListViewItemProvider ===================== + + void RebuildAllItems() override; + void RefreshAllItems() override; + void NotifyColumnRebuilt() override; + void NotifyColumnChanged() override; + + // ===================== GuiListControl::IItemProvider ===================== + + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; + vint Count()override; + IDescriptable* RequestView(const WString& identifier)override; -Interfaces: -***********************************************************************/ + // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== -#ifndef VCZH_PRESENTATION_CONTROLS_GUILISTVIEWCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUILISTVIEWCONTROLS + Ptr GetSmallImage(vint itemIndex)override; + Ptr GetLargeImage(vint itemIndex)override; + WString GetText(vint itemIndex)override; + WString GetSubItem(vint itemIndex, vint index)override; + vint GetDataColumnCount()override; + vint GetDataColumn(vint index)override; + vint GetColumnCount()override; + WString GetColumnText(vint index)override; + // ===================== list::ListViewColumnItemArranger::IColumnItemView ===================== + + bool AttachCallback(list::ListViewColumnItemArranger::IColumnItemViewCallback* value)override; + bool DetachCallback(list::ListViewColumnItemArranger::IColumnItemViewCallback* value)override; + vint GetColumnSize(vint index)override; + void SetColumnSize(vint index, vint value)override; + GuiMenu* GetDropdownPopup(vint index)override; + ColumnSortingState GetSortingState(vint index)override; + }; -namespace vl -{ - namespace presentation - { - namespace controls - { - ///List view column header control for detailed view. - class GuiListViewColumnHeader : public GuiMenuButton, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ListViewColumnHeaderTemplate, GuiMenuButton) protected: - ColumnSortingState columnSortingState = ColumnSortingState::NotSorted; + ItemSource* itemSource; public: - /// Create a control with a specified default theme. + /// Create a bindable List view control. /// The theme name for retriving a default control template. - GuiListViewColumnHeader(theme::ThemeName themeName); - ~GuiListViewColumnHeader(); + GuiBindableListView(theme::ThemeName themeName); + ~GuiBindableListView(); - bool IsAltAvailable()override; + /// Get all data columns indices in columns. + /// All data columns indices in columns. + list::ListViewDataColumns& GetDataColumns(); + /// Get all columns. + /// All columns. + list::ListViewColumns& GetColumns(); - /// Get the column sorting state. - /// The column sorting state. - ColumnSortingState GetColumnSortingState(); - /// Set the column sorting state. - /// The new column sorting state. - void SetColumnSortingState(ColumnSortingState value); - }; + /// Get the item source. + /// The item source. + Ptr GetItemSource(); + /// Set the item source. + /// The item source. Null is acceptable if you want to clear all data. + void SetItemSource(Ptr _itemSource); + + /// Large image property name changed event. + compositions::GuiNotifyEvent LargeImagePropertyChanged; + /// Small image property name changed event. + compositions::GuiNotifyEvent SmallImagePropertyChanged; + + /// Get the large image property name to get the large image from an item. + /// The large image property name. + ItemProperty> GetLargeImageProperty(); + /// Set the large image property name to get the large image from an item. + /// The large image property name. + void SetLargeImageProperty(const ItemProperty>& value); + + /// Get the small image property name to get the small image from an item. + /// The small image property name. + ItemProperty> GetSmallImageProperty(); + /// Set the small image property name to get the small image from an item. + /// The small image property name. + void SetSmallImageProperty(const ItemProperty>& value); - /// List view base control. All list view controls inherit from this class. - class GuiListViewBase : public GuiSelectableListControl, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(ListViewTemplate, GuiSelectableListControl) - public: - /// Create a list view base control. - /// The theme name for retriving a default control template. - /// The item provider for this control. - GuiListViewBase(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider); - ~GuiListViewBase(); + /// Get the selected item. + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + description::Value GetSelectedItem(); - /// Column clicked event. - compositions::GuiItemNotifyEvent ColumnClicked; + /// Notify the control that data in some items are modified. + /// The index of the first item. + /// The number of items + /// Returns true if this operation succeeded. + bool NotifyItemDataModified(vint start, vint count); }; /*********************************************************************** -ListView ItemStyleProvider +GuiBindableTreeView ***********************************************************************/ - - namespace list + + /// A bindable Tree view control. + class GuiBindableTreeView : public GuiVirtualTreeView, public Description { - /// The required view for . - class IListViewItemView : public virtual IDescriptable, public Description + using IValueEnumerable = reflection::description::IValueEnumerable; + protected: + class ItemSource; + + class ItemSourceNode + : public Object + , public virtual tree::INodeProvider { + friend class ItemSource; + typedef collections::List> NodeList; + protected: + description::Value itemSource; + ItemSource* rootProvider; + ItemSourceNode* parent; + tree::INodeProviderCallback* callback; + bool expanding = false; + + Ptr itemChangedEventHandler; + Ptr childrenVirtualList; + NodeList children; + + Ptr PrepareValueList(const description::Value& inputItemSource); + void PrepareChildren(Ptr newValueList); + void UnprepareChildren(); + void PrepareReverseMapping(); + void UnprepareReverseMapping(); public: - /// The identifier for this view. - static const wchar_t* const Identifier; + ItemSourceNode(const description::Value& _itemSource, ItemSourceNode* _parent); + ItemSourceNode(ItemSource* _rootProvider); + ~ItemSourceNode(); - /// Get the small image of an item. - /// The small image. - /// The index of the item. - virtual Ptr GetSmallImage(vint itemIndex) = 0; - /// Get the large image of an item. - /// The large image. - /// The index of the item. - virtual Ptr GetLargeImage(vint itemIndex) = 0; - /// Get the text of an item. - /// The text. - /// The index of the item. - virtual WString GetText(vint itemIndex) = 0; - /// Get the sub item text of an item. If the sub item index out of range, it returns an empty string. - /// The sub item text. - /// The index of the item. - /// The sub item index of the item. - virtual WString GetSubItem(vint itemIndex, vint index) = 0; + description::Value GetItemSource(); + void SetItemSource(const description::Value& _itemSource); - /// Get the number of data columns. - /// The number of data columns. - virtual vint GetDataColumnCount() = 0; - /// Get the column index of the index-th data column. - /// The column index. - /// The order of the data column. - virtual vint GetDataColumn(vint index) = 0; + // ===================== tree::INodeProvider ===================== - /// Get the number of all columns. - /// The number of all columns. - virtual vint GetColumnCount() = 0; - /// Get the text of the column. - /// The text of the column. - /// The index of the column. - virtual WString GetColumnText(vint index) = 0; - }; + bool GetExpanding()override; + void SetExpanding(bool value)override; + vint CalculateTotalVisibleNodes()override; + void NotifyDataModified()override; -/*********************************************************************** -ListViewColumnItemArranger -***********************************************************************/ + vint GetChildCount()override; + Ptr GetParent()override; + Ptr GetChild(vint index)override; + }; - /// List view column item arranger. This arranger contains column headers. When an column header is resized, all items will be notified via the [T:vl.presentation.controls.list.ListViewColumnItemArranger.IColumnItemView] for . - class ListViewColumnItemArranger : public VirtualRepeatRangedItemArrangerBase, public Description + class ItemSource + : public tree::NodeRootProviderBase + , public virtual tree::ITreeViewItemView { - using TBase = VirtualRepeatRangedItemArrangerBase; - typedef collections::List ColumnHeaderButtonList; - typedef collections::List ColumnHeaderSplitterList; + friend class ItemSourceNode; public: - static const vint SplitterWidth = 8; - - /// Callback for [T:vl.presentation.controls.list.ListViewColumnItemArranger.IColumnItemView]. Column item view use this interface to notify column related modification. - class IColumnItemViewCallback : public virtual IDescriptable, public Description - { - public: - /// Called when any column object is changed (inserted, removed, updated binding, etc.). - virtual void OnColumnRebuilt()=0; + WritableItemProperty reverseMappingProperty; + ItemProperty textProperty; + ItemProperty> imageProperty; + ItemProperty> childrenProperty; + Ptr rootNode; - /// Called when any property of a column is changed (size changed, text changed, etc.). - virtual void OnColumnChanged(bool needToRefreshItems)=0; - }; - - /// The required view for . - class IColumnItemView : public virtual IDescriptable, public Description - { - public: - /// The identifier for this view. - static const wchar_t* const Identifier; - - /// Attach an column item view callback to this view. - /// Returns true if this operation succeeded. - /// The column item view callback. - virtual bool AttachCallback(IColumnItemViewCallback* value)=0; - /// Detach an column item view callback from this view. - /// Returns true if this operation succeeded. - /// The column item view callback. - virtual bool DetachCallback(IColumnItemViewCallback* value)=0; + public: + ItemSource(); + ~ItemSource(); - /// Get the size of the column. - /// The size of the column. - /// The index of the column. - virtual vint GetColumnSize(vint index)=0; - /// Set the size of the column. - /// The index of the column. - /// The new size of the column. - virtual void SetColumnSize(vint index, vint value)=0; + description::Value GetItemSource(); + void SetItemSource(const description::Value& _itemSource); - /// Get the popup binded to the column. - /// The popup binded to the column. - /// The index of the column. - virtual GuiMenu* GetDropdownPopup(vint index)=0; - /// Get the sorting state of the column. - /// The sorting state of the column. - /// The index of the column. - virtual ColumnSortingState GetSortingState(vint index)=0; - }; - protected: - class ColumnItemViewCallback : public Object, public virtual IColumnItemViewCallback - { - protected: - ListViewColumnItemArranger* arranger = nullptr; + void UpdateBindingProperties(bool updateChildrenProperty); - public: - ColumnItemViewCallback(ListViewColumnItemArranger* _arranger); - ~ColumnItemViewCallback(); + // ===================== tree::INodeRootProvider ===================== - void OnColumnRebuilt() override; - void OnColumnChanged(bool needToRefreshItems) override; - }; + Ptr GetRootNode()override; + WString GetTextValue(tree::INodeProvider* node)override; + description::Value GetBindingValue(tree::INodeProvider* node)override; + IDescriptable* RequestView(const WString& identifier)override; - class ColumnItemArrangerRepeatComposition : public TBase::ArrangerRepeatComposition - { - protected: - ListViewColumnItemArranger* arranger = nullptr; + // ===================== tree::ITreeViewItemView ===================== - void Layout_EndLayout(bool totalSizeUpdated) override; - Size Layout_CalculateTotalSize() override; - public: - ColumnItemArrangerRepeatComposition(ListViewColumnItemArranger* _arranger); - }; + Ptr GetNodeImage(tree::INodeProvider* node)override; + }; - GuiListViewBase* listView = nullptr; - IListViewItemView* listViewItemView = nullptr; - IColumnItemView* columnItemView = nullptr; - Ptr columnItemViewCallback; - compositions::GuiStackComposition* columnHeaders = nullptr; - ColumnHeaderButtonList columnHeaderButtons; - ColumnHeaderSplitterList columnHeaderSplitters; - bool splitterDragging = false; - vint splitterLatestX = 0; + protected: + ItemSource* itemSource; - void OnViewLocationChanged(compositions::GuiGraphicsComposition* composition, compositions::GuiEventArgs& arguments); - void ColumnClicked(vint index, compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void ColumnCachedBoundsChanged(vint index, compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void ColumnHeaderSplitterLeftButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void ColumnHeaderSplitterLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void ColumnHeaderSplitterMouseMove(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + public: + /// Create a bindable Tree view control. + /// The theme name for retriving a default control template. + /// (Optional): The value of . + GuiBindableTreeView(theme::ThemeName themeName, WritableItemProperty reverseMappingProperty = {}); + ~GuiBindableTreeView(); + + /// Text property name changed event. + compositions::GuiNotifyEvent TextPropertyChanged; + /// Image property name changed event. + compositions::GuiNotifyEvent ImagePropertyChanged; + /// Children property name changed event. + compositions::GuiNotifyEvent ChildrenPropertyChanged; - void FixColumnsAfterViewLocationChanged(); - void FixColumnsAfterLayout(); - vint GetColumnsWidth(); - vint GetColumnsYOffset(); - void DeleteColumnButtons(); - void RebuildColumns(); - void RefreshColumns(); - public: - ListViewColumnItemArranger(); - ~ListViewColumnItemArranger(); + /// Get the item source. + /// The item source. + description::Value GetItemSource(); + /// Set the item source. + /// The item source. Null is acceptable if you want to clear all data. + void SetItemSource(description::Value _itemSource); + + /// + /// Get the reverse mapping property name to store the internal tree view node for an item. + /// The value is set in the constructor. + /// Using this property makes items in item source exclusive to a treeview control. + /// Sharing such item in different treeview controls causes exceptions. + /// + /// The reverse mapping property name. + WritableItemProperty GetReverseMappingProperty(); + + /// Get the text property name to get the item text from an item. + /// The text property name. + ItemProperty GetTextProperty(); + /// Set the text property name to get the item text from an item. + /// The text property name. + void SetTextProperty(const ItemProperty& value); + + /// Get the image property name to get the image from an item. + /// The image property name. + ItemProperty> GetImageProperty(); + /// Set the image property name to get the image from an item. + /// The image property name. + void SetImageProperty(const ItemProperty>& value); + + /// Get the children property name to get the children from an item. + /// The children property name. + ItemProperty> GetChildrenProperty(); + /// Set the children property name to get the children from an item. + /// The children property name. + void SetChildrenProperty(const ItemProperty>& value); + + /// Get the selected item. + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + description::Value GetSelectedItem(); + + /// Notify the control that data in an item is modified. Child nodes are not notified. + /// The item from the item source. + /// Returns true if this operation succeeded. + void NotifyNodeDataModified(description::Value value); + }; + } + } +} + +#endif - Size GetTotalSize()override; - void AttachListControl(GuiListControl* value)override; - void DetachListControl()override; - }; - } /*********************************************************************** -ListViewItemProvider +.\CONTROLS\LISTCONTROLPACKAGE\GUIDATAGRIDINTERFACES.H ***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System - namespace list - { - class ListViewItem; - - class ListViewSubItems : public collections::ObservableListBase - { - friend class ListViewItem; - protected: - ListViewItem* owner; - - void NotifyUpdateInternal(vint start, vint count, vint newCount)override; - public: - }; +Interfaces: +***********************************************************************/ - class ListViewItemProvider; +#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDINTERFACES +#define VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDINTERFACES - /// List view item. - class ListViewItem : public Object, public Description - { - friend class ListViewSubItems; - friend class ListViewItemProvider; - protected: - ListViewItemProvider* owner; - ListViewSubItems subItems; - Ptr smallImage; - Ptr largeImage; - WString text; - description::Value tag; - - void NotifyUpdate(); - public: - /// Create a list view item. - ListViewItem(); - - /// Get all sub items of this item. - /// All sub items of this item. - ListViewSubItems& GetSubItems(); - /// Get the small image of this item. - /// The small image of this item. - Ptr GetSmallImage(); - /// Set the small image of this item. - /// The small image of this item. - void SetSmallImage(Ptr value); - /// Get the large image of this item. - /// The large image of this item. - Ptr GetLargeImage(); - /// Set the large image of this item. - /// The large image of this item. - void SetLargeImage(Ptr value); - /// Get the text of this item. - /// The text of this item. - const WString& GetText(); - /// Set the text of this item. - /// The text of this item. - void SetText(const WString& value); - /// Get the tag of this item. - /// The tag of this item. - description::Value GetTag(); - /// Set the tag of this item. - /// The tag of this item. - void SetTag(const description::Value& value); - }; - class ListViewColumns; - - /// List view column. - class ListViewColumn : public Object, public Description - { - friend class ListViewColumns; - protected: - ListViewColumns* owner = nullptr; - WString text; - ItemProperty textProperty; - vint size; - bool ownPopup = true; - GuiMenu* dropdownPopup = nullptr; - ColumnSortingState sortingState = ColumnSortingState::NotSorted; - - void NotifyRebuilt(); - void NotifyChanged(bool needToRefreshItems); - public: - /// Create a column with the specified text and size. - /// The specified text. - /// The specified size. - ListViewColumn(const WString& _text=L"", vint _size=160); - ~ListViewColumn(); - - /// Get the text of this item. - /// The text of this item. - const WString& GetText(); - /// Set the text of this item. - /// The text of this item. - void SetText(const WString& value); - /// Get the text property of this item. - /// The text property of this item. - ItemProperty GetTextProperty(); - /// Set the text property of this item. - /// The text property of this item. - void SetTextProperty(const ItemProperty& value); - /// Get the size of this item. - /// The size of this item. - vint GetSize(); - /// Set the size of this item. - /// The size of this item. - void SetSize(vint value); - /// Test if the column owns the popup. Owned popup will be deleted in the destructor. - /// Returns true if the column owns the popup. - bool GetOwnPopup(); - /// Set if the column owns the popup. - /// Set to true to let the column own the popup. - void SetOwnPopup(bool value); - /// Get the dropdown context menu of this item. - /// The dropdown context menu of this item. - GuiMenu* GetDropdownPopup(); - /// Set the dropdown context menu of this item. - /// The dropdown context menu of this item. - void SetDropdownPopup(GuiMenu* value); - /// Get the sorting state of this item. - /// The sorting state of this item. - ColumnSortingState GetSortingState(); - /// Set the sorting state of this item. - /// The sorting state of this item. - void SetSortingState(ColumnSortingState value); - }; +namespace vl +{ + namespace presentation + { + namespace controls + { + namespace list + { - class IListViewItemProvider : public virtual Interface +/*********************************************************************** +Datagrid Interfaces +***********************************************************************/ + + class IDataVisualizer; + class IDataEditor; + + /// The data grid context. + class IDataGridContext : public virtual IDescriptable, public Description { public: - virtual void RebuildAllItems() = 0; - virtual void RefreshAllItems() = 0; - virtual void NotifyColumnRebuilt() = 0; - virtual void NotifyColumnChanged() = 0; + virtual GuiListControl::IItemProvider* GetItemProvider() = 0; + virtual templates::GuiListViewTemplate* GetListViewControlTemplate() = 0; + virtual void RequestSaveData() = 0; }; - /// List view data column container. - class ListViewDataColumns : public collections::ObservableListBase + /// The visualizer factory. + class IDataVisualizerFactory : public virtual IDescriptable, public Description { - protected: - IListViewItemProvider* itemProvider; - - void NotifyUpdateInternal(vint start, vint count, vint newCount)override; public: - /// Create a container. - /// The item provider in the same control to receive notifications. - ListViewDataColumns(IListViewItemProvider* _itemProvider); - ~ListViewDataColumns(); + /// Create a data visualizer. + /// The created data visualizer. + /// Context information of the data grid. + virtual Ptr CreateVisualizer(IDataGridContext* dataGridContext) = 0; }; - - /// List view column container. - class ListViewColumns : public collections::ObservableListBase> - { - friend class ListViewColumn; - protected: - IListViewItemProvider* itemProvider; - bool affectItemFlag = true; - void NotifyColumnRebuilt(vint column); - void NotifyColumnChanged(vint column, bool needToRefreshItems); - void AfterInsert(vint index, const Ptr& value)override; - void BeforeRemove(vint index, const Ptr& value)override; - void NotifyUpdateInternal(vint start, vint count, vint newCount)override; - public: - /// Create a container. - /// The item provider in the same control to receive notifications. - ListViewColumns(IListViewItemProvider* _itemProvider); - ~ListViewColumns(); - }; - - /// Item provider for . - class ListViewItemProvider - : public ListProvider> - , protected virtual IListViewItemProvider - , public virtual IListViewItemView - , public virtual ListViewColumnItemArranger::IColumnItemView - , public Description + /// The visualizer for each cell in [T:vl.presentation.controls.GuiVirtualDataGrid]. + class IDataVisualizer : public virtual IDescriptable, public Description { - friend class ListViewItem; - friend class ListViewColumns; - friend class ListViewDataColumns; - typedef collections::List ColumnItemViewCallbackList; - protected: - ListViewDataColumns dataColumns; - ListViewColumns columns; - ColumnItemViewCallbackList columnItemViewCallbacks; + public: + /// Get the factory object that creates this visualizer. + /// The factory object. + virtual IDataVisualizerFactory* GetFactory() = 0; - void AfterInsert(vint index, const Ptr& value)override; - void BeforeRemove(vint index, const Ptr& value)override; + /// Get the template that renders the data. The data visualizer should maintain this template, and delete it when necessary. + /// The template. + virtual templates::GuiGridVisualizerTemplate* GetTemplate() = 0; + /// Notify that the template has been deleted during the deconstruction of UI objects. + virtual void NotifyDeletedTemplate() = 0; - // ===================== list::IListViewItemProvider ===================== + /// Called before visualizing a cell. + /// The item provider. + /// The row number of the cell. + /// The column number of the cell. + virtual void BeforeVisualizeCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column) = 0; - void RebuildAllItems() override; - void RefreshAllItems() override; - void NotifyColumnRebuilt() override; - void NotifyColumnChanged() override; + /// Set the selected state. + /// Set to true to make this data visualizer looks selected. + virtual void SetSelected(bool value) = 0; + }; + /// The editor factory. + class IDataEditorFactory : public virtual IDescriptable, public Description + { public: - ListViewItemProvider(); - ~ListViewItemProvider(); - - // ===================== GuiListControl::IItemProvider ===================== - - WString GetTextValue(vint itemIndex)override; - description::Value GetBindingValue(vint itemIndex)override; - IDescriptable* RequestView(const WString& identifier)override; - - // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== + /// Create a data editor. + /// The created data editor. + /// Context information of the data grid. + virtual Ptr CreateEditor(IDataGridContext* dataGridContext) = 0; + }; - Ptr GetSmallImage(vint itemIndex)override; - Ptr GetLargeImage(vint itemIndex)override; - WString GetText(vint itemIndex)override; - WString GetSubItem(vint itemIndex, vint index)override; - vint GetDataColumnCount()override; - vint GetDataColumn(vint index)override; - vint GetColumnCount()override; - WString GetColumnText(vint index)override; + /// The editor for each cell in [T:vl.presentation.controls.GuiVirtualDataGrid]. + class IDataEditor : public virtual IDescriptable, public Description + { + public: + /// Get the factory object that creates this editor. + /// The factory object. + virtual IDataEditorFactory* GetFactory() = 0; - // ===================== list::ListViewColumnItemArranger::IColumnItemView ===================== + /// Get the template that edit the data. The data editor should maintain this template, and delete it when necessary. + /// The template. + virtual templates::GuiGridEditorTemplate* GetTemplate() = 0; + /// Notify that the template has been deleted during the deconstruction of UI objects. + virtual void NotifyDeletedTemplate() = 0; - bool AttachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; - bool DetachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; - vint GetColumnSize(vint index)override; - void SetColumnSize(vint index, vint value)override; - GuiMenu* GetDropdownPopup(vint index)override; - ColumnSortingState GetSortingState(vint index)override; + /// Called before editing a cell. + /// The item provider. + /// The row number of the cell. + /// The column number of the cell. + virtual void BeforeEditCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column) = 0; - /// Get all data columns indices in columns. - /// All data columns indices in columns. - ListViewDataColumns& GetDataColumns(); - /// Get all columns. - /// All columns. - ListViewColumns& GetColumns(); + /// Test if the edit has saved the data. + /// Returns true if the data is saved. + virtual bool GetCellValueSaved() = 0; }; - } - -/*********************************************************************** -GuiVirtualListView -***********************************************************************/ - enum class ListViewView - { - BigIcon, - SmallIcon, - List, - Tile, - Information, - Detail, - Unknown, - }; - - /// List view control in virtual mode. - class GuiVirtualListView : public GuiListViewBase, public Description - { - protected: - ListViewView view = ListViewView::Unknown; - - void OnStyleInstalled(vint itemIndex, ItemStyle* style, bool refreshPropertiesOnly)override; - void OnItemTemplateChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - /// Create a list view control in virtual mode. - /// The theme name for retriving a default control template. - /// The item provider for this control. - GuiVirtualListView(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider); - ~GuiVirtualListView(); - - /// Get the current view. - /// The current view. After [M:vl.presentation.controls.GuiListControl.SetItemTemplate] is called, the current view is reset to Unknown. - ListViewView GetView(); - /// Set the current view. - /// The current view. - void SetView(ListViewView _view); - }; + /// The required view for [T:vl.presentation.controls.GuiVirtualDataGrid]. + class IDataGridView : public virtual IDescriptable, public Description + { + public: + /// The identifier for this view. + static const wchar_t* const Identifier; -/*********************************************************************** -GuiListView -***********************************************************************/ - - /// List view control in virtual mode. - class GuiListView : public GuiVirtualListView, public Description - { - protected: - list::ListViewItemProvider* items; - public: - /// Create a list view control. - /// The theme name for retriving a default control template. - GuiListView(theme::ThemeName themeName); - ~GuiListView(); - - /// Get all list view items. - /// All list view items. - list::ListViewItemProvider& GetItems(); - /// Get all data columns indices in columns. - /// All data columns indices in columns. - list::ListViewDataColumns& GetDataColumns(); - /// Get all columns. - /// All columns. - list::ListViewColumns& GetColumns(); + /// Test is a column sortable. + /// Returns true if this column is sortable. + /// The index of the column. + virtual bool IsColumnSortable(vint column) = 0; + /// Set the column sorting state to update the data. + /// The index of the column. Set to -1 means go back to the unsorted state. + /// Set to true if the data is sorted in ascending order. + virtual void SortByColumn(vint column, bool ascending) = 0; + /// Get the sorted columm. If no column is under a sorted state, it returns -1. + /// The column number. + virtual vint GetSortedColumn() = 0; + /// Test is the sort order ascending. + /// Returns true if the sort order is ascending. + virtual bool IsSortOrderAscending() = 0; - /// Get the selected item. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - Ptr GetSelectedItem(); - }; + /// Get the column span for the cell. + /// The column span for the cell. + /// The row number for the cell. + /// The column number for the cell. + virtual vint GetCellSpan(vint row, vint column) = 0; + /// Get the data visualizer factory that creates data visualizers for visualizing the cell. + /// The data visualizer factory. The data grid control to use the predefined data visualizer if this function returns null. + /// The row number for the cell. + /// The column number for the cell. + virtual IDataVisualizerFactory* GetCellDataVisualizerFactory(vint row, vint column) = 0; + /// Get the data editor factory that creates data editors for editing the cell. + /// The data editor factory. Returns null to disable editing. + /// The row number for the cell. + /// The column number for the cell. + virtual IDataEditorFactory* GetCellDataEditorFactory(vint row, vint column) = 0; + /// Get the binding value of a cell. + /// The binding value of cell. + /// The row index of the cell. + /// The column index of the cell. + virtual description::Value GetBindingCellValue(vint row, vint column) = 0; + /// Set the binding value of a cell. + /// The row index of the cell. + /// The column index of the cell. + /// The value to set. + virtual void SetBindingCellValue(vint row, vint column, const description::Value& value) = 0; + }; + } } } } #endif + /*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUIBINDABLELISTCONTROLS.H +.\CONTROLS\LISTCONTROLPACKAGE\GUIDATAGRIDEXTENSIONS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -19164,8 +19391,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIBINDABLELISTCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIBINDABLELISTCONTROLS +#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATAEXTENSIONS +#define VCZH_PRESENTATION_CONTROLS_GUIDATAEXTENSIONS namespace vl @@ -19174,434 +19401,445 @@ namespace vl { namespace controls { - template - struct DefaultValueOf + namespace list { - static T Get() - { - return reflection::description::TypedValueSerializerProvider::GetDefaultValue(); - } - }; - template - struct DefaultValueOf> - { - static Ptr Get() - { - return nullptr; - } - }; +/*********************************************************************** +Extension Bases +***********************************************************************/ - template<> - struct DefaultValueOf - { - static description::Value Get() + class DataVisualizerFactory; + class DataEditorFactory; + + /// Base class for all data visualizers. + class DataVisualizerBase : public Object, public virtual IDataVisualizer { - return description::Value(); - } - }; + friend class DataVisualizerFactory; + using ItemTemplate = templates::GuiGridVisualizerTemplate; + protected: + DataVisualizerFactory* factory = nullptr; + IDataGridContext* dataGridContext = nullptr; + templates::GuiGridVisualizerTemplate* visualizerTemplate = nullptr; - template - T ReadProperty(const description::Value& thisObject, const ItemProperty& propertyName) - { - if (!thisObject.IsNull() && propertyName) - { - return propertyName(thisObject); - } - else - { - return DefaultValueOf::Get(); - } - } + public: + /// Create the data visualizer. + DataVisualizerBase(); + ~DataVisualizerBase(); - template - T ReadProperty(const description::Value& thisObject, const WritableItemProperty& propertyName) - { - auto defaultValue = DefaultValueOf::Get(); - if (!thisObject.IsNull() && propertyName) + IDataVisualizerFactory* GetFactory()override; + templates::GuiGridVisualizerTemplate* GetTemplate()override; + void NotifyDeletedTemplate()override; + void BeforeVisualizeCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column)override; + void SetSelected(bool value)override; + }; + + class DataVisualizerFactory : public Object, public virtual IDataVisualizerFactory, public Description { - return propertyName(thisObject, defaultValue, false); - } - else + using ItemTemplate = templates::GuiGridVisualizerTemplate; + protected: + TemplateProperty templateFactory; + Ptr decoratedFactory; + + ItemTemplate* CreateItemTemplate(controls::list::IDataGridContext* dataGridContext); + public: + DataVisualizerFactory(TemplateProperty _templateFactory, Ptr _decoratedFactory = nullptr); + ~DataVisualizerFactory(); + + Ptr CreateVisualizer(IDataGridContext* dataGridContext)override; + }; + + /// Base class for all data editors. + class DataEditorBase : public Object, public virtual IDataEditor { - return defaultValue; - } - } + friend class DataEditorFactory; + using ItemTemplate = templates::GuiGridEditorTemplate; + protected: + IDataEditorFactory* factory = nullptr; + IDataGridContext* dataGridContext = nullptr; + templates::GuiGridEditorTemplate* editorTemplate = nullptr; - template - void WriteProperty(const description::Value& thisObject, const WritableItemProperty& propertyName, const T& value) - { - if (!thisObject.IsNull() && propertyName) + void OnCellValueChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + /// Create the data editor. + DataEditorBase(); + ~DataEditorBase(); + + IDataEditorFactory* GetFactory()override; + templates::GuiGridEditorTemplate* GetTemplate()override; + void NotifyDeletedTemplate()override; + void BeforeEditCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column)override; + bool GetCellValueSaved()override; + }; + + class DataEditorFactory : public Object, public virtual IDataEditorFactory, public Description { - propertyName(thisObject, value, true); - } - } + using ItemTemplate = templates::GuiGridEditorTemplate; + protected: + TemplateProperty templateFactory; + + public: + DataEditorFactory(TemplateProperty _templateFactory); + ~DataEditorFactory(); + + Ptr CreateEditor(IDataGridContext* dataGridContext)override; + }; /*********************************************************************** -GuiBindableTextList +Visualizer Extensions ***********************************************************************/ - /// A bindable Text list control. - class GuiBindableTextList : public GuiVirtualTextList, public Description - { - protected: - class ItemSource - : public list::ItemProviderBase - , protected list::ITextItemView + class MainColumnVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description { protected: - Ptr itemChangedEventHandler; - Ptr itemSource; + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; + void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnTextColorChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnSmallImageChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: - ItemProperty textProperty; - WritableItemProperty checkedProperty; + MainColumnVisualizerTemplate(); + ~MainColumnVisualizerTemplate(); + }; - public: - ItemSource(); - ~ItemSource(); + class SubColumnVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description + { + protected: + elements::GuiSolidLabelElement* text = nullptr; - Ptr GetItemSource(); - void SetItemSource(Ptr _itemSource); + void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnTextColorChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void Initialize(bool fixTextColor); - description::Value Get(vint index); - void UpdateBindingProperties(); - bool NotifyUpdate(vint start, vint count, bool itemReferenceUpdated); - - // ===================== GuiListControl::IItemProvider ===================== + SubColumnVisualizerTemplate(bool fixTextColor); + public: + SubColumnVisualizerTemplate(); + ~SubColumnVisualizerTemplate(); + }; - WString GetTextValue(vint itemIndex)override; - description::Value GetBindingValue(vint itemIndex)override; - vint Count()override; - IDescriptable* RequestView(const WString& identifier)override; - - // ===================== list::TextItemStyleProvider::ITextItemView ===================== + class HyperlinkVisualizerTemplate : public SubColumnVisualizerTemplate, public Description + { + protected: + void label_MouseEnter(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void label_MouseLeave(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - bool GetChecked(vint itemIndex)override; - void SetChecked(vint itemIndex, bool value)override; + public: + HyperlinkVisualizerTemplate(); + ~HyperlinkVisualizerTemplate(); }; - protected: - ItemSource* itemSource; + class FocusRectangleVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description + { + protected: + compositions::GuiBoundsComposition* focusComposition = nullptr; - public: - /// Create a bindable Text list control. - /// The theme name for retriving a default control template. - GuiBindableTextList(theme::ThemeName themeName); - ~GuiBindableTextList(); - - /// Text property name changed event. - compositions::GuiNotifyEvent TextPropertyChanged; - /// Checked property name changed event. - compositions::GuiNotifyEvent CheckedPropertyChanged; + void OnSelectedChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - /// Get the item source. - /// The item source. - Ptr GetItemSource(); - /// Set the item source. - /// The item source. Null is acceptable if you want to clear all data. - void SetItemSource(Ptr _itemSource); - - /// Get the text property name to get the item text from an item. - /// The text property name. - ItemProperty GetTextProperty(); - /// Set the text property name to get the item text from an item. - /// The text property name. - void SetTextProperty(const ItemProperty& value); - - /// Get the checked property name to get the check state from an item. - /// The checked property name. - WritableItemProperty GetCheckedProperty(); - /// Set the checked property name to get the check state from an item. - /// The checked property name. - void SetCheckedProperty(const WritableItemProperty& value); + public: + FocusRectangleVisualizerTemplate(); + ~FocusRectangleVisualizerTemplate(); + }; - /// Get the selected item. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - description::Value GetSelectedItem(); + class CellBorderVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description + { + protected: + elements::GuiSolidBorderElement* border1 = nullptr; + elements::GuiSolidBorderElement* border2 = nullptr; + + void OnItemSeparatorColorChanged(GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - /// Notify the control that data in some items are modified. - /// The index of the first item. - /// The number of items - /// Returns true if this operation succeeded. - bool NotifyItemDataModified(vint start, vint count); - }; + public: + CellBorderVisualizerTemplate(); + ~CellBorderVisualizerTemplate(); + }; + } + } + } +} + +#endif /*********************************************************************** -GuiBindableListView +.\CONTROLS\LISTCONTROLPACKAGE\GUILISTVIEWITEMTEMPLATES.H ***********************************************************************/ - - /// A bindable List view control. - class GuiBindableListView : public GuiVirtualListView, public Description +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System + +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_CONTROLS_GUILISTVIEWITEMTEMPLATES +#define VCZH_PRESENTATION_CONTROLS_GUILISTVIEWITEMTEMPLATES + + +namespace vl +{ + namespace presentation + { + namespace controls + { + namespace list { - protected: - class ItemSource - : public list::ItemProviderBase - , protected virtual list::IListViewItemProvider - , public virtual list::IListViewItemView - , public virtual list::ListViewColumnItemArranger::IColumnItemView + class DefaultListViewItemTemplate : public PredefinedListItemTemplate + { + public: + DefaultListViewItemTemplate(); + ~DefaultListViewItemTemplate(); + }; + + class BigIconListViewItemTemplate : public DefaultListViewItemTemplate { - typedef collections::List ColumnItemViewCallbackList; protected: - list::ListViewDataColumns dataColumns; - list::ListViewColumns columns; - ColumnItemViewCallbackList columnItemViewCallbacks; - Ptr itemChangedEventHandler; - Ptr itemSource; + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; + void OnInitialize()override; + void OnRefresh()override; + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: - ItemProperty> largeImageProperty; - ItemProperty> smallImageProperty; + BigIconListViewItemTemplate(); + ~BigIconListViewItemTemplate(); + }; + + class SmallIconListViewItemTemplate : public DefaultListViewItemTemplate + { + protected: + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; + void OnInitialize()override; + void OnRefresh()override; + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: - ItemSource(); - ~ItemSource(); + SmallIconListViewItemTemplate(); + ~SmallIconListViewItemTemplate(); + }; - Ptr GetItemSource(); - void SetItemSource(Ptr _itemSource); - - description::Value Get(vint index); - void UpdateBindingProperties(); - bool NotifyUpdate(vint start, vint count, bool itemReferenceUpdated); - list::ListViewDataColumns& GetDataColumns(); - list::ListViewColumns& GetColumns(); - - // ===================== list::IListViewItemProvider ===================== + class ListListViewItemTemplate : public DefaultListViewItemTemplate + { + protected: + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; - void RebuildAllItems() override; - void RefreshAllItems() override; - void NotifyColumnRebuilt() override; - void NotifyColumnChanged() override; - - // ===================== GuiListControl::IItemProvider ===================== + void OnInitialize()override; + void OnRefresh()override; + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + ListListViewItemTemplate(); + ~ListListViewItemTemplate(); + }; - WString GetTextValue(vint itemIndex)override; - description::Value GetBindingValue(vint itemIndex)override; - vint Count()override; - IDescriptable* RequestView(const WString& identifier)override; + class TileListViewItemTemplate : public DefaultListViewItemTemplate + { + typedef collections::Array DataTextElementArray; + protected: + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; + compositions::GuiTableComposition* textTable = nullptr; + DataTextElementArray dataTexts; - // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== + elements::GuiSolidLabelElement* CreateTextElement(vint textRow); + void ResetTextTable(vint dataColumnCount); + void OnInitialize()override; + void OnRefresh()override; + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + TileListViewItemTemplate(); + ~TileListViewItemTemplate(); + }; - Ptr GetSmallImage(vint itemIndex)override; - Ptr GetLargeImage(vint itemIndex)override; - WString GetText(vint itemIndex)override; - WString GetSubItem(vint itemIndex, vint index)override; - vint GetDataColumnCount()override; - vint GetDataColumn(vint index)override; - vint GetColumnCount()override; - WString GetColumnText(vint index)override; + class InformationListViewItemTemplate : public DefaultListViewItemTemplate + { + typedef collections::Array DataTextElementArray; + protected: + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; + compositions::GuiTableComposition* textTable = nullptr; + DataTextElementArray columnTexts; + DataTextElementArray dataTexts; + elements::GuiSolidBackgroundElement* bottomLine = nullptr; + compositions::GuiBoundsComposition* bottomLineComposition = nullptr; - // ===================== list::ListViewColumnItemArranger::IColumnItemView ===================== - - bool AttachCallback(list::ListViewColumnItemArranger::IColumnItemViewCallback* value)override; - bool DetachCallback(list::ListViewColumnItemArranger::IColumnItemViewCallback* value)override; - vint GetColumnSize(vint index)override; - void SetColumnSize(vint index, vint value)override; - GuiMenu* GetDropdownPopup(vint index)override; - ColumnSortingState GetSortingState(vint index)override; + void ResetTextTable(vint dataColumnCount); + void OnInitialize()override; + void OnRefresh()override; + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + InformationListViewItemTemplate(); + ~InformationListViewItemTemplate(); }; - protected: - ItemSource* itemSource; + class DetailListViewItemTemplate + : public DefaultListViewItemTemplate + { + typedef collections::Array SubItemCellList; + typedef collections::Array SubItemTestList; + typedef ListViewColumnItemArranger::IColumnItemView IColumnItemView; + protected: + IColumnItemView* columnItemView = nullptr; + elements::GuiImageFrameElement* image = nullptr; + elements::GuiSolidLabelElement* text = nullptr; + compositions::GuiTableComposition* textTable = nullptr; + SubItemCellList subItemCells; + SubItemTestList subItemTexts; - public: - /// Create a bindable List view control. - /// The theme name for retriving a default control template. - GuiBindableListView(theme::ThemeName themeName); - ~GuiBindableListView(); + void UpdateSubItemSize(); + void ResetTextTable(vint subColumnCount); + void OnInitialize()override; + void OnRefresh()override; + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + DetailListViewItemTemplate(); + ~DetailListViewItemTemplate(); + }; + } + } + } +} - /// Get all data columns indices in columns. - /// All data columns indices in columns. - list::ListViewDataColumns& GetDataColumns(); - /// Get all columns. - /// All columns. - list::ListViewColumns& GetColumns(); +#endif - /// Get the item source. - /// The item source. - Ptr GetItemSource(); - /// Set the item source. - /// The item source. Null is acceptable if you want to clear all data. - void SetItemSource(Ptr _itemSource); - - /// Large image property name changed event. - compositions::GuiNotifyEvent LargeImagePropertyChanged; - /// Small image property name changed event. - compositions::GuiNotifyEvent SmallImagePropertyChanged; - - /// Get the large image property name to get the large image from an item. - /// The large image property name. - ItemProperty> GetLargeImageProperty(); - /// Set the large image property name to get the large image from an item. - /// The large image property name. - void SetLargeImageProperty(const ItemProperty>& value); - - /// Get the small image property name to get the small image from an item. - /// The small image property name. - ItemProperty> GetSmallImageProperty(); - /// Set the small image property name to get the small image from an item. - /// The small image property name. - void SetSmallImageProperty(const ItemProperty>& value); +/*********************************************************************** +.\CONTROLS\LISTCONTROLPACKAGE\GUIDATAGRIDCONTROLS.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System - /// Get the selected item. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - description::Value GetSelectedItem(); +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDCONTROLS + + +namespace vl +{ + namespace presentation + { + namespace controls + { + class GuiVirtualDataGrid; - /// Notify the control that data in some items are modified. - /// The index of the first item. - /// The number of items - /// Returns true if this operation succeeded. - bool NotifyItemDataModified(vint start, vint count); - }; + namespace list + { /*********************************************************************** -GuiBindableTreeView +DefaultDataGridItemTemplate ***********************************************************************/ - - /// A bindable Tree view control. - class GuiBindableTreeView : public GuiVirtualTreeView, public Description - { - using IValueEnumerable = reflection::description::IValueEnumerable; - protected: - class ItemSource; - class ItemSourceNode - : public Object - , public virtual tree::INodeProvider + class DefaultDataGridItemTemplate + : public DefaultListViewItemTemplate { - friend class ItemSource; - typedef collections::List> NodeList; protected: - description::Value itemSource; - ItemSource* rootProvider; - ItemSourceNode* parent; - tree::INodeProviderCallback* callback; - bool expanding = false; + compositions::GuiTableComposition* textTable = nullptr; + collections::Array dataVisualizerFactories; + collections::Array> dataVisualizers; + collections::Array dataCells; + IDataEditor* currentEditor = nullptr; - Ptr itemChangedEventHandler; - Ptr childrenVirtualList; - NodeList children; + IDataVisualizerFactory* GetDataVisualizerFactory(vint row, vint column); + IDataEditorFactory* GetDataEditorFactory(vint row, vint column); + vint GetCellColumnIndex(compositions::GuiGraphicsComposition* composition); + bool IsInEditor(GuiVirtualDataGrid* dataGrid, compositions::GuiMouseEventArgs& arguments); + void OnCellButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void OnCellLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void OnCellRightButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - Ptr PrepareValueList(const description::Value& inputItemSource); - void PrepareChildren(Ptr newValueList); - void UnprepareChildren(); - void PrepareReverseMapping(); - void UnprepareReverseMapping(); + void DeleteAllVisualizers(); + void DeleteVisualizer(vint column); + void ResetDataTable(vint columnCount); + void OnInitialize()override; + void OnRefresh()override; + void OnSelectedChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnVisuallyEnabledChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: - ItemSourceNode(const description::Value& _itemSource, ItemSourceNode* _parent); - ItemSourceNode(ItemSource* _rootProvider); - ~ItemSourceNode(); - - description::Value GetItemSource(); - void SetItemSource(const description::Value& _itemSource); - - // ===================== tree::INodeProvider ===================== - - bool GetExpanding()override; - void SetExpanding(bool value)override; - vint CalculateTotalVisibleNodes()override; - void NotifyDataModified()override; + DefaultDataGridItemTemplate(); + ~DefaultDataGridItemTemplate(); - vint GetChildCount()override; - Ptr GetParent()override; - Ptr GetChild(vint index)override; + void UpdateSubItemSize(); + bool IsEditorOpened(); + void NotifyOpenEditor(vint column, IDataEditor* editor); + void NotifyCloseEditor(); + void NotifySelectCell(vint column); + void NotifyCellEdited(); }; + } - class ItemSource - : public tree::NodeRootProviderBase - , public virtual tree::ITreeViewItemView - { - friend class ItemSourceNode; - public: - WritableItemProperty reverseMappingProperty; - ItemProperty textProperty; - ItemProperty> imageProperty; - ItemProperty> childrenProperty; - Ptr rootNode; - - public: - ItemSource(); - ~ItemSource(); - - description::Value GetItemSource(); - void SetItemSource(const description::Value& _itemSource); - - void UpdateBindingProperties(bool updateChildrenProperty); +/*********************************************************************** +GuiVirtualDataGrid +***********************************************************************/ - // ===================== tree::INodeRootProvider ===================== + /// Data grid control in virtual mode. + class GuiVirtualDataGrid + : public GuiVirtualListView + , protected compositions::GuiAltActionHostBase + , private list::IDataGridContext + , public Description + { + friend class list::DefaultDataGridItemTemplate; + protected: + list::IListViewItemView* listViewItemView = nullptr; + list::ListViewColumnItemArranger::IColumnItemView* columnItemView = nullptr; + list::IDataGridView* dataGridView = nullptr; + Ptr defaultMainColumnVisualizerFactory; + Ptr defaultSubColumnVisualizerFactory; - Ptr GetRootNode()override; - WString GetTextValue(tree::INodeProvider* node)override; - description::Value GetBindingValue(tree::INodeProvider* node)override; - IDescriptable* RequestView(const WString& identifier)override; + bool skipOnSelectionChanged = false; + GridPos selectedCell{ -1,-1 }; + Ptr currentEditor; + GridPos currentEditorPos{ -1,-1 }; + bool currentEditorOpeningEditor = false; - // ===================== tree::ITreeViewItemView ===================== + compositions::IGuiAltActionHost* GetActivatingAltHost()override; + void OnItemModified(vint start, vint count, vint newCount, bool itemReferenceUpdated)override; + void OnStyleInstalled(vint index, ItemStyle* style, bool refreshPropertiesOnly)override; + void OnStyleUninstalled(ItemStyle* style)override; - Ptr GetNodeImage(tree::INodeProvider* node)override; - }; + void NotifyCloseEditor(); + void NotifySelectCell(vint row, vint column); + bool StartEdit(vint row, vint column); + void StopEdit(); + void OnColumnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); + void OnSelectionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); + void OnKeyUp(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); - protected: - ItemSource* itemSource; + public: + templates::GuiListViewTemplate* GetListViewControlTemplate()override; + void RequestSaveData()override; public: - /// Create a bindable Tree view control. + /// Create a data grid control in virtual mode. /// The theme name for retriving a default control template. - /// (Optional): The value of . - GuiBindableTreeView(theme::ThemeName themeName, WritableItemProperty reverseMappingProperty = {}); - ~GuiBindableTreeView(); - - /// Text property name changed event. - compositions::GuiNotifyEvent TextPropertyChanged; - /// Image property name changed event. - compositions::GuiNotifyEvent ImagePropertyChanged; - /// Children property name changed event. - compositions::GuiNotifyEvent ChildrenPropertyChanged; + /// The item provider for this control. + GuiVirtualDataGrid(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider); + ~GuiVirtualDataGrid(); - /// Get the item source. - /// The item source. - description::Value GetItemSource(); - /// Set the item source. - /// The item source. Null is acceptable if you want to clear all data. - void SetItemSource(description::Value _itemSource); + /// Selected cell changed event. + compositions::GuiNotifyEvent SelectedCellChanged; - /// - /// Get the reverse mapping property name to store the internal tree view node for an item. - /// The value is set in the constructor. - /// Using this property makes items in item source exclusive to a treeview control. - /// Sharing such item in different treeview controls causes exceptions. - /// - /// The reverse mapping property name. - WritableItemProperty GetReverseMappingProperty(); - - /// Get the text property name to get the item text from an item. - /// The text property name. - ItemProperty GetTextProperty(); - /// Set the text property name to get the item text from an item. - /// The text property name. - void SetTextProperty(const ItemProperty& value); - - /// Get the image property name to get the image from an item. - /// The image property name. - ItemProperty> GetImageProperty(); - /// Set the image property name to get the image from an item. - /// The image property name. - void SetImageProperty(const ItemProperty>& value); - - /// Get the children property name to get the children from an item. - /// The children property name. - ItemProperty> GetChildrenProperty(); - /// Set the children property name to get the children from an item. - /// The children property name. - void SetChildrenProperty(const ItemProperty>& value); + IItemProvider* GetItemProvider()override; - /// Get the selected item. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - description::Value GetSelectedItem(); + /// Change the view to data grid's default view. + void SetViewToDefault(); - /// Notify the control that data in an item is modified. Child nodes are not notified. - /// The item from the item source. - /// Returns true if this operation succeeded. - void NotifyNodeDataModified(description::Value value); + /// Get the row index and column index of the selected cell. + /// The row index and column index of the selected cell. + GridPos GetSelectedCell(); + + /// Select a cell. + /// Returns true if the editor is opened. + /// The row index and column index of the selected cell. + /// Set to true to open an editor. + bool SelectCell(const GridPos& value, bool openEditor); }; } } @@ -19611,7 +19849,7 @@ GuiBindableTreeView /*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUIDATAGRIDINTERFACES.H +.\CONTROLS\LISTCONTROLPACKAGE\GUIBINDABLEDATAGRID.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -19621,8 +19859,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDINTERFACES -#define VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDINTERFACES +#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATASTRUCTURED +#define VCZH_PRESENTATION_CONTROLS_GUIDATASTRUCTURED namespace vl @@ -19631,334 +19869,488 @@ namespace vl { namespace controls { + class GuiBindableDataGrid; + namespace list { /*********************************************************************** -Datagrid Interfaces +Interfaces +***********************************************************************/ + + class IDataProcessorCallback : public virtual IDescriptable, public Description + { + public: + virtual GuiListControl::IItemProvider* GetItemProvider() = 0; + virtual void OnProcessorChanged() = 0; + }; + + class IDataFilter : public virtual IDescriptable, public Description + { + public: + virtual void SetCallback(IDataProcessorCallback* value) = 0; + virtual bool Filter(const description::Value& row) = 0; + }; + + class IDataSorter : public virtual IDescriptable, public Description + { + public: + virtual void SetCallback(IDataProcessorCallback* value) = 0; + virtual vint Compare(const description::Value& row1, const description::Value& row2) = 0; + }; + +/*********************************************************************** +Filter Extensions ***********************************************************************/ - class IDataVisualizer; - class IDataEditor; + /// Base class for . + class DataFilterBase : public Object, public virtual IDataFilter, public Description + { + protected: + IDataProcessorCallback* callback = nullptr; - /// The data grid context. - class IDataGridContext : public virtual IDescriptable, public Description + /// Called when the structure or properties for this filter is changed. + void InvokeOnProcessorChanged(); + public: + DataFilterBase(); + + void SetCallback(IDataProcessorCallback* value)override; + }; + + /// Base class for a that contains multiple sub filters. + class DataMultipleFilter : public DataFilterBase, public Description { + protected: + collections::List> filters; + public: - virtual GuiListControl::IItemProvider* GetItemProvider() = 0; - virtual templates::GuiListViewTemplate* GetListViewControlTemplate() = 0; - virtual void RequestSaveData() = 0; + DataMultipleFilter(); + + /// Add a sub filter. + /// Returns true if this operation succeeded. + /// The sub filter. + bool AddSubFilter(Ptr value); + /// Remove a sub filter. + /// Returns true if this operation succeeded. + /// The sub filter. + bool RemoveSubFilter(Ptr value); + void SetCallback(IDataProcessorCallback* value)override; }; - /// The visualizer factory. - class IDataVisualizerFactory : public virtual IDescriptable, public Description + /// A filter that keep a row if all sub filters agree. + class DataAndFilter : public DataMultipleFilter, public Description { public: - /// Create a data visualizer. - /// The created data visualizer. - /// Context information of the data grid. - virtual Ptr CreateVisualizer(IDataGridContext* dataGridContext) = 0; + /// Create the filter. + DataAndFilter(); + + bool Filter(const description::Value& row)override; }; + + /// A filter that keep a row if one of all sub filters agrees. + class DataOrFilter : public DataMultipleFilter, public Description + { + public: + /// Create the filter. + DataOrFilter(); - /// The visualizer for each cell in [T:vl.presentation.controls.GuiVirtualDataGrid]. - class IDataVisualizer : public virtual IDescriptable, public Description + bool Filter(const description::Value& row)override; + }; + + /// A filter that keep a row if the sub filter not agrees. + class DataNotFilter : public DataFilterBase, public Description { + protected: + Ptr filter; public: - /// Get the factory object that creates this visualizer. - /// The factory object. - virtual IDataVisualizerFactory* GetFactory() = 0; + /// Create the filter. + DataNotFilter(); + + /// Set a sub filter. + /// Returns true if this operation succeeded. + /// The sub filter. + bool SetSubFilter(Ptr value); + void SetCallback(IDataProcessorCallback* value)override; + bool Filter(const description::Value& row)override; + }; - /// Get the template that renders the data. The data visualizer should maintain this template, and delete it when necessary. - /// The template. - virtual templates::GuiGridVisualizerTemplate* GetTemplate() = 0; - /// Notify that the template has been deleted during the deconstruction of UI objects. - virtual void NotifyDeletedTemplate() = 0; +/*********************************************************************** +Sorter Extensions +***********************************************************************/ - /// Called before visualizing a cell. - /// The item provider. - /// The row number of the cell. - /// The column number of the cell. - virtual void BeforeVisualizeCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column) = 0; + /// Base class for . + class DataSorterBase : public Object, public virtual IDataSorter, public Description + { + protected: + IDataProcessorCallback* callback = nullptr; - /// Set the selected state. - /// Set to true to make this data visualizer looks selected. - virtual void SetSelected(bool value) = 0; - }; + /// Called when the structure or properties for this filter is changed. + void InvokeOnProcessorChanged(); + public: + DataSorterBase(); - /// The editor factory. - class IDataEditorFactory : public virtual IDescriptable, public Description + void SetCallback(IDataProcessorCallback* value)override; + }; + + /// A multi-level . + class DataMultipleSorter : public DataSorterBase, public Description { + protected: + Ptr leftSorter; + Ptr rightSorter; public: - /// Create a data editor. - /// The created data editor. - /// Context information of the data grid. - virtual Ptr CreateEditor(IDataGridContext* dataGridContext) = 0; + /// Create the sorter. + DataMultipleSorter(); + + /// Set the first sub sorter. + /// Returns true if this operation succeeded. + /// The sub sorter. + bool SetLeftSorter(Ptr value); + /// Set the second sub sorter. + /// Returns true if this operation succeeded. + /// The sub sorter. + bool SetRightSorter(Ptr value); + void SetCallback(IDataProcessorCallback* value)override; + vint Compare(const description::Value& row1, const description::Value& row2)override; + }; + + /// A reverse order . + class DataReverseSorter : public DataSorterBase, public Description + { + protected: + Ptr sorter; + public: + /// Create the sorter. + DataReverseSorter(); + + /// Set the sub sorter. + /// Returns true if this operation succeeded. + /// The sub sorter. + bool SetSubSorter(Ptr value); + void SetCallback(IDataProcessorCallback* value)override; + vint Compare(const description::Value& row1, const description::Value& row2)override; }; - /// The editor for each cell in [T:vl.presentation.controls.GuiVirtualDataGrid]. - class IDataEditor : public virtual IDescriptable, public Description +/*********************************************************************** +DataColumn +***********************************************************************/ + + class DataColumns; + class DataProvider; + + /// Datagrid Column. + class DataColumn : public Object, public Description { + friend class DataColumns; + friend class DataProvider; + protected: + DataProvider* dataProvider = nullptr; + ItemProperty textProperty; + WritableItemProperty valueProperty; + WString text; + vint size = 160; + ColumnSortingState sortingState = ColumnSortingState::NotSorted; + bool ownPopup = true; + GuiMenu* popup = nullptr; + Ptr associatedFilter; + Ptr associatedSorter; + Ptr visualizerFactory; + Ptr editorFactory; + + void NotifyRebuilt(); + void NotifyChanged(bool needToRefreshItems); public: - /// Get the factory object that creates this editor. - /// The factory object. - virtual IDataEditorFactory* GetFactory() = 0; + DataColumn(); + ~DataColumn(); - /// Get the template that edit the data. The data editor should maintain this template, and delete it when necessary. - /// The template. - virtual templates::GuiGridEditorTemplate* GetTemplate() = 0; - /// Notify that the template has been deleted during the deconstruction of UI objects. - virtual void NotifyDeletedTemplate() = 0; + /// Value property name changed event. + compositions::GuiNotifyEvent ValuePropertyChanged; + /// Text property name changed event. + compositions::GuiNotifyEvent TextPropertyChanged; + + /// Get the text for the column. + /// The text for the column. + WString GetText(); + /// Set the text for the column. + /// The text for the column. + void SetText(const WString& value); + + /// Get the size for the column. + /// The size for the column. + vint GetSize(); + /// Set the size for the column. + /// The size for the column. + void SetSize(vint value); + + /// Test if the column owns the popup. Owned popup will be deleted in the destructor. + /// Returns true if the column owns the popup. + bool GetOwnPopup(); + /// Set if the column owns the popup. + /// Set to true to let the column own the popup. + void SetOwnPopup(bool value); + + /// Get the popup for the column. + /// The popup for the column. + GuiMenu* GetPopup(); + /// Set the popup for the column. + /// The popup for the column. + void SetPopup(GuiMenu* value); + + /// Get the filter for the column. + /// The filter for the column. + Ptr GetFilter(); + /// Set the filter for the column. + /// The filter. + void SetFilter(Ptr value); + + /// Get the sorter for the column. + /// The sorter for the column. + Ptr GetSorter(); + /// Set the sorter for the column. + /// The sorter. + void SetSorter(Ptr value); + + /// Get the visualizer factory for the column. + /// The the visualizer factory for the column. + Ptr GetVisualizerFactory(); + /// Set the visualizer factory for the column. + /// The visualizer factory. + void SetVisualizerFactory(Ptr value); + + /// Get the editor factory for the column. + /// The the editor factory for the column. + Ptr GetEditorFactory(); + /// Set the editor factory for the column. + /// The editor factory. + void SetEditorFactory(Ptr value); + + /// Get the text value from an item. + /// The text value. + /// The row index of the item. + WString GetCellText(vint row); + /// Get the cell value from an item. + /// The cell value. + /// The row index of the item. + description::Value GetCellValue(vint row); + /// Set the cell value to an item. + /// The row index of the item. + /// The value property name. + void SetCellValue(vint row, description::Value value); - /// Called before editing a cell. - /// The item provider. - /// The row number of the cell. - /// The column number of the cell. - virtual void BeforeEditCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column) = 0; + /// Get the text property name to get the cell text from an item. + /// The text property name. + ItemProperty GetTextProperty(); + /// Set the text property name to get the cell text from an item. + /// The text property name. + void SetTextProperty(const ItemProperty& value); - /// Test if the edit has saved the data. - /// Returns true if the data is saved. - virtual bool GetCellValueSaved() = 0; + /// Get the value property name to get the cell value from an item. + /// The value property name. + WritableItemProperty GetValueProperty(); + /// Set the value property name to get the cell value from an item. + /// The value property name. + void SetValueProperty(const WritableItemProperty& value); }; - /// The required view for [T:vl.presentation.controls.GuiVirtualDataGrid]. - class IDataGridView : public virtual IDescriptable, public Description + class DataColumns : public collections::ObservableListBase> { - public: - /// The identifier for this view. - static const wchar_t* const Identifier; - - /// Test is a column sortable. - /// Returns true if this column is sortable. - /// The index of the column. - virtual bool IsColumnSortable(vint column) = 0; - /// Set the column sorting state to update the data. - /// The index of the column. Set to -1 means go back to the unsorted state. - /// Set to true if the data is sorted in ascending order. - virtual void SortByColumn(vint column, bool ascending) = 0; - /// Get the sorted columm. If no column is under a sorted state, it returns -1. - /// The column number. - virtual vint GetSortedColumn() = 0; - /// Test is the sort order ascending. - /// Returns true if the sort order is ascending. - virtual bool IsSortOrderAscending() = 0; + friend class DataColumn; + protected: + DataProvider* dataProvider = nullptr; + bool affectItemFlag = true; - /// Get the column span for the cell. - /// The column span for the cell. - /// The row number for the cell. - /// The column number for the cell. - virtual vint GetCellSpan(vint row, vint column) = 0; - /// Get the data visualizer factory that creates data visualizers for visualizing the cell. - /// The data visualizer factory. The data grid control to use the predefined data visualizer if this function returns null. - /// The row number for the cell. - /// The column number for the cell. - virtual IDataVisualizerFactory* GetCellDataVisualizerFactory(vint row, vint column) = 0; - /// Get the data editor factory that creates data editors for editing the cell. - /// The data editor factory. Returns null to disable editing. - /// The row number for the cell. - /// The column number for the cell. - virtual IDataEditorFactory* GetCellDataEditorFactory(vint row, vint column) = 0; - /// Get the binding value of a cell. - /// The binding value of cell. - /// The row index of the cell. - /// The column index of the cell. - virtual description::Value GetBindingCellValue(vint row, vint column) = 0; - /// Set the binding value of a cell. - /// The row index of the cell. - /// The column index of the cell. - /// The value to set. - virtual void SetBindingCellValue(vint row, vint column, const description::Value& value) = 0; + void NotifyColumnRebuilt(vint column); + void NotifyColumnChanged(vint column, bool needToRefreshItems); + void NotifyUpdateInternal(vint start, vint count, vint newCount)override; + bool QueryInsert(vint index, const Ptr& value)override; + void AfterInsert(vint index, const Ptr& value)override; + void BeforeRemove(vint index, const Ptr& value)override; + public: + DataColumns(DataProvider* _dataProvider); + ~DataColumns(); }; - } - } - } -} - -#endif - /*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUIDATAGRIDEXTENSIONS.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control System - -Interfaces: +DataProvider ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATAEXTENSIONS -#define VCZH_PRESENTATION_CONTROLS_GUIDATAEXTENSIONS + class DataProvider + : public virtual ItemProviderBase + , public virtual IListViewItemView + , public virtual ListViewColumnItemArranger::IColumnItemView + , public virtual IDataGridView + , public virtual IDataProcessorCallback + , public virtual IListViewItemProvider + , public Description + { + friend class DataColumn; + friend class DataColumns; + friend class controls::GuiBindableDataGrid; + typedef collections::List ColumnItemViewCallbackList; + protected: + ListViewDataColumns dataColumns; + DataColumns columns; + ColumnItemViewCallbackList columnItemViewCallbacks; + Ptr itemSource; + Ptr itemChangedEventHandler; + Ptr additionalFilter; + Ptr currentFilter; + Ptr currentSorter; + collections::List virtualRowToSourceRow; -namespace vl -{ - namespace presentation - { - namespace controls - { - namespace list - { + bool NotifyUpdate(vint start, vint count, bool itemReferenceUpdated); + void RebuildAllItems() override; + void RefreshAllItems() override; + void NotifyColumnRebuilt() override; + void NotifyColumnChanged() override; + GuiListControl::IItemProvider* GetItemProvider()override; -/*********************************************************************** -Extension Bases -***********************************************************************/ + void OnProcessorChanged()override; + void OnItemSourceModified(vint start, vint count, vint newCount); - class DataVisualizerFactory; - class DataEditorFactory; - - /// Base class for all data visualizers. - class DataVisualizerBase : public Object, public virtual IDataVisualizer - { - friend class DataVisualizerFactory; - using ItemTemplate = templates::GuiGridVisualizerTemplate; - protected: - DataVisualizerFactory* factory = nullptr; - IDataGridContext* dataGridContext = nullptr; - templates::GuiGridVisualizerTemplate* visualizerTemplate = nullptr; + void RebuildFilter(); + void ReorderRows(bool invokeCallback); public: - /// Create the data visualizer. - DataVisualizerBase(); - ~DataVisualizerBase(); - - IDataVisualizerFactory* GetFactory()override; - templates::GuiGridVisualizerTemplate* GetTemplate()override; - void NotifyDeletedTemplate()override; - void BeforeVisualizeCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column)override; - void SetSelected(bool value)override; - }; - - class DataVisualizerFactory : public Object, public virtual IDataVisualizerFactory, public Description - { - using ItemTemplate = templates::GuiGridVisualizerTemplate; - protected: - TemplateProperty templateFactory; - Ptr decoratedFactory; + ItemProperty> largeImageProperty; + ItemProperty> smallImageProperty; - ItemTemplate* CreateItemTemplate(controls::list::IDataGridContext* dataGridContext); public: - DataVisualizerFactory(TemplateProperty _templateFactory, Ptr _decoratedFactory = nullptr); - ~DataVisualizerFactory(); + /// Create a data provider. + DataProvider(); + ~DataProvider(); - Ptr CreateVisualizer(IDataGridContext* dataGridContext)override; - }; - - /// Base class for all data editors. - class DataEditorBase : public Object, public virtual IDataEditor - { - friend class DataEditorFactory; - using ItemTemplate = templates::GuiGridEditorTemplate; - protected: - IDataEditorFactory* factory = nullptr; - IDataGridContext* dataGridContext = nullptr; - templates::GuiGridEditorTemplate* editorTemplate = nullptr; + ListViewDataColumns& GetDataColumns(); + DataColumns& GetColumns(); + Ptr GetItemSource(); + void SetItemSource(Ptr _itemSource); + + Ptr GetAdditionalFilter(); + void SetAdditionalFilter(Ptr value); - void OnCellValueChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - /// Create the data editor. - DataEditorBase(); - ~DataEditorBase(); + // ===================== GuiListControl::IItemProvider ===================== - IDataEditorFactory* GetFactory()override; - templates::GuiGridEditorTemplate* GetTemplate()override; - void NotifyDeletedTemplate()override; - void BeforeEditCell(GuiListControl::IItemProvider* itemProvider, vint row, vint column)override; - bool GetCellValueSaved()override; - }; - - class DataEditorFactory : public Object, public virtual IDataEditorFactory, public Description - { - using ItemTemplate = templates::GuiGridEditorTemplate; - protected: - TemplateProperty templateFactory; + vint Count()override; + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; + IDescriptable* RequestView(const WString& identifier)override; + + // ===================== list::IListViewItemProvider ===================== - public: - DataEditorFactory(TemplateProperty _templateFactory); - ~DataEditorFactory(); + Ptr GetSmallImage(vint itemIndex)override; + Ptr GetLargeImage(vint itemIndex)override; + WString GetText(vint itemIndex)override; + WString GetSubItem(vint itemIndex, vint index)override; + vint GetDataColumnCount()override; + vint GetDataColumn(vint index)override; + vint GetColumnCount()override; + WString GetColumnText(vint index)override; + + // ===================== list::ListViewColumnItemArranger::IColumnItemView ===================== + + bool AttachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; + bool DetachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; + vint GetColumnSize(vint index)override; + void SetColumnSize(vint index, vint value)override; + GuiMenu* GetDropdownPopup(vint index)override; + ColumnSortingState GetSortingState(vint index)override; + + // ===================== list::IDataGridView ===================== - Ptr CreateEditor(IDataGridContext* dataGridContext)override; + bool IsColumnSortable(vint column)override; + void SortByColumn(vint column, bool ascending)override; + vint GetSortedColumn()override; + bool IsSortOrderAscending()override; + + vint GetCellSpan(vint row, vint column)override; + IDataVisualizerFactory* GetCellDataVisualizerFactory(vint row, vint column)override; + IDataEditorFactory* GetCellDataEditorFactory(vint row, vint column)override; + description::Value GetBindingCellValue(vint row, vint column)override; + void SetBindingCellValue(vint row, vint column, const description::Value& value)override; }; + } /*********************************************************************** -Visualizer Extensions +GuiBindableDataGrid ***********************************************************************/ - class MainColumnVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description - { - protected: - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; - - void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnTextColorChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnSmallImageChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - MainColumnVisualizerTemplate(); - ~MainColumnVisualizerTemplate(); - }; + /// A bindable Data grid control. + class GuiBindableDataGrid : public GuiVirtualDataGrid, public Description + { + protected: + list::DataProvider* dataProvider = nullptr; - class SubColumnVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description - { - protected: - elements::GuiSolidLabelElement* text = nullptr; + public: + /// Create a bindable Data grid control. + /// The theme name for retriving a default control template. + GuiBindableDataGrid(theme::ThemeName themeName); + ~GuiBindableDataGrid(); - void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnTextColorChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void Initialize(bool fixTextColor); + /// Get all data columns indices in columns. + /// All data columns indices in columns. + list::ListViewDataColumns& GetDataColumns(); + /// Get all columns. + /// All columns. + list::DataColumns& GetColumns(); - SubColumnVisualizerTemplate(bool fixTextColor); - public: - SubColumnVisualizerTemplate(); - ~SubColumnVisualizerTemplate(); - }; + /// Get the item source. + /// The item source. + Ptr GetItemSource(); + /// Set the item source. + /// The item source. Null is acceptable if you want to clear all data. + void SetItemSource(Ptr _itemSource); - class HyperlinkVisualizerTemplate : public SubColumnVisualizerTemplate, public Description - { - protected: - void label_MouseEnter(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void label_MouseLeave(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + /// Get the additional filter. + /// The additional filter. + Ptr GetAdditionalFilter(); + /// Set the additional filter. This filter will be composed with filters of all column to be the final filter. + /// The additional filter. + void SetAdditionalFilter(Ptr value); - public: - HyperlinkVisualizerTemplate(); - ~HyperlinkVisualizerTemplate(); - }; + /// Large image property name changed event. + compositions::GuiNotifyEvent LargeImagePropertyChanged; + /// Small image property name changed event. + compositions::GuiNotifyEvent SmallImagePropertyChanged; - class FocusRectangleVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description - { - protected: - compositions::GuiBoundsComposition* focusComposition = nullptr; + /// Get the large image property name to get the large image from an item. + /// The large image property name. + ItemProperty> GetLargeImageProperty(); + /// Set the large image property name to get the large image from an item. + /// The large image property name. + void SetLargeImageProperty(const ItemProperty>& value); - void OnSelectedChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + /// Get the small image property name to get the small image from an item. + /// The small image property name. + ItemProperty> GetSmallImageProperty(); + /// Set the small image property name to get the small image from an item. + /// The small image property name. + void SetSmallImageProperty(const ItemProperty>& value); - public: - FocusRectangleVisualizerTemplate(); - ~FocusRectangleVisualizerTemplate(); - }; - class CellBorderVisualizerTemplate : public templates::GuiGridVisualizerTemplate, public Description - { - protected: - elements::GuiSolidBorderElement* border1 = nullptr; - elements::GuiSolidBorderElement* border2 = nullptr; + /// Get the selected cell. + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + description::Value GetSelectedRowValue(); - void OnItemSeparatorColorChanged(GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + /// Get the selected cell. + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + description::Value GetSelectedCellValue(); - public: - CellBorderVisualizerTemplate(); - ~CellBorderVisualizerTemplate(); - }; - } + /// Notify the control that data in some items are modified. + /// The index of the first item. + /// The number of items + /// Returns true if this operation succeeded. + bool NotifyItemDataModified(vint start, vint count); + }; } } } #endif + /*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUILISTVIEWITEMTEMPLATES.H +.\CONTROLS\TOOLSTRIPPACKAGE\GUIRIBBONIMPL.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -19968,8 +20360,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUILISTVIEWITEMTEMPLATES -#define VCZH_PRESENTATION_CONTROLS_GUILISTVIEWITEMTEMPLATES +#ifndef VCZH_PRESENTATION_CONTROLS_GUIRIBBONIMPL +#define VCZH_PRESENTATION_CONTROLS_GUIRIBBONIMPL namespace vl @@ -19978,119 +20370,85 @@ namespace vl { namespace controls { - namespace list - { - class DefaultListViewItemTemplate : public PredefinedListItemTemplate - { - public: - DefaultListViewItemTemplate(); - ~DefaultListViewItemTemplate(); - }; - - class BigIconListViewItemTemplate : public DefaultListViewItemTemplate - { - protected: - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; + class GuiBindableRibbonGalleryList; - void OnInitialize()override; - void OnRefresh()override; - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - BigIconListViewItemTemplate(); - ~BigIconListViewItemTemplate(); - }; +/*********************************************************************** +GalleryItemArranger +***********************************************************************/ - class SmallIconListViewItemTemplate : public DefaultListViewItemTemplate + namespace ribbon_impl + { + class GalleryItemArrangerRepeatComposition : public compositions::GuiVirtualRepeatCompositionBase, public Description { - protected: - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; - - void OnInitialize()override; - void OnRefresh()override; - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - SmallIconListViewItemTemplate(); - ~SmallIconListViewItemTemplate(); - }; + private: + vint pim_itemWidth = 0; + bool blockScrollUpdate = true; - class ListListViewItemTemplate : public DefaultListViewItemTemplate - { protected: - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; + GuiBindableRibbonGalleryList* owner; + vint itemWidth = 1; + vint firstIndex = 0; - void OnInitialize()override; - void OnRefresh()override; - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void Layout_BeginPlaceItem(bool firstPhase, Rect newBounds, vint& newStartIndex)override; + compositions::VirtualRepeatPlaceItemResult Layout_PlaceItem(bool firstPhase, bool newCreatedStyle, vint index, ItemStyleRecord style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent)override; + compositions::VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex)override; + void Layout_EndLayout(bool totalSizeUpdated) override; + void Layout_InvalidateItemSizeCache()override; + void Layout_CalculateTotalSize(Size& full, Size& minimum)override; public: - ListListViewItemTemplate(); - ~ListListViewItemTemplate(); - }; + GalleryItemArrangerRepeatComposition(GuiBindableRibbonGalleryList* _owner); + ~GalleryItemArrangerRepeatComposition(); - class TileListViewItemTemplate : public DefaultListViewItemTemplate - { - typedef collections::Array DataTextElementArray; - protected: - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; - compositions::GuiTableComposition* textTable = nullptr; - DataTextElementArray dataTexts; + vint FindItemByVirtualKeyDirection(vint itemIndex, compositions::KeyDirection key)override; + compositions::VirtualRepeatEnsureItemVisibleResult EnsureItemVisible(vint itemIndex)override; + Size GetAdoptedSize(Size expectedSize)override; - elements::GuiSolidLabelElement* CreateTextElement(vint textRow); - void ResetTextTable(vint dataColumnCount); - void OnInitialize()override; - void OnRefresh()override; - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - TileListViewItemTemplate(); - ~TileListViewItemTemplate(); + void ScrollUp(); + void ScrollDown(); + void UnblockScrollUpdate(); }; - class InformationListViewItemTemplate : public DefaultListViewItemTemplate + class GalleryItemArranger : public list::VirtualRepeatRangedItemArrangerBase, public Description { - typedef collections::Array DataTextElementArray; - protected: - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; - compositions::GuiTableComposition* textTable = nullptr; - DataTextElementArray columnTexts; - DataTextElementArray dataTexts; - elements::GuiSolidBackgroundElement* bottomLine = nullptr; - compositions::GuiBoundsComposition* bottomLineComposition = nullptr; - - void ResetTextTable(vint dataColumnCount); - void OnInitialize()override; - void OnRefresh()override; - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + using TBase = list::VirtualRepeatRangedItemArrangerBase; public: - InformationListViewItemTemplate(); - ~InformationListViewItemTemplate(); + GalleryItemArranger(GuiBindableRibbonGalleryList* _owner); + ~GalleryItemArranger(); + + void ScrollUp(); + void ScrollDown(); + void UnblockScrollUpdate(); }; - class DetailListViewItemTemplate - : public DefaultListViewItemTemplate + class GalleryResponsiveLayout : public compositions::GuiResponsiveCompositionBase, public Description { - typedef collections::Array SubItemCellList; - typedef collections::Array SubItemTestList; - typedef ListViewColumnItemArranger::IColumnItemView IColumnItemView; protected: - IColumnItemView* columnItemView = nullptr; - elements::GuiImageFrameElement* image = nullptr; - elements::GuiSolidLabelElement* text = nullptr; - compositions::GuiTableComposition* textTable = nullptr; - SubItemCellList subItemCells; - SubItemTestList subItemTexts; - - void UpdateSubItemSize(); - void ResetTextTable(vint subColumnCount); - void OnInitialize()override; - void OnRefresh()override; - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + vint minCount = 0; + vint maxCount = 0; + Size sizeOffset; + vint itemCount = 0; + vint itemWidth = 1; + + void UpdateMinSize(); public: - DetailListViewItemTemplate(); - ~DetailListViewItemTemplate(); + GalleryResponsiveLayout(); + ~GalleryResponsiveLayout(); + + vint GetMinCount(); + vint GetMaxCount(); + vint GetItemWidth(); + Size GetSizeOffset(); + vint GetVisibleItemCount(); + + void SetMinCount(vint value); + void SetMaxCount(vint value); + void SetItemWidth(vint value); + void SetSizeOffset(Size value); + + vint GetLevelCount()override; + vint GetCurrentLevel()override; + bool LevelDown()override; + bool LevelUp()override; }; } } @@ -20099,8 +20457,9 @@ namespace vl #endif + /*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUIDATAGRIDCONTROLS.H +.\CONTROLS\TOOLSTRIPPACKAGE\GUITOOLSTRIPMENU.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -20110,8 +20469,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIDATAGRIDCONTROLS +#ifndef VCZH_PRESENTATION_CONTROLS_GUITOOLSTRIPMENU +#define VCZH_PRESENTATION_CONTROLS_GUITOOLSTRIPMENU namespace vl @@ -20120,122 +20479,256 @@ namespace vl { namespace controls { - class GuiVirtualDataGrid; - namespace list +/*********************************************************************** +Toolstrip Item Collection +***********************************************************************/ + + /// IToolstripUpdateLayout is a required service for all menu item container. + class IToolstripUpdateLayout : public IDescriptable + { + public: + virtual void UpdateLayout() = 0; + }; + + /// IToolstripUpdateLayout is a required service for a menu item which want to force the container to redo layout. + class IToolstripUpdateLayoutInvoker : public IDescriptable + { + public: + /// The identifier for this service. + static const wchar_t* const Identifier; + + virtual void SetCallback(IToolstripUpdateLayout* callback) = 0; + }; + + /// Toolstrip item collection. + class GuiToolstripCollectionBase : public collections::ObservableListBase + { + public: + + protected: + IToolstripUpdateLayout * contentCallback; + + void InvokeUpdateLayout(); + bool QueryInsert(vint index, GuiControl* const& child)override; + void BeforeRemove(vint index, GuiControl* const& child)override; + void AfterInsert(vint index, GuiControl* const& child)override; + void AfterRemove(vint index, vint count)override; + public: + GuiToolstripCollectionBase(IToolstripUpdateLayout* _contentCallback); + ~GuiToolstripCollectionBase(); + }; + + /// Toolstrip item collection. + class GuiToolstripCollection : public GuiToolstripCollectionBase { + using EventHandlerList = collections::List>; + protected: + compositions::GuiStackComposition* stackComposition; + EventHandlerList eventHandlers; + + void UpdateItemVisibility(vint index, GuiControl* child); + void OnItemVisibleChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void BeforeRemove(vint index, GuiControl* const& child)override; + void AfterInsert(vint index, GuiControl* const& child)override; + void AfterRemove(vint index, vint count)override; + public: + GuiToolstripCollection(IToolstripUpdateLayout* _contentCallback, compositions::GuiStackComposition* _stackComposition); + ~GuiToolstripCollection(); + }; /*********************************************************************** -DefaultDataGridItemTemplate +Toolstrip Container ***********************************************************************/ - class DefaultDataGridItemTemplate - : public DefaultListViewItemTemplate - { - protected: - compositions::GuiTableComposition* textTable = nullptr; - collections::Array dataVisualizerFactories; - collections::Array> dataVisualizers; - collections::Array dataCells; - IDataEditor* currentEditor = nullptr; + /// Toolstrip menu. + class GuiToolstripMenu : public GuiMenu, protected IToolstripUpdateLayout, Description + { + protected: + compositions::GuiSharedSizeRootComposition* sharedSizeRootComposition; + compositions::GuiStackComposition* stackComposition; + Ptr toolstripItems; - IDataVisualizerFactory* GetDataVisualizerFactory(vint row, vint column); - IDataEditorFactory* GetDataEditorFactory(vint row, vint column); - vint GetCellColumnIndex(compositions::GuiGraphicsComposition* composition); - bool IsInEditor(GuiVirtualDataGrid* dataGrid, compositions::GuiMouseEventArgs& arguments); - void OnCellButtonDown(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void OnCellLeftButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); - void OnCellRightButtonUp(compositions::GuiGraphicsComposition* sender, compositions::GuiMouseEventArgs& arguments); + void UpdateLayout()override; + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + /// The owner menu item of the parent menu. + GuiToolstripMenu(theme::ThemeName themeName, GuiControl* _owner); + ~GuiToolstripMenu(); + + /// Get all managed child controls ordered by their positions. + /// All managed child controls. + collections::ObservableListBase& GetToolstripItems(); + }; - void DeleteAllVisualizers(); - void DeleteVisualizer(vint column); - void ResetDataTable(vint columnCount); - void OnInitialize()override; - void OnRefresh()override; - void OnSelectedChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnFontChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnContextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnVisuallyEnabledChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - DefaultDataGridItemTemplate(); - ~DefaultDataGridItemTemplate(); + /// Toolstrip menu bar. + class GuiToolstripMenuBar : public GuiMenuBar, public Description + { + protected: + compositions::GuiStackComposition* stackComposition; + Ptr toolstripItems; - void UpdateSubItemSize(); - bool IsEditorOpened(); - void NotifyOpenEditor(vint column, IDataEditor* editor); - void NotifyCloseEditor(); - void NotifySelectCell(vint column); - void NotifyCellEdited(); - }; - } + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiToolstripMenuBar(theme::ThemeName themeName); + ~GuiToolstripMenuBar(); + + /// Get all managed child controls ordered by their positions. + /// All managed child controls. + collections::ObservableListBase& GetToolstripItems(); + }; + + /// Toolstrip tool bar. + class GuiToolstripToolBar : public GuiControl, public Description + { + protected: + compositions::GuiStackComposition* stackComposition; + Ptr toolstripItems; + + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiToolstripToolBar(theme::ThemeName themeName); + ~GuiToolstripToolBar(); + + /// Get all managed child controls ordered by their positions. + /// All managed child controls. + collections::ObservableListBase& GetToolstripItems(); + }; /*********************************************************************** -GuiVirtualDataGrid +Toolstrip Component ***********************************************************************/ - /// Data grid control in virtual mode. - class GuiVirtualDataGrid - : public GuiVirtualListView - , protected compositions::GuiAltActionHostBase - , private list::IDataGridContext - , public Description + /// Toolstrip button that can connect with a . + class GuiToolstripButton : public GuiMenuButton, protected IToolstripUpdateLayoutInvoker, public Description { - friend class list::DefaultDataGridItemTemplate; protected: - list::IListViewItemView* listViewItemView = nullptr; - list::ListViewColumnItemArranger::IColumnItemView* columnItemView = nullptr; - list::IDataGridView* dataGridView = nullptr; - Ptr defaultMainColumnVisualizerFactory; - Ptr defaultSubColumnVisualizerFactory; + GuiToolstripCommand* command; + IToolstripUpdateLayout* callback = nullptr; + Ptr descriptionChangedHandler; + + void SetCallback(IToolstripUpdateLayout* _callback)override; + void OnActiveAlt()override; + void UpdateCommandContent(); + void OnLayoutAwaredPropertyChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnCommandDescriptionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiToolstripButton(theme::ThemeName themeName); + ~GuiToolstripButton(); + + /// Get the attached . + /// The attached toolstrip command. + GuiToolstripCommand* GetCommand(); + /// Detach from the previous and attach to a new one. If the command is null, this function only do detaching. + /// The new toolstrip command. + void SetCommand(GuiToolstripCommand* value); + + /// Get the toolstrip sub menu. If the sub menu is not created, it returns null. + /// The toolstrip sub menu. + GuiToolstripMenu* GetToolstripSubMenu(); + + /// Get the toolstrip sub menu. If the sub menu is not created, it returns null. + /// The toolstrip sub menu. + GuiToolstripMenu* EnsureToolstripSubMenu(); + /// Create the toolstrip sub menu if necessary. The created toolstrip sub menu is owned by this menu button. + /// The style controller for the toolstrip sub menu. Set to null to use the default control template. + void CreateToolstripSubMenu(TemplateProperty subMenuTemplate); + + IDescriptable* QueryService(const WString& identifier)override; + }; + +/*********************************************************************** +Toolstrip Group +***********************************************************************/ + + class GuiToolstripNestedContainer : public GuiControl, protected IToolstripUpdateLayout, protected IToolstripUpdateLayoutInvoker + { + protected: + IToolstripUpdateLayout* callback = nullptr; + + void UpdateLayout()override; + void SetCallback(IToolstripUpdateLayout* _callback)override; + public: + GuiToolstripNestedContainer(theme::ThemeName themeName); + ~GuiToolstripNestedContainer(); + + IDescriptable* QueryService(const WString& identifier)override; + }; + + /// A toolstrip item, which is also a toolstrip item container, automatically maintaining splitters between items. + class GuiToolstripGroupContainer : public GuiToolstripNestedContainer, public Description + { + protected: + class GroupCollection : public GuiToolstripCollectionBase + { + protected: + GuiToolstripGroupContainer* container; + ControlTemplatePropertyType splitterTemplate; - bool skipOnSelectionChanged = false; - GridPos selectedCell{ -1,-1 }; - Ptr currentEditor; - GridPos currentEditorPos{ -1,-1 }; - bool currentEditorOpeningEditor = false; + void BeforeRemove(vint index, GuiControl* const& child)override; + void AfterInsert(vint index, GuiControl* const& child)override; + void AfterRemove(vint index, vint count)override; + public: + GroupCollection(GuiToolstripGroupContainer* _container); + ~GroupCollection(); - compositions::IGuiAltActionHost* GetActivatingAltHost()override; - void OnItemModified(vint start, vint count, vint newCount, bool itemReferenceUpdated)override; - void OnStyleInstalled(vint index, ItemStyle* style, bool refreshPropertiesOnly)override; - void OnStyleUninstalled(ItemStyle* style)override; + ControlTemplatePropertyType GetSplitterTemplate(); + void SetSplitterTemplate(const ControlTemplatePropertyType& value); + void RebuildSplitters(); + }; - void NotifyCloseEditor(); - void NotifySelectCell(vint row, vint column); - bool StartEdit(vint row, vint column); - void StopEdit(); - void OnColumnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); - void OnSelectionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnKeyDown(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); - void OnKeyUp(compositions::GuiGraphicsComposition* sender, compositions::GuiKeyEventArgs& arguments); + protected: + compositions::GuiStackComposition* stackComposition; + theme::ThemeName splitterThemeName; + Ptr groupCollection; + void OnParentLineChanged()override; public: - templates::GuiListViewTemplate* GetListViewControlTemplate()override; - void RequestSaveData()override; + GuiToolstripGroupContainer(theme::ThemeName themeName); + ~GuiToolstripGroupContainer(); - public: - /// Create a data grid control in virtual mode. - /// The theme name for retriving a default control template. - /// The item provider for this control. - GuiVirtualDataGrid(theme::ThemeName themeName, GuiListControl::IItemProvider* _itemProvider); - ~GuiVirtualDataGrid(); + ControlTemplatePropertyType GetSplitterTemplate(); + void SetSplitterTemplate(const ControlTemplatePropertyType& value); - /// Selected cell changed event. - compositions::GuiNotifyEvent SelectedCellChanged; + /// Get all managed child controls ordered by their positions. + /// All managed child controls. + collections::ObservableListBase& GetToolstripItems(); + }; - IItemProvider* GetItemProvider()override; + /// A toolstrip item, which is also a toolstrip item container. + class GuiToolstripGroup : public GuiToolstripNestedContainer, public Description + { + protected: + compositions::GuiStackComposition* stackComposition; + Ptr toolstripItems; - /// Change the view to data grid's default view. - void SetViewToDefault(); + void OnParentLineChanged()override; + public: + GuiToolstripGroup(theme::ThemeName themeName); + ~GuiToolstripGroup(); - /// Get the row index and column index of the selected cell. - /// The row index and column index of the selected cell. - GridPos GetSelectedCell(); + /// Get all managed child controls ordered by their positions. + /// All managed child controls. + collections::ObservableListBase& GetToolstripItems(); + }; + } + } - /// Select a cell. - /// Returns true if the editor is opened. - /// The row index and column index of the selected cell. - /// Set to true to open an editor. - bool SelectCell(const GridPos& value, bool openEditor); + namespace collections + { + namespace randomaccess_internal + { + template<> + struct RandomAccessable + { + static const bool CanRead = true; + static const bool CanResize = false; }; } } @@ -20245,7 +20738,7 @@ GuiVirtualDataGrid /*********************************************************************** -.\CONTROLS\LISTCONTROLPACKAGE\GUIBINDABLEDATAGRID.H +.\CONTROLS\TOOLSTRIPPACKAGE\GUIRIBBONCONTROLS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -20255,8 +20748,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIDATASTRUCTURED -#define VCZH_PRESENTATION_CONTROLS_GUIDATASTRUCTURED +#ifndef VCZH_PRESENTATION_CONTROLS_GUIRIBBONCONTROLS +#define VCZH_PRESENTATION_CONTROLS_GUIRIBBONCONTROLS namespace vl @@ -20264,479 +20757,376 @@ namespace vl namespace presentation { namespace controls - { - class GuiBindableDataGrid; - - namespace list - { - -/*********************************************************************** -Interfaces -***********************************************************************/ - - class IDataProcessorCallback : public virtual IDescriptable, public Description - { - public: - virtual GuiListControl::IItemProvider* GetItemProvider() = 0; - virtual void OnProcessorChanged() = 0; - }; - - class IDataFilter : public virtual IDescriptable, public Description - { - public: - virtual void SetCallback(IDataProcessorCallback* value) = 0; - virtual bool Filter(const description::Value& row) = 0; - }; - - class IDataSorter : public virtual IDescriptable, public Description - { - public: - virtual void SetCallback(IDataProcessorCallback* value) = 0; - virtual vint Compare(const description::Value& row1, const description::Value& row2) = 0; - }; - -/*********************************************************************** -Filter Extensions -***********************************************************************/ - - /// Base class for . - class DataFilterBase : public Object, public virtual IDataFilter, public Description - { - protected: - IDataProcessorCallback* callback = nullptr; - - /// Called when the structure or properties for this filter is changed. - void InvokeOnProcessorChanged(); - public: - DataFilterBase(); - - void SetCallback(IDataProcessorCallback* value)override; - }; - - /// Base class for a that contains multiple sub filters. - class DataMultipleFilter : public DataFilterBase, public Description - { - protected: - collections::List> filters; - - public: - DataMultipleFilter(); - - /// Add a sub filter. - /// Returns true if this operation succeeded. - /// The sub filter. - bool AddSubFilter(Ptr value); - /// Remove a sub filter. - /// Returns true if this operation succeeded. - /// The sub filter. - bool RemoveSubFilter(Ptr value); - void SetCallback(IDataProcessorCallback* value)override; - }; - - /// A filter that keep a row if all sub filters agree. - class DataAndFilter : public DataMultipleFilter, public Description - { - public: - /// Create the filter. - DataAndFilter(); - - bool Filter(const description::Value& row)override; - }; - - /// A filter that keep a row if one of all sub filters agrees. - class DataOrFilter : public DataMultipleFilter, public Description - { - public: - /// Create the filter. - DataOrFilter(); - - bool Filter(const description::Value& row)override; - }; - - /// A filter that keep a row if the sub filter not agrees. - class DataNotFilter : public DataFilterBase, public Description - { - protected: - Ptr filter; - public: - /// Create the filter. - DataNotFilter(); - - /// Set a sub filter. - /// Returns true if this operation succeeded. - /// The sub filter. - bool SetSubFilter(Ptr value); - void SetCallback(IDataProcessorCallback* value)override; - bool Filter(const description::Value& row)override; - }; - -/*********************************************************************** -Sorter Extensions -***********************************************************************/ - - /// Base class for . - class DataSorterBase : public Object, public virtual IDataSorter, public Description - { - protected: - IDataProcessorCallback* callback = nullptr; - - /// Called when the structure or properties for this filter is changed. - void InvokeOnProcessorChanged(); - public: - DataSorterBase(); - - void SetCallback(IDataProcessorCallback* value)override; - }; - - /// A multi-level . - class DataMultipleSorter : public DataSorterBase, public Description - { - protected: - Ptr leftSorter; - Ptr rightSorter; - public: - /// Create the sorter. - DataMultipleSorter(); - - /// Set the first sub sorter. - /// Returns true if this operation succeeded. - /// The sub sorter. - bool SetLeftSorter(Ptr value); - /// Set the second sub sorter. - /// Returns true if this operation succeeded. - /// The sub sorter. - bool SetRightSorter(Ptr value); - void SetCallback(IDataProcessorCallback* value)override; - vint Compare(const description::Value& row1, const description::Value& row2)override; - }; - - /// A reverse order . - class DataReverseSorter : public DataSorterBase, public Description - { - protected: - Ptr sorter; - public: - /// Create the sorter. - DataReverseSorter(); - - /// Set the sub sorter. - /// Returns true if this operation succeeded. - /// The sub sorter. - bool SetSubSorter(Ptr value); - void SetCallback(IDataProcessorCallback* value)override; - vint Compare(const description::Value& row1, const description::Value& row2)override; - }; + { + class GuiRibbonTabPage; + class GuiRibbonGroup; /*********************************************************************** -DataColumn +Ribbon Tab ***********************************************************************/ - class DataColumns; - class DataProvider; - - /// Datagrid Column. - class DataColumn : public Object, public Description - { - friend class DataColumns; - friend class DataProvider; - protected: - DataProvider* dataProvider = nullptr; - ItemProperty textProperty; - WritableItemProperty valueProperty; - WString text; - vint size = 160; - ColumnSortingState sortingState = ColumnSortingState::NotSorted; - bool ownPopup = true; - GuiMenu* popup = nullptr; - Ptr associatedFilter; - Ptr associatedSorter; - Ptr visualizerFactory; - Ptr editorFactory; + /// Ribbon tab control, for displaying ribbon tab pages. + class GuiRibbonTab : public GuiTab, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonTabTemplate, GuiTab) + protected: + compositions::GuiBoundsComposition* beforeHeaders = nullptr; + compositions::GuiBoundsComposition* afterHeaders = nullptr; + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiRibbonTab(theme::ThemeName themeName); + ~GuiRibbonTab(); - void NotifyRebuilt(); - void NotifyChanged(bool needToRefreshItems); - public: - DataColumn(); - ~DataColumn(); + /// Get the composition representing the space before tabs. + /// The composition representing the space before tabs. + compositions::GuiGraphicsComposition* GetBeforeHeaders(); + /// Get the composition representing the space after tabs. + /// The composition representing the space after tabs. + compositions::GuiGraphicsComposition* GetAfterHeaders(); + }; - /// Value property name changed event. - compositions::GuiNotifyEvent ValuePropertyChanged; - /// Text property name changed event. - compositions::GuiNotifyEvent TextPropertyChanged; + class GuiRibbonGroupCollection : public collections::ObservableListBase + { + protected: + GuiRibbonTabPage* tabPage = nullptr; - /// Get the text for the column. - /// The text for the column. - WString GetText(); - /// Set the text for the column. - /// The text for the column. - void SetText(const WString& value); + bool QueryInsert(vint index, GuiRibbonGroup* const& value)override; + void AfterInsert(vint index, GuiRibbonGroup* const& value)override; + void AfterRemove(vint index, vint count)override; - /// Get the size for the column. - /// The size for the column. - vint GetSize(); - /// Set the size for the column. - /// The size for the column. - void SetSize(vint value); + public: + GuiRibbonGroupCollection(GuiRibbonTabPage* _tabPage); + ~GuiRibbonGroupCollection(); + }; - /// Test if the column owns the popup. Owned popup will be deleted in the destructor. - /// Returns true if the column owns the popup. - bool GetOwnPopup(); - /// Set if the column owns the popup. - /// Set to true to let the column own the popup. - void SetOwnPopup(bool value); + /// Ribbon tab page control, adding to the Pages property of a . + class GuiRibbonTabPage : public GuiTabPage, public AggregatableDescription + { + friend class GuiRibbonGroupCollection; + protected: + bool highlighted = false; + GuiRibbonGroupCollection groups; + compositions::GuiResponsiveStackComposition* responsiveStack = nullptr; + compositions::GuiResponsiveContainerComposition* responsiveContainer = nullptr; + compositions::GuiStackComposition* stack = nullptr; - /// Get the popup for the column. - /// The popup for the column. - GuiMenu* GetPopup(); - /// Set the popup for the column. - /// The popup for the column. - void SetPopup(GuiMenu* value); + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiRibbonTabPage(theme::ThemeName themeName); + ~GuiRibbonTabPage(); + + /// Highlighted changed event. + compositions::GuiNotifyEvent HighlightedChanged; - /// Get the filter for the column. - /// The filter for the column. - Ptr GetFilter(); - /// Set the filter for the column. - /// The filter. - void SetFilter(Ptr value); + /// Test if this is a highlighted tab page. + /// Returns true if this is a highlighted tab page. + bool GetHighlighted(); + /// Set if this is a highlighted tab page. + /// Set to true to highlight the tab page. + void SetHighlighted(bool value); - /// Get the sorter for the column. - /// The sorter for the column. - Ptr GetSorter(); - /// Set the sorter for the column. - /// The sorter. - void SetSorter(Ptr value); + /// Get the collection of ribbon groups. + /// The collection of ribbon groups. + collections::ObservableListBase& GetGroups(); + }; - /// Get the visualizer factory for the column. - /// The the visualizer factory for the column. - Ptr GetVisualizerFactory(); - /// Set the visualizer factory for the column. - /// The visualizer factory. - void SetVisualizerFactory(Ptr value); +/*********************************************************************** +Ribbon Group +***********************************************************************/ - /// Get the editor factory for the column. - /// The the editor factory for the column. - Ptr GetEditorFactory(); - /// Set the editor factory for the column. - /// The editor factory. - void SetEditorFactory(Ptr value); + class GuiRibbonGroupItemCollection : public collections::ObservableListBase + { + protected: + GuiRibbonGroup* group = nullptr; - /// Get the text value from an item. - /// The text value. - /// The row index of the item. - WString GetCellText(vint row); - /// Get the cell value from an item. - /// The cell value. - /// The row index of the item. - description::Value GetCellValue(vint row); - /// Set the cell value to an item. - /// The row index of the item. - /// The value property name. - void SetCellValue(vint row, description::Value value); + bool QueryInsert(vint index, GuiControl* const& value)override; + void AfterInsert(vint index, GuiControl* const& value)override; + void AfterRemove(vint index, vint count)override; - /// Get the text property name to get the cell text from an item. - /// The text property name. - ItemProperty GetTextProperty(); - /// Set the text property name to get the cell text from an item. - /// The text property name. - void SetTextProperty(const ItemProperty& value); + public: + GuiRibbonGroupItemCollection(GuiRibbonGroup* _group); + ~GuiRibbonGroupItemCollection(); + }; - /// Get the value property name to get the cell value from an item. - /// The value property name. - WritableItemProperty GetValueProperty(); - /// Set the value property name to get the cell value from an item. - /// The value property name. - void SetValueProperty(const WritableItemProperty& value); - }; + /// Ribbon group control, adding to the Groups property of a . + class GuiRibbonGroup : public GuiControl, protected compositions::GuiAltActionHostBase, public Description + { + friend class GuiRibbonGroupItemCollection; + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGroupTemplate, GuiControl) + protected: - class DataColumns : public collections::ObservableListBase> + class CommandExecutor : public Object, public IRibbonGroupCommandExecutor { - friend class DataColumn; protected: - DataProvider* dataProvider = nullptr; - bool affectItemFlag = true; + GuiRibbonGroup* group; - void NotifyColumnRebuilt(vint column); - void NotifyColumnChanged(vint column, bool needToRefreshItems); - void NotifyUpdateInternal(vint start, vint count, vint newCount)override; - bool QueryInsert(vint index, const Ptr& value)override; - void AfterInsert(vint index, const Ptr& value)override; - void BeforeRemove(vint index, const Ptr& value)override; public: - DataColumns(DataProvider* _dataProvider); - ~DataColumns(); + CommandExecutor(GuiRibbonGroup* _group); + ~CommandExecutor(); + + void NotifyExpandButtonClicked()override; }; + bool expandable = false; + Ptr largeImage; + GuiRibbonGroupItemCollection items; + compositions::GuiResponsiveStackComposition* responsiveStack = nullptr; + compositions::GuiStackComposition* stack = nullptr; + Ptr commandExecutor; + + compositions::GuiResponsiveViewComposition* responsiveView = nullptr; + compositions::GuiResponsiveFixedComposition* responsiveFixedButton = nullptr; + GuiToolstripButton* dropdownButton = nullptr; + GuiMenu* dropdownMenu = nullptr; + + bool IsAltAvailable()override; + compositions::IGuiAltActionHost* GetActivatingAltHost()override; + void OnCachedBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); + void OnBeforeSubMenuOpening(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiRibbonGroup(theme::ThemeName themeName); + ~GuiRibbonGroup(); + + /// Expandable changed event. + compositions::GuiNotifyEvent ExpandableChanged; + /// Expand button clicked event. + compositions::GuiNotifyEvent ExpandButtonClicked; + /// Large image changed event. + compositions::GuiNotifyEvent LargeImageChanged; + + /// Test if this group is expandable. An expandable group will display an extra small button, which raises . + /// Returns true if this group is expandable. + bool GetExpandable(); + /// Set if this group is expandable. + /// Set to true to make this group is expandable. + void SetExpandable(bool value); + + /// Get the large image for the collapsed ribbon group. + /// The large image for the collapsed ribbon group. + Ptr GetLargeImage(); + /// Set the large image for the collapsed ribbon group. + /// The large image for the collapsed ribbon group. + void SetLargeImage(Ptr value); + + /// Get the collection of controls in this group. + /// The collection of controls. + collections::ObservableListBase& GetItems(); + }; + /*********************************************************************** -DataProvider +Ribbon Buttons ***********************************************************************/ - class DataProvider - : public virtual ItemProviderBase - , public virtual IListViewItemView - , public virtual ListViewColumnItemArranger::IColumnItemView - , public virtual IDataGridView - , public virtual IDataProcessorCallback - , public virtual IListViewItemProvider - , public Description - { - friend class DataColumn; - friend class DataColumns; - friend class controls::GuiBindableDataGrid; - typedef collections::List ColumnItemViewCallbackList; - protected: - ListViewDataColumns dataColumns; - DataColumns columns; - ColumnItemViewCallbackList columnItemViewCallbacks; - Ptr itemSource; - Ptr itemChangedEventHandler; - - Ptr additionalFilter; - Ptr currentFilter; - Ptr currentSorter; - collections::List virtualRowToSourceRow; + /// Auto resizable ribbon icon label. + class GuiRibbonIconLabel : public GuiControl, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonIconLabelTemplate, GuiControl) + protected: + Ptr image; - bool NotifyUpdate(vint start, vint count, bool itemReferenceUpdated); - void RebuildAllItems() override; - void RefreshAllItems() override; - void NotifyColumnRebuilt() override; - void NotifyColumnChanged() override; - GuiListControl::IItemProvider* GetItemProvider()override; + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiRibbonIconLabel(theme::ThemeName themeName); + ~GuiRibbonIconLabel(); - void OnProcessorChanged()override; - void OnItemSourceModified(vint start, vint count, vint newCount); + /// Image changed event. + compositions::GuiNotifyEvent ImageChanged; - void RebuildFilter(); - void ReorderRows(bool invokeCallback); + /// Get the image for the menu button. + /// The image for the menu button. + Ptr GetImage(); + /// Set the image for the menu button. + /// The image for the menu button. + void SetImage(Ptr value); + }; - public: - ItemProperty> largeImageProperty; - ItemProperty> smallImageProperty; + /// Represents the size of a ribbon button in a control. + enum class RibbonButtonSize + { + /// Large icon with text. + Large = 0, + /// Small icon with text. + Small = 1, + /// Small icon only. + Icon = 2, + }; - public: - /// Create a data provider. - DataProvider(); - ~DataProvider(); + class GuiRibbonButtons; - ListViewDataColumns& GetDataColumns(); - DataColumns& GetColumns(); - Ptr GetItemSource(); - void SetItemSource(Ptr _itemSource); - - Ptr GetAdditionalFilter(); - void SetAdditionalFilter(Ptr value); + class GuiRibbonButtonsItemCollection : public collections::ObservableListBase + { + protected: + GuiRibbonButtons* buttons = nullptr; - // ===================== GuiListControl::IItemProvider ===================== + bool QueryInsert(vint index, GuiControl* const& value)override; + void AfterInsert(vint index, GuiControl* const& value)override; + void BeforeRemove(vint index, GuiControl* const& value)override; - vint Count()override; - WString GetTextValue(vint itemIndex)override; - description::Value GetBindingValue(vint itemIndex)override; - IDescriptable* RequestView(const WString& identifier)override; - - // ===================== list::IListViewItemProvider ===================== + public: + GuiRibbonButtonsItemCollection(GuiRibbonButtons* _buttons); + ~GuiRibbonButtonsItemCollection(); + }; - Ptr GetSmallImage(vint itemIndex)override; - Ptr GetLargeImage(vint itemIndex)override; - WString GetText(vint itemIndex)override; - WString GetSubItem(vint itemIndex, vint index)override; - vint GetDataColumnCount()override; - vint GetDataColumn(vint index)override; - vint GetColumnCount()override; - WString GetColumnText(vint index)override; - - // ===================== list::ListViewColumnItemArranger::IColumnItemView ===================== - - bool AttachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; - bool DetachCallback(ListViewColumnItemArranger::IColumnItemViewCallback* value)override; - vint GetColumnSize(vint index)override; - void SetColumnSize(vint index, vint value)override; - GuiMenu* GetDropdownPopup(vint index)override; - ColumnSortingState GetSortingState(vint index)override; - - // ===================== list::IDataGridView ===================== + /// Auto resizable ribbon buttons. + class GuiRibbonButtons : public GuiControl, public Description + { + friend class GuiRibbonButtonsItemCollection; + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonButtonsTemplate, GuiControl) + protected: + RibbonButtonSize minSize; + RibbonButtonSize maxSize; + compositions::GuiResponsiveViewComposition* responsiveView = nullptr; + compositions::GuiResponsiveFixedComposition* views[3] = { nullptr,nullptr,nullptr }; + GuiRibbonButtonsItemCollection buttons; + + void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); + void SetButtonThemeName(compositions::GuiResponsiveCompositionBase* fixed, GuiControl* button); + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + /// Max allowed size. + /// Min allowed size. + GuiRibbonButtons(theme::ThemeName themeName, RibbonButtonSize _maxSize, RibbonButtonSize _minSize); + ~GuiRibbonButtons(); - bool IsColumnSortable(vint column)override; - void SortByColumn(vint column, bool ascending)override; - vint GetSortedColumn()override; - bool IsSortOrderAscending()override; - - vint GetCellSpan(vint row, vint column)override; - IDataVisualizerFactory* GetCellDataVisualizerFactory(vint row, vint column)override; - IDataEditorFactory* GetCellDataEditorFactory(vint row, vint column)override; - description::Value GetBindingCellValue(vint row, vint column)override; - void SetBindingCellValue(vint row, vint column, const description::Value& value)override; - }; - } + /// Get the collection of buttons. is expected. + /// The collection of buttons. + collections::ObservableListBase& GetButtons(); + }; /*********************************************************************** -GuiBindableDataGrid +Ribbon Toolstrips ***********************************************************************/ - /// A bindable Data grid control. - class GuiBindableDataGrid : public GuiVirtualDataGrid, public Description + class GuiRibbonToolstrips; + + class GuiRibbonToolstripsGroupCollection : public collections::ObservableListBase { protected: - list::DataProvider* dataProvider = nullptr; + GuiRibbonToolstrips* toolstrips = nullptr; + + bool QueryInsert(vint index, GuiToolstripGroup* const& value)override; + void AfterInsert(vint index, GuiToolstripGroup* const& value)override; + void AfterRemove(vint index, vint count)override; public: - /// Create a bindable Data grid control. + GuiRibbonToolstripsGroupCollection(GuiRibbonToolstrips* _toolstrips); + ~GuiRibbonToolstripsGroupCollection(); + }; + + /// Auto resizable ribbon toolstrips. + class GuiRibbonToolstrips : public GuiControl, public Description + { + friend class GuiRibbonToolstripsGroupCollection; + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonToolstripsTemplate, GuiControl) + protected: + compositions::GuiResponsiveViewComposition* responsiveView = nullptr; + GuiToolstripToolBar* toolbars[5] = { nullptr,nullptr,nullptr,nullptr,nullptr }; + GuiToolstripGroupContainer* longContainers[2] = { nullptr,nullptr }; + GuiToolstripGroupContainer* shortContainers[3] = { nullptr,nullptr,nullptr }; + compositions::GuiResponsiveFixedComposition* views[2] = { nullptr,nullptr }; + GuiRibbonToolstripsGroupCollection groups; + + void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); + void RearrangeToolstripGroups(vint viewIndex = -1); + public: + /// Create a control with a specified default theme. /// The theme name for retriving a default control template. - GuiBindableDataGrid(theme::ThemeName themeName); - ~GuiBindableDataGrid(); + GuiRibbonToolstrips(theme::ThemeName themeName); + ~GuiRibbonToolstrips(); - /// Get all data columns indices in columns. - /// All data columns indices in columns. - list::ListViewDataColumns& GetDataColumns(); - /// Get all columns. - /// All columns. - list::DataColumns& GetColumns(); + /// Get the collection of toolstrip groups. will decide the order of these toolstrip groups. + /// The collection of toolstrip groups. + collections::ObservableListBase& GetGroups(); + }; - /// Get the item source. - /// The item source. - Ptr GetItemSource(); - /// Set the item source. - /// The item source. Null is acceptable if you want to clear all data. - void SetItemSource(Ptr _itemSource); +/*********************************************************************** +Ribbon Gallery +***********************************************************************/ - /// Get the additional filter. - /// The additional filter. - Ptr GetAdditionalFilter(); - /// Set the additional filter. This filter will be composed with filters of all column to be the final filter. - /// The additional filter. - void SetAdditionalFilter(Ptr value); + /// Ribbon gallery, with scroll up, scroll down, dropdown buttons. + class GuiRibbonGallery : public GuiControl, public Description + { + using ItemStyle = templates::GuiListItemTemplate; + using ItemStyleProperty = TemplateProperty; - /// Large image property name changed event. - compositions::GuiNotifyEvent LargeImagePropertyChanged; - /// Small image property name changed event. - compositions::GuiNotifyEvent SmallImagePropertyChanged; + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGalleryTemplate, GuiControl) + protected: + class CommandExecutor : public Object, public IRibbonGalleryCommandExecutor + { + protected: + GuiRibbonGallery* gallery; - /// Get the large image property name to get the large image from an item. - /// The large image property name. - ItemProperty> GetLargeImageProperty(); - /// Set the large image property name to get the large image from an item. - /// The large image property name. - void SetLargeImageProperty(const ItemProperty>& value); + public: + CommandExecutor(GuiRibbonGallery* _gallery); + ~CommandExecutor(); + + void NotifyScrollUp()override; + void NotifyScrollDown()override; + void NotifyDropdown()override; + }; + + bool scrollUpEnabled = true; + bool scrollDownEnabled = true; + Ptr commandExecutor; + + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + GuiRibbonGallery(theme::ThemeName themeName); + ~GuiRibbonGallery(); - /// Get the small image property name to get the small image from an item. - /// The small image property name. - ItemProperty> GetSmallImageProperty(); - /// Set the small image property name to get the small image from an item. - /// The small image property name. - void SetSmallImageProperty(const ItemProperty>& value); + /// Scroll up enabled changed event. + compositions::GuiNotifyEvent ScrollUpEnabledChanged; + /// Scroll down enabled changed event. + compositions::GuiNotifyEvent ScrollDownEnabledChanged; + /// Scroll up button clicked event. + compositions::GuiNotifyEvent RequestedScrollUp; + /// Scroll down button clicked event. + compositions::GuiNotifyEvent RequestedScrollDown; + /// Dropdown button clicked event. + compositions::GuiNotifyEvent RequestedDropdown; + /// Test if the scroll up button is enabled. + /// Returns true if the scroll up button is enabled. + bool GetScrollUpEnabled(); + /// Set if the scroll up button is enabled. + /// Set to true to enable the scroll up button. + void SetScrollUpEnabled(bool value); - /// Get the selected cell. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - description::Value GetSelectedRowValue(); + /// Test if the scroll down button is enabled. + /// Returns true if the scroll down button is enabled. + bool GetScrollDownEnabled(); + /// Set if the scroll down button is enabled. + /// Set to true to enable the scroll down button. + void SetScrollDownEnabled(bool value); + }; - /// Get the selected cell. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - description::Value GetSelectedCellValue(); + /// Resizable ribbon toolstrip menu with a space above of all menu items to display extra content. + class GuiRibbonToolstripMenu : public GuiToolstripMenu, public Description + { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonToolstripMenuTemplate, GuiToolstripMenu) + protected: + compositions::GuiBoundsComposition* contentComposition; - /// Notify the control that data in some items are modified. - /// The index of the first item. - /// The number of items - /// Returns true if this operation succeeded. - bool NotifyItemDataModified(vint start, vint count); + public: + /// Create a control with a specified default theme. + /// The theme name for retriving a default control template. + /// The owner menu item of the parent menu. + GuiRibbonToolstripMenu(theme::ThemeName themeName, GuiControl* owner); + ~GuiRibbonToolstripMenu(); + + /// Get the composition representing the space above of menu items. + /// The composition representing the space above of menu items. + compositions::GuiGraphicsComposition* GetContentComposition(); }; } } @@ -20746,7 +21136,7 @@ GuiBindableDataGrid /*********************************************************************** -.\CONTROLS\TOOLSTRIPPACKAGE\GUIRIBBONIMPL.H +.\CONTROLS\TOOLSTRIPPACKAGE\GUIRIBBONGALLERYLIST.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 @@ -20756,8 +21146,8 @@ GacUI::Control System Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIRIBBONIMPL -#define VCZH_PRESENTATION_CONTROLS_GUIRIBBONIMPL +#ifndef VCZH_PRESENTATION_CONTROLS_GUIRIBBONGALLERYLIST +#define VCZH_PRESENTATION_CONTROLS_GUIRIBBONGALLERYLIST namespace vl @@ -20766,1061 +21156,1921 @@ namespace vl { namespace controls { - class GuiBindableRibbonGalleryList; /*********************************************************************** -GalleryItemArranger +Ribbon Gallery List ***********************************************************************/ - namespace ribbon_impl + /// Represents the position of an item in the gallery list. + struct GalleryPos { - class GalleryItemArrangerRepeatComposition : public compositions::GuiVirtualRepeatCompositionBase, public Description - { - private: - vint pim_itemWidth = 0; - bool blockScrollUpdate = true; - - protected: - GuiBindableRibbonGalleryList* owner; - vint itemWidth = 1; - vint firstIndex = 0; - - void Layout_BeginPlaceItem(bool firstPhase, Rect newBounds, vint& newStartIndex)override; - compositions::VirtualRepeatPlaceItemResult Layout_PlaceItem(bool firstPhase, bool newCreatedStyle, vint index, ItemStyleRecord style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent)override; - compositions::VirtualRepeatEndPlaceItemResult Layout_EndPlaceItem(bool firstPhase, Rect newBounds, vint newStartIndex)override; - void Layout_EndLayout(bool totalSizeUpdated) override; - void Layout_InvalidateItemSizeCache()override; - Size Layout_CalculateTotalSize()override; - public: - GalleryItemArrangerRepeatComposition(GuiBindableRibbonGalleryList* _owner); - ~GalleryItemArrangerRepeatComposition(); - - vint FindItemByVirtualKeyDirection(vint itemIndex, compositions::KeyDirection key)override; - compositions::VirtualRepeatEnsureItemVisibleResult EnsureItemVisible(vint itemIndex)override; - Size GetAdoptedSize(Size expectedSize)override; + /// Group index. + vint group; + /// Item index. + vint item; - void ScrollUp(); - void ScrollDown(); - void UnblockScrollUpdate(); - }; + GalleryPos() + :group(-1), item(-1) + { + } - class GalleryItemArranger : public list::VirtualRepeatRangedItemArrangerBase, public Description + GalleryPos(vint _group, vint _item) + :group(_group), item(_item) { - using TBase = list::VirtualRepeatRangedItemArrangerBase; - public: - GalleryItemArranger(GuiBindableRibbonGalleryList* _owner); - ~GalleryItemArranger(); + } - void ScrollUp(); - void ScrollDown(); - void UnblockScrollUpdate(); - }; + GUI_DEFINE_COMPARE_OPERATORS(GalleryPos) + }; - class GalleryResponsiveLayout : public compositions::GuiResponsiveCompositionBase, public Description + namespace list + { + class GroupedDataSource; + + /// A gallery group. + class GalleryGroup : public Description { + friend class GroupedDataSource; + using IValueList = reflection::description::IValueList; protected: - vint minCount = 0; - vint maxCount = 0; - Size sizeOffset; - vint itemCount = 0; - vint itemWidth = 1; + Ptr eventHandler; + WString name; + Ptr itemValues; - void UpdateMinSize(); public: - GalleryResponsiveLayout(); - ~GalleryResponsiveLayout(); - - vint GetMinCount(); - vint GetMaxCount(); - vint GetItemWidth(); - Size GetSizeOffset(); - vint GetVisibleItemCount(); - - void SetMinCount(vint value); - void SetMaxCount(vint value); - void SetItemWidth(vint value); - void SetSizeOffset(Size value); + GalleryGroup(); + ~GalleryGroup(); - vint GetLevelCount()override; - vint GetCurrentLevel()override; - bool LevelDown()override; - bool LevelUp()override; + /// Get the title of this group. + /// The title of this group. + WString GetName(); + /// Get the all items of this group, could be null. + /// All items of this group. + Ptr GetItemValues(); }; - } - } - } -} - -#endif - - -/*********************************************************************** -.\CONTROLS\TOOLSTRIPPACKAGE\GUITOOLSTRIPMENU.H -***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Control System -Interfaces: -***********************************************************************/ + class GroupedDataSource : public Description + { + using IValueEnumerable = reflection::description::IValueEnumerable; + using IValueList = reflection::description::IValueList; + using IValueObservableList = reflection::description::IValueObservableList; + using GalleryItemList = collections::ObservableList; + using GalleryGroupList = collections::ObservableList>; -#ifndef VCZH_PRESENTATION_CONTROLS_GUITOOLSTRIPMENU -#define VCZH_PRESENTATION_CONTROLS_GUITOOLSTRIPMENU + protected: + compositions::GuiGraphicsComposition* associatedComposition; + Ptr itemSource; + ItemProperty titleProperty; + ItemProperty> childrenProperty; + GalleryItemList joinedItemSource; + GalleryGroupList groupedItemSource; + collections::List cachedGroupItemCounts; + Ptr groupChangedHandler; + bool ignoreGroupChanged = false; -namespace vl -{ - namespace presentation - { - namespace controls - { + void RebuildItemSource(); + Ptr GetChildren(Ptr children); + void AttachGroupChanged(Ptr group, vint index); + void OnGroupChanged(vint start, vint oldCount, vint newCount); + void OnGroupItemChanged(vint index, vint start, vint oldCount, vint newCount); + vint GetCountBeforeGroup(vint index); + void InsertGroupToJoined(vint index); + void RemoveGroupFromJoined(vint index); -/*********************************************************************** -Toolstrip Item Collection -***********************************************************************/ + public: + GroupedDataSource(compositions::GuiGraphicsComposition* _associatedComposition); + ~GroupedDataSource(); - /// IToolstripUpdateLayout is a required service for all menu item container. - class IToolstripUpdateLayout : public IDescriptable - { - public: - virtual void UpdateLayout() = 0; - }; + /// Group enabled event. + compositions::GuiNotifyEvent GroupEnabledChanged; + /// Group title property changed event. + compositions::GuiNotifyEvent GroupTitlePropertyChanged; + /// Group children property changed event. + compositions::GuiNotifyEvent GroupChildrenPropertyChanged; - /// IToolstripUpdateLayout is a required service for a menu item which want to force the container to redo layout. - class IToolstripUpdateLayoutInvoker : public IDescriptable - { - public: - /// The identifier for this service. - static const wchar_t* const Identifier; + /// Get the item source. + /// The item source. + Ptr GetItemSource(); + /// Set the item source. + /// The item source. Null is acceptable if you want to clear all data. + void SetItemSource(Ptr value); - virtual void SetCallback(IToolstripUpdateLayout* callback) = 0; - }; + /// Test if grouping is enabled. Enabled means there is really both GroupTitleProperty and GroupChildrenProperty is not empty. + /// Returns true if grouping is enabled. + bool GetGroupEnabled(); - /// Toolstrip item collection. - class GuiToolstripCollectionBase : public collections::ObservableListBase - { - public: + /// Get the group title property. + /// The group title property. + ItemProperty GetGroupTitleProperty(); + /// Get the group title property. + /// The group title property. + void SetGroupTitleProperty(const ItemProperty& value); - protected: - IToolstripUpdateLayout * contentCallback; + /// Get the group children property. + /// The group children property. + ItemProperty> GetGroupChildrenProperty(); + /// Get the group children property. + /// The children title property. + void SetGroupChildrenProperty(const ItemProperty>& value); - void InvokeUpdateLayout(); - bool QueryInsert(vint index, GuiControl* const& child)override; - void BeforeRemove(vint index, GuiControl* const& child)override; - void AfterInsert(vint index, GuiControl* const& child)override; - void AfterRemove(vint index, vint count)override; - public: - GuiToolstripCollectionBase(IToolstripUpdateLayout* _contentCallback); - ~GuiToolstripCollectionBase(); - }; + /// Get all groups. + /// All groups. + const GalleryGroupList& GetGroups(); + }; + } - /// Toolstrip item collection. - class GuiToolstripCollection : public GuiToolstripCollectionBase + namespace ribbon_impl { - using EventHandlerList = collections::List>; - protected: - compositions::GuiStackComposition* stackComposition; - EventHandlerList eventHandlers; - - void UpdateItemVisibility(vint index, GuiControl* child); - void OnItemVisibleChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void BeforeRemove(vint index, GuiControl* const& child)override; - void AfterInsert(vint index, GuiControl* const& child)override; - void AfterRemove(vint index, vint count)override; - public: - GuiToolstripCollection(IToolstripUpdateLayout* _contentCallback, compositions::GuiStackComposition* _stackComposition); - ~GuiToolstripCollection(); - }; - -/*********************************************************************** -Toolstrip Container -***********************************************************************/ + class GalleryItemArrangerRepeatComposition; + class GalleryItemArranger; + class GalleryResponsiveLayout; + } - /// Toolstrip menu. - class GuiToolstripMenu : public GuiMenu, protected IToolstripUpdateLayout, Description + /// Auto resizable ribbon gallyer list. + class GuiBindableRibbonGalleryList : public GuiRibbonGallery, public list::GroupedDataSource, private IGuiMenuDropdownProvider, public Description { - protected: - compositions::GuiSharedSizeRootComposition* sharedSizeRootComposition; - compositions::GuiStackComposition* stackComposition; - Ptr toolstripItems; + friend class ribbon_impl::GalleryItemArrangerRepeatComposition; - void UpdateLayout()override; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - /// The owner menu item of the parent menu. - GuiToolstripMenu(theme::ThemeName themeName, GuiControl* _owner); - ~GuiToolstripMenu(); - - /// Get all managed child controls ordered by their positions. - /// All managed child controls. - collections::ObservableListBase& GetToolstripItems(); - }; + using IValueEnumerable = reflection::description::IValueEnumerable; + using IValueObservableList = reflection::description::IValueObservableList; + using ItemStyleProperty = TemplateProperty; - /// Toolstrip menu bar. - class GuiToolstripMenuBar : public GuiMenuBar, public Description - { + GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGalleryListTemplate, GuiRibbonGallery) protected: - compositions::GuiStackComposition* stackComposition; - Ptr toolstripItems; + ItemStyleProperty itemStyle; + GuiBindableTextList* itemList; + GuiRibbonToolstripMenu* subMenu; + vint visibleItemCount = 1; + bool skipItemAppliedEvent = false; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiToolstripMenuBar(theme::ThemeName themeName); - ~GuiToolstripMenuBar(); - - /// Get all managed child controls ordered by their positions. - /// All managed child controls. - collections::ObservableListBase& GetToolstripItems(); - }; + ribbon_impl::GalleryItemArranger* itemListArranger; + ribbon_impl::GalleryResponsiveLayout* layout; + GuiScrollContainer* groupContainer; + compositions::GuiRepeatStackComposition* groupStack; - /// Toolstrip tool bar. - class GuiToolstripToolBar : public GuiControl, public Description - { - protected: - compositions::GuiStackComposition* stackComposition; - Ptr toolstripItems; + void UpdateLayoutSizeOffset(); + void OnItemListSelectionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnItemListItemMouseEnter(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); + void OnItemListItemMouseLeave(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); + void OnCachedBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnRequestedDropdown(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnRequestedScrollUp(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + void OnRequestedScrollDown(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiToolstripToolBar(theme::ThemeName themeName); - ~GuiToolstripToolBar(); - - /// Get all managed child controls ordered by their positions. - /// All managed child controls. - collections::ObservableListBase& GetToolstripItems(); - }; + void MenuResetGroupTemplate(); + GuiControl* MenuGetGroupHeader(vint groupIndex); + compositions::GuiRepeatFlowComposition* MenuGetGroupFlow(vint groupIndex); + GuiSelectableButton* MenuGetGroupItemBackground(vint groupIndex, vint itemIndex); -/*********************************************************************** -Toolstrip Component -***********************************************************************/ + void StartPreview(vint index); + void StopPreview(vint index); - /// Toolstrip button that can connect with a . - class GuiToolstripButton : public GuiMenuButton, protected IToolstripUpdateLayoutInvoker, public Description - { - protected: - GuiToolstripCommand* command; - IToolstripUpdateLayout* callback = nullptr; - Ptr descriptionChangedHandler; + private: + GuiMenu* ProvideDropdownMenu()override; - void SetCallback(IToolstripUpdateLayout* _callback)override; - void OnActiveAlt()override; - void UpdateCommandContent(); - void OnLayoutAwaredPropertyChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnClicked(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnCommandDescriptionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); public: /// Create a control with a specified default theme. /// The theme name for retriving a default control template. - GuiToolstripButton(theme::ThemeName themeName); - ~GuiToolstripButton(); - - /// Get the attached . - /// The attached toolstrip command. - GuiToolstripCommand* GetCommand(); - /// Detach from the previous and attach to a new one. If the command is null, this function only do detaching. - /// The new toolstrip command. - void SetCommand(GuiToolstripCommand* value); + GuiBindableRibbonGalleryList(theme::ThemeName themeName); + ~GuiBindableRibbonGalleryList(); - /// Get the toolstrip sub menu. If the sub menu is not created, it returns null. - /// The toolstrip sub menu. - GuiToolstripMenu* GetToolstripSubMenu(); + /// Item template changed event. + compositions::GuiNotifyEvent ItemTemplateChanged; + /// Selection changed event. + compositions::GuiNotifyEvent SelectionChanged; + /// Preview started event. + compositions::GuiItemNotifyEvent PreviewStarted; + /// Preview stopped event. + compositions::GuiItemNotifyEvent PreviewStopped; + /// Item applied event. + compositions::GuiItemNotifyEvent ItemApplied; - /// Get the toolstrip sub menu. If the sub menu is not created, it returns null. - /// The toolstrip sub menu. - GuiToolstripMenu* EnsureToolstripSubMenu(); - /// Create the toolstrip sub menu if necessary. The created toolstrip sub menu is owned by this menu button. - /// The style controller for the toolstrip sub menu. Set to null to use the default control template. - void CreateToolstripSubMenu(TemplateProperty subMenuTemplate); + /// Get the item style provider. + /// The item style provider. + ItemStyleProperty GetItemTemplate(); + /// Set the item style provider + /// The new item style provider + void SetItemTemplate(ItemStyleProperty value); - IDescriptable* QueryService(const WString& identifier)override; - }; + /// Convert an item index to a gallery item position. + /// The gallery item position. + /// The item index. + GalleryPos IndexToGalleryPos(vint index); + /// Convert a gallery item position to an item index. + /// The item index. + /// The gallery item position. + vint GalleryPosToIndex(GalleryPos pos); -/*********************************************************************** -Toolstrip Group -***********************************************************************/ + /// Get the minimum number of items should be displayed. + /// The minimum number of items should be displayed. + vint GetMinCount(); + /// Set the minimum number of items should be displayed. + /// The minimum number of items should be displayed. + void SetMinCount(vint value); - class GuiToolstripNestedContainer : public GuiControl, protected IToolstripUpdateLayout, protected IToolstripUpdateLayoutInvoker - { - protected: - IToolstripUpdateLayout* callback = nullptr; + /// Get the maximum number of items should be displayed. + /// The maximum number of items should be displayed. + vint GetMaxCount(); + /// Set the maximum number of items should be displayed. + /// The maximum number of items should be displayed. + void SetMaxCount(vint value); - void UpdateLayout()override; - void SetCallback(IToolstripUpdateLayout* _callback)override; - public: - GuiToolstripNestedContainer(theme::ThemeName themeName); - ~GuiToolstripNestedContainer(); + /// Get the selected item index. + /// The index of the selected item. If there are multiple selected items, or there is no selected item, -1 will be returned. + vint GetSelectedIndex(); + /// Get the selected item. + /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. + description::Value GetSelectedItem(); + /// Select an item with event raised. + /// The index of the item to select. Set to -1 to clear the selection. + void ApplyItem(vint index); + /// Select an item without event raised. + /// The index of the item to select. Set to -1 to clear the selection. + void SelectItem(vint index); - IDescriptable* QueryService(const WString& identifier)override; - }; + /// Get the minimum items visible in the drop down menu. + /// The minimum items visible in the drop down menu. + vint GetVisibleItemCount(); + /// Set minimum items visible in the drop down menu. + /// The minimum items visible in the drop down menu. + void SetVisibleItemCount(vint value); - /// A toolstrip item, which is also a toolstrip item container, automatically maintaining splitters between items. - class GuiToolstripGroupContainer : public GuiToolstripNestedContainer, public Description - { - protected: - class GroupCollection : public GuiToolstripCollectionBase - { - protected: - GuiToolstripGroupContainer* container; - ControlTemplatePropertyType splitterTemplate; + /// Get the dropdown menu. + /// The dropdown menu. + GuiToolstripMenu* GetSubMenu(); - void BeforeRemove(vint index, GuiControl* const& child)override; - void AfterInsert(vint index, GuiControl* const& child)override; - void AfterRemove(vint index, vint count)override; - public: - GroupCollection(GuiToolstripGroupContainer* _container); - ~GroupCollection(); + IDescriptable* QueryService(const WString& identifier)override; + }; + } + } +} - ControlTemplatePropertyType GetSplitterTemplate(); - void SetSplitterTemplate(const ControlTemplatePropertyType& value); - void RebuildSplitters(); - }; +#endif - protected: - compositions::GuiStackComposition* stackComposition; - theme::ThemeName splitterThemeName; - Ptr groupCollection; - void OnParentLineChanged()override; - public: - GuiToolstripGroupContainer(theme::ThemeName themeName); - ~GuiToolstripGroupContainer(); +/*********************************************************************** +.\CONTROLS\INCLUDEALL.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Application Framework - ControlTemplatePropertyType GetSplitterTemplate(); - void SetSplitterTemplate(const ControlTemplatePropertyType& value); +Interfaces: +***********************************************************************/ - /// Get all managed child controls ordered by their positions. - /// All managed child controls. - collections::ObservableListBase& GetToolstripItems(); - }; +#ifndef VCZH_PRESENTATION_CONTROLS_INCLUDEALL +#define VCZH_PRESENTATION_CONTROLS_INCLUDEALL - /// A toolstrip item, which is also a toolstrip item container. - class GuiToolstripGroup : public GuiToolstripNestedContainer, public Description - { - protected: - compositions::GuiStackComposition* stackComposition; - Ptr toolstripItems; - void OnParentLineChanged()override; - public: - GuiToolstripGroup(theme::ThemeName themeName); - ~GuiToolstripGroup(); - /// Get all managed child controls ordered by their positions. - /// All managed child controls. - collections::ObservableListBase& GetToolstripItems(); - }; - } - } - namespace collections - { - namespace randomaccess_internal - { - template<> - struct RandomAccessable - { - static const bool CanRead = true; - static const bool CanResize = false; - }; - } - } -} #endif - /*********************************************************************** -.\CONTROLS\TOOLSTRIPPACKAGE\GUIRIBBONCONTROLS.H +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOLSCHEMASHARED.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) -GacUI::Control System +GacUI::Remote Window Interfaces: + IGuiRemoteProtocol + ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIRIBBONCONTROLS -#define VCZH_PRESENTATION_CONTROLS_GUIRIBBONCONTROLS +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMASHARED +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMASHARED -namespace vl +namespace vl::presentation::remoteprotocol { - namespace presentation + template + struct JsonHelper { - namespace controls - { - class GuiRibbonTabPage; - class GuiRibbonGroup; + static Ptr ToJson(const T& value); + static void ConvertJsonToCustomType(Ptr node, T& value); + }; -/*********************************************************************** -Ribbon Tab -***********************************************************************/ + template + Ptr ConvertCustomTypeToJson(const T& value) + { + return JsonHelper::ToJson(value); + } - /// Ribbon tab control, for displaying ribbon tab pages. - class GuiRibbonTab : public GuiTab, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonTabTemplate, GuiTab) - protected: - compositions::GuiBoundsComposition* beforeHeaders = nullptr; - compositions::GuiBoundsComposition* afterHeaders = nullptr; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiRibbonTab(theme::ThemeName themeName); - ~GuiRibbonTab(); + template<> Ptr ConvertCustomTypeToJson(const bool& value); + template<> Ptr ConvertCustomTypeToJson(const vint& value); + template<> Ptr ConvertCustomTypeToJson(const float& value); + template<> Ptr ConvertCustomTypeToJson(const double& value); + template<> Ptr ConvertCustomTypeToJson(const WString& value); + template<> Ptr ConvertCustomTypeToJson(const wchar_t& value); + template<> Ptr ConvertCustomTypeToJson(const VKEY& value); + template<> Ptr ConvertCustomTypeToJson(const Color& value); - /// Get the composition representing the space before tabs. - /// The composition representing the space before tabs. - compositions::GuiGraphicsComposition* GetBeforeHeaders(); - /// Get the composition representing the space after tabs. - /// The composition representing the space after tabs. - compositions::GuiGraphicsComposition* GetAfterHeaders(); - }; + template + void ConvertJsonToCustomType(Ptr node, T& value) + { + return JsonHelper::FromJson(node, value); + } - class GuiRibbonGroupCollection : public collections::ObservableListBase + template<> void ConvertJsonToCustomType(Ptr node, bool& value); + template<> void ConvertJsonToCustomType(Ptr node, vint& value); + template<> void ConvertJsonToCustomType(Ptr node, float& value); + template<> void ConvertJsonToCustomType(Ptr node, double& value); + template<> void ConvertJsonToCustomType(Ptr node, WString& value); + template<> void ConvertJsonToCustomType(Ptr node, wchar_t& value); + template<> void ConvertJsonToCustomType(Ptr node, VKEY& value); + template<> void ConvertJsonToCustomType(Ptr node, Color& value); + + template + void ConvertCustomTypeToJsonField(Ptr node, const wchar_t* name, const T& value) + { + auto field = Ptr(new glr::json::JsonObjectField); + field->name.value = WString::Unmanaged(name); + field->value = ConvertCustomTypeToJson(value); + node->fields.Add(field); + } + + template + struct JsonHelper> + { + static Ptr ToJson(const Nullable& value) + { + if (!value) { - protected: - GuiRibbonTabPage* tabPage = nullptr; + auto node = Ptr(new glr::json::JsonLiteral); + node->value = glr::json::JsonLiteralValue::Null; + return node; + } + else + { + return ConvertCustomTypeToJson(value.Value()); + } + } - bool QueryInsert(vint index, GuiRibbonGroup* const& value)override; - void AfterInsert(vint index, GuiRibbonGroup* const& value)override; - void AfterRemove(vint index, vint count)override; + static void FromJson(Ptr node, Nullable& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, Ptr>&)#" + if (auto jsonLiteral = node.Cast()) + { + if (jsonLiteral->value == glr::json::JsonLiteralValue::Null) + { + value.Reset(); + return; + } + else + { + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); + } + } + else + { + T item; + ConvertJsonToCustomType(node, item); + value = item; + } +#undef ERROR_MESSAGE_PREFIX + } + }; - public: - GuiRibbonGroupCollection(GuiRibbonTabPage* _tabPage); - ~GuiRibbonGroupCollection(); - }; + template + struct JsonHelper>> + { + static Ptr ToJson(const Ptr>& value) + { + if (!value) + { + auto node = Ptr(new glr::json::JsonLiteral); + node->value = glr::json::JsonLiteralValue::Null; + return node; + } + else + { + auto node = Ptr(new glr::json::JsonArray); + for (auto&& item : *value.Obj()) + { + node->items.Add(ConvertCustomTypeToJson(item)); + } + return node; + } + } - /// Ribbon tab page control, adding to the Pages property of a . - class GuiRibbonTabPage : public GuiTabPage, public AggregatableDescription + static void FromJson(Ptr node, Ptr>& value) + { +#define ERROR_MESSAGE_PREFIX L"vl::presentation::remoteprotocol::ConvertJsonToCustomType(Ptr, Ptr>&)#" + if (auto jsonLiteral = node.Cast()) { - friend class GuiRibbonGroupCollection; - protected: - bool highlighted = false; - GuiRibbonGroupCollection groups; - compositions::GuiResponsiveStackComposition* responsiveStack = nullptr; - compositions::GuiResponsiveContainerComposition* responsiveContainer = nullptr; - compositions::GuiStackComposition* stack = nullptr; + if (jsonLiteral->value == glr::json::JsonLiteralValue::Null) + { + value = {}; + return; + } + } + else if (auto jsonArray = node.Cast()) + { + value = Ptr(new collections::List); + for (auto jsonItem : jsonArray->items) + { + T item; + ConvertJsonToCustomType(jsonItem, item); + value->Add(std::move(item)); + } + return; + } + CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Json node does not match the expected type."); +#undef ERROR_MESSAGE_PREFIX + } + }; +} + +#endif + + +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\PROTOCOL\GENERATED\GUIREMOTEPROTOCOLSCHEMA.H +***********************************************************************/ +/*********************************************************************** +This file is generated by : Vczh GacUI Remote Protocol Generator +Licensed under https ://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMA +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_REMOTEPROTOCOLSCHEMA + + +namespace vl::presentation::remoteprotocol +{ + enum class IOMouseButton + { + Left, + Middle, + Right, + }; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiRibbonTabPage(theme::ThemeName themeName); - ~GuiRibbonTabPage(); - - /// Highlighted changed event. - compositions::GuiNotifyEvent HighlightedChanged; + enum class RendererType + { + FocusRectangle, + SolidBorder, + SinkBorder, + SinkSplitter, + SolidBackground, + GradientBackground, + InnerShadow, + SolidLabel, + Polygon, + UnsupportedImageFrame, + UnsupportedColorizedText, + UnsupportedDocument, + }; - /// Test if this is a highlighted tab page. - /// Returns true if this is a highlighted tab page. - bool GetHighlighted(); - /// Set if this is a highlighted tab page. - /// Set to true to highlight the tab page. - void SetHighlighted(bool value); + enum class ElementHorizontalAlignment + { + Left, + Right, + Center, + }; - /// Get the collection of ribbon groups. - /// The collection of ribbon groups. - collections::ObservableListBase& GetGroups(); - }; + enum class ElementVerticalAlignment + { + Top, + Bottom, + Center, + }; -/*********************************************************************** -Ribbon Group -***********************************************************************/ + enum class ElementSolidLabelMeasuringRequest + { + FontHeight, + TotalSize, + }; - class GuiRibbonGroupItemCollection : public collections::ObservableListBase - { - protected: - GuiRibbonGroup* group = nullptr; + struct FontConfig + { + ::vl::presentation::FontProperties defaultFont; + ::vl::Ptr<::vl::collections::List<::vl::WString>> supportedFonts; + }; - bool QueryInsert(vint index, GuiControl* const& value)override; - void AfterInsert(vint index, GuiControl* const& value)override; - void AfterRemove(vint index, vint count)override; + struct ScreenConfig + { + ::vl::presentation::NativeRect bounds; + ::vl::presentation::NativeRect clientBounds; + double scalingX; + double scalingY; + }; - public: - GuiRibbonGroupItemCollection(GuiRibbonGroup* _group); - ~GuiRibbonGroupItemCollection(); - }; + struct IOMouseInfoWithButton + { + ::vl::presentation::remoteprotocol::IOMouseButton button; + ::vl::presentation::NativeWindowMouseInfo info; + }; - /// Ribbon group control, adding to the Groups property of a . - class GuiRibbonGroup : public GuiControl, protected compositions::GuiAltActionHostBase, public Description - { - friend class GuiRibbonGroupItemCollection; - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGroupTemplate, GuiControl) - protected: + struct GlobalShortcutKey + { + ::vl::vint id; + bool ctrl; + bool shift; + bool alt; + ::vl::presentation::VKEY code; + }; - class CommandExecutor : public Object, public IRibbonGroupCommandExecutor - { - protected: - GuiRibbonGroup* group; + struct WindowSizingConfig + { + ::vl::presentation::NativeRect bounds; + ::vl::presentation::NativeRect clientBounds; + ::vl::presentation::INativeWindow::WindowSizeState sizeState; + ::vl::presentation::NativeMargin customFramePadding; + }; - public: - CommandExecutor(GuiRibbonGroup* _group); - ~CommandExecutor(); + struct WindowShowing + { + bool activate; + ::vl::presentation::INativeWindow::WindowSizeState sizeState; + }; - void NotifyExpandButtonClicked()override; - }; + struct ElementDesc_SolidBorder + { + ::vl::vint id; + ::vl::presentation::Color borderColor; + ::vl::presentation::elements::ElementShape shape; + }; - bool expandable = false; - Ptr largeImage; - GuiRibbonGroupItemCollection items; - compositions::GuiResponsiveStackComposition* responsiveStack = nullptr; - compositions::GuiStackComposition* stack = nullptr; - Ptr commandExecutor; + struct ElementDesc_SinkBorder + { + ::vl::vint id; + ::vl::presentation::Color leftTopColor; + ::vl::presentation::Color rightBottomColor; + }; - compositions::GuiResponsiveViewComposition* responsiveView = nullptr; - compositions::GuiResponsiveFixedComposition* responsiveFixedButton = nullptr; - GuiToolstripButton* dropdownButton = nullptr; - GuiMenu* dropdownMenu = nullptr; + struct ElementDesc_SinkSplitter + { + ::vl::vint id; + ::vl::presentation::Color leftTopColor; + ::vl::presentation::Color rightBottomColor; + ::vl::presentation::elements::Gui3DSplitterElement::Direction direction; + }; - bool IsAltAvailable()override; - compositions::IGuiAltActionHost* GetActivatingAltHost()override; - void OnCachedBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnTextChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); - void OnBeforeSubMenuOpening(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + struct ElementDesc_SolidBackground + { + ::vl::vint id; + ::vl::presentation::Color backgroundColor; + ::vl::presentation::elements::ElementShape shape; + }; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiRibbonGroup(theme::ThemeName themeName); - ~GuiRibbonGroup(); + struct ElementDesc_GradientBackground + { + ::vl::vint id; + ::vl::presentation::Color leftTopColor; + ::vl::presentation::Color rightBottomColor; + ::vl::presentation::elements::GuiGradientBackgroundElement::Direction direction; + ::vl::presentation::elements::ElementShape shape; + }; - /// Expandable changed event. - compositions::GuiNotifyEvent ExpandableChanged; - /// Expand button clicked event. - compositions::GuiNotifyEvent ExpandButtonClicked; - /// Large image changed event. - compositions::GuiNotifyEvent LargeImageChanged; + struct ElementDesc_InnerShadow + { + ::vl::vint id; + ::vl::presentation::Color shadowColor; + ::vl::vint thickness; + }; - /// Test if this group is expandable. An expandable group will display an extra small button, which raises . - /// Returns true if this group is expandable. - bool GetExpandable(); - /// Set if this group is expandable. - /// Set to true to make this group is expandable. - void SetExpandable(bool value); + struct ElementDesc_Polygon + { + ::vl::vint id; + ::vl::presentation::Size size; + ::vl::presentation::Color borderColor; + ::vl::presentation::Color backgroundColor; + ::vl::Ptr<::vl::collections::List<::vl::presentation::Point>> points; + }; - /// Get the large image for the collapsed ribbon group. - /// The large image for the collapsed ribbon group. - Ptr GetLargeImage(); - /// Set the large image for the collapsed ribbon group. - /// The large image for the collapsed ribbon group. - void SetLargeImage(Ptr value); + struct ElementDesc_SolidLabel + { + ::vl::vint id; + ::vl::presentation::Color textColor; + ::vl::presentation::remoteprotocol::ElementHorizontalAlignment horizontalAlignment; + ::vl::presentation::remoteprotocol::ElementVerticalAlignment verticalAlignment; + bool wrapLine; + bool wrapLineHeightCalculation; + bool ellipse; + bool multiline; + ::vl::Nullable<::vl::presentation::FontProperties> font; + ::vl::Nullable<::vl::WString> text; + ::vl::Nullable<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest> measuringRequest; + }; - /// Get the collection of controls in this group. - /// The collection of controls. - collections::ObservableListBase& GetItems(); - }; + struct RendererCreation + { + ::vl::vint id; + ::vl::presentation::remoteprotocol::RendererType type; + }; -/*********************************************************************** -Ribbon Buttons -***********************************************************************/ + struct ElementRendering + { + ::vl::vint id; + ::vl::presentation::Rect bounds; + ::vl::presentation::Rect clipper; + }; - /// Auto resizable ribbon icon label. - class GuiRibbonIconLabel : public GuiControl, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonIconLabelTemplate, GuiControl) - protected: - Ptr image; + struct ElementBoundary + { + ::vl::presentation::INativeWindowListener::HitTestResult hitTestResult; + ::vl::presentation::Rect bounds; + ::vl::presentation::Rect clipper; + }; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiRibbonIconLabel(theme::ThemeName themeName); - ~GuiRibbonIconLabel(); + struct ElementMeasuring_FontHeight + { + ::vl::WString fontFamily; + ::vl::vint fontSize; + ::vl::vint height; + }; - /// Image changed event. - compositions::GuiNotifyEvent ImageChanged; + struct ElementMeasuring_ElementMinSize + { + ::vl::vint id; + ::vl::presentation::Size minSize; + }; - /// Get the image for the menu button. - /// The image for the menu button. - Ptr GetImage(); - /// Set the image for the menu button. - /// The image for the menu button. - void SetImage(Ptr value); - }; + struct ElementMeasurings + { + ::vl::Ptr<::vl::collections::List<::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight>> fontHeights; + ::vl::Ptr<::vl::collections::List<::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize>> minSizes; + }; - /// Represents the size of a ribbon button in a control. - enum class RibbonButtonSize - { - /// Large icon with text. - Large = 0, - /// Small icon with text. - Small = 1, - /// Small icon only. - Icon = 2, - }; + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::IOMouseButton>(const ::vl::presentation::remoteprotocol::IOMouseButton & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeWindowListener::HitTestResult>(const ::vl::presentation::INativeWindowListener::HitTestResult & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeCursor::SystemCursorType>(const ::vl::presentation::INativeCursor::SystemCursorType & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::INativeWindow::WindowSizeState>(const ::vl::presentation::INativeWindow::WindowSizeState & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::RendererType>(const ::vl::presentation::remoteprotocol::RendererType & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::ElementShapeType>(const ::vl::presentation::elements::ElementShapeType & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::GuiGradientBackgroundElement::Direction>(const ::vl::presentation::elements::GuiGradientBackgroundElement::Direction & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::Gui3DSplitterElement::Direction>(const ::vl::presentation::elements::Gui3DSplitterElement::Direction & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementHorizontalAlignment>(const ::vl::presentation::remoteprotocol::ElementHorizontalAlignment & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementVerticalAlignment>(const ::vl::presentation::remoteprotocol::ElementVerticalAlignment & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest>(const ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeCoordinate>(const ::vl::presentation::NativeCoordinate & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativePoint>(const ::vl::presentation::NativePoint & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeSize>(const ::vl::presentation::NativeSize & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeRect>(const ::vl::presentation::NativeRect & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeMargin>(const ::vl::presentation::NativeMargin & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::Point>(const ::vl::presentation::Point & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::Size>(const ::vl::presentation::Size & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::Rect>(const ::vl::presentation::Rect & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::FontProperties>(const ::vl::presentation::FontProperties & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::FontConfig>(const ::vl::presentation::remoteprotocol::FontConfig & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ScreenConfig>(const ::vl::presentation::remoteprotocol::ScreenConfig & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowMouseInfo>(const ::vl::presentation::NativeWindowMouseInfo & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::IOMouseInfoWithButton>(const ::vl::presentation::remoteprotocol::IOMouseInfoWithButton & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowKeyInfo>(const ::vl::presentation::NativeWindowKeyInfo & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::NativeWindowCharInfo>(const ::vl::presentation::NativeWindowCharInfo & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::GlobalShortcutKey>(const ::vl::presentation::remoteprotocol::GlobalShortcutKey & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::WindowSizingConfig>(const ::vl::presentation::remoteprotocol::WindowSizingConfig & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::WindowShowing>(const ::vl::presentation::remoteprotocol::WindowShowing & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::elements::ElementShape>(const ::vl::presentation::elements::ElementShape & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SolidBorder>(const ::vl::presentation::remoteprotocol::ElementDesc_SolidBorder & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SinkBorder>(const ::vl::presentation::remoteprotocol::ElementDesc_SinkBorder & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter>(const ::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SolidBackground>(const ::vl::presentation::remoteprotocol::ElementDesc_SolidBackground & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_GradientBackground>(const ::vl::presentation::remoteprotocol::ElementDesc_GradientBackground & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_InnerShadow>(const ::vl::presentation::remoteprotocol::ElementDesc_InnerShadow & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_Polygon>(const ::vl::presentation::remoteprotocol::ElementDesc_Polygon & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementDesc_SolidLabel>(const ::vl::presentation::remoteprotocol::ElementDesc_SolidLabel & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::RendererCreation>(const ::vl::presentation::remoteprotocol::RendererCreation & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementRendering>(const ::vl::presentation::remoteprotocol::ElementRendering & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementBoundary>(const ::vl::presentation::remoteprotocol::ElementBoundary & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight>(const ::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize>(const ::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize & value); + template<> vl::Ptr ConvertCustomTypeToJson<::vl::presentation::remoteprotocol::ElementMeasurings>(const ::vl::presentation::remoteprotocol::ElementMeasurings & value); + + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::IOMouseButton>(vl::Ptr node, ::vl::presentation::remoteprotocol::IOMouseButton& value); + template<> void ConvertJsonToCustomType<::vl::presentation::INativeWindowListener::HitTestResult>(vl::Ptr node, ::vl::presentation::INativeWindowListener::HitTestResult& value); + template<> void ConvertJsonToCustomType<::vl::presentation::INativeCursor::SystemCursorType>(vl::Ptr node, ::vl::presentation::INativeCursor::SystemCursorType& value); + template<> void ConvertJsonToCustomType<::vl::presentation::INativeWindow::WindowSizeState>(vl::Ptr node, ::vl::presentation::INativeWindow::WindowSizeState& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::RendererType>(vl::Ptr node, ::vl::presentation::remoteprotocol::RendererType& value); + template<> void ConvertJsonToCustomType<::vl::presentation::elements::ElementShapeType>(vl::Ptr node, ::vl::presentation::elements::ElementShapeType& value); + template<> void ConvertJsonToCustomType<::vl::presentation::elements::GuiGradientBackgroundElement::Direction>(vl::Ptr node, ::vl::presentation::elements::GuiGradientBackgroundElement::Direction& value); + template<> void ConvertJsonToCustomType<::vl::presentation::elements::Gui3DSplitterElement::Direction>(vl::Ptr node, ::vl::presentation::elements::Gui3DSplitterElement::Direction& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementHorizontalAlignment>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementHorizontalAlignment& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementVerticalAlignment>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementVerticalAlignment& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementSolidLabelMeasuringRequest& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeCoordinate>(vl::Ptr node, ::vl::presentation::NativeCoordinate& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativePoint>(vl::Ptr node, ::vl::presentation::NativePoint& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeSize>(vl::Ptr node, ::vl::presentation::NativeSize& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeRect>(vl::Ptr node, ::vl::presentation::NativeRect& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeMargin>(vl::Ptr node, ::vl::presentation::NativeMargin& value); + template<> void ConvertJsonToCustomType<::vl::presentation::Point>(vl::Ptr node, ::vl::presentation::Point& value); + template<> void ConvertJsonToCustomType<::vl::presentation::Size>(vl::Ptr node, ::vl::presentation::Size& value); + template<> void ConvertJsonToCustomType<::vl::presentation::Rect>(vl::Ptr node, ::vl::presentation::Rect& value); + template<> void ConvertJsonToCustomType<::vl::presentation::FontProperties>(vl::Ptr node, ::vl::presentation::FontProperties& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::FontConfig>(vl::Ptr node, ::vl::presentation::remoteprotocol::FontConfig& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ScreenConfig>(vl::Ptr node, ::vl::presentation::remoteprotocol::ScreenConfig& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowMouseInfo>(vl::Ptr node, ::vl::presentation::NativeWindowMouseInfo& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::IOMouseInfoWithButton>(vl::Ptr node, ::vl::presentation::remoteprotocol::IOMouseInfoWithButton& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowKeyInfo>(vl::Ptr node, ::vl::presentation::NativeWindowKeyInfo& value); + template<> void ConvertJsonToCustomType<::vl::presentation::NativeWindowCharInfo>(vl::Ptr node, ::vl::presentation::NativeWindowCharInfo& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::GlobalShortcutKey>(vl::Ptr node, ::vl::presentation::remoteprotocol::GlobalShortcutKey& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::WindowSizingConfig>(vl::Ptr node, ::vl::presentation::remoteprotocol::WindowSizingConfig& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::WindowShowing>(vl::Ptr node, ::vl::presentation::remoteprotocol::WindowShowing& value); + template<> void ConvertJsonToCustomType<::vl::presentation::elements::ElementShape>(vl::Ptr node, ::vl::presentation::elements::ElementShape& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidBorder>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SolidBorder& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SinkBorder>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SinkBorder& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidBackground>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SolidBackground& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_GradientBackground>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_GradientBackground& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_InnerShadow>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_InnerShadow& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_Polygon>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_Polygon& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementDesc_SolidLabel>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementDesc_SolidLabel& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::RendererCreation>(vl::Ptr node, ::vl::presentation::remoteprotocol::RendererCreation& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementRendering>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementRendering& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementBoundary>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementBoundary& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementMeasuring_FontHeight& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementMeasuring_ElementMinSize& value); + template<> void ConvertJsonToCustomType<::vl::presentation::remoteprotocol::ElementMeasurings>(vl::Ptr node, ::vl::presentation::remoteprotocol::ElementMeasurings& value); - class GuiRibbonButtons; +#define GACUI_REMOTEPROTOCOL_MESSAGES(HANDLER)\ + HANDLER(ControllerGetFontConfig, void, ::vl::presentation::remoteprotocol::FontConfig, NOREQ, RES, NODROP)\ + HANDLER(ControllerGetScreenConfig, void, ::vl::presentation::remoteprotocol::ScreenConfig, NOREQ, RES, NODROP)\ + HANDLER(ControllerConnectionEstablished, void, void, NOREQ, NORES, NODROP)\ + HANDLER(ControllerConnectionStopped, void, void, NOREQ, NORES, NODROP)\ + HANDLER(IOUpdateGlobalShortcutKey, ::vl::Ptr<::vl::collections::List<::vl::presentation::remoteprotocol::GlobalShortcutKey>>, void, REQ, NORES, NODROP)\ + HANDLER(IORequireCapture, void, void, NOREQ, NORES, NODROP)\ + HANDLER(IOReleaseCapture, void, void, NOREQ, NORES, NODROP)\ + HANDLER(IOIsKeyPressing, ::vl::presentation::VKEY, bool, REQ, RES, NODROP)\ + HANDLER(IOIsKeyToggled, ::vl::presentation::VKEY, bool, REQ, RES, NODROP)\ + HANDLER(WindowGetBounds, void, ::vl::presentation::remoteprotocol::WindowSizingConfig, NOREQ, RES, NODROP)\ + HANDLER(WindowNotifySetTitle, ::vl::WString, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetEnabled, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetTopMost, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetShowInTaskBar, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetCustomFrameMode, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetMaximizedBox, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetMinimizedBox, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetBorder, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetSizeBox, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetIconVisible, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetTitleBar, bool, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetBounds, ::vl::presentation::NativeRect, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifySetClientSize, ::vl::presentation::NativeSize, void, REQ, NORES, DROPREP)\ + HANDLER(WindowNotifyActivate, void, void, NOREQ, NORES, DROPREP)\ + HANDLER(WindowNotifyShow, ::vl::presentation::remoteprotocol::WindowShowing, void, REQ, NORES, DROPREP)\ + HANDLER(RendererCreated, ::vl::Ptr<::vl::collections::List<::vl::presentation::remoteprotocol::RendererCreation>>, void, REQ, NORES, NODROP)\ + HANDLER(RendererDestroyed, ::vl::Ptr<::vl::collections::List<::vl::vint>>, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_SolidBorder, ::vl::presentation::remoteprotocol::ElementDesc_SolidBorder, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_SinkBorder, ::vl::presentation::remoteprotocol::ElementDesc_SinkBorder, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_SinkSplitter, ::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_SolidBackground, ::vl::presentation::remoteprotocol::ElementDesc_SolidBackground, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_GradientBackground, ::vl::presentation::remoteprotocol::ElementDesc_GradientBackground, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_InnerShadow, ::vl::presentation::remoteprotocol::ElementDesc_InnerShadow, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_Polygon, ::vl::presentation::remoteprotocol::ElementDesc_Polygon, void, REQ, NORES, NODROP)\ + HANDLER(RendererUpdateElement_SolidLabel, ::vl::presentation::remoteprotocol::ElementDesc_SolidLabel, void, REQ, NORES, NODROP)\ + HANDLER(RendererBeginRendering, void, void, NOREQ, NORES, NODROP)\ + HANDLER(RendererBeginBoundary, ::vl::presentation::remoteprotocol::ElementBoundary, void, REQ, NORES, NODROP)\ + HANDLER(RendererRenderElement, ::vl::presentation::remoteprotocol::ElementRendering, void, REQ, NORES, NODROP)\ + HANDLER(RendererEndBoundary, void, void, NOREQ, NORES, NODROP)\ + HANDLER(RendererEndRendering, void, ::vl::presentation::remoteprotocol::ElementMeasurings, NOREQ, RES, NODROP)\ - class GuiRibbonButtonsItemCollection : public collections::ObservableListBase - { - protected: - GuiRibbonButtons* buttons = nullptr; +#define GACUI_REMOTEPROTOCOL_EVENTS(HANDLER)\ + HANDLER(ControllerConnect, void, NOREQ, NODROP)\ + HANDLER(ControllerDisconnect, void, NOREQ, NODROP)\ + HANDLER(ControllerRequestExit, void, NOREQ, NODROP)\ + HANDLER(ControllerForceExit, void, NOREQ, NODROP)\ + HANDLER(ControllerScreenUpdated, ::vl::presentation::remoteprotocol::ScreenConfig, REQ, DROPREP)\ + HANDLER(IOGlobalShortcutKey, ::vl::vint, REQ, NODROP)\ + HANDLER(IOButtonDown, ::vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ + HANDLER(IOButtonDoubleClick, ::vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ + HANDLER(IOButtonUp, ::vl::presentation::remoteprotocol::IOMouseInfoWithButton, REQ, NODROP)\ + HANDLER(IOHWheel, ::vl::presentation::NativeWindowMouseInfo, REQ, NODROP)\ + HANDLER(IOVWheel, ::vl::presentation::NativeWindowMouseInfo, REQ, NODROP)\ + HANDLER(IOMouseMoving, ::vl::presentation::NativeWindowMouseInfo, REQ, DROPCON)\ + HANDLER(IOMouseEntered, void, NOREQ, NODROP)\ + HANDLER(IOMouseLeaved, void, NOREQ, NODROP)\ + HANDLER(IOKeyDown, ::vl::presentation::NativeWindowKeyInfo, REQ, NODROP)\ + HANDLER(IOKeyUp, ::vl::presentation::NativeWindowKeyInfo, REQ, NODROP)\ + HANDLER(IOChar, ::vl::presentation::NativeWindowCharInfo, REQ, NODROP)\ + HANDLER(WindowBoundsUpdated, ::vl::presentation::remoteprotocol::WindowSizingConfig, REQ, DROPREP)\ + HANDLER(WindowActivatedUpdated, bool, REQ, DROPREP)\ - bool QueryInsert(vint index, GuiControl* const& value)override; - void AfterInsert(vint index, GuiControl* const& value)override; - void BeforeRemove(vint index, GuiControl* const& value)override; +#define GACUI_REMOTEPROTOCOL_MESSAGE_REQUEST_TYPES(HANDLER)\ + HANDLER(::vl::Ptr<::vl::collections::List<::vl::presentation::remoteprotocol::GlobalShortcutKey>>)\ + HANDLER(::vl::Ptr<::vl::collections::List<::vl::presentation::remoteprotocol::RendererCreation>>)\ + HANDLER(::vl::Ptr<::vl::collections::List<::vl::vint>>)\ + HANDLER(::vl::WString)\ + HANDLER(::vl::presentation::NativeRect)\ + HANDLER(::vl::presentation::NativeSize)\ + HANDLER(::vl::presentation::VKEY)\ + HANDLER(::vl::presentation::remoteprotocol::ElementBoundary)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_GradientBackground)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_InnerShadow)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_Polygon)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_SinkBorder)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_SinkSplitter)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_SolidBackground)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_SolidBorder)\ + HANDLER(::vl::presentation::remoteprotocol::ElementDesc_SolidLabel)\ + HANDLER(::vl::presentation::remoteprotocol::ElementRendering)\ + HANDLER(::vl::presentation::remoteprotocol::WindowShowing)\ + HANDLER(bool)\ + +#define GACUI_REMOTEPROTOCOL_MESSAGE_RESPONSE_TYPES(HANDLER)\ + HANDLER(::vl::presentation::remoteprotocol::ElementMeasurings)\ + HANDLER(::vl::presentation::remoteprotocol::FontConfig)\ + HANDLER(::vl::presentation::remoteprotocol::ScreenConfig)\ + HANDLER(::vl::presentation::remoteprotocol::WindowSizingConfig)\ + HANDLER(bool)\ + +#define GACUI_REMOTEPROTOCOL_EVENT_REQUEST_TYPES(HANDLER)\ + HANDLER(::vl::presentation::NativeWindowCharInfo)\ + HANDLER(::vl::presentation::NativeWindowKeyInfo)\ + HANDLER(::vl::presentation::NativeWindowMouseInfo)\ + HANDLER(::vl::presentation::remoteprotocol::IOMouseInfoWithButton)\ + HANDLER(::vl::presentation::remoteprotocol::ScreenConfig)\ + HANDLER(::vl::presentation::remoteprotocol::WindowSizingConfig)\ + HANDLER(::vl::vint)\ + HANDLER(bool)\ - public: - GuiRibbonButtonsItemCollection(GuiRibbonButtons* _buttons); - ~GuiRibbonButtonsItemCollection(); - }; +} - /// Auto resizable ribbon buttons. - class GuiRibbonButtons : public GuiControl, public Description - { - friend class GuiRibbonButtonsItemCollection; - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonButtonsTemplate, GuiControl) - protected: - RibbonButtonSize minSize; - RibbonButtonSize maxSize; - compositions::GuiResponsiveViewComposition* responsiveView = nullptr; - compositions::GuiResponsiveFixedComposition* views[3] = { nullptr,nullptr,nullptr }; - GuiRibbonButtonsItemCollection buttons; - - void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); - void SetButtonThemeName(compositions::GuiResponsiveCompositionBase* fixed, GuiControl* button); - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - /// Max allowed size. - /// Min allowed size. - GuiRibbonButtons(theme::ThemeName themeName, RibbonButtonSize _maxSize, RibbonButtonSize _minSize); - ~GuiRibbonButtons(); +#endif - /// Get the collection of buttons. is expected. - /// The collection of buttons. - collections::ObservableListBase& GetButtons(); - }; /*********************************************************************** -Ribbon Toolstrips +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEGRAPHICS.H ***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window - class GuiRibbonToolstrips; - - class GuiRibbonToolstripsGroupCollection : public collections::ObservableListBase - { - protected: - GuiRibbonToolstrips* toolstrips = nullptr; +Interfaces: + GuiRemoteController - bool QueryInsert(vint index, GuiToolstripGroup* const& value)override; - void AfterInsert(vint index, GuiToolstripGroup* const& value)override; - void AfterRemove(vint index, vint count)override; +***********************************************************************/ - public: - GuiRibbonToolstripsGroupCollection(GuiRibbonToolstrips* _toolstrips); - ~GuiRibbonToolstripsGroupCollection(); - }; +#ifndef VCZH_PRESENTATION_GUIREMOTEGRAPHICS +#define VCZH_PRESENTATION_GUIREMOTEGRAPHICS - /// Auto resizable ribbon toolstrips. - class GuiRibbonToolstrips : public GuiControl, public Description - { - friend class GuiRibbonToolstripsGroupCollection; - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonToolstripsTemplate, GuiControl) - protected: - compositions::GuiResponsiveViewComposition* responsiveView = nullptr; - GuiToolstripToolBar* toolbars[5] = { nullptr,nullptr,nullptr,nullptr,nullptr }; - GuiToolstripGroupContainer* longContainers[2] = { nullptr,nullptr }; - GuiToolstripGroupContainer* shortContainers[3] = { nullptr,nullptr,nullptr }; - compositions::GuiResponsiveFixedComposition* views[2] = { nullptr,nullptr }; - GuiRibbonToolstripsGroupCollection groups; - void OnBeforeSwitchingView(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); - void RearrangeToolstripGroups(vint viewIndex = -1); - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiRibbonToolstrips(theme::ThemeName themeName); - ~GuiRibbonToolstrips(); +namespace vl::presentation +{ + class GuiHostedController; + class GuiRemoteController; + class GuiRemoteMessages; - /// Get the collection of toolstrip groups. will decide the order of these toolstrip groups. - /// The collection of toolstrip groups. - collections::ObservableListBase& GetGroups(); - }; + namespace elements_remoteprotocol + { + class IGuiRemoteProtocolElementRender; + } + namespace elements + { /*********************************************************************** -Ribbon Gallery +GuiRemoteGraphicsRenderTarget ***********************************************************************/ - /// Ribbon gallery, with scroll up, scroll down, dropdown buttons. - class GuiRibbonGallery : public GuiControl, public Description - { - using ItemStyle = templates::GuiListItemTemplate; - using ItemStyleProperty = TemplateProperty; + class GuiRemoteGraphicsRenderTarget : public GuiGraphicsRenderTarget + { + using RendererMap = collections::Dictionary; + using RendererSet = collections::SortedList; + using FontHeightMap = collections::Dictionary, vint>; + using HitTestResult = INativeWindowListener::HitTestResult; + protected: + GuiRemoteController* remote; + GuiHostedController* hostedController; + NativeSize canvasSize; + vint usedElementIds = 0; + RendererMap renderers; + collections::SortedList createdRenderers; + collections::SortedList destroyedRenderers; + RendererSet renderersAskingForCache; + Nullable clipperValidArea; + collections::List hitTestResults; - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGalleryTemplate, GuiControl) - protected: - class CommandExecutor : public Object, public IRibbonGalleryCommandExecutor - { - protected: - GuiRibbonGallery* gallery; + HitTestResult GetHitTestResultFromGenerator(reflection::DescriptableObject* generator); - public: - CommandExecutor(GuiRibbonGallery* _gallery); - ~CommandExecutor(); + void StartRenderingOnNativeWindow() override; + RenderTargetFailure StopRenderingOnNativeWindow() override; - void NotifyScrollUp()override; - void NotifyScrollDown()override; - void NotifyDropdown()override; - }; + Size GetCanvasSize() override; + void AfterPushedClipper(Rect clipper, Rect validArea, reflection::DescriptableObject* generator) override; + void AfterPushedClipperAndBecameInvalid(Rect clipper, reflection::DescriptableObject* generator) override; + void AfterPoppedClipperAndBecameValid(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) override; + void AfterPoppedClipper(Rect validArea, bool clipperExists, reflection::DescriptableObject* generator) override; - bool scrollUpEnabled = true; - bool scrollDownEnabled = true; - Ptr commandExecutor; + public: + FontHeightMap fontHeights; + vuint64_t renderingBatchId = 0; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiRibbonGallery(theme::ThemeName themeName); - ~GuiRibbonGallery(); + GuiRemoteGraphicsRenderTarget(GuiRemoteController* _remote, GuiHostedController* _hostedController); + ~GuiRemoteGraphicsRenderTarget(); - /// Scroll up enabled changed event. - compositions::GuiNotifyEvent ScrollUpEnabledChanged; - /// Scroll down enabled changed event. - compositions::GuiNotifyEvent ScrollDownEnabledChanged; - /// Scroll up button clicked event. - compositions::GuiNotifyEvent RequestedScrollUp; - /// Scroll down button clicked event. - compositions::GuiNotifyEvent RequestedScrollDown; - /// Dropdown button clicked event. - compositions::GuiNotifyEvent RequestedDropdown; + void OnControllerConnect(); + void OnControllerDisconnect(); - /// Test if the scroll up button is enabled. - /// Returns true if the scroll up button is enabled. - bool GetScrollUpEnabled(); - /// Set if the scroll up button is enabled. - /// Set to true to enable the scroll up button. - void SetScrollUpEnabled(bool value); + GuiRemoteMessages& GetRemoteMessages(); + vint AllocateNewElementId(); + void RegisterRenderer(elements_remoteprotocol::IGuiRemoteProtocolElementRender* renderer); + void UnregisterRenderer(elements_remoteprotocol::IGuiRemoteProtocolElementRender* renderer); + Rect GetClipperValidArea(); + }; - /// Test if the scroll down button is enabled. - /// Returns true if the scroll down button is enabled. - bool GetScrollDownEnabled(); - /// Set if the scroll down button is enabled. - /// Set to true to enable the scroll down button. - void SetScrollDownEnabled(bool value); - }; +/*********************************************************************** +GuiRemoteGraphicsResourceManager +***********************************************************************/ - /// Resizable ribbon toolstrip menu with a space above of all menu items to display extra content. - class GuiRibbonToolstripMenu : public GuiToolstripMenu, public Description - { - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonToolstripMenuTemplate, GuiToolstripMenu) - protected: - compositions::GuiBoundsComposition* contentComposition; + class GuiRemoteGraphicsResourceManager : public GuiGraphicsResourceManager + { + protected: + GuiRemoteController* remote; + GuiRemoteGraphicsRenderTarget renderTarget; + GuiHostedController* hostedController; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - /// The owner menu item of the parent menu. - GuiRibbonToolstripMenu(theme::ThemeName themeName, GuiControl* owner); - ~GuiRibbonToolstripMenu(); + public: + GuiRemoteGraphicsResourceManager(GuiRemoteController* _remote, GuiHostedController* _hostedController); + ~GuiRemoteGraphicsResourceManager(); - /// Get the composition representing the space above of menu items. - /// The composition representing the space above of menu items. - compositions::GuiGraphicsComposition* GetContentComposition(); - }; - } + void Initialize(); + void Finalize(); + + void OnControllerConnect(); + void OnControllerDisconnect(); + + // ============================================================= + // IGuiGraphicsResourceManager + // ============================================================= + + IGuiGraphicsRenderTarget* GetRenderTarget(INativeWindow* window) override; + void RecreateRenderTarget(INativeWindow* window) override; + void ResizeRenderTarget(INativeWindow* window) override; + IGuiGraphicsLayoutProvider* GetLayoutProvider() override; + }; } } #endif - /*********************************************************************** -.\CONTROLS\TOOLSTRIPPACKAGE\GUIRIBBONGALLERYLIST.H +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEGRAPHICS_BASICELEMENTS.H ***********************************************************************/ /*********************************************************************** Vczh Library++ 3.0 Developer: Zihan Chen(vczh) -GacUI::Control System +GacUI::Remote Window Interfaces: ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_GUIRIBBONGALLERYLIST -#define VCZH_PRESENTATION_CONTROLS_GUIRIBBONGALLERYLIST +#ifndef VCZH_PRESENTATION_GUIREMOTEGRAPHICS_BASICELEMENTS +#define VCZH_PRESENTATION_GUIREMOTEGRAPHICS_BASICELEMENTS -namespace vl +namespace vl::presentation::elements_remoteprotocol { - namespace presentation + using namespace elements; + + class IGuiRemoteProtocolElementRender : public virtual Interface { - namespace controls - { + public: + virtual IGuiGraphicsRenderer* GetRenderer() = 0; + virtual vint GetID() = 0; + virtual remoteprotocol::RendererType GetRendererType() = 0; + virtual bool IsUpdated() = 0; + virtual void ResetUpdated() = 0; + virtual void SendUpdateElementMessages(bool fullContent) = 0; + virtual bool IsRenderedInLastBatch() = 0; + + virtual bool NeedUpdateMinSizeFromCache() = 0; + virtual void TryFetchMinSizeFromCache() = 0; + virtual void UpdateMinSize(Size size) = 0; + virtual void NotifyMinSizeCacheInvalidated() = 0; + }; -/*********************************************************************** -Ribbon Gallery List -***********************************************************************/ + template + class GuiRemoteProtocolElementRenderer + : public GuiElementRendererBase + , public virtual IGuiRemoteProtocolElementRender + { + protected: + vint id = -1; + vuint64_t renderingBatchId = 0; + bool updated = true; - /// Represents the position of an item in the gallery list. - struct GalleryPos - { - /// Group index. - vint group; - /// Item index. - vint item; + void InitializeInternal(); + void FinalizeInternal(); + void RenderTargetChangedInternal(GuiRemoteGraphicsRenderTarget* oldRenderTarget, GuiRemoteGraphicsRenderTarget* newRenderTarget); + public: + // IGuiRemoteProtocolElementRender + IGuiGraphicsRenderer* GetRenderer() override; + vint GetID() override; + remoteprotocol::RendererType GetRendererType() override; + bool IsUpdated() override; + void ResetUpdated() override; + bool IsRenderedInLastBatch() override; + + bool NeedUpdateMinSizeFromCache() override; + void TryFetchMinSizeFromCache() override; + void UpdateMinSize(Size size) override; + void NotifyMinSizeCacheInvalidated() override; + + // IGuiGraphicsRenderer + void Render(Rect bounds) override; + void OnElementStateChanged() override; + }; - GalleryPos() - :group(-1), item(-1) - { - } + class GuiFocusRectangleElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiFocusRectangleElementRenderer(); + + bool IsUpdated() override; + void ResetUpdated() override; + void SendUpdateElementMessages(bool fullContent) override; + void OnElementStateChanged() override; + }; + + class GuiSolidBorderElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiSolidBorderElementRenderer(); + + void SendUpdateElementMessages(bool fullContent) override; + }; + + class Gui3DBorderElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + Gui3DBorderElementRenderer(); + + void SendUpdateElementMessages(bool fullContent) override; + }; + + class Gui3DSplitterElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + Gui3DSplitterElementRenderer(); + + void SendUpdateElementMessages(bool fullContent) override; + }; + + class GuiSolidBackgroundElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiSolidBackgroundElementRenderer(); - GalleryPos(vint _group, vint _item) - :group(_group), item(_item) - { - } + void SendUpdateElementMessages(bool fullContent) override; + }; - GUI_DEFINE_COMPARE_OPERATORS(GalleryPos) - }; + class GuiGradientBackgroundElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiGradientBackgroundElementRenderer(); - namespace list - { - class GroupedDataSource; + void SendUpdateElementMessages(bool fullContent) override; + }; - /// A gallery group. - class GalleryGroup : public Description - { - friend class GroupedDataSource; - using IValueList = reflection::description::IValueList; - protected: - Ptr eventHandler; - WString name; - Ptr itemValues; + class GuiInnerShadowElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiInnerShadowElementRenderer(); - public: - GalleryGroup(); - ~GalleryGroup(); + void SendUpdateElementMessages(bool fullContent) override; + }; - /// Get the title of this group. - /// The title of this group. - WString GetName(); - /// Get the all items of this group, could be null. - /// All items of this group. - Ptr GetItemValues(); - }; + class GuiSolidLabelElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + using MeasuringRequest = Nullable; + protected: + FontProperties lastFont; + WString lastText; + bool needFontHeight = false; - class GroupedDataSource : public Description - { - using IValueEnumerable = reflection::description::IValueEnumerable; - using IValueList = reflection::description::IValueList; - using IValueObservableList = reflection::description::IValueObservableList; - using GalleryItemList = collections::ObservableList; - using GalleryGroupList = collections::ObservableList>; + MeasuringRequest GetMeasuringRequest(); + bool IsNeedFontHeight(MeasuringRequest request); + public: + GuiSolidLabelElementRenderer(); - protected: - compositions::GuiGraphicsComposition* associatedComposition; - Ptr itemSource; - ItemProperty titleProperty; - ItemProperty> childrenProperty; + bool NeedUpdateMinSizeFromCache() override; + void TryFetchMinSizeFromCache() override; + void UpdateMinSize(Size size) override; + void NotifyMinSizeCacheInvalidated() override; - GalleryItemList joinedItemSource; - GalleryGroupList groupedItemSource; - collections::List cachedGroupItemCounts; - Ptr groupChangedHandler; - bool ignoreGroupChanged = false; + void SendUpdateElementMessages(bool fullContent) override; + }; - void RebuildItemSource(); - Ptr GetChildren(Ptr children); - void AttachGroupChanged(Ptr group, vint index); - void OnGroupChanged(vint start, vint oldCount, vint newCount); - void OnGroupItemChanged(vint index, vint start, vint oldCount, vint newCount); - vint GetCountBeforeGroup(vint index); - void InsertGroupToJoined(vint index); - void RemoveGroupFromJoined(vint index); + class GuiImageFrameElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiImageFrameElementRenderer(); - public: - GroupedDataSource(compositions::GuiGraphicsComposition* _associatedComposition); - ~GroupedDataSource(); + void SendUpdateElementMessages(bool fullContent) override; + }; - /// Group enabled event. - compositions::GuiNotifyEvent GroupEnabledChanged; - /// Group title property changed event. - compositions::GuiNotifyEvent GroupTitlePropertyChanged; - /// Group children property changed event. - compositions::GuiNotifyEvent GroupChildrenPropertyChanged; + class GuiPolygonElementRenderer : public GuiRemoteProtocolElementRenderer + { + friend class GuiElementRendererBase; + public: + GuiPolygonElementRenderer(); - /// Get the item source. - /// The item source. - Ptr GetItemSource(); - /// Set the item source. - /// The item source. Null is acceptable if you want to clear all data. - void SetItemSource(Ptr value); + void SendUpdateElementMessages(bool fullContent) override; + }; - /// Test if grouping is enabled. Enabled means there is really both GroupTitleProperty and GroupChildrenProperty is not empty. - /// Returns true if grouping is enabled. - bool GetGroupEnabled(); + class GuiColorizedTextElementRenderer : public GuiRemoteProtocolElementRenderer, protected GuiColorizedTextElement::ICallback + { + friend class GuiElementRendererBase; + using TBase = GuiRemoteProtocolElementRenderer; + protected: + void ColorChanged() override; + void FontChanged() override; + void InitializeInternal(); + void FinalizeInternal(); + public: + GuiColorizedTextElementRenderer(); - /// Get the group title property. - /// The group title property. - ItemProperty GetGroupTitleProperty(); - /// Get the group title property. - /// The group title property. - void SetGroupTitleProperty(const ItemProperty& value); + void OnElementStateChanged() override; + void SendUpdateElementMessages(bool fullContent) override; + }; +} - /// Get the group children property. - /// The group children property. - ItemProperty> GetGroupChildrenProperty(); - /// Get the group children property. - /// The children title property. - void SetGroupChildrenProperty(const ItemProperty>& value); +#endif - /// Get all groups. - /// All groups. - const GalleryGroupList& GetGroups(); - }; - } +/*********************************************************************** +.\PLATFORMPROVIDERS\REMOTE\GUIREMOTEPROTOCOL.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Remote Window - namespace ribbon_impl - { - class GalleryItemArrangerRepeatComposition; - class GalleryItemArranger; - class GalleryResponsiveLayout; - } +Interfaces: + IGuiRemoteProtocol - /// Auto resizable ribbon gallyer list. - class GuiBindableRibbonGalleryList : public GuiRibbonGallery, public list::GroupedDataSource, private IGuiMenuDropdownProvider, public Description - { - friend class ribbon_impl::GalleryItemArrangerRepeatComposition; +***********************************************************************/ - using IValueEnumerable = reflection::description::IValueEnumerable; - using IValueObservableList = reflection::description::IValueObservableList; - using ItemStyleProperty = TemplateProperty; +#ifndef VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEPROTOCOL +#define VCZH_PRESENTATION_GUIREMOTECONTROLLER_GUIREMOTEPROTOCOL - GUI_SPECIFY_CONTROL_TEMPLATE_TYPE(RibbonGalleryListTemplate, GuiRibbonGallery) - protected: - ItemStyleProperty itemStyle; - GuiBindableTextList* itemList; - GuiRibbonToolstripMenu* subMenu; - vint visibleItemCount = 1; - bool skipItemAppliedEvent = false; - ribbon_impl::GalleryItemArranger* itemListArranger; - ribbon_impl::GalleryResponsiveLayout* layout; - GuiScrollContainer* groupContainer; - compositions::GuiRepeatStackComposition* groupStack; +namespace vl::presentation +{ +/*********************************************************************** +IGuiRemoteProtocolEvents +***********************************************************************/ - void UpdateLayoutSizeOffset(); - void OnItemListSelectionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnItemListItemMouseEnter(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); - void OnItemListItemMouseLeave(compositions::GuiGraphicsComposition* sender, compositions::GuiItemEventArgs& arguments); - void OnCachedBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnRequestedDropdown(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnRequestedScrollUp(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); - void OnRequestedScrollDown(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments); + class IGuiRemoteProtocolEvents : public virtual Interface + { + public: +#define EVENT_NOREQ(NAME, REQUEST) virtual void On ## NAME() = 0; +#define EVENT_REQ(NAME, REQUEST) virtual void On ## NAME(const REQUEST& arguments) = 0; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_REQ +#undef EVENT_NOREQ - void MenuResetGroupTemplate(); - GuiControl* MenuGetGroupHeader(vint groupIndex); - compositions::GuiRepeatFlowComposition* MenuGetGroupFlow(vint groupIndex); - GuiSelectableButton* MenuGetGroupItemBackground(vint groupIndex, vint itemIndex); +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE) virtual void Respond ## NAME(vint id, const RESPONSE& arguments) = 0; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + }; - void StartPreview(vint index); - void StopPreview(vint index); +/*********************************************************************** +IGuiRemoteProtocolMessages +***********************************************************************/ - private: - GuiMenu* ProvideDropdownMenu()override; + class IGuiRemoteProtocolMessages : public virtual Interface + { + public: +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME() = 0; +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(vint id) = 0; +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(const REQUEST& arguments) = 0; +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE) virtual void Request ## NAME(vint id, const REQUEST& arguments) = 0; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES + }; - public: - /// Create a control with a specified default theme. - /// The theme name for retriving a default control template. - GuiBindableRibbonGalleryList(theme::ThemeName themeName); - ~GuiBindableRibbonGalleryList(); +/*********************************************************************** +IGuiRemoteProtocolConfig +***********************************************************************/ - /// Item template changed event. - compositions::GuiNotifyEvent ItemTemplateChanged; - /// Selection changed event. - compositions::GuiNotifyEvent SelectionChanged; - /// Preview started event. - compositions::GuiItemNotifyEvent PreviewStarted; - /// Preview stopped event. - compositions::GuiItemNotifyEvent PreviewStopped; - /// Item applied event. - compositions::GuiItemNotifyEvent ItemApplied; + class IGuiRemoteProtocolConfig : public virtual Interface + { + public: + virtual WString GetExecutablePath() = 0; + }; - /// Get the item style provider. - /// The item style provider. - ItemStyleProperty GetItemTemplate(); - /// Set the item style provider - /// The new item style provider - void SetItemTemplate(ItemStyleProperty value); +/*********************************************************************** +IGuiRemoteProtocol +***********************************************************************/ - /// Convert an item index to a gallery item position. - /// The gallery item position. - /// The item index. - GalleryPos IndexToGalleryPos(vint index); - /// Convert a gallery item position to an item index. - /// The item index. - /// The gallery item position. - vint GalleryPosToIndex(GalleryPos pos); + class IGuiRemoteProtocol + : public virtual IGuiRemoteProtocolConfig + , public virtual IGuiRemoteProtocolMessages + { + public: + virtual void Initialize(IGuiRemoteProtocolEvents* events) = 0; + virtual void Submit() = 0; + virtual void ProcessRemoteEvents() = 0; + }; +} + +namespace vl::presentation::remoteprotocol::repeatfiltering +{ + using FilteredRequestTypes = Variant; + + using FilteredResponseTypes = Variant; + + using FilteredEventTypes = Variant; + + enum class FilteredRequestNames + { + Unknown, +#define FILTERED_ENUM_ITEM(NAME, ...) NAME, + GACUI_REMOTEPROTOCOL_MESSAGES(FILTERED_ENUM_ITEM) +#undef FILTERED_ENUM_ITEM + }; - /// Get the minimum number of items should be displayed. - /// The minimum number of items should be displayed. - vint GetMinCount(); - /// Set the minimum number of items should be displayed. - /// The minimum number of items should be displayed. - void SetMinCount(vint value); + enum class FilteredResponseNames + { + Unknown, +#define FILTERED_ENUM_ITEM_NORES(NAME) +#define FILTERED_ENUM_ITEM_RES(NAME) NAME, +#define FILTERED_ENUN_ITEM(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) FILTERED_ENUM_ITEM_ ## RESTAG(NAME) + GACUI_REMOTEPROTOCOL_MESSAGES(FILTERED_ENUN_ITEM) +#undef FILTERED_ENUM_ITEM +#undef FILTERED_ENUM_ITEM_RES +#undef FILTERED_ENUM_ITEM_NORES + }; - /// Get the maximum number of items should be displayed. - /// The maximum number of items should be displayed. - vint GetMaxCount(); - /// Set the maximum number of items should be displayed. - /// The maximum number of items should be displayed. - void SetMaxCount(vint value); + enum class FilteredEventNames + { + Unknown, +#define FILTERED_ENUM_ITEM(NAME, ...) NAME, + GACUI_REMOTEPROTOCOL_EVENTS(FILTERED_ENUM_ITEM) +#undef FILTERED_ENUM_ITEM + }; - /// Get the selected item index. - /// The index of the selected item. If there are multiple selected items, or there is no selected item, -1 will be returned. - vint GetSelectedIndex(); - /// Get the selected item. - /// Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned. - description::Value GetSelectedItem(); - /// Select an item with event raised. - /// The index of the item to select. Set to -1 to clear the selection. - void ApplyItem(vint index); - /// Select an item without event raised. - /// The index of the item to select. Set to -1 to clear the selection. - void SelectItem(vint index); + struct FilteredRequest + { + bool dropped = false; + vint id = -1; + FilteredRequestNames name = FilteredRequestNames::Unknown; + FilteredRequestTypes arguments; + }; - /// Get the minimum items visible in the drop down menu. - /// The minimum items visible in the drop down menu. - vint GetVisibleItemCount(); - /// Set minimum items visible in the drop down menu. - /// The minimum items visible in the drop down menu. - void SetVisibleItemCount(vint value); + struct FilteredResponse + { + vint id = -1; + FilteredResponseNames name = FilteredResponseNames::Unknown; + FilteredResponseTypes arguments; + }; - /// Get the dropdown menu. - /// The dropdown menu. - GuiToolstripMenu* GetSubMenu(); + struct FilteredEvent + { + bool dropped = false; + vint id = -1; + FilteredEventNames name = FilteredEventNames::Unknown; + FilteredEventTypes arguments; + }; - IDescriptable* QueryService(const WString& identifier)override; - }; +/*********************************************************************** +GuiRemoteEventFilter +***********************************************************************/ + + class GuiRemoteEventFilter + : public Object + , public virtual IGuiRemoteProtocolEvents + { + protected: + collections::List filteredResponses; + collections::List filteredEvents; + +#define EVENT_NODROP(NAME) +#define EVENT_DROPREP(NAME) vint lastDropRepeatEvent ## NAME = -1; +#define EVENT_DROPCON(NAME) vint lastDropConsecutiveEvent ## NAME = -1; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NODROP + + public: + IGuiRemoteProtocolEvents* targetEvents = nullptr; + bool submitting = false; + collections::Dictionary responseIds; + + void ProcessResponses() + { + for (auto&& response : filteredResponses) + { +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE)\ + case FilteredResponseNames::NAME:\ + targetEvents->Respond ## NAME(response.id, response.arguments.Get());\ + break;\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + switch (response.name) + { + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) + default: + CHECK_FAIL(L"vl::presentation::remoteprotocol::GuiRemoteEventFilter::ProcessResponses()#Unrecognized response."); + } +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + } + + filteredResponses.Clear(); + } + + void ProcessEvents() + { +#define EVENT_NODROP(NAME) +#define EVENT_DROPREP(NAME) lastDropRepeatEvent ## NAME = -1; +#define EVENT_DROPCON(NAME) lastDropConsecutiveEvent ## NAME = -1; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NODROP + + collections::List events(std::move(filteredEvents)); + + for (auto&& event : events) + { + if (event.dropped) + { + continue; + } + +#define EVENT_NOREQ(NAME, REQUEST)\ + case FilteredEventNames::NAME:\ + targetEvents->On ## NAME();\ + break;\ + +#define EVENT_REQ(NAME, REQUEST)\ + case FilteredEventNames::NAME:\ + targetEvents->On ## NAME(event.arguments.Get());\ + break;\ + +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST) + switch (event.name) + { + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) + default: + CHECK_FAIL(L"vl::presentation::remoteprotocol::GuiRemoteEventFilter::ProcessEvents()#Unrecognized event."); + } +#undef EVENT_HANDLER +#undef EVENT_REQ +#undef EVENT_NOREQ + } } - } -} -#endif + // responses + +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE)\ + void Respond ## NAME(vint id, const RESPONSE& arguments) override\ + {\ + CHECK_ERROR(\ + responseIds[id] == FilteredResponseNames::NAME,\ + L"vl::presentation::remoteprotocol::GuiRemoteEventFilter::"\ + L"Respond" L ## #NAME L"()#"\ + L"Messages sending to IGuiRemoteProtocol should be responded by calling the correct function.");\ + responseIds.Remove(id);\ + FilteredResponse response;\ + response.id = id;\ + response.name = FilteredResponseNames::NAME;\ + response.arguments = arguments;\ + filteredResponses.Add(response);\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + // events + +#define EVENT_NODROP(NAME) + +#define EVENT_DROPREP(NAME)\ + if (lastDropRepeatEvent ## NAME != -1)\ + {\ + filteredEvents[lastDropRepeatEvent ## NAME].dropped = true;\ + }\ + lastDropRepeatEvent ## NAME = filteredEvents.Count() - 1\ + +#define EVENT_DROPCON(NAME)\ + if (lastDropConsecutiveEvent ## NAME != -1 && lastDropConsecutiveEvent ## NAME == filteredEvents.Count() - 1)\ + {\ + filteredEvents[lastDropConsecutiveEvent ## NAME].dropped = true;\ + }\ + lastDropConsecutiveEvent ## NAME = filteredEvents.Count() - 1\ + +#define EVENT_NOREQ(NAME, REQUEST, DROPTAG)\ + void On ## NAME() override\ + {\ + if (submitting)\ + {\ + EVENT_ ## DROPTAG(NAME);\ + FilteredEvent event;\ + event.name = FilteredEventNames::NAME;\ + filteredEvents.Add(event);\ + }\ + else\ + {\ + targetEvents->On ## NAME();\ + }\ + }\ + +#define EVENT_REQ(NAME, REQUEST, DROPTAG)\ + void On ## NAME(const REQUEST& arguments) override\ + {\ + if (submitting)\ + {\ + EVENT_ ## DROPTAG(NAME);\ + FilteredEvent event;\ + event.name = FilteredEventNames::NAME;\ + event.arguments = arguments;\ + filteredEvents.Add(event);\ + }\ + else\ + {\ + targetEvents->On ## NAME(arguments);\ + }\ + }\ + +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST, DROPTAG) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_REQ +#undef EVENT_NOREQ +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NOREP + }; /*********************************************************************** -.\CONTROLS\INCLUDEALL.H +GuiRemoteProtocolFilter ***********************************************************************/ -/*********************************************************************** -Vczh Library++ 3.0 -Developer: Zihan Chen(vczh) -GacUI::Application Framework -Interfaces: + class GuiRemoteProtocolFilterVerifier; + + class GuiRemoteProtocolFilter + : public Object + , public virtual IGuiRemoteProtocol + { + friend class GuiRemoteProtocolFilterVerifier; + protected: + IGuiRemoteProtocol* targetProtocol = nullptr; + GuiRemoteEventFilter eventFilter; + vint lastRequestId = -1; + collections::List filteredRequests; + +#define MESSAGE_NODROP(NAME) +#define MESSAGE_DROPREP(NAME) vint lastDropRepeatRequest ## NAME = -1; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, DROPTAG) MESSAGE_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_DROPREP +#undef MESSAGE_NODROP + + void ProcessRequests() + { +#define MESSAGE_NODROP(NAME) +#define MESSAGE_DROPREP(NAME) lastDropRepeatRequest ## NAME = -1; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, DROPTAG) MESSAGE_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_DROPREP +#undef MESSAGE_NODROP + + for (auto&& request : filteredRequests) + { + CHECK_ERROR(\ + !request.dropped || request.id == -1,\ + L"vl::presentation::remoteprotocol::GuiRemoteProtocolFilter::ProcessRequests()#"\ + L"Messages with id cannot be dropped.");\ + if (request.dropped) + { + continue; + } + +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE)\ + case FilteredRequestNames::NAME:\ + targetProtocol->Request ## NAME();\ + break;\ + +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE)\ + case FilteredRequestNames::NAME:\ + targetProtocol->Request ## NAME(request.id);\ + break;\ + +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE)\ + case FilteredRequestNames::NAME:\ + targetProtocol->Request ## NAME(request.arguments.Get());\ + break;\ + +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE)\ + case FilteredRequestNames::NAME:\ + targetProtocol->Request ## NAME(request.id, request.arguments.Get());\ + break;\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE) + switch (request.name) + { + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) + default: + CHECK_FAIL(L"vl::presentation::remoteprotocol::GuiRemoteProtocolFilter::ProcessRequests()#Unrecognized request."); + } +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES + } + + CHECK_ERROR(eventFilter.responseIds.Count() == 0, L"Messages sending to IGuiRemoteProtocol should be all responded."); + filteredRequests.Clear(); + } + public: + GuiRemoteProtocolFilter(IGuiRemoteProtocol* _protocol) + : targetProtocol(_protocol) + { + } + + protected: + + public: + + // messages + +#define MESSAGE_NODROP(NAME) + +#define MESSAGE_DROPREP(NAME)\ + if (lastDropRepeatRequest ## NAME != -1)\ + {\ + filteredRequests[lastDropRepeatRequest ## NAME].dropped = true;\ + }\ + lastDropRepeatRequest ## NAME = filteredRequests.Count()\ + +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME() override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + FilteredRequest request;\ + request.name = FilteredRequestNames::NAME;\ + filteredRequests.Add(request);\ + }\ + +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME(vint id) override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + CHECK_ERROR(\ + lastRequestId < id,\ + L"vl::presentation::remoteprotocol::GuiRemoteProtocolFilter::"\ + L"Request" L ## #NAME L"()#"\ + L"Id of a message sending to IGuiRemoteProtocol should be increasing.");\ + lastRequestId = id;\ + FilteredRequest request;\ + request.id = id;\ + request.name = FilteredRequestNames::NAME;\ + filteredRequests.Add(request);\ + eventFilter.responseIds.Add(id, FilteredResponseNames::NAME);\ + }\ + +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME(const REQUEST& arguments) override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + FilteredRequest request;\ + request.name = FilteredRequestNames::NAME;\ + request.arguments = arguments;\ + filteredRequests.Add(request);\ + }\ + +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME(vint id, const REQUEST& arguments) override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + CHECK_ERROR(\ + lastRequestId < id,\ + L"vl::presentation::remoteprotocol::GuiRemoteProtocolFilter::"\ + L"Request" L ## #NAME L"()#"\ + L"Id of a message sending to IGuiRemoteProtocol should be increasing.");\ + lastRequestId = id;\ + FilteredRequest request;\ + request.id = id;\ + request.name = FilteredRequestNames::NAME;\ + request.arguments = arguments;\ + filteredRequests.Add(request);\ + eventFilter.responseIds.Add(id, FilteredResponseNames::NAME);\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, DROPTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE, DROPTAG) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES +#undef MESSAGE_DROPREP +#undef MESSAGE_NODROP + + // protocol + + WString GetExecutablePath() override + { + return targetProtocol->GetExecutablePath(); + } + + void Initialize(IGuiRemoteProtocolEvents* _events) override + { + eventFilter.targetEvents = _events; + targetProtocol->Initialize(&eventFilter); + } + + void Submit() override + { + eventFilter.submitting = true; + targetProtocol->Submit(); + ProcessRequests(); + eventFilter.ProcessResponses(); + eventFilter.submitting = false; + eventFilter.ProcessEvents(); + } + + void ProcessRemoteEvents() override + { + targetProtocol->ProcessRemoteEvents(); + } + }; + +/*********************************************************************** +GuiRemoteEventFilterVerifier ***********************************************************************/ -#ifndef VCZH_PRESENTATION_CONTROLS_INCLUDEALL -#define VCZH_PRESENTATION_CONTROLS_INCLUDEALL + class GuiRemoteEventFilterVerifier + : public Object + , public virtual IGuiRemoteProtocolEvents + { + protected: +#define EVENT_NODROP(NAME) +#define EVENT_DROPREP(NAME) bool lastDropRepeatEvent ## NAME = false; +#define EVENT_DROPCON(NAME) bool lastDropConsecutiveEvent ## NAME = false; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NODROP + + public: + IGuiRemoteProtocolEvents* targetEvents = nullptr; + bool submitting = false; + + void ClearDropRepeatMasks() + { +#define EVENT_NODROP(NAME) +#define EVENT_DROPREP(NAME) lastDropRepeatEvent ## NAME = false; +#define EVENT_DROPCON(NAME) +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NODROP + } + void ClearDropConsecutiveMasks() + { +#define EVENT_NODROP(NAME) +#define EVENT_DROPREP(NAME) +#define EVENT_DROPCON(NAME) lastDropConsecutiveEvent ## NAME = false; +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NODROP + } + + // responses +#define MESSAGE_NORES(NAME, RESPONSE) +#define MESSAGE_RES(NAME, RESPONSE)\ + void Respond ## NAME(vint id, const RESPONSE& arguments) override\ + {\ + targetEvents->Respond ## NAME(id, arguments);\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, ...) MESSAGE_ ## RESTAG(NAME, RESPONSE) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_RES +#undef MESSAGE_NORES + // events + +#define EVENT_NODROP(NAME) + +#define EVENT_DROPREP(NAME)\ + CHECK_ERROR(!lastDropRepeatEvent ## NAME, L"vl::presentation::remoteprotocol::GuiRemoteEventFilterVerifier::On" L ## #NAME L"(...)#[@DropRepeat] event repeated.");\ + lastDropRepeatEvent ## NAME = true;\ + +#define EVENT_DROPCON(NAME)\ + CHECK_ERROR(!lastDropConsecutiveEvent ## NAME, L"vl::presentation::remoteprotocol::GuiRemoteEventFilterVerifier::On" L ## #NAME L"(...)#[@DropConsecutive] event repeated.");\ + ClearDropConsecutiveMasks();\ + lastDropConsecutiveEvent ## NAME = true;\ + +#define EVENT_NOREQ(NAME, REQUEST, DROPTAG)\ + void On ## NAME() override\ + {\ + if (submitting)\ + {\ + EVENT_ ## DROPTAG(NAME);\ + targetEvents->On ## NAME();\ + }\ + else\ + {\ + targetEvents->On ## NAME();\ + }\ + }\ + +#define EVENT_REQ(NAME, REQUEST, DROPTAG)\ + void On ## NAME(const REQUEST& arguments) override\ + {\ + if (submitting)\ + {\ + EVENT_ ## DROPTAG(NAME);\ + targetEvents->On ## NAME(arguments);\ + }\ + else\ + {\ + targetEvents->On ## NAME(arguments);\ + }\ + }\ + +#define EVENT_HANDLER(NAME, REQUEST, REQTAG, DROPTAG, ...) EVENT_ ## REQTAG(NAME, REQUEST, DROPTAG) + GACUI_REMOTEPROTOCOL_EVENTS(EVENT_HANDLER) +#undef EVENT_HANDLER +#undef EVENT_REQ +#undef EVENT_NOREQ +#undef EVENT_DROPCON +#undef EVENT_DROPREP +#undef EVENT_NOREP + }; +/*********************************************************************** +GuiRemoteProtocolFilterVerifier +***********************************************************************/ + + class GuiRemoteProtocolFilterVerifier + : public Object + , public virtual IGuiRemoteProtocol + { + protected: + GuiRemoteProtocolFilter* targetProtocol = nullptr; + GuiRemoteEventFilterVerifier eventFilter; + vint lastRequestId = -1; + collections::List filteredRequests; + +#define MESSAGE_NODROP(NAME) +#define MESSAGE_DROPREP(NAME) bool lastDropRepeatRequest ## NAME = false; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, DROPTAG) MESSAGE_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_DROPREP +#undef MESSAGE_NODROP + + void ClearDropRepeatMasks() + { +#define MESSAGE_NODROP(NAME) +#define MESSAGE_DROPREP(NAME) lastDropRepeatRequest ## NAME = false; +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, DROPTAG) MESSAGE_ ## DROPTAG(NAME) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_DROPREP +#undef MESSAGE_NODROP + } + public: + GuiRemoteProtocolFilterVerifier(GuiRemoteProtocolFilter* _protocol) + : targetProtocol(_protocol) + { + } + + protected: + + public: + + // messages + +#define MESSAGE_NODROP(NAME) + +#define MESSAGE_DROPREP(NAME)\ + CHECK_ERROR(!lastDropRepeatRequest ## NAME, L"vl::presentation::remoteprotocol::GuiRemoteProtocolFilterVerifier::Request" L ## #NAME L"(...)#[@DropRepeat] message repeated.");\ + lastDropRepeatRequest ## NAME = true;\ + +#define MESSAGE_NOREQ_NORES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME() override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + targetProtocol->Request ## NAME();\ + }\ + +#define MESSAGE_NOREQ_RES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME(vint id) override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + targetProtocol->Request ## NAME(id);\ + }\ + +#define MESSAGE_REQ_NORES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME(const REQUEST& arguments) override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + targetProtocol->Request ## NAME(arguments);\ + }\ + +#define MESSAGE_REQ_RES(NAME, REQUEST, RESPONSE, DROPTAG)\ + void Request ## NAME(vint id, const REQUEST& arguments) override\ + {\ + MESSAGE_ ## DROPTAG(NAME);\ + targetProtocol->Request ## NAME(id, arguments);\ + }\ + +#define MESSAGE_HANDLER(NAME, REQUEST, RESPONSE, REQTAG, RESTAG, DROPTAG, ...) MESSAGE_ ## REQTAG ## _ ## RESTAG(NAME, REQUEST, RESPONSE, DROPTAG) + GACUI_REMOTEPROTOCOL_MESSAGES(MESSAGE_HANDLER) +#undef MESSAGE_HANDLER +#undef MESSAGE_REQ_RES +#undef MESSAGE_REQ_NORES +#undef MESSAGE_NOREQ_RES +#undef MESSAGE_NOREQ_NORES +#undef MESSAGE_DROPREP +#undef MESSAGE_NODROP + + // protocol + + WString GetExecutablePath() override + { + return targetProtocol->GetExecutablePath(); + } + + void Initialize(IGuiRemoteProtocolEvents* _events) override + { + targetProtocol->Initialize(&eventFilter); + eventFilter.targetEvents = targetProtocol->eventFilter.targetEvents; + targetProtocol->eventFilter.targetEvents = _events; + } + + void Submit() override + { + eventFilter.submitting = true; + targetProtocol->Submit(); + ClearDropRepeatMasks(); + eventFilter.ClearDropRepeatMasks(); + eventFilter.ClearDropConsecutiveMasks(); + eventFilter.submitting = false; + } + + void ProcessRemoteEvents() override + { + targetProtocol->ProcessRemoteEvents(); + } + }; +} #endif @@ -26342,6 +27592,7 @@ GuiHostedController void Initialize(); void Finalize(); + void RequestRefresh(); // ============================================================= // INativeController @@ -26680,31 +27931,32 @@ GuiRemoteController using HotKeySet = collections::SortedList; using HotKeyIds = collections::Dictionary; protected: - IGuiRemoteProtocol* remoteProtocol; - GuiRemoteMessages remoteMessages; - GuiRemoteEvents remoteEvents; - GuiRemoteWindow remoteWindow; - SharedCallbackService callbackService; - SharedAsyncService asyncService; - bool applicationRunning = false; - bool connectionForcedToStop = false; - bool connectionStopped = false; - - remoteprotocol::FontConfig remoteFontConfig; - remoteprotocol::ScreenConfig remoteScreenConfig; - - vint usedHotKeys = (vint)NativeGlobalShortcutKeyResult::ValidIdBegins; - HotKeySet hotKeySet; - HotKeyIds hotKeyIds; - - CursorMap cursors; - bool timerEnabled = false; - bool windowCreated = false; - bool windowDestroyed = false; - - collections::Dictionary keyNames; - collections::Dictionary keyCodes; - bool keyInitialized = false; + IGuiRemoteProtocol* remoteProtocol = nullptr; + GuiRemoteMessages remoteMessages; + GuiRemoteEvents remoteEvents; + GuiRemoteWindow remoteWindow; + elements::GuiRemoteGraphicsResourceManager* resourceManager = nullptr; + SharedCallbackService callbackService; + SharedAsyncService asyncService; + bool applicationRunning = false; + bool connectionForcedToStop = false; + bool connectionStopped = false; + + remoteprotocol::FontConfig remoteFontConfig; + remoteprotocol::ScreenConfig remoteScreenConfig; + + vint usedHotKeys = (vint)NativeGlobalShortcutKeyResult::ValidIdBegins; + HotKeySet hotKeySet; + HotKeyIds hotKeyIds; + + CursorMap cursors; + bool timerEnabled = false; + bool windowCreated = false; + bool windowDestroyed = false; + + collections::Dictionary keyNames; + collections::Dictionary keyCodes; + bool keyInitialized = false; // ============================================================= // INativeResourceService diff --git a/Import/GacUICompiler.cpp b/Import/GacUICompiler.cpp index e47c9db7..57c1e8c1 100644 --- a/Import/GacUICompiler.cpp +++ b/Import/GacUICompiler.cpp @@ -10504,6 +10504,11 @@ CheckRemoteProtocolSchema } } + void Visit(GuiRpOptionalType* node) override + { + node->element->Accept(this); + } + void Visit(GuiRpArrayType* node) override { node->element->Accept(this); @@ -10551,11 +10556,30 @@ CheckRemoteProtocolSchema { errors.Add({ att->name.codeRange,L"Missing parameter for attribute: \"" + att->name.value + L"\"." }); } + else if (symbols->cppMapping.Keys().Contains(node->name.value)) + { + errors.Add({ att->name.codeRange,L"Too many attributes: \"" + att->name.value + L"\"." }); + } else { symbols->cppMapping.Add(node->name.value, att->cppType.value); } } + else if (att->name.value == L"@CppNamespace") + { + if (!att->cppType) + { + errors.Add({ att->name.codeRange,L"Missing parameter for attribute: \"" + att->name.value + L"\"." }); + } + else if (symbols->cppNamespaces.Keys().Contains(node->name.value)) + { + errors.Add({ att->name.codeRange,L"Too many attributes: \"" + att->name.value + L"\"." }); + } + else + { + symbols->cppNamespaces.Add(node->name.value, att->cppType.value); + } + } else { errors.Add({ att->name.codeRange,L"Unsupported attribute: \"" + att->name.value + L"\" on enum \"" + node->name.value + L"\"." }); @@ -10749,6 +10773,9 @@ GenerateRemoteProtocolHeaderFile case GuiRpPrimitiveTypes::Key: writer.WriteString(L"::vl::presentation::VKEY"); break; + case GuiRpPrimitiveTypes::Color: + writer.WriteString(L"::vl::presentation::Color"); + break; default: CHECK_FAIL(L"Unrecognized type"); } @@ -10759,7 +10786,7 @@ GenerateRemoteProtocolHeaderFile vint index = symbols->cppMapping.Keys().IndexOf(type); if (index == -1) { - return config.cppNamespace + L"::" + type; + return L"::" + config.cppNamespace + L"::" + type; } else { @@ -10767,11 +10794,31 @@ GenerateRemoteProtocolHeaderFile } } + static WString GetCppNamespace(const WString& type, Ptr symbols, GuiRpCppConfig& config) + { + vint index = symbols->cppNamespaces.Keys().IndexOf(type); + if (index == -1) + { + return GetCppType(type, symbols, config); + } + else + { + return symbols->cppNamespaces.Values()[index]; + } + } + void Visit(GuiRpReferenceType* node) override { writer.WriteString(GetCppType(node->name.value, symbols, config)); } + void Visit(GuiRpOptionalType* node) override + { + writer.WriteString(L"::vl::Nullable<"); + node->element->Accept(this); + writer.WriteString(L">"); + } + void Visit(GuiRpArrayType* node) override { writer.WriteString(L"::vl::Ptr<::vl::collections::List<"); @@ -10917,6 +10964,66 @@ GenerateRemoteProtocolHeaderFile } writer.WriteLine(L""); + SortedList requestTypes, responseTypes, eventTypes; + { + for (auto messageDecl : From(schema->declarations).FindType()) + { + if (messageDecl->request) + { + auto type = stream::GenerateToStream([&](stream::TextWriter& writer) + { + GuiRpPrintTypeVisitor visitor(symbols, config, writer); + messageDecl->request->type->Accept(&visitor); + }); + if (!requestTypes.Contains(type)) + { + requestTypes.Add(type); + } + } + + if (messageDecl->response) + { + auto type = stream::GenerateToStream([&](stream::TextWriter& writer) + { + GuiRpPrintTypeVisitor visitor(symbols, config, writer); + messageDecl->response->type->Accept(&visitor); + }); + if (!responseTypes.Contains(type)) + { + responseTypes.Add(type); + } + } + } + + for (auto eventDecl : From(schema->declarations).FindType()) + { + if (eventDecl->request) + { + auto type = stream::GenerateToStream([&](stream::TextWriter& writer) + { + GuiRpPrintTypeVisitor visitor(symbols, config, writer); + eventDecl->request->type->Accept(&visitor); + }); + if (!eventTypes.Contains(type)) + { + eventTypes.Add(type); + } + } + } + } + + writer.WriteLine(L"#define GACUI_REMOTEPROTOCOL_MESSAGE_REQUEST_TYPES(HANDLER)\\"); + for (auto type : requestTypes) writer.WriteLine(L"\tHANDLER(" + type + L")\\"); + writer.WriteLine(L""); + + writer.WriteLine(L"#define GACUI_REMOTEPROTOCOL_MESSAGE_RESPONSE_TYPES(HANDLER)\\"); + for (auto type : responseTypes) writer.WriteLine(L"\tHANDLER(" + type + L")\\"); + writer.WriteLine(L""); + + writer.WriteLine(L"#define GACUI_REMOTEPROTOCOL_EVENT_REQUEST_TYPES(HANDLER)\\"); + for (auto type : eventTypes) writer.WriteLine(L"\tHANDLER(" + type + L")\\"); + writer.WriteLine(L""); + writer.WriteLine(L"}"); writer.WriteLine(L""); writer.WriteLine(L"#endif"); @@ -10929,6 +11036,7 @@ GenerateRemoteProtocolCppFile void GenerateEnumSerializerFunctionImpl(Ptr enumDecl, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) { WString cppName = GuiRpPrintTypeVisitor::GetCppType(enumDecl->name.value, symbols, config); + WString cppNss = GuiRpPrintTypeVisitor::GetCppNamespace(enumDecl->name.value, symbols, config); GenerateSerializerFunctionHeader(cppName, false, writer); writer.WriteLine(L"\t{"); writer.WriteLine(L"#define ERROR_MESSAGE_PREFIX L\"vl::presentation::remoteprotocol::ConvertCustomTypeToJson<" + cppName + L">(const " + cppName + L"&)#\""); @@ -10937,7 +11045,7 @@ GenerateRemoteProtocolCppFile writer.WriteLine(L"\t\t{"); for (auto member : enumDecl->members) { - writer.WriteLine(L"\t\tcase " + cppName + L"::" + member->name.value + L": node->content.value = L\"" + member->name.value + L"\"; break;"); + writer.WriteLine(L"\t\tcase " + cppNss + L"::" + member->name.value + L": node->content.value = WString::Unmanaged(L\"" + member->name.value + L"\"); break;"); } writer.WriteLine(L"\t\tdefault: CHECK_FAIL(ERROR_MESSAGE_PREFIX L\"Unsupported enum value.\");"); writer.WriteLine(L"\t\t}"); @@ -10965,6 +11073,7 @@ GenerateRemoteProtocolCppFile void GenerateEnumDeserializerFunctionImpl(Ptr enumDecl, Ptr symbols, GuiRpCppConfig& config, stream::TextWriter& writer) { WString cppName = GuiRpPrintTypeVisitor::GetCppType(enumDecl->name.value, symbols, config); + WString cppNss = GuiRpPrintTypeVisitor::GetCppNamespace(enumDecl->name.value, symbols, config); GenerateDeserializerFunctionHeader(cppName, false, writer); writer.WriteLine(L"\t{"); writer.WriteLine(L"#define ERROR_MESSAGE_PREFIX L\"vl::presentation::remoteprotocol::ConvertJsonToCustomType<" + cppName + L">(Ptr, " + cppName + L"&)#\""); @@ -10972,7 +11081,7 @@ GenerateRemoteProtocolCppFile writer.WriteLine(L"\t\tCHECK_ERROR(jsonNode, ERROR_MESSAGE_PREFIX L\"Json node does not match the expected type.\");"); for (auto member : enumDecl->members) { - writer.WriteLine(L"\t\tif (jsonNode->content.value == L\"" + member->name.value + L"\") value = " + cppName + L"::" + member->name.value + L"; else"); + writer.WriteLine(L"\t\tif (jsonNode->content.value == L\"" + member->name.value + L"\") value = " + cppNss + L"::" + member->name.value + L"; else"); } writer.WriteLine(L"\t\tCHECK_FAIL(ERROR_MESSAGE_PREFIX L\"Unsupported enum value.\");"); writer.WriteLine(L"#undef ERROR_MESSAGE_PREFIX"); @@ -11061,6 +11170,11 @@ Visitor Pattern Implementation visitor->Visit(this); } + void GuiRpOptionalType::Accept(GuiRpType::IVisitor* visitor) + { + visitor->Visit(this); + } + void GuiRpArrayType::Accept(GuiRpType::IVisitor* visitor) { visitor->Visit(this); @@ -11095,6 +11209,7 @@ namespace vl::reflection::description IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes, presentation::remoteprotocol::GuiRpPrimitiveTypes) IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpPrimitiveType, presentation::remoteprotocol::GuiRpPrimitiveType) IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpReferenceType, presentation::remoteprotocol::GuiRpReferenceType) + IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpOptionalType, presentation::remoteprotocol::GuiRpOptionalType) IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpArrayType, presentation::remoteprotocol::GuiRpArrayType) IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpAttribute, presentation::remoteprotocol::GuiRpAttribute) IMPL_TYPE_INFO_RENAME(vl::presentation::remoteprotocol::GuiRpDeclaration, presentation::remoteprotocol::GuiRpDeclaration) @@ -11126,6 +11241,7 @@ namespace vl::reflection::description ENUM_NAMESPACE_ITEM(String) ENUM_NAMESPACE_ITEM(Char) ENUM_NAMESPACE_ITEM(Key) + ENUM_NAMESPACE_ITEM(Color) END_ENUM_ITEM(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpPrimitiveType) @@ -11144,6 +11260,14 @@ namespace vl::reflection::description CLASS_MEMBER_FIELD(name) END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpReferenceType) + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpOptionalType) + CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpType) + + CLASS_MEMBER_CONSTRUCTOR(vl::Ptr(), NO_PARAMETER) + + CLASS_MEMBER_FIELD(element) + END_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpOptionalType) + BEGIN_CLASS_MEMBER(vl::presentation::remoteprotocol::GuiRpArrayType) CLASS_MEMBER_BASE(vl::presentation::remoteprotocol::GuiRpType) @@ -11253,6 +11377,7 @@ namespace vl::reflection::description BEGIN_INTERFACE_MEMBER(vl::presentation::remoteprotocol::GuiRpType::IVisitor) CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpPrimitiveType* node)) CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpReferenceType* node)) + CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpOptionalType* node)) CLASS_MEMBER_METHOD_OVERLOAD(Visit, {L"node"}, void(vl::presentation::remoteprotocol::GuiRpType::IVisitor::*)(vl::presentation::remoteprotocol::GuiRpArrayType* node)) END_INTERFACE_MEMBER(vl::presentation::remoteprotocol::GuiRpType) @@ -11276,6 +11401,7 @@ namespace vl::reflection::description ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveType) ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpReferenceType) + ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpOptionalType) ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpArrayType) ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpAttribute) ADD_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpDeclaration) @@ -11408,6 +11534,12 @@ namespace vl::presentation::remoteprotocol::json_visitor Print(node->type.Obj()); EndField(); } + void AstVisitor::PrintFields(GuiRpOptionalType* node) + { + BeginField(L"element"); + Print(node->element.Obj()); + EndField(); + } void AstVisitor::PrintFields(GuiRpPrimitiveType* node) { BeginField(L"type"); @@ -11419,6 +11551,9 @@ namespace vl::presentation::remoteprotocol::json_visitor case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Char: WriteString(L"Char"); break; + case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Color: + WriteString(L"Color"); + break; case vl::presentation::remoteprotocol::GuiRpPrimitiveTypes::Double: WriteString(L"Double"); break; @@ -11512,6 +11647,20 @@ namespace vl::presentation::remoteprotocol::json_visitor EndObject(); } + void AstVisitor::Visit(GuiRpOptionalType* node) + { + if (!node) + { + WriteNull(); + return; + } + BeginObject(); + WriteType(L"OptionalType", node); + PrintFields(static_cast(node)); + PrintFields(static_cast(node)); + EndObject(); + } + void AstVisitor::Visit(GuiRpArrayType* node) { if (!node) @@ -11715,33 +11864,35 @@ namespace vl::presentation::remoteprotocol { void GuiRemoteProtocolParserData(vl::stream::IStream& outputStream) { - static const vl::vint dataLength = 5216; // 69320 bytes before compressing + static const vl::vint dataLength = 5825; // 78019 bytes before compressing static const vl::vint dataBlock = 256; - static const vl::vint dataRemain = 96; - static const vl::vint dataSolidRows = 20; - static const vl::vint dataRows = 21; + static const vl::vint dataRemain = 193; + static const vl::vint dataSolidRows = 22; + static const vl::vint dataRows = 23; static const char* compressed[] = { - "\xC8\x0E\x01\x00\x58\x14\x00\x00\x1B\x00\x01\x82\x80\x0F\x03\x82\x81\x82\x06\x89\x82\x8D\x0A\x80\x0A\x84\x0C\x0A\x9C\x0A\x83\x1A\x82\x16\x85\x18\x0A\xB7\x0A\x9D\x1A\x85\x22\x85\x25\x0A\xD2\x0A\x98\x2A\x84\x2E\x84\x70\x0A\x09\xBF\x6B\x9C\x93\x96\x84\x00\x2D\xAD\xAF\x91\x9C\x93\x98\x9B\x7F\x36\xB4\xB9\x91\x9B\x9A\x9A\x85\x9B\x38\xBF\xB7\x8F\x9F\x91\x02\x84\xA3\x09\xC8\x86\x82\x07\xA2\x87\x01\xA6\x09\x84\x10\xA6\x85\x03\xAB\x80\x03\x56\x82\x80\xBD\x95\x9A\x87\x03\xAC\x01\xDB\x82\xBA\x93\xB4\x9D\xB2\x9F\x2A\xC3\xA7\xBD\xA9\xB4\xB1\xB6\xB3\x6F\xE8\x86\x82\xB1\xBC\xB7\xB8\xB5\x75\xAE\xAB\xBA\xB9\xB9\xA1\xBE\xAE\x7C\xF7\xAE\xA2\xC0\xBC\xC2\xB9\x81\x74\x86\xF6\xA8\xC8\xBA\xC5\xC0\xC6\x83\x90\xC5\xD2\xC7\xC2\xAD\xC6\xCA\x8B\x96\xD1\xDA\xC3\xCC\xCD\xCB\xB0\x97\x9E\xD9\xC0\xDB\xCC\xD1\xCE\xD3\x9F\xB0\xA1\xC8\xD3\xD0\x00\x04\xB0\x00\x09\x30\xC9\xC8\xCF\xC6\xD0\xDB\xAC\xB8\xEA\xC5\xDB\xDF\xD1\xDF\xD4\xB4\xB7\xFE\xAE\xC3\xE5\xD9\xE2\xE1\x80\xC7\xF9\xCA\xEF\xDD\xD5\xE1\xE5\xC9\xD1\xFB\xAC\xEF\xE5\xE6\xDD\xEA\xD8\xAB\xD6\xF4", - "\xEA\xE9\x95\xA4\x85\x0B\x33\xDA\xF9\xEC\xDC\xF2\xDE\xF3\xC0\xE3\xEA\xE5\xFB\xF7\xF1\xF7\xF4\xEC\xF1\xEE\xF2\xF0\xFB\xFA\xFB\xFA\xF8\xCE\xEF\xFA\xFC\xDC\x04\xD8\x86\xDF\x7F\x53\x76\x74\x02\x85\x84\x70\x81\x07\x83\x8A\x82\x81\xC6\x48\x8D\x83\x82\x09\x8C\x88\x70\x84\x0F\x92\x80\x74\x85\x13\x96\x8B\x76\x83\x02\x4E\x00\x6C\x42\x06\x4A\x55\x85\x84\x24\xA3\x86\x89\x86\x25\xA8\x87\x8B\x85\x1A\xA8\x7C\x7F\x7D\x2F\xB9\x77\x77\x7E\x33\xB4\x71\x8F\x8D\x35\xB0\x89\x8E\x8C\xCC\x4E\x41\x82\x41\x11\x22\x76\x8F\x8E\x38\x9C\x73\x92\x91\x3A\x88\x9C\x8C\x87\x2C\xA9\x8D\x93\x8A\x1B\x98\x8F\x92\x8A\x54\x93\x96\x95\x94\x2D\xB4\x8A\x91\x6B\x12\x30\x63\x06\x90\x49\x8C\x98\x96\x93\x63\x90\x9E\x88\x91\x68\x9B\x99\x9A\x98\x67\xAA\x9E\x98\x9B\x5A\xB0\x97\x92\x9C\x61\x8A\x44\x04\x6C\x15\x20\x9B\x92\x94\x65\x95\x9D\x9F\x95\x6D\xB4\x9B\x9D\x96\x73\xBC\x91\xA2\xA1\x71\x88\xA5\xA0\xA1\x75\x89\x46\x04\x6C\x17\x3A\x95\x92\xA0\x93\x8A\xAD\xA0\x99\x87\x8C\xA3\xA0\xA6\x89\x9A\xA5\xA6\xA7\x6B\x96\xAB\xA4\x94\x10\x7F\x83\x41\x06\x92\xA1\xA0\xAB\x9B", - "\xA2\x9F\xAC\xA7\xA2\xAF\x97\xA6\x99\xA7\xB1\xA3\xAE\x9D\xA6\xB5\xAE\xA3\xAC\xAC\xBB\xB2\xA7\xAC\xAD\xBD\xB6\xA0\xA0\xB0\xBF\xBC\xA5\xB2\xAF\xC3\xBC\x6A\x05\xAA\xAC\xAB\xA4\xA6\xAA\xB9\x90\xB1\xB2\xAE\xC7\x82\xBF\x9F\xB5\xB8\x93\xB2\xB5\xB5\xD4\x97\x90\x42\xA9\xDC\x9B\xB9\xB0\xB2\xD8\x84\xB3\xBA\xB5\xD9\xA1\xBD\xB1\xB4\xEB\x9A\xBD\xBA\x40\x12\x60\xB7\xB9\xB7\xE5\x86\xB3\xBE\xB8\xF5\xA4\xB9\xBB\xBD\xEF\xBC\xBF\xB1\xBF\xF9\xA8\xB6\xB9\xC0\xF4\xBB\xB4\xC0\xBE\x06\xC9\xC3\xC1\x07\xCC\xBF\xBE\xC1\xAB\x08\xC3\xCA\xC2\xBD\x07\xC0\xC3\xC6\xBE\x12\xD9\xC4\xC7\xC5\x02\xDB\xCA\xC4\xC6\x1E\xE1\xC0\xCB\xC8\x1D\xE4\xBE\x05\xC3\x10\xD6\xCF\xC5\xC9\x2C\xC5\xCB\xCA\xCB\x22\xED\xC1\xC5\xCC\x30\xE4\xC5\xCE\xCC\x2A\xF4\xC3\xCE\xCD\x3B\xF8\xCF\xC2\xB3\x29\xFF\xC6\x43\x07\x28\xC0\xD6\xD0\xBB\x42\xEE\xB9\xD2\xBA\x4B\xFE\xB1\xD3\xD3\x47\xCA\xD0\xD4\xD2\x53\xC3\x40\x08\x6C\x21\x05\xD4\xD5\xD4\x4C\xD5\xDD\xD4\xD7\x4E\xE0\xD5\xC5\xD3\x00\x22\x0A\xD6\xD4\x62\xDC\xC7\xCF\xDA\x3D\xEC\xD9\xCC\xCF\x6F\xFE\xCE\xD5\xD8\x5B\xF5\xD8\xDA\x41\x14", - "\x72\xB3\xDB\xDC\x7B\xC9\x44\x0B\xD9\x5F\xF6\xD1\xE3\xDD\x84\xC3\xE6\xE0\xDD\x85\xC8\xE7\xE1\xDF\x82\xCA\xEE\xE0\xE3\x89\xD0\xEB\xE2\xDA\x6D\xD5\xE1\xDE\xDB\x64\xE5\x00\xE3\xE3\x94\xD7\xE6\xE4\xD9\x9D\xE0\xEF\xCB\xE7\x0A\x66\x0B\xE6\xE4\x9C\xE3\xEE\xE7\xEA\xA2\xFA\xCC\xE8\xDF\xA1\xF0\xEA\xE9\xEB\x70\xF4\xE2\xDD\x42\x27\x27\xE1\xED\xDA\xB3\xF2\xEE\xEA\xED\x98\xFE\xE5\xEE\xF0\xB7\xCD\xE8\xEB\xF1\xBB\xC6\xF9\xF1\xE4\xCB\xD3\xED\xEE\xD8\x28\x3A\xEF\xF2\x41\x29\x12\xFF\xEC\xF1\xC1\xFC\xE7\xF6\xF6\xC3\xDC\xF5\xF0\xF3\xD3\xE0\xFB\xF6\xF2\xE1\xCE\xF3\xFA\xF8\xDD\xE4\xF7\xFA\xF9\xE9\xE8\xFF\xF4\xFB\xEF\xE9\xEC\x6E\x45\x7A\xCD\xF2\xFD\xFB\xF0\xD9\xFA\xF8\xFE\xF7\xF1\xF8\xF1\xF9\x01\x2B\x07\xE9\x2C\x06\x7A\xFE\x7F\x7B\x7D\xFD\x7A\x7E\xFB\x0A\x89\x7E\xD2\x62\x6D\x05\xA7\x6E\x05\x01\xFE\x76\x7F\x6B\x6F\x03\x82\x0C\x89\x82\x03\xFB\x74\x82\x00\x87\x86\x80\x15\x81\x86\x07\xA2\x88\x81\x0F\x9D\x85\x84\x06\x70\x04\x06\x9B\x8B\x80\x16\x8B\x70\x23\xF5\x63\x86\x0C\xA8\x83\x86\x10\xB5\x87\x84\x36\x94\x86\x0E\xB9\x8C\x86\x1C\xBE\x81", - "\x83\x26\x80\x88\x09\xBD\x82\x89\x1B\x85\x8B\x87\x3F\x98\x5E\x0C\x2B\x8F\x74\xEF\x47\x8C\x88\x2E\x9A\x80\xC0\x33\x00\x36\x1A\x30\x35\x06\xB0\x36\x04\x6C\x1A\x2A\x6E\x1C\x30\x31\x07\x4C\x8F\x26\x0E\x61\x88\x7B\x28\x81\x8A\x37\x3B\x04\x8E\x13\xE6\x83\x89\x24\x8D\x8C\x83\x4F\x8E\x8C\xF0\x6C\x86\x88\x3A\x88\x89\x8E\x78\x96\x8C\x14\xEF\x83\x20\x1E\x2A\x88\x8E\x7A\x92\x8D\x19\xFC\x8D\x80\x42\x92\x8B\x8E\xCC\x3C\x21\x0C\xF7\x81\x91\xD6\x3E\x07\x8F\x2D\x86\x93\x19\x92\x9D\x8D\x3C\x94\x95\x8E\x97\x8C\x91\x26\xFB\x88\x91\x4E\x83\x96\x93\x6B\x9B\x92\x20\xA1\x90\x94\x40\xA2\x94\x5E\x3F\x10\x91\x21\xA5\x91\x92\x31\x40\x0A\x95\x87\x9F\x92\x2C\xA4\x93\x96\x83\x01\x08\x96\x93\x8C\x97\xE2\x42\x08\x97\x4A\x8D\x97\x97\xA7\x86\x8F\x10\x3D\x98\x92\xB2\x44\x0C\x98\x9A\x9A\x95\x2C\xB4\x9C\x98\x53\x8A\x99\x97\xB5\x8D\x95\x34\xAB\x93\x9B\x65\x86\x7E\x23\x8B\x9C\x91\x35\xD0\x9D\x99\xC8\x46\x08\x99\xDA\x9D\x98\x35\xE2\x96\x9A\x69\xA4\x9C\x9B\xCE\x9B\x9A\x2F\xC1\x9C\x9D\x67\xAB\x9E\x9D\xC5\x9B\x9B\x11\x30\x38\x08\xD8\x09\x08\x36\x4A\x10", - "\x34\x48\x7A\x6C\x08\xD8\x0D\x08\x97\x4E\x00\x9F\x28\xE9\x9A\x43\x27\x02\xA6\x92\xF0\x89\x9A\x3A\xF1\x97\x9D\x77\x8B\xA2\xA1\x0D\xAC\xA0\x41\x93\xA6\x9C\x8A\xBE\x48\x0A\x07\xA0\x99\x42\xE1\x96\xA3\x72\xA3\x9D\xA3\xC7\x71\x09\x46\xED\x9F\xA0\xDF\x22\x21\x9B\x03\xB5\xA2\x4A\x9F\xAB\xA4\x8F\xAE\xA0\x9D\x2D\xB0\xA4\x4B\xB3\xAF\xA4\x87\x91\xA0\xA2\x20\xB6\xA4\x99\x53\x00\x36\x2A\x30\x35\x0A\xB0\x36\x08\x6C\x57\x00\x36\x92\x3A\x69\x0B\xB8\x9A\x0B\x48\x9B\xA9\xA4\x81\x1B\x0B\xA9\x25\xAD\xA9\x4D\x92\xA1\xA6\x9D\x95\xAC\xAA\x34\xB2\xA7\x54\xB8\xA7\xAA\xAE\x99\xAE\x24\x28\xA8\xA1\x54\xE2\xA7\xA6\x8E\x9D\xAE\xAC\x8B\x7D\x08\x54\xE5\xA6\x5A\x2F\x2B\xA9\xA7\x58\xBB\xA8\x5A\xF2\xA2\xAA\xAD\xB6\xAE\xAA\x59\xB8\xAC\x5D\xE4\xA0\xAE\xAF\xBB\xAA\xA3\x63\xA0\xB2\x86\x5F\x0F\xAD\xB3\xB5\xAA\xAF\xC7\x60\x0C\x6C\x61\x05\xB1\xBC\xB1\xAF\x78\x62\x0D\xB3\x5F\xA4\xAC\xAC\x7A\x63\x0A\xB2\x77\xAF\xB2\xC1\x64\x08\xB2\xC4\x9E\xB2\xB3\xA0\xBE\xAD\x66\x94\x65\x0D\xCE\xA1\xB6\x37\x66\x06\xB6\x68\x9F\xBB\xB5\xD3\x87\xB6\xB5\x7C\xA6\xB1\x6C\x8E", - "\xBD\xB4\x8A\x67\x0A\xB5\x73\xA3\xB5\x6E\xD5\x38\x0C\xDC\xAF\xB5\xB6\xBB\xB0\xB6\x60\xFD\xA1\xB8\xE0\xBF\xB5\xB8\xC8\xA7\xBA\x72\xB3\xBF\x71\x34\x30\x32\x0D\xB0\x2B\x0C\x6C\x6C\x00\x37\x36\x30\x36\x0D\xB0\x2F\x0C\x2E\xF0\x0E\xB6\xE6\xB6\xA9\x0E\xDD\xA3\xBA\x6C\xE2\xB4\xB7\xE4\x9E\xBC\xB5\xE6\xA4\xBF\x64\xCC\xA7\xBC\xE1\x80\x62\x0E\xE1\xB4\xB0\x71\xCB\xBA\xBC\xDD\xB4\xB8\x60\x73\x11\xBC\x7B\xF5\xB4\x0E\xFD\x81\xB2\xBE\xE3\xA0\xC1\x79\xF7\xBB\xBE\x01\xEB\xBF\xBF\x05\xC9\xC0\x82\x8B\xC5\xB3\xFA\x95\x85\x0E\xFE\xAD\xC2\x81\xF6\xB4\x5E\x3B\x11\xC3\xBE\xED\xB4\x63\x1D\x17\xC1\xC0\x05\xD2\xC6\xC3\x18\xCE\xC2\x76\x78\x0C\xC3\x01\xED\x31\x0F\x25\xC7\xC3\x87\x8C\xC1\xC5\x09\xE8\xBC\xC0\x2C\xDD\xC1\x8C\xD9\xAA\x0F\x14\xD4\xC2\xC4\xBC\x3B\x0C\x6C\x7C\x00\x37\x3E\x38\x96\x0F\x36\xCF\xC5\x86\xE9\xBE\xC4\xF7\xA0\xC2\xC6\x2B\xC9\xC9\x8B\xC7\xC2\x21\x3F\x01\xCE\xC8\x33\xCA\xC7\x92\xD1\xC6\xAE\x40\x0F\xCE\xB8\x43\xD0\xC6\x92\xC8\xC0\xA5\x40\x17\xCC\xC8\x4C\xD2\xC8\x97\xE3\xC9\xAA\x41\x1F\xCA\xCB\x53\xDB\xCA\x89\xB8\xC0\xCC\xBE", - "\x43\x10\x36\x84\x10\x35\x21\x38\x96\x11\x33\xD9\xCE\xBB\x87\x16\xCC\x9B\xE8\xC4\xCC\x31\xEB\xCD\xC8\x58\xDB\xCC\x10\x88\x10\x37\x44\x30\x32\x11\xB8\x8B\x12\x9E\x80\xD9\xB6\x46\x0B\xD4\x6C\x8D\x0F\xD0\x95\xC2\xC2\xD1\x4A\xCC\xD4\xCF\x7E\x4E\x10\x6C\x0F\x10\x36\x48\x38\x91\x12\x92\xCA\xCF\x4B\x92\x11\xD5\x34\xE6\xD5\xCF\x37\xD7\xD3\x9D\x96\xDF\x99\x49\x38\x94\x12\xB0\x35\x10\x6C\x16\x18\x97\x4B\x25\xD0\xD5\x15\x98\x13\xAD\x8B\x79\x12\x5C\x9A\x10\x36\x9B\x10\x34\x27\x38\x9D\x13\x5D\xFE\xCF\xA5\x9E\x06\xDB\xF1\x22\x02\x45\x80\x0C\x29\x21\xDE\x24\x3B\xB3\x86\x21\xDA\xE3\x13\xDB\x20\xD5\xC2\x3B\xB5\x82\x29\xDB\xE5\x1B\xD9\x20\xDD\xDB\x3B\xB7\x80\x01\xDC\xA0\x23\xDD\xDC\x37\x23\xDD\x78\x2B\x50\x28\xD9\x09\x26\x43\x7D\x2D\xD8\x51\x5B\x3E\xDC\x83\x00\x44\x38\x55\x3D\x2C\x50\x72\xD4\x29\x76\xCA\x27\xDE\xC6\x39\xDC\x71\x40\x2F\x2A\x7D\xE9\xDB\xDE\xC4\x2F\x36\xC1\xB4\x25\xDE\x84\xDB\x3C\xDF\x02\xE6\x39\xC3\x8B\x23\x3B\x88\xC2\x3B\xDF\x0A\x36\xE3\x72\x13\xE1\x20\x80\xC2\x3A\xE3\xDB\x24\xE3\x74\x66\xDE\xE0\xE1\x0A\xE3\xE0", - "\x37\x3C\xE1\xBF\xB7\x2C\xDF\xA7\x3D\x2A\xE5\x1E\xEB\x38\xC8\xC0\x28\xE3\x84\x2E\xE4\x38\x30\xF5\xE3\xC8\xB7\x25\xE0\x94\xF4\x23\xDC\xC9\x27\xE6\x71\x7E\xD5\xE5\x87\xCA\x23\xDC\x44\xF6\xDE\xCE\x8B\xE1\x26\x7E\xC8\xE9\xE5\xFF\xCB\xEA\xCF\xB1\x2D\xE7\xA1\xC7\xE5\xE8\x40\x22\xEB\xC5\xD0\xE8\xEA\x96\xCC\x59\xE7\x7D\x33\xE4\xCD\xB4\x2C\xDE\x7E\xC9\xEB\x20\x31\xFB\x3A\xD8\xE3\xED\x25\xAA\xDB\xEF\xE7\x45\xFB\x3A\xD6\xCB\x37\xEC\x84\xF5\xE6\x20\x58\x2F\xE5\xD4\xE1\xEB\xE6\xB2\xCA\x21\xEF\x38\xFB\xEC\xBE\xFD\xE4\xEA\xC2\xED\x20\xE8\xD3\x33\xED\xC8\xDC\xE5\xE5\xBB\xC3\x22\x2A\x7A\xE9\x21\xDA\xC0\x2B\xEC\xB6\xEB\x24\xDF\x90\xE1\xF2\xE4\xD2\xE6\xEA\x9A\x2E\xEC\xEE\x57\xED\xF3\x4D\x0A\xF6\xF3\x96\x2A\xE1\x39\x95\xF6\xF1\xEA\xEC\xEF\xF3\xC5\xF0\xED\xEB\x34\x24\xF5\xE9\xAB\x27\xF4\xCE\xEF\xE9\x26\xAB\xE3\xED\xEB\xB3\xFB\x24\xC4\xFD\x2A\xF6\xB3\xF5\xF4\xBB\x8C\xF3\x20\xB3\xE1\xF5\xF8\x29\x75\xEE\xB3\xC9\xF4\xF8\x81\x06\xFC\x26\xB9\xF4\xE7\xB8\x99\xFE\x5C\xE5\xC0\x00\xF0\x01\xE6\xF0\x4B\x63\xD7\xE7\xEA\xCD\xF9\x20\xD4\xFA\xDA", - "\x42\x61\xFC\x5E\xEB\xD8\xFA\xFC\x51\x2C\xF8\xC3\xFF\xE6\xF6\xD0\xEF\xF6\x20\xF0\xCC\x5E\xF5\xC1\x4D\x2F\x73\xD3\x3E\xFE\xF5\xEA\x20\xBA\xEF\xF8\xDB\xFB\xFA\xFE\xFF\xD0\x60\x80\xD4\x62\x80\x03\x1B\x6E\xF2\x7F\x7D\x00\x01\x7F\xD9\x7C\x74\x87\x72\x78\xDE\x7B\x7E\xE9\x79\x7F\xEF\x64\x80\x1D\x2D\x7E\xAE\x71\x13\xE3\x60\x7C\x18\x8F\x7F\x12\x83\x80\x1D\x8D\x7F\x1F\x8C\x6D\x14\x80\x6E\x23\x84\x6E\x25\x8B\x7F\x1B\x89\x10\x06\x8F\x80\x31\x1A\x72\x0A\x8F\x71\xDA\x7D\x7B\x0A\x1A\x72\x24\x71\x80\x21\x84\x82\x37\x86\x82\x39\x88\x82\x0D\x86\x83\xD2\x6C\x81\x3F\x8E\x83\xD6\x60\x1E\xEA\x7D\x82\x0A\x1F\x82\x32\x71\x83\xFF\x03\x6E\xBB\x7A\x25\xD6\x74\x7E\xE2\x6A\x10\x1A\x8D\x83\x06\x14\x83\xC7\x72\x10\x56\x80\x7D\x4A\x83\x6E\xE7\x7E\x6D\x40\x83\x84\x42\x88\x7E\x1E\x81\x84\x63\x80\x86\x65\x82\x86\x20\x84\x86\x69\x86\x86\x05\x85\x84\xA6\x77\x84\x16\x8C\x7B\x4B\x89\x71\x6E\x8C\x12\x2A\x70\x85\x35\x88\x77\x71\x8C\x7B\xDD\x77\x7B\x54\x83\x10\x7D\x8B\x1C\x81\x87\x81\x7F\x84\x71\x7D\x13\x88\x72\x8C\x84\xD3\x18\x88\xBC\x73\x6E\xD1\x78", - "\x87\xBC\x71\x7D\x40\x10\x89\xB3\x72\x89\x37\x14\x89\xA5\x76\x89\x34\x18\x89\xAA\x7A\x84\x8C\x83\x7B\x9F\x85\x7A\xDC\x7B\x88\x9E\x8B\x85\x0E\x82\x1C\xA1\x86\x79\xA9\x8C\x76\x8A\x87\x88\xA5\x8C\x80\xDB\x74\x87\xAE\x80\x8B\x32\x81\x56\x2B\x1B\x8A\x63\x73\x8A\xB3\x83\x75\x85\x8D\x71\xA4\x84\x8B\x73\x89\x10\x4D\x84\x13\xB8\x82\x7D\xB2\x8A\x86\xCE\x7B\x87\xB3\x73\x6E\xFE\x1B\x8B\x9D\x71\x13\xC5\x89\x87\x80\x85\x82\xCD\x84\x1C\xD1\x87\x13\xD7\x8C\x7F\x86\x88\x8C\x01\x15\x8D\xC6\x19\x8D\xD0\x86\x8A\xC2\x84\x8D\xBF\x8C\x8B\x2C\x10\x8E\xBD\x80\x00\xD1\x7C\x8C\xE5\x8F\x8C\xE9\x8F\x7C\xB8\x7F\x8A\xE6\x87\x8B\xE2\x86\x10\xC5\x88\x8E\xE7\x85\x8F\x68\x7D\x8E\x7E\x89\x8F\xC0\x8D\x8A\xD6\x82\x8F\xEE\x81\x8B\x09\x11\x7D\xF8\x85\x8B\x21\x2A\x8C\xA5\x77\x90\xFF\x0C\x90\xBA\x81\x90\xC0\x8E\x90\xA7\x82\x88\x02\x9D\x8F\x08\x93\x10\xC3\x81\x8E\x11\x9A\x8F\x02\x16\x90\x1C\x91\x10\xF0\x8F\x86\x05\x93\x1D\x2A\x71\x7D\x2A\x7D\x25\x91\x76\x10\x3E\x2A\x79\x2A\x94\x92\x44\x89\x92\x03\x1E\x8D\xC2\x1A\x72\x59\x86\x84\x61\x8B\x71\x5F\x83\x93", - "\x52\x8E\x92\xE3\x8D\x17\x9C\x8C\x76\x2A\x75\x8C\x3F\x93\x76\x41\x9C\x93\x06\x10\x22\x12\x7A\x10\x48\x9A\x93\x09\x1B\x94\xCB\x1E\x5C\x45\x7E\x74\x4E\x13\x95\x36\x74\x95\xF6\x86\x95\xD3\x85\x95\x11\x84\x15\xEC\x79\x10\x5D\x87\x7D\x5D\x9A\x87\x5E\x91\x96\x57\x1E\x15\x66\x9D\x93\x06\x1D\x7A\x6A\x97\x96\x69\x9B\x93\x09\x1A\x72\xE1\x6B\x82\x02\x12\x97\x01\x14\x97\x00\x06\x97\x78\x9F\x92\x06\x16\x97\x32\x9E\x8B\x13\x8D\x94\x0D\x1A\x10\xF4\x7A\x74\x09\x13\x98\x03\x18\x84\x00\x06\x98\x07\x12\x98\x81\x99\x10\x28\x96\x10\x5F\x2B\x79\x09\x11\x99\xF0\x7A\x10\x94\x93\x10\x4E\x90\x00\x97\x92\x10\x2B\x93\x10\x77\x29\x10\x79\x25\x98\x13\x90\x00\xA1\x90\x24\x70\x80\x9A\x8C\x90\x98\xA8\x92\x9A\x09\x1D\x99\x02\x15\x9A\x03\x1F\x98\x03\x1F\x28\xAC\x94\x98\x06\x14\x9B\xA6\x9F\x97\xB7\x99\x9A\x47\x9A\x10\xB8\x93\x10\x8A\x91\x10\xAE\x91\x10\xBF\x92\x10\xB2\x92\x10\x91\x25\x9B\xFB\x89\x10\xC9\x99\x9B\x95\x9C\x9C\xBC\x98\x99\x0A\x1D\x9C\xC0\x9D\x98\x06\x14\x9D\xC6\x9F\x10\x90\x21\x77\x21\x9D\x1A\x83\x87\x35\x71\x7A\x94\xF2\x6D\x72\x0A", - "\x10\x9E\xE1\x9A\x92\xE3\x91\x77\xD1\x37\x9E\x40\x29\x9E\x23\x99\x10\x12\x4C\x9E\xB1\x9E\x9E\x5C\x90\x9F\xF2\x93\x10\x13\x04\x9F\x0E\x78\x45\xF7\x91\x10\x14\x0A\x9F\x08\x79\x46\xFD\x94\x9A\x00\xA1\x10\xAD\x77\x4B\x03\xA6\x01\x05\xAE\x1A\x0A\x1C\x4B\x03\xA7\x01\x0B\xAA\x78\x0E\xAD\x9F\x18\x0B\xA0\x2F\x17\x4F\x03\xA9\x01\x0B\xA1\x6E\x06\x53\xA0\x1A\x0B\xA0\x50\x8E\x53\x45\x75\x8C\x2F\x1F\x95\x44\x53\xA2\x7C\x2A\x72\x42\x58\xA2\x1A\x26\x97\x40\x5C\xA2\x64\x2D\x97\x00\x0F\x54\x30\xA3\x10\x1B\x0B\xA0\xE3\x6A\x54\x03\xAC\x01\x0B\xA2\xA3\x34\xA5\x72\x83\x8D\x01\x38\xAA\x10\x3A\xAD\x9F\x1E\x0B\xA0\x69\x7E\x56\x03\xAF\x01\x48\xAA\x10\x84\x53\xA0\x20\x0D\xA4\x09\x1F\xA4\xFD\x91\x02\x0B\xAF\x09\x71\x7F\x74\xBC\x11\x9E\xDD\x98\x2F\x25\xAC\x27\x45\x18\x4B\x2F\x11\x7D\xE1\x93\x6E\x5D\xA0\x30\x2F\x13\x94\xCC\x1F\x12\x83\x87\xA6\x62\x2F\x12\x53\x8D\x1A\x69\xA2\xA6\x58\x9E\x27\x63\xA4\xA7\x68\x90\x25\x5F\xA6\x8B\x68\xA3\x83\x60\xAC\x96\xC8\x79\x10\x8A\x7A\xA5\xBE\x16\xA6\x7F\xA7\x93\x00\x04\xA2\x7C\x2C\x8E\x1A\x2F\x12\x69\x7F", - "\x95\x9B\x90\x92\x7C\x2D\xA6\x87\xA6\x10\x9F\x97\x95\x62\x33\x88\x32\xA5\x1D\x2F\x18\x9D\x01\x1F\x95\x0C\x3C\xA7\x73\xA2\xAA\x71\x77\x32\x5A\x96\x3C\x50\x8B\xA9\xDA\x1F\x12\x59\x33\x96\xB8\x37\x3A\x20\x7E\xA6\xEA\x95\xA7\x8F\x30\x72\xAA\xAB\xA5\x0A\x12\x40\xAE\xA6\x10\x30\x49\x90\x1A\x2F\x95\xB2\xA5\x74\x4B\x47\xAA\x91\x3F\x95\xB7\xAE\x1B\x2F\x1C\x9F\x62\x96\x10\x02\xAE\xAB\x64\x2D\x7A\xC1\xA5\x72\x7E\x44\xAC\x8B\x3D\x7A\xC7\xA9\x1A\x2F\x19\x4A\xBB\xA3\x10\xD8\x4E\xAC\x50\x2A\x78\xD1\xAE\x70\xDF\x44\xAD\x8F\x3A\x78\xD7\xA2\xA7\x0A\x18\xA1\xCB\xA3\x10\x1D\xAE\xAD\x7E\x2A\x72\xE1\xA8\x70\x18\x54\xAA\x1A\x2A\x72\xE7\xAA\x1B\x2F\x12\x52\x5B\x93\x10\x2F\xAE\xAE\x57\x21\x6E\xF1\xA3\x6F\x2B\xAE\xAF\xC7\x31\x6E\xF7\xAB\xA6\x0A\x17\xA2\x06\x10\x85\x3F\xA1\xA8\x64\x26\x97\x3C\x88\xAE\xE7\x42\xA3\x76\x9C\xA9\xDB\x49\x76\x99\x96\xB1\x1A\x20\x56\x4B\x1C\x27\x99\x98\x98\x1A\xB0\x52\xC3\x90\x00\xC7\x97\x25\x2F\x1A\xA4\x04\xB6\x30\x25\xBA\x99\x95\xA0\x25\x54\xA3\x10\x84\xA9\x1A\x91\xA0\x00\xC5\x96\xB2\xDB\x43\xB3\x97\xAA\xA7", - "\xDB\x49\xB3\x8B\x9D\xA8\x7C\x2C\x58\x09\x1E\x7B\x04\xB0\x9B\x02\x15\xB3\xD7\x2F\x4C\x46\xB1\x9C\x47\xBA\x10\x97\x54\xAF\x64\x2E\xA9\xA4\x9D\xB2\x59\x55\x2A\x06\x1F\x2D\x64\x2F\x12\x9C\x5A\x37\xA5\x51\xB4\x7C\x2B\x2C\x09\x18\x2A\x3E\xB9\x10\xB7\x5E\xB4\x50\x26\xB5\x03\x1E\xB5\x57\xBB\x4D\xF1\x26\x10\xA6\xA9\xB6\x09\x1D\x5B\x64\xBE\x27\x6D\xB3\x10\x66\x31\xB6\x64\x20\x95\x1D\xBA\x21\x44\x39\x10\x66\xB6\xA7\x0A\x12\x5D\x7A\x34\x5D\x5C\xBA\x37\xFC\x6B\xB7\x06\x1D\xAA\x6E\xB0\x52\xE6\x96\xA3\x52\xB1\x10\xD8\x5A\x37\xDA\x53\xB8\x79\xB4\xB0\x8B\xB2\x10\x88\xBA\xB3\xE7\x47\xB9\x02\x11\xAA\x89\xB3\x10\xE0\x51\xB7\x57\x25\xB7\x43\x3D\xB8\x76\x59\x37\x06\x1A\x39\x76\xB3\x10\xF0\x50\xBA\xD7\x28\xBA\xD4\x34\xBA\xD5\x19\x5F\x92\xB0\x25\xA6\x33\xBB\x7E\xB9\x10\x10\x6C\xBA\x94\xA9\x10\xB5\xBB\xAE\xB7\xB6\x10\x16\x6C\xBA\x50\x8C\x6F\xBD\xB3\x10\x64\xA1\x77\x1B\x6C\xBA\xB1\xA5\x3A\xE3\x74\xBA\x24\x6C\xBA\xC0\xAC\xBC\x82\xA4\xBA\x28\x6C\xBA\xD0\xA2\xBD\x98\xAD\xB9\x02\x15\x63\xAC\xB0\xAE\xD8\xB8\x91\xA4\xBA\x63\xAC\xB0\xAF\xDF", - "\xB8\x85\xA4\xBC\x63\x7A\x3E\x63\xB6\xB8\x83\x04\xB9\x3B\x7E\x34\xBA\x4E\x6C\xBA\xD5\x1B\x9E\x06\x1E\xBE\xDA\xBF\x52\xD5\x3C\xBB\xB0\xBE\x41\xF4\x36\x10\x04\x49\xBA\x02\x16\x65\xF2\xBA\x1D\xFF\xB6\x10\x2A\x40\xC0\x57\x2E\x65\xEB\xB7\x2D\x10\x49\x10\xAE\xB8\xB9\x06\x1F\x66\xAC\xB6\x97\xFC\x6D\xC0\x06\x17\x41\x08\xC6\x57\xF1\x97\xBA\xA4\xB1\x67\xAC\xB2\xA3\xFC\x6B\xC1\x03\x18\xC1\xF7\xB6\x57\x24\xC3\x10\xBA\xA5\xC2\x73\x63\xC0\xBC\x17\xC0\x06\x16\xC1\x10\xC1\x53\xBD\xA3\x10\x5A\x49\xC1\x75\x6C\xC2\xBE\x14\x45\x0B\xC1\xB2\x03\x19\x67\xAC\xB9\x76\xFC\x6A\xC3\xBE\xB6\xB3\x09\x14\x68\xAC\xB8\x98\x41\xC7\x8C\x31\xC2\x10\x86\x6C\xBA\x99\x99\xC4\xFB\xAF\xBB\x03\x18\x68\xAC\xB3\xB2\x50\xC6\x10\x71\xA8\xAF\x0A\x1A\x68\xAC\xBA\xB4\x57\xC9\x95\x25\xCE\x68\xAC\xBB\xB2\x5F\xC2\x10\x19\x98\xAD\x0A\x11\x69\xAC\xB3\xB3\x65\xC1\x10\x35\x98\xC6\x09\x1A\x69\x7A\x3C\x69\x0B\xCC\xB3\x92\xA9\x10\x56\x49\x10\xC3\xA5\xC2\xA0\x68\xC3\xA9\x1A\xAC\x03\x19\xC7\x25\xC5\x41\x35\xC6\x10\x42\xCB\xC4\x2F\x5C\x45\x06\x13\xAD\x25\xC4\x6A\x7E\xCD", - "\x1A\x60\x4B\xC3\xAB\xAA\x10\xAE\x6C\xBA\x44\xB7\xC7\x06\x11\xC9\x43\xCB\xB4\x09\x10\x6B\xAC\xB6\xB4\xFC\x6A\xC9\xC6\xB4\xBA\xB2\x6C\xBA\x50\xB1\xCA\xCD\xB9\xC1\xB4\x6C\xBA\x54\xBE\xB0\x03\x12\xCA\x02\x19\xC5\x08\xB9\x10\xB6\x6C\xBA\x60\xB4\xB0\xB0\xC1\x10\x8A\xA5\x74\xBA\x6C\xBA\x68\xBE\xCA\x02\x19\xCB\x00\x07\xC6\x12\xB6\x10\xBD\x6C\xBA\x7D\xB8\xC9\xAF\xCE\xA7\x19\xCF\x6B\x7A\x31\x6C\x0B\xCB\xB6\xC0\xC1\x10\x63\x49\x10\x5E\x49\xC1\xC5\x6F\xC8\x68\x4A\x10\xD5\xC3\xC8\x1E\x4C\xC8\xCB\xC9\xC1\x15\x4A\x48\x06\x1A\xAD\x25\xC9\x6C\xDA\xCC\x1C\xE6\xC3\x10\xC7\x42\xCE\xDA\x18\xA5\x92\xCC\x1B\xAF\x49\x10\x85\xC8\xC8\x00\x01\x0A\xA7\x3C\xB9\xD3\xC0\x00\xF3\xCB\xC8\xA4\xB2\x0A\xA7\x33\xB7\xC9\x89\x10\xFD\xC3\x10\xC3\x4E\xCE\x25\x48\xA0\xFE\xC9\xC1\xA3\x07\x3A\x86\xBB\xCF\x0A\xD6\xD0\xFB\xB5\x42\x13\xA2\xD1\x08\xD6\x40\x07\xD6\x10\x8F\x49\xC1\xA4\x08\x4B\xED\xC6\x10\x05\xD2\xC5\x59\x5D\xAD\x03\x19\x4F\x19\xC5\x0A\xB8\x43\x4F\xF1\xC8\xAC\x0A\x16\x0A\xA7\x35\xB9\xCA\xC2\x10\x2A\xDB\xC9\x3C\xC2\x10\xA7\x07\x3A\x9A\xB1\xD3", - "\x01\x13\xD3\xA3\xC9\xC1\xA8\x07\x3A\xA2\xBB\xCF\x3C\xD2\x10\x6A\xA1\x9E\xA9\x07\x3A\xA6\xB2\xD4\x6E\x95\xC2\xAA\x07\x3A\x7F\x3A\x37\x43\xDA\xCB\xA4\xBB\x0A\xA7\x3F\xC0\x03\xD6\x10\x51\xD3\xCC\xA4\xBC\x0A\xA7\x35\xBC\x57\xD3\x10\x59\xDF\xC6\xC5\xC3\x10\xAD\x00\x1B\xAE\x07\x74\x0A\x16\xBF\xFB\xC5\x4F\x09\x13\xAE\x25\xC0\x0B\xB8\x4A\xAE\x03\x1C\xD6\xDE\xC5\x42\x26\xD8\xD5\x13\xD6\x40\xFB\x46\x10\xFF\x49\xC1\xB1\x08\x4B\x7D\xD6\x10\xFA\xA5\xD7\xBE\x12\x0B\x68\xDA\x21\x01\x59\x10\x77\xD6\xCF\xB4\x07\x3A\xF4\xBB\xCF\x89\xD6\x10\xF3\xA4\xD8\xFE\x3D\xAE\x03\x13\xD9\xF6\xC5\x41\x98\xD2\x10\xFD\x49\xC1\xB5\x08\x4B\x83\xD3\x10\x91\xD9\xD9\x1E\x47\x52\x6C\xB4\xBA\xB6\x07\xD8\x64\x29\xBF\x04\xB6\xDA\x03\x15\xC0\xF6\xC8\x0B\xAA\xD0\x25\xFD\xBB\xCF\xAE\xD2\x10\xEB\xC2\xD2\x01\x1A\x0B\xB3\xDE\x27\x29\xC6\xDB\x0A\x11\xD8\xF6\xCC\x0B\xBD\xD7\x25\xB0\xDF\xD5\x02\x12\xA2\x06\x1C\x53\x19\xCE\x0B\xC5\xD7\x3C\xFD\xA3\x10\xCC\xD5\xC2\xC0\x0F\xDC\x06\x33\xB0\xD2\xD4\xBA\xC2\x06\xDD\x03\x3A\xB0\xD9\xD9\xC1\xC4\x0C\xDD\x14\x36\x54\xA7", - "\xD9\xC1\xC6\x04\xAB\x0C\xCF\xDC\xE4\xDF\xDA\xA4\xB9\x0C\xE8\xD5\x1D\x27\xC2\x10\xE3\x6B\xDE\xB8\xD4\xBA\xCC\x0F\xDE\xDA\x13\xC3\xF2\xD3\x12\xC1\xD4\xBA\xCF\x08\xDF\xBC\x17\xC8\xFB\xD9\x10\xF4\xD1\x10\x2B\xB5\xD3\x01\x12\x0D\xE2\xDE\x1B\x80\xC8\xDC\x01\x15\xA4\x03\x12\xD0\x44\xC6\x10\xD4\x0B\xE0\xA9\x15\xCF\x03\xE6\x10\x10\xE2\x10\xC7\xD3\xE1\x03\x16\x0D\x16\xED\x1A\xD7\xC3\xB9\x03\x1B\xE1\x01\x19\xDB\x1E\xE2\x10\xD8\x01\xE2\xBA\x1D\xCD\x30\xB4\xA4\xFD\xD9\xC1\xDA\x0C\xE2\xCC\x10\xCE\x19\xE5\xE2\x0A\x17\xE0\x93\xC9\x10\xDC\x07\x3A\x1B\xD4\xB0\x0D\xB2\x10\x48\x59\xC1\xDD\x08\x4B\x1C\xB1\xE1\xA4\xBE\x0D\xA9\xC4\x26\x28\xE9\xA8\x25\x1A\x10\x1D\xEC\xC9\x06\x12\x0E\x4B\xE0\x25\x15\xD2\x10\x83\x87\xE4\xF5\xD9\xC1\xE6\x05\xE5\x7E\x24\xD2\x58\xEF\xE4\x09\x12\xDC\xBA\xD0\x00\xEA\x0E\xE5\x57\x24\xD7\x60\xC3\x10\x5A\xE6\xE0\xA4\xBE\x0E\x00\xEE\x1B\x7B\xDF\xE2\x09\x18\xB2\x03\x1A\x56\x19\xC1\x0F\xB8\x46\xE7\x02\x12\xE1\x52\xE3\x10\xF2\x01\xE7\xA9\x14\xE6\x52\xD5\xE7\x50\xE4\xBA\xF5\x02\xE8\xAD\x1B\xD9\x85\xE6\x10\x7C\xE7", - "\xE2\xA4\xB8\x0F\x8A\xEA\x1B\xD3\xDB\xE6\x02\x1F\xE8\x00\x04\xE8\x7F\xE2\x10\xFB\x03\xE9\xCC\x18\xDD\x61\xE6\xE8\x8E\x94\xBA\xFE\x04\xE3\x2F\x13\xE4\x24\xE2\x10\x2F\xB2\x10\x78\xE5\xC2\x00\x0B\xA0\x06\x3B\xEA\x01\x1E\xE7\x08\xEF\xEA\xF2\x6B\xCB\x06\x11\xE4\x8D\xE3\x10\xB2\xE0\x00\x51\xE5\xEB\x04\x07\xEB\x7C\x28\xE9\x83\x8D\xEB\x4D\xE5\xEB\x07\x02\xEC\x1A\x20\xB4\xD9\xBC\xEB\x31\xE5\xC2\x0A\x0A\xEC\x64\x29\xB5\xCD\xEA\xEA\x39\xE4\xBA\x0D\x02\x6F\x31\xBD\x1A\x63\xB9\xEA\x01\x1A\x58\xB0\x78\xAC\x34\x73\xA0\x1D\x91\x9E\x83\x84\x14\x42\xB4\xB0\x44\x1F\x95\x44\x10\x85\x44\x1D\x7A\x44\x1A\x78\xF1\xE1\x9E\xF2\xEE\xA6\x67\xAF\x0F\xFC\x68\xEE\x03\x2B\xED\x04\x95\x74\xE9\xE4\xE7\xFE\xE5\xA6\x02\xF1\x77\x24\xA1\x8D\xE7\xEC\xA6\xE1\x95\xD4\x6A\xAF\x0F\xEE\xE3\xAA\x45\x7D\xF0\x68\xE3\x6F\x10\xFF\x9E\x07\x22\x89\x20\x74\x14\x17\xF7\xA7\x71\x79\xF1\x4A\xCE\x70\x5F\x9B\x15\x1F\xF0\x14\xEC\xEB\xA7\x45\x73\xF2\x64\x9E\xF1\xE1\x94\xCC\x2E\x1A\xF2\x2B\x10\xEF\x2F\x1E\xF2\x80\xAE\x70\x30\xF3\xBD\x7F\x12\xCB\xFF\x02\xEF\x70\xA4\xEF", - "\x3A\xF1\x77\x62\xDE\x12\x3D\xF4\x7B\xE1\x92\x7C\x6F\x91\xF4\x44\xFC\xF3\xE1\x91\xB1\x2E\x18\xF4\x2B\x11\x6E\x44\x1C\xF4\x2F\x1E\xF4\x39\x98\x70\x15\xB3\x14\x53\xF7\x13\x76\x94\x14\x57\xFF\x12\x59\xFA\x97\x25\x7B\xF5\x09\x17\xB0\x00\x07\xB0\xFF\x02\xA3\x44\x12\xA3\xE7\xE2\xA3\x40\x70\xC2\x8E\xA3\x20\x93\x70\x14\x69\x74\x14\x6F\xFF\x12\x20\xB3\x14\x73\xF7\x13\x88\x94\x14\x77\xF1\x9E", + "\xC3\x30\x01\x00\xB9\x16\x00\x00\x1D\x00\x01\x82\x80\x0F\x03\x82\x81\x82\x06\x89\x82\x90\x0A\x83\x0A\x85\x0D\x0A\x9F\x0A\x86\x1A\x85\x16\x84\x1A\x0A\xBA\x0A\x80\x2A\x80\x26\x84\x27\x0A\xD5\x0A\x9B\x2A\x87\x2E\x85\x7E\x0B\x09\xBF\x6B\x9C\x93\x96\x84\x00\x2D\xAD\xAF\x91\x9C\x93\x98\x9B\x7F\x36\xB4\xB9\x91\x9B\x9A\x9A\x85\x9B\x38\xBF\xB7\x8F\x9F\x91\x02\x84\xA3\x09\xC8\x86\x82\x07\xA2\x87\x01\xA6\x09\x84\x10\xA6\x85\x03\xAB\x80\x03\x56\x82\x87\x19\xA1\x80\xA1\x9F\x9A\x0A\x88\x1C\xB0\x93\xA2\xA2\x9C\xB3\x3C\xE8\xBE\x8A\x95\xB4\xB7\xB2\xB7\x69\xF0\xAB\xA6\x8E\xAA\xB4\xB0\xB9\x77\xF4\xAD\xBA\xBF\xB4\xBD\xB8\xBF\x73\x83\xB5\xB8\xBE\x96\xB9\xC2\xC2\x41\x88\xDF\xA7\xC0\xC1\xBE\xC1\xBD\x8F\xFD\x91\xDF\xB3\xC9\xC2\x81\xC1\x8D\x8C\xD5\xCE\xC7\xC8\xC9\xCE\xC9\x9F\x94\xE1\xD6\xCD\xAE\xCD\xD2\xD0\xA7\xA2\xE9\xC4\xD4\xB0\xD5\xD6\xD5\xAF\xAC\xD8\xDB\xCA\xCA\x81\x05\xB1\x0A\x0A\x8C\xAA\xC6\xC1\xC5\xCC\xDF\xB4\xC0\xE3\xDC\xCB\xD4\xE1\xD8\xE3\xB3\xC3\xF5\xC5\xEB\xE7\xE1\xE7\xE4\xCC\xC2\xD1\xEB\xC2\xEE\xE5\xEA\xE8\xD6\xD4\xDA\xFD", + "\xDB\xEC\xDE\xEF\xDF\xDD\xE0\xDC\xE3\xF9\x84\x07\xB1\x06\xBA\xE4\xE2\xFF\xE1\xE1\xF1\xF6\xF5\xEF\xEC\xCA\xF7\xE6\xD1\xEC\xF9\xF9\xEE\xF8\xF7\xF3\xEB\xFE\xFA\xF8\xFE\xFF\x7E\x7B\x7B\x80\xF1\x44\x8A\x7D\x42\x08\x46\x4A\x53\x40\x0C\x49\x4B\x6E\x81\x00\x90\x82\x81\x81\x14\x87\x82\x84\x76\x18\xB5\x79\x86\x6B\x1B\xB0\x6D\x86\x6C\x1A\xA1\x8C\x86\x88\x1E\xA4\x80\x8B\x88\x28\xA5\x89\x88\x6B\x12\x23\x5E\x42\x83\xFD\x5F\x88\x72\x89\x33\xAB\x85\x8E\x8A\x38\xA7\x89\x8F\x8D\x3A\xBD\x8C\x8F\x8F\xCF\x74\x81\x92\x8D\x43\xBB\x85\x92\x8F\x47\x80\x94\x7C\x91\xD5\x55\x03\x5A\x05\xE9\x41\x82\x8D\x92\x54\x8B\x96\x92\x95\x48\x98\x9A\x91\x7E\x11\x95\x8D\x96\x85\x5E\x93\x80\x9B\x98\x5F\xA5\x92\x9A\x99\x53\x9A\x95\x94\x97\x00\x18\x03\x59\x06\x51\x97\x82\x92\x9A\x74\xAC\x99\x9A\x9D\x73\xB8\x9C\x92\x9E\x57\xBC\x99\x96\x9F\x5B\xB1\x89\x9E\xA0\x7B\x8F\x43\x58\x07\x71\xA1\x97\x9C\xA1\x7D\x8C\xAF\x9E\xA3\x81\x92\x93\xA2\xA4\x85\x94\xAD\xA2\xA5\x8F\x98\xA1\xA6\x9C\xAE\x5E\x03\x5A\x44\x30\x9A\xAB\x98\xA4\xA3\xA2\xA5\x9C\xA9\xA7\xA6\xA0\xA1\xA9", + "\x9C\x97\xAD\xA9\xA6\xAF\x9B\xAA\xA3\xA4\x06\x61\x03\x5A\x08\x89\xA4\x97\x9B\xAE\x8B\xAA\xA8\xAB\xAA\xA9\xB1\xAC\xAB\xAC\x95\x82\xB1\xB0\xB1\xAE\x88\xB0\xAE\xB2\xC6\x64\x03\x59\x09\xB9\xA8\x94\xAC\xB3\xC3\xBA\xAD\xAE\xB1\xC0\x99\xBF\xAF\xB6\xBE\x9D\xB8\xB4\xB7\xDF\x89\x47\x0B\x58\x28\x11\xBC\xAF\xB4\xD6\xA8\xB2\xB5\xB1\xD4\x87\xB9\xB8\xBB\xEF\x89\xB1\xBF\xB2\xF3\xB2\xA5\xBD\xB5\xEB\xB2\xB9\xBC\xBD\xFB\xB6\xBD\xBC\xBE\xE7\xB0\xBF\xBE\xBB\x03\xDA\xBE\xB5\x98\x2A\x23\x57\xB5\xBB\x06\xE1\xBE\xC0\xC3\xE0\x90\xC7\xC3\xBD\x04\xC1\xCA\xBE\xC5\xFC\x98\xCE\xBE\xC6\x00\xCB\xCA\xAF\x0A\x0A\xEA\xBC\xC5\xC5\x1E\xC5\xC1\xC4\xC5\x0D\xD2\xCF\xC0\xCA\x27\xC1\x4C\x09\xC8\x02\xE3\xC9\xC8\xCB\x13\xE6\xC5\xCE\xCC\x2D\xF8\xC7\xCD\xC9\xBB\x96\x49\x51\xCE\x3C\xC1\xD2\xCA\xD0\x31\xC4\xD7\xC6\xD1\x19\xC8\xDB\xC6\xD2\x1D\xC3\xDE\xD1\xD1\x4F\xC7\xD1\xD5\xD2\x22\xEE\x00\xCE\xD4\x50\xD9\xD8\xD7\xD6\x54\xDA\xDD\xD4\xD7\x4B\xD3\xD1\xDA\xD7\x63\xE0\xDD\xD0\xD9\x67\xE6\xD4\xCA\xD8\x69\xDF\xDE\xD9\xD9\x19\xEF\x07\xD7\xDB\x6D\xF0\xD6\xDD\xDD\x78", + "\xEB\xD8\xDA\xDE\x6A\xF3\xC6\xCF\xCA\x7F\xEA\xC2\xE0\xCD\x80\xFA\xC5\xE0\xD3\x7C\xF4\xD9\xE3\xDD\x8B\xF9\xDC\x98\x0C\x73\xCC\xEE\xDE\xE1\x83\xC1\xE4\xE1\xE5\x94\xD7\xEA\xE6\xE5\x9C\xD9\xED\xE4\xE2\x93\xD8\x71\x0F\x58\x32\x11\xEE\xE0\xD0\x6C\xCD\xEA\xE9\xE8\xA9\xEC\xEB\xDC\x9B\x33\x26\xEB\xE8\xEA\xAF\xF4\xED\xDE\xED\x8A\xEE\xE7\xEF\xCE\xAD\xF8\xE2\xE6\xEF\xCD\x58\x4F\xCC\xEF\xB5\xF7\xC5\x0E\xEC\xBA\xF9\xE0\xF3\xEC\xC4\xFB\xE7\xE1\xEF\xCD\xCA\xF1\xF7\xEF\xD3\xE7\xE5\xF4\xF3\xCF\xC5\xF9\xF6\xF3\x98\xFC\xC6\x0C\xF2\xCB\xC9\xF4\xF7\xF6\xD2\xE4\xF3\xF9\xF7\xD0\xC6\x47\x0C\xF8\xD7\xE2\xF6\xF6\xF9\xEF\xE8\xFA\xF6\xFC\xDC\xDB\xEE\xE7\xFD\xA0\xE1\xFA\xFD\xFB\x0A\x78\x0C\xF8\xFC\xD8\x74\x7D\xF9\x02\x87\x7C\xFB\x79\x7C\x7F\x08\x80\x82\xFB\x01\x86\x81\xF4\x44\x81\x7E\x0D\x93\x7D\x04\xF5\x7F\x73\xFA\x39\x07\x7F\x0F\x95\x62\x46\x43\x7A\x81\xFD\x5D\x81\x81\x19\x8B\x82\x08\x9E\x81\x84\x12\x93\x83\x80\x27\x85\x81\x05\x92\x8B\x84\x0A\xB8\x7E\x81\x29\x90\x81\x0B\xA8\x83\x86\x15\xAF\x84\x85\xF7\x7B\x04\x06\xB1\x8C\x81\x1A\xB2\x87", + "\x86\x2E\x87\x83\x07\xC3\x85\x85\x9B\x7C\x03\x87\x01\x3D\x04\x12\xC0\x84\x86\x26\xB6\x82\x88\x45\x84\x88\x0F\xA3\x87\x66\x1F\x0B\x8F\x07\x4B\x90\x8B\x14\xB9\x6C\x22\x0E\x91\x8F\x8B\x5B\x80\x85\x18\xD2\x8E\x87\x1E\x8E\x8F\x87\x5A\x85\x8C\x15\xE4\x87\x8C\x33\xA9\x8F\x7E\x41\x19\x88\x0C\xEA\x86\x85\xCE\x42\x0A\x8E\x38\x8F\x8E\x1E\xF3\x8D\x8D\x35\xA0\x8C\x8E\x62\x80\x90\x1B\xFB\x89\x8E\x3E\x84\x91\x88\x86\x89\x91\x21\x8B\x98\x90\x46\x8D\x8F\x90\x8F\x82\x67\x10\x78\x8D\x91\x4A\x91\x96\x91\x4F\x8A\x90\x6C\x44\x03\x2D\x22\x23\x2E\x08\x63\x27\x0B\x58\x1E\x2E\x8A\x81\x09\x0B\x2C\x4A\x03\x2F\x12\x14\x9C\x34\x26\x2C\x91\x93\x98\x88\x8D\x7D\x4D\x0F\x94\x59\xB1\x96\x8D\x9A\x97\x92\x25\xB0\x9B\x96\x5B\xBD\x90\x97\xB7\x9E\x8F\x18\xFF\x8D\x8F\x3A\x85\x99\x40\x20\x25\x96\x20\xC4\x90\x92\x5E\xBA\x97\x99\xCE\x91\x9A\x2F\x99\x6F\x09\x5A\x80\x9F\x97\x2F\x30\x0A\x35\xC2\x9B\x99\x61\x9E\x9D\x9B\xE0\x87\x9B\x20\xB9\x92\x9B\x6B\x90\x9B\x9A\xE5\x9C\x9A\x38\xCC\x94\x9C\x74\xAE\x9E\x9C\xE9\x86\x9B\x1B\xD1\x0B\x9A\x79\xAD\x98\x9E\x00\x72", + "\x09\x3D\x81\x9B\x9D\x6F\xBD\x99\x9C\xD8\x33\x0B\x3E\xE3\x91\x99\x9C\x54\x0B\xA0\xEC\x85\xA0\x3F\xCD\x9F\x86\x91\x0A\x9F\x9F\x10\xAF\x8E\x15\x08\xAE\x9E\x86\xB8\x9F\xA2\xEA\x96\xA1\x46\xF7\x9B\xA2\x85\x84\xA0\x9B\xF6\x9E\xA3\x40\x57\x04\xA2\x80\x9C\xA1\xA4\x20\xA9\x20\x16\x25\xA1\xA3\x93\x8B\xA6\xA5\x1F\xA7\x9C\x46\xA8\xA2\xA7\x8E\xA9\xA1\xA6\xF1\x8F\xA6\x48\x95\xA0\xA6\x62\x99\x0B\x2C\x5A\x03\x2C\x49\x0F\xAC\x0B\xB1\x1D\x0B\x2C\x5E\x03\x2E\x49\x0F\xA0\x0C\x96\xA1\x0C\xA5\x1A\xB4\xA7\xC6\x62\x00\xAB\x9E\xBC\xA3\xA7\x26\xB8\xA9\x4B\xDA\xA1\xAA\x9D\xB7\xA1\xA1\x5F\xB7\xA9\x58\xD9\xA7\x63\x31\x15\xAC\xAB\x56\xA4\xAD\x4D\xD2\xAF\x9C\x9B\x99\x64\x0C\x67\xA3\xAF\x56\x97\x65\x0D\xB8\xAB\xAE\xAB\x77\xB8\xA5\x5B\xEC\xA3\xA6\xBC\xB9\xA2\xAF\x7D\xA0\xB2\x5B\xFF\xA0\xAD\xBC\x85\xB6\x38\x66\x03\x2F\x19\x63\x28\x0D\xB1\x29\x0B\x2C\x6A\x03\x2F\x1A\x63\x2C\x0D\xB1\x2D\x0C\xA5\x6E\x16\xAC\x61\xE2\xA9\x63\x37\x1A\xB3\xAF\x7E\xA0\xB6\x60\xFC\xA3\xB0\xD1\x87\xB6\xB4\x9C\xBB\xB2\x5A\xAA\xB3\xAE\xC3\xBA\x50\x0E\x9F\xA1\xB3\x69\xB2", + "\xB9\xB4\xD4\xAB\xB6\xB6\xF7\x71\x0D\x6C\xA5\xB6\x8C\x39\x3B\xB4\xB4\xC0\xA1\xB4\x6D\xB7\xB3\xB9\xD6\xAC\xB5\xAB\xA3\xA2\xB8\x6F\xCB\xB1\xB9\xE4\x8E\xBB\xB6\xCC\xBC\x9F\x1C\x3F\xBA\xB9\xE6\x90\xB9\x67\x74\x03\x2D\x1D\x54\xBF\xB9\xDA\xA6\x8E\x0E\xDC\xB7\xB9\x75\xE3\xB2\x43\x3B\x21\xBE\xBB\xD1\xA5\x70\x1E\x67\xB4\xB9\xF4\xA2\xBD\xBB\xED\xB6\xBA\x3F\xF9\x0C\xBC\xE3\xBF\x82\x0F\xF5\xA8\xBB\x7B\xFB\xB8\xBC\xF9\xB1\xBC\xBC\xFC\xBF\xBC\x7C\xF6\xB5\xB9\x3D\x39\xB9\xAD\x04\xCE\xBE\xAE\x7C\x07\xC0\xB4\x8E\xC2\xAE\xFA\xBD\xBC\x80\x92\xC3\xC1\x08\xC2\xC1\xC0\x09\xDE\xBD\x86\x93\xC6\x4D\x3E\x23\x2E\x0F\x63\x3F\x0F\x58\x00\x13\x2D\x40\x23\x2A\x10\x63\x23\x13\x58\x04\x1C\xA5\x42\x0D\xC0\xC2\x08\xC6\x13\x8B\xAE\xB7\xC2\x0A\xD8\xC6\xC2\x1B\xD5\xC0\x82\xB8\xCC\xC7\x1D\xFE\xC7\xC1\x19\x67\x13\x8C\xC7\xBF\xC6\x18\xC0\xCC\xC8\x47\xC0\x60\x22\x43\xC8\xB7\x1E\xEE\x31\x11\x4C\xC5\xBA\x93\xC6\xC4\xCA\x1A\xF9\xC7\xC6\x45\xD6\xCB\x94\xDA\xC9\xCA\x24\xD5\xCE\xCB\x5C\xC9\xC9\x75\x0A\x11\xCA\x05\xF5\xC7\xCC\xBB\x4B\x11\x99\x9A\xCB\xCB\x8D", + "\x4C\x13\xCD\x1C\xD7\xCA\x8D\xF3\xC8\xCD\x36\xC0\x65\x11\x70\xDA\xC6\x6B\x0E\x19\xCE\x2C\xE2\xCE\xCC\x72\xD5\xCD\x97\xCD\xC3\xD0\x29\xC5\xD0\xD0\x8F\x1D\xCC\x9D\x81\xDB\x56\x48\x23\x29\x12\x63\x32\x10\x4B\x93\x1A\xD0\x41\xFF\xCC\xCD\x87\xD8\xD3\xA5\xF1\xC6\xCE\x43\xDB\xD2\xCF\xB0\x34\x11\xA5\x8C\xDD\xD2\x40\xE5\xD2\xD3\x72\xB5\x13\xA8\xA7\xDC\xD3\x4C\xED\xD7\xD3\xC4\x96\x13\xAA\xAE\xD0\xD5\x30\xDF\xCC\xD0\xB0\xC2\x23\x25\x33\xD9\xD6\x4B\xF7\xD6\xD3\xBF\xC6\xD4\x1F\x98\x13\x2D\x4C\x23\x2A\x13\x2C\xBB\x10\xAF\xC1\xDA\xC2\x4E\x0B\xDE\xD6\xD0\xC0\xCE\xB4\xB8\xDC\xD9\x57\xD5\xDB\xC0\x9D\x03\x2E\x27\x63\x2F\x12\x96\xA0\x17\xD9\xD3\xC0\xD8\x6B\x21\x10\xDC\xDC\xA2\x15\xDC\xE2\xC1\xDE\xB0\xBD\xD4\xD4\x5A\xD8\x73\x14\x63\x24\x17\x58\x25\x1C\xA4\x53\x28\xDB\xDD\x72\xA7\x17\xBD\xA8\xD1\xDA\x6A\xFD\xD9\xDD\xFE\xCA\xDC\xBF\xC6\x38\x14\x96\xA9\x13\x2C\xAA\x03\x2F\x2A\x2C\xAC\x15\x7D\xD6\xDE\xCA\xAD\x0E\xE0\x1B\xAE\x1C\xA5\x57\x23\x28\x16\x63\x31\x14\x4B\xB2\x12\xE2\x3F\xF2\xAB\x16\x1D\xFE\x9E\x1F\x0B\x41\x21\x07\x43\x21\x25", + "\x88\x26\xE6\x40\x28\xEF\x36\x95\xC1\x24\xE5\xC1\x2E\xE4\x00\x30\xE3\x3E\x99\xF4\xE1\x3A\x36\xFD\x35\xCE\xA9\xEA\x21\x9B\xD6\x3A\xE6\xE6\x26\x54\x50\x37\x38\x41\xDE\x24\xE4\x28\xD6\x24\xEA\x41\x0E\x0D\x37\xAA\x08\x30\x28\x47\xE4\x2B\xD0\x8A\x2C\xE8\xC4\x0E\xEF\x37\x40\x3B\x2B\xD3\xB7\x22\xE7\xDC\x08\x32\x2C\x5B\xF4\x26\xD2\x83\x28\x3C\xC4\x11\xEC\x3A\x63\xE2\x21\xD5\xBF\x37\xEB\xE0\x19\xED\x37\x40\x32\xE4\x75\x60\xE8\xEB\x9B\x29\xE8\xE9\x50\xEA\x21\xDB\xF3\x37\xEE\x00\x2B\xE9\x38\x7B\xF1\x39\xDE\x89\x21\xF1\xA4\xD4\xED\xE9\x70\xF7\x26\xD6\xF5\xE4\x27\xAE\xFD\x34\xEE\x6E\xF6\xEE\x42\x65\xEF\x37\xA8\xC5\xF3\xEA\x09\x3F\xEF\x7C\x17\xF0\x28\xC5\xC9\xF5\xF1\x48\xFF\x34\xE4\xF3\x38\xF3\xD0\xD1\x39\xEA\x8B\xE1\x39\xDF\x9A\xF1\x3A\xCE\xDD\xF1\x26\xA8\xFD\x37\xEA\x88\xF1\xED\x98\x29\xF4\xF4\x5C\xEA\x22\xD7\xA2\xFF\xF3\x98\x3D\xEC\xF2\xC1\x31\xF4\x62\x33\xF6\xEB\xDE\xED\x27\xF6\x82\xF9\xF6\xE9\xD1\x33\xF5\xE4\xE2\xEB\xF9\xA7\xEE\x2A\xEC\x87\xF5\xF9\xDA\xED\x21\xEA\x4F\x23\xF8\xF5\xEC\xE6\xF8\x96\x08\xFE\x3A\x71\xFA\xF7", + "\xE3\xDD\xFB\x25\xDF\xC6\xEA\xFA\xDA\xF9\xF0\xED\x8C\xF6\xF6\xF2\xFF\x1A\xEE\xE3\xF6\xF8\x4B\x7D\xE4\x3B\xA8\xF2\xE5\xF4\x03\x2C\xF6\x75\x2E\xFF\xF4\x96\x36\xFB\xFA\xEA\x75\x7D\xEC\x77\x7C\xEE\x7E\x78\x5F\x7E\x7E\xE6\x76\x76\xE6\x28\x7F\x6A\x7B\x7E\x91\x74\x13\xDF\x7D\x7F\x31\x10\x7F\x07\x82\x7F\xE5\x70\x7D\xD6\x11\x75\x51\x7C\x80\x01\x1A\x7F\x40\x1C\x7F\x12\x8A\x81\x00\x8B\x74\x0E\x88\x7B\x10\x85\x80\xE2\x75\x81\x03\x83\x7F\x93\x77\x7E\x0F\x5C\x81\x7E\x75\x82\xCE\x7D\x7E\x16\x8F\x7E\x18\x80\x14\xCD\x70\x7E\x92\x70\x7D\x83\x76\x10\x58\x19\x7E\x24\x82\x80\x0F\x80\x7B\x0A\x1F\x83\xBF\x14\x7C\xDC\x75\x83\x11\x82\x81\x2C\x16\x80\xBC\x75\x83\x09\x85\x79\x45\x83\x82\xF9\x72\x83\x3A\x87\x82\x35\x84\x81\x4F\x8B\x82\x17\x8C\x83\x37\x11\x75\x52\x10\x84\x55\x82\x84\x26\x84\x84\x51\x14\x85\x0D\x84\x86\x33\x84\x80\x59\x89\x82\x5B\x83\x84\x2D\x11\x85\xC1\x7A\x10\x61\x87\x84\xDB\x70\x78\xEE\x7B\x84\x4C\x86\x83\x5E\x84\x13\x39\x8B\x87\x5D\x8B\x7C\x1F\x8E\x7E\x20\x8D\x7F\x7A\x8C\x84\x4E\x81\x1C\x7F\x80\x88\x72\x8B\x79\x79\x88", + "\x82\x7D\x81\x13\x8B\x8B\x87\xF4\x76\x85\x80\x8F\x0F\x85\x8F\x7A\x87\x82\x81\x89\x83\x1F\x93\x8C\x84\x8D\x8D\x7A\x8F\x8D\x86\x91\x8D\x12\x9F\x82\x81\x95\x8A\x86\x57\x81\x13\x99\x8D\x79\x9B\x8D\x7F\x9D\x8C\x7C\x08\x8D\x82\xAA\x87\x89\xAF\x8F\x7A\x5A\x8A\x88\xB3\x85\x8A\x4A\x20\x83\x1B\x8A\x7C\x0A\x28\x2A\x30\x87\x7F\x73\x2E\x8B\x96\x80\x88\x32\x75\x87\xED\x20\x83\x46\x88\x87\xA4\x86\x10\xD9\x76\x2C\x30\x8A\x8C\x35\x74\x87\xC2\x8B\x83\x3E\x8A\x73\xD6\x82\x74\xD8\x87\x15\xC7\x8B\x87\x32\x79\x20\xCB\x8D\x8D\x02\x1D\x22\x3C\x79\x10\x3E\x71\x7E\xE8\x8A\x8D\xEB\x87\x8E\x06\x19\x8E\xC0\x87\x72\xEC\x8F\x8E\xF3\x82\x8F\xEE\x86\x8F\x2D\x7A\x10\x41\x72\x8D\xE4\x81\x10\xE2\x8E\x88\xCF\x83\x86\xFC\x8F\x7C\x67\x87\x8F\x07\x15\x8F\x07\x95\x8B\xC8\x81\x16\x08\x9F\x72\x0D\x93\x73\x0F\x90\x8F\xA0\x7D\x8E\xF9\x84\x91\x31\x7D\x73\x11\x99\x91\x06\x91\x10\xFB\x83\x8E\x04\x96\x10\xFF\x82\x8A\x01\x96\x1B\x1A\x95\x91\xF4\x8B\x91\x10\x98\x92\x12\x93\x81\x18\x9A\x92\x25\x97\x91\x16\x95\x8D\xE5\x17\x8D\x1F\x93\x10\x21\x9B\x7F\x90\x86\x10", + "\xB7\x84\x27\xD3\x8F\x90\xA7\x8D\x84\x0A\x1D\x77\xEA\x86\x10\x42\x97\x13\xAD\x83\x94\xDE\x8E\x92\x4A\x96\x92\xF8\x80\x93\x27\x9C\x94\x2B\x7F\x92\x32\x9F\x94\x4E\x9D\x94\x53\x93\x10\x1D\x94\x31\x30\x87\x93\x83\x83\x92\x01\x1D\x8A\xD4\x1D\x93\x28\x9D\x8C\x00\x9C\x85\xFF\x01\x8D\x70\x80\x94\x09\x18\x96\xF3\x1C\x96\x6B\x8A\x96\x41\x8F\x1B\x6E\x9B\x8A\x2D\x12\x73\x3B\x93\x97\x97\x82\x73\xAD\x84\x8D\x6F\x9B\x12\x47\x97\x13\x7C\x94\x97\x2C\x1F\x97\x34\x11\x98\x97\x84\x98\x31\x16\x98\x80\x88\x98\x2D\x18\x97\x80\x8E\x98\xE0\x88\x7E\x72\x9E\x7E\x90\x98\x88\x77\x8D\x96\x94\x99\x93\x03\x17\x97\x99\x9E\x95\x00\x0D\x8A\x95\x9C\x89\xB2\x31\x9A\xB0\x82\x99\xC1\x14\x9A\xB8\x87\x99\xD1\x18\x9A\x9D\x76\x97\xBD\x1C\x9A\x48\x92\x10\xAD\x82\x73\xBF\x84\x13\x8C\x90\x97\x64\x7F\x9A\x9D\x96\x96\x32\x7C\x9A\x32\x70\x7C\x98\x95\x83\xB0\x91\x8F\x69\x80\x95\x01\x10\x9C\xAB\x9B\x9B\x69\x9B\x12\xAE\x98\x92\xC8\x96\x1D\xC3\x94\x13\xD1\x9C\x92\x84\x7F\x90\xCF\x90\x14\xD3\x95\x97\xB2\x37\x9B\x2B\x19\x9D\x2C\x1E\x9D\xCC\x96\x9A\xC1\x96\x96\xE0", + "\x9C\x87\x71\x97\x9A\xCA\x95\x86\xDA\x99\x10\x9C\x92\x9C\x9A\x92\x9B\xBA\x9E\x99\xB5\x9C\x8A\xE9\x9D\x97\x67\x9F\x9E\x01\x1C\x9A\xE5\x95\x9E\x32\x7E\x81\x37\x1B\x9F\xF8\x90\x00\xED\x94\x9E\x01\xA0\x9A\x01\xA3\x9F\x71\x8A\x77\x68\x8F\x95\x0B\xA0\x00\x2F\x26\x87\x09\x11\x01\x0D\xA2\xA1\x62\x81\x95\x15\xAC\x91\x0D\xA5\x94\x35\x92\x10\xBB\x7A\x7A\x6E\x8E\xA1\x09\x1F\x93\x81\x8B\x99\xBD\x1A\x98\x94\x82\x9E\xD1\x16\xA2\xA0\x88\xA2\x86\x79\x10\x0D\x20\xA1\x06\x1F\xA2\x20\xA1\xA3\xBD\x17\x59\xD0\x7F\x7F\x6B\x9C\xA2\x73\x9B\xA3\x3A\xAD\xA3\x05\x94\x15\x53\x89\x10\x64\x91\x10\x43\xA0\x00\x45\xA7\xA4\x41\xA9\x8D\x42\xAA\x10\xDF\x7D\xA4\x4C\xAF\xA4\xEC\x90\xA5\x3A\x92\xA5\x03\x19\x83\x7D\x7D\xA1\x16\xA4\x95\x59\xA6\x95\x0E\x91\x93\x5D\xAA\xA5\x5F\xA8\x95\xB4\x87\x9E\x09\x94\xA3\x11\xA3\xA6\x03\x14\xA1\x64\xA1\x10\x6A\xA6\x93\x0A\x1D\xA6\x0B\x1A\x10\xE6\x86\x10\x0F\xA9\x9B\x09\x15\xA7\xC5\x93\x10\x78\xAE\x8F\x0D\x1A\x10\x32\xA2\x10\x14\x0A\x10\x4E\x27\xA6\x09\x1F\x9C\x83\xA6\x10\x70\xAD\x81\x82\xAF\xA6\x0A\x17\x93\x87\xA9", + "\xA6\x7E\xAB\xA8\x09\x13\xA7\x03\x10\x25\x84\xA6\x10\xCF\x96\xA9\x88\xAA\x9A\x00\x0A\xA9\x90\xA5\x74\x09\x1E\xA9\x02\x19\xA8\x00\x0F\xA7\x01\x12\xAA\x01\x14\xA9\x02\x17\x01\x8C\xA5\xA8\x0A\x1C\xAA\x97\xA2\x90\x03\x10\xAB\x9B\xA0\xAA\x06\x14\xAB\x9F\xA6\xA6\xB7\xA2\xA7\x0A\x1E\x26\x0F\x5A\x01\x18\x88\xA0\xC6\x13\x97\x23\x08\x81\x2F\x1B\x06\x47\x78\x7D\x0A\x15\xAC\xC6\xA9\x10\x6C\x09\xAC\x18\x80\x32\xCD\xA6\x10\x6D\x00\xAD\xD5\x99\x10\xA3\x33\xAD\x03\x1E\x06\xD6\xA0\xA4\xD8\xAA\xAD\x03\x1F\x06\xDD\xA6\x7A\xFE\x30\xAE\x01\x10\x07\xE3\xA1\x7A\x56\x46\xAE\x00\x01\x07\xE9\xA1\x10\xDF\x7C\x49\xEC\xA2\x07\xEF\xA0\x00\x39\x8E\x49\xEC\xA3\x07\xF5\xA7\xAF\xEC\xA0\x00\x74\x05\xAF\x2F\x1E\x4A\xEC\xA5\x07\xF5\xA8\xA5\x01\x1A\x4F\xEC\xA6\x07\xF5\xA1\x98\x24\x50\x7D\xAC\x9F\x12\x45\xA1\x54\x0E\xBD\x1F\x7D\x7F\x53\x13\xB1\x20\x3E\x7B\x52\x17\xB2\x21\x59\x91\x10\x49\x5B\xB1\x03\x17\x07\xF5\xA2\x73\x47\x5C\xAE\x78\x05\xAF\x1D\xB0\x00\x1F\xBB\x7C\x73\x99\x07\x23\xBA\x10\x25\xB6\xAE\x7A\x05\xAF\xCF\x9F\x54\xEC\xAB\x07\x34\xBA\x10", + "\x54\x5C\xAE\x7C\x09\xB3\x09\x1B\xB3\xE6\xAD\x07\xF5\xA4\x0B\x18\x84\x8C\xAE\x16\xAC\xC2\xA0\x30\x2F\x1B\x93\x48\xBC\x52\x10\xBD\x1F\x2F\x14\x9B\x39\x3F\x12\x60\x98\x81\x73\x99\xB4\x15\x3F\x12\x1A\xA0\x1B\x2F\x11\x98\x58\xBC\x26\x2F\x1F\xB0\x18\x85\x78\x5F\xB0\xB5\x0C\x91\x20\x4F\xBF\x82\x22\x3D\xB5\x66\xB1\xA5\x6A\xB1\x33\x2F\x16\xB0\xBB\x2F\x12\x39\x81\x75\x7D\x76\xB4\xB0\x12\xB5\x68\xBD\x92\xD0\x89\x33\xFD\x9D\xB6\x6B\xA6\xA4\x0A\x11\xA8\x6F\xB9\xB7\x8D\xA0\xB8\x03\x1F\xA8\x02\x15\xA4\x10\x15\xB8\xAC\x17\xB5\x88\xB2\x10\x88\x29\xA3\x37\x33\x97\xFE\x97\xB4\x11\x19\xA4\x03\x10\x2D\x8E\xB3\xAC\x87\xBB\xB7\x09\x14\x11\x4B\xA9\x10\x2F\x3D\xB9\xCD\x1E\xB5\x91\xB1\x10\x3E\x3D\xB7\x37\x31\x98\x97\xBC\xB5\x0A\x10\x39\xA3\xB6\x10\xDF\x36\xBA\xD5\x11\x98\x5C\x95\x1F\x2F\x1B\x3E\xB3\xB3\x10\x4A\x46\xBB\x54\xBB\x44\x2F\x1B\xAE\xAC\xB5\x38\x85\x7F\xBA\xAC\x1F\x12\x71\x4D\xBB\x02\x12\x4A\xC0\xBA\xA0\xB6\xA1\x26\x2F\x14\x4A\x4A\xA6\x10\xC9\x41\x8C\x01\x25\xA4\x65\xB0\x7D\xD5\x44\xB9\x85\x35\xA4\xC8\xB6\x1C\x2F\x18\xB0\xD5", + "\xB3\x10\x1A\xB8\xBD\x12\x25\xA4\xB9\xB8\xB9\x09\x16\xB1\xE5\xB2\x10\x4B\x58\xBE\x61\x2F\x7D\xDB\xBB\x7C\x4D\x5E\xBD\x98\x3F\x7D\xE1\xBD\x1C\x2F\x16\x56\xCC\xB1\x10\x8F\x5F\xBC\x6E\xB0\x92\xA9\xB0\x00\x91\x5F\xBF\x00\x00\x5B\x02\xC6\x10\x75\xB5\xC0\xBA\x58\xBF\xF6\x39\x83\xFB\xB5\x1D\x2F\x19\x5D\x08\xC8\x5F\x0B\xC5\xA5\x9F\xB2\x21\x2F\x16\x60\x08\xC6\x62\x19\xC4\x92\x21\xC8\x74\x28\x60\xC1\x9D\x38\x84\xD2\xBA\x10\x2E\x68\xC0\x6A\x63\xC2\x00\x0D\x77\xEB\xB0\xBB\x09\x1F\x66\x08\xC2\x69\x2E\xC2\xB7\xF5\xB6\x7A\x94\x6E\xC2\xD8\x12\xB7\x13\xC6\xAC\xA2\x6F\xA3\x03\x14\x6C\x37\xCB\xC1\x29\xC9\x10\xC6\x62\xC4\x02\x19\x6D\x2E\xCE\x73\x39\xC1\x7A\xDB\x6C\xC3\xF5\x1E\x73\x3F\xC8\x81\xDD\x6A\xC4\x01\x10\x6F\x4D\xC6\xC4\xBA\x2F\x12\xF2\x68\xC5\x00\x05\x70\x2E\xC9\xB2\x4F\xC8\x74\x07\x72\xC5\xAE\x19\xB2\x55\xC0\x7D\x09\x70\xC6\x14\x73\xC6\x5C\xC6\x26\x2F\x16\x71\x60\xC0\x72\x2E\xCF\x9C\x29\xB8\x1D\xEA\x4A\x7F\x2B\x99\xBC\xC6\x47\x93\xD7\x9A\xBB\xC6\x46\xAA\x00\x0A\xAA\x72\xCD\x1F\x44\xB1\x2A\x12\x26\xC8\x00\x04\xAA\x7A\xC6", + "\x4C\x7B\xA0\x00\x8A\xB7\xC8\x09\x16\x0B\x2C\x53\xC9\x9D\xA5\xC0\xD8\x17\x0B\x0B\x85\x1F\xA8\xA0\x00\x70\x20\xBA\x6C\x4F\xC9\xB8\xAD\xC5\xC6\x45\xCA\xA9\xAA\xC9\xF5\x19\x0B\xE6\x25\x14\xBD\xAA\x10\xA1\xCC\xC1\xC6\x41\xCB\x03\x14\xB8\xB2\xC9\x10\xBB\x0C\x52\xC0\xA9\x10\xBE\xA7\xCB\x6C\x4D\xB8\x06\x1E\x29\xA2\xC3\x10\xBC\x03\x16\xBD\x0D\xC9\xAE\x10\x10\x09\x13\xB9\xBE\xC3\x10\xBF\x0C\x52\xC2\xC6\x10\xCA\xCD\xCC\xFE\x40\x2A\xB5\x25\xC0\xC0\x0C\x52\xB6\x29\x10\x9C\xB4\xCD\x66\x21\x0C\xC8\xC0\x1B\xB8\x29\x10\xD1\xC7\xC4\x06\x13\x0C\x63\x14\x0C\xE6\x22\x82\x09\x13\xCE\x06\x1E\x2C\xC3\xCE\x4F\xCC\xA1\xCC\x05\xC6\x0C\x63\x17\x0C\xE6\x2A\xB7\x06\x13\xCF\x03\x10\xCF\xDE\xC0\x51\xFE\xC3\x10\x20\x05\xC0\xC9\x0C\x52\xDD\xC3\x10\xEE\xC6\xCE\xC4\x42\xBA\x06\x15\x2E\xF1\xC1\x10\xCA\x0C\x52\x0E\xD6\x10\xA5\xBF\xCF\xD8\x1B\x0C\xE1\xCC\x1A\x29\x09\xD1\xE2\xBA\x10\xCD\x0B\x44\x90\xB9\x10\x1B\xD3\xC0\x0A\xD2\x10\xCE\x0B\x44\xA8\xB2\xD2\x9A\xB6\xCA\x09\x1F\x0C\x4B\x44\xB6\x0A\x13\xD2\xDE\xAF\xCF\xD0\x0B\x44\xDA\xB1\xD3\x41\x95\xC0", + "\xD1\x0B\x44\xF4\xB8\xD3\x26\xC3\xB7\x0A\x12\x0D\x4B\x4D\xC0\x2A\xD1\xA2\x05\xC3\x0D\x4B\x4D\x77\x51\x72\xD3\x03\x1A\xA2\x7E\xC9\x10\xD4\x0B\x44\x38\xCE\xD3\x06\x12\xB7\x8F\xC9\x10\xD5\x03\x16\xD6\x06\x2E\x4E\xCA\x10\x09\x32\x2E\x05\xC8\x0D\x2C\x52\xAD\x06\x1F\xD5\x16\xDC\x47\x15\xD3\x10\x4C\xDC\xD2\x6C\x4B\xBA\x03\x12\x37\x0F\xD0\x00\xD9\x0C\x52\x70\xD6\x10\xB1\x31\xD7\xD8\x1A\x0D\x1C\xDD\x1C\xB2\xBD\xD0\x05\xCC\x0D\x4B\x44\xC6\xB1\xBA\x10\xA5\x38\xD7\x7C\x49\xAD\x7E\xD1\xD7\xDD\x0B\x44\xCF\x91\x75\x88\xD3\x10\x85\xD7\xD6\x38\x41\xD9\x03\x16\x35\x71\xDE\x0D\x2C\x57\xD7\x06\x1D\xD7\x25\xD1\x4E\xC2\x36\x10\x17\x41\xD7\xDF\x0C\x52\xB5\xBB\x14\x05\xC0\x0E\x4B\x4A\x7F\x51\x75\xDA\x24\xA1\xD7\xE1\x0B\x44\x37\x9B\xDA\x2B\xD4\xC9\x06\x12\x0E\x4B\x44\xC8\xB2\xD7\xAD\xFF\xC3\x0E\x4B\x44\xAA\xB9\xD4\x94\x05\xC4\x0E\x4B\x4C\xC8\xBF\xD3\x10\x62\xB0\x7D\xE5\x0B\x44\x91\xC5\xDC\x02\x12\xA2\x14\xCA\x10\xE6\x0B\x44\xB6\xC3\x10\xCC\xD1\x10\x4E\xDD\xD1\x09\x17\x0E\x4B\x48\xC9\xD5\xD0\x00\x56\xD2\xC8\x09\x18\x0E\x63\x19\x0E\xE6", + "\x2F\xC9\x51\x7C\xBB\x06\x17\x3C\x71\xDB\x0E\x2C\x55\xAE\xEA\x3A\xCA\x38\x41\xDA\xB4\xB0\xDF\x2E\x4B\x41\x06\x18\x45\x71\xDC\x0E\x2C\x57\x44\x8A\xCD\xD9\x00\x0D\x0E\x4B\x48\xCA\x00\x01\x75\xFC\xD3\xA5\x71\xDE\x0E\x4B\x4D\xCB\xD4\xDA\x10\x05\xE9\x94\xFF\xCF\x0E\x4B\x44\xCB\x02\x14\xE0\xD0\xBF\xCF\xF0\x0B\x44\xBB\xC2\xBF\x02\x1D\xE0\x22\xCF\xCF\xF1\x0B\x44\xC0\xCB\xE0\x09\x1C\xE1\xF9\x95\xC0\xF2\x0B\x44\xCC\xC2\xE2\x06\x14\xE2\xF6\xA5\xC0\xF3\x0B\x44\xD3\xCA\xE2\x03\x1C\xE2\xD7\xDC\xBF\x0A\x14\x0F\x4B\x45\xCE\x13\xEC\xE0\x1F\xAC\xD6\x03\x15\x0F\x63\x16\x0F\xE6\x26\xCD\x32\xE2\x10\xBF\xB6\x10\x3A\x41\xD7\xF8\x0C\x52\xC4\xBE\xBB\xF4\xDD\x44\xF8\xDB\xE2\x4F\xE6\x43\x5D\x46\x10\x77\x41\xD7\xF9\x0C\x52\x57\xE6\x10\xCE\xB2\xD9\xB0\x1A\x0F\x7B\xD5\x1D\x93\x49\x10\xF2\xDE\xDF\xFC\x0B\x44\x03\xDF\x50\x63\xE7\xDF\x05\xCD\x0F\x4B\x4B\xCD\x1A\xE1\x10\x6B\xE3\x10\xA0\x46\xD8\x38\x42\xAF\x6C\xE1\xD7\xFE\x0B\x44\x09\xDB\xE3\x09\x18\xE7\x74\xE3\xE5\x3F\x48\xAF\x06\x15\xE7\x5E\xED\x44\x86\xE3\x10\xCB\xB6\xD1\x2C\x5D\xE5\x03\x13", + "\xE7\x3E\xEE\x4F\xD4\xB3\x10\xB4\x41\xD7\x03\xE8\xC6\xB0\x19\x4A\xFD\xD1\xE9\x01\x11\x00\xF5\xA8\x1D\xFC\xCE\xE7\x06\x1A\xE9\x06\xEF\xCF\x02\x0F\xE9\xF5\x11\xD0\xA2\xE3\x10\xA4\xEE\xE0\xFE\xD3\x00\xA8\xEE\x1A\x07\xDB\xEA\x02\x1D\xEA\xF0\x91\xD7\x04\x01\xEB\xB0\x1C\xD0\x45\xE1\x10\xB6\xE1\x10\x5B\xBF\xD4\x54\x1A\xEB\xAC\x13\x2E\x0F\x5F\xEB\x00\x07\xDC\xCB\x76\x00\xC4\xE6\x1C\x13\xDD\xEB\x00\x08\xEC\xCE\xD6\xAC\x07\x0D\xEC\xCD\x1B\xD6\x9D\xEA\x10\xC8\xE5\xE3\xCF\xD1\xA2\xD6\xE5\x1D\x66\xD0\xED\xC8\xEF\xDD\xEC\xB4\x94\x05\xB7\x74\x32\x74\xD6\xD0\xEB\x4A\x09\x17\x4A\x71\xDC\x00\xDF\xEC\x26\x02\xB6\x10\xEC\xE7\xE8\x36\x45\xE9\xA3\xE2\xE8\x66\x47\xBD\x03\x1A\x4D\x71\xDD\x00\xF1\xED\x1F\xFE\xE6\x10\x07\x56\xE7\xB0\x1E\x00\xE8\xED\x1F\xF4\x49\x10\xF8\xEE\xDF\x10\x01\xF0\xA4\xB3\x16\x0B\xF6\x10\x02\x56\xF0\x4D\x44\xBE\x03\x15\xF1\xF6\xEF\x43\x1A\xF3\x10\xDD\xBF\xCF\x11\x00\xF1\x12\x25\xF0\x06\x13\xF1\xFE\xDF\x46\x0E\x57\xCD\x71\xD2\x01\x09\xF1\x20\x6E\xD4\xEB\x01\x19\xF2\x6F\xD5\xC0\x14\x0D\xF2\x12\x26\xD9\x71\xE0\x00", + "\x32\xF2\x10\x5B\xEE\xDF\x16\x06\xF3\x61\x25\xD7\xD0\xEB\xF3\x01\x13\xF0\xFE\xD8\x01\x40\xFA\x2B\x9C\xD0\xF3\x00\x0D\xB0\x06\x13\x51\x71\xDA\x01\x49\xFD\x39\xE7\xB3\x10\x50\xFF\xCF\x1C\x03\xF5\xF7\x3E\xBE\x56\xF5\xC0\x1E\x0A\xF5\x3C\x32\xB1\x4F\xF5\xC0\x20\x00\xF6\x22\x33\x54\x2A\xFF\xCF\x22\x07\x74\xCA\xE3\x10\x8F\xD2\x10\x32\x78\xF6\x33\xF1\xD7\x25\x0C\xF6\xFD\x1A\xD9\x03\x11\xF7\x0A\x1D\xF3\x9C\xE0\x00\x28\x06\xF7\x01\x2A\xDE\xA6\xD9\x10\x72\xF2\x10\x46\xFD\xF7\x2B\x00\xF8\x12\x28\xDE\x79\xF3\x12\x92\xAF\xCF\x2E\x06\xF6\xAE\x15\xE6\x4C\xF1\xB3\x03\x10\xE7\xFE\xD0\x03\x92\xF0\x1B\xF6\xDD\xF8\x09\x16\xF9\x02\x12\xF4\x7D\xF2\x03\x9B\xFC\x1A\x2C\xE4\xB2\x7B\xF5\xC0\x34\x05\xFA\xC6\x1D\xE4\x70\xF0\xB3\x0A\x17\xF8\xB4\xD3\x10\x36\x0C\xFA\xCD\x15\xE5\x9E\xF6\x10\xA0\xF1\x10\x98\xC7\xD5\x06\x18\x03\x22\xF3\x10\x7C\xF9\xED\x09\x1B\xB2\x03\x15\x54\x71\xD9\x03\xC1\xFA\x2B\xF1\xB7\xF9\x05\xCA\x03\x47\x7C\xED\x2F\x10\xE9\x25\xE9\x10\xCD\xF1\xFA\x05\xCE\x03\xD1\xFD\x1F\x89\xE2\x10\x73\x97\xFD\x01\x13\xFC\x40\xD9\x10\x42", + "\x0B\xFD\x01\x2E\xEE\xC5\xB3\x10\xE0\xF0\x00\xB2\xF3\xFE\x85\xE6\xFE\x12\x23\xEF\xC6\xD5\x12\x8F\xFE\xDF\x4A\x0A\xF8\x61\x2F\xF1\xB9\xF3\x10\x36\xB6\x10\xF7\xBF\xCF\x4D\x03\xF9\x66\x13\xFE\x7E\xFC\x71\x6A\x13\x18\x7F\xBA\x16\xE4\x5E\x7E\x85\x04\x00\xD8\x7D\x5C\x71\x02\x08\x86\x4C\x24\x79\xF9\x79\x10\x0D\x81\xF8\x65\x60\x54\x01\x02\xBB\x14\xA7\x74\x01\x86\x0A\x05\x8C\x7F\x05\x67\x0A\x1A\x80\xEC\x02\xF6\x1D\x80\xFF\x75\x7F\x7D\x7A\x0B\x36\x7D\xEA\x0B\xFB\x00\x02\xCC\x20\x5A\x03\x0F\xFF\x7E\x6E\x2E\x02\x00\xBB\x14\x0C\x82\x08\x98\x7D\xEF\x5D\x03\x11\x85\x1F\x6B\x7F\x5C\x57\x81\x01\x0A\xF4\x73\x7C\x81\x00\x06\x3C\x82\x6B\x00\x82\xC9\x72\x67\x69\x7D\xB8\x63\x06\x46\x80\x6C\x15\x2B\x3F\x68\x09\xAD\x7E\xDF\x73\x10\x66\x02\x13\x8C\x0D\x8D\x29\x0A\xA8\x81\x21\x80\xC0\x2B\x83\xB1\x46\x17\xFE\x5A\x10\x7A\x5D\xCE\x3D\xAF\x0C\x50\x06\x5F\x3E\x44\x0B\x2E\x44\x0B\x5C\x40\xED\x44\x09\x91\x44\x0A\x81\x4C\x28\x39\x40\xA2\x09\x8A\x09\x0A\xDC\x44\x0A\x77\x82\x6B\x46\x57\x3B\x8F\xB5\x58\x5B\x3F\x07\x3B\x51\x5C\x3B\x38\x5A\xEA\x40", + "\x7D\x6C\x83\xEB\x65\x5A\xC6\x56\x10\xA5\x38\x63\x5F\xB0\x30\x4E\x1A\x81\x5B\xC6\x52\xFA\x5C\x77\x7F\x01\x07\xEC\x58\x06\x55\x84\xDB\x40\xFA\x18\x84\xDD\x6D\x1E\x47\x49\xE1\x24\x0A\x9F\x81\x78\x63\x5A\x63\x51\x0A\xB3\x6D\x76\x05\x52\x9D\x3F\x0D\xA9\x5A\xE8\x3A\x0A\xA6\x86\x1B\x94\x76\xDC\x0B\x27\x7F\x06\x34\x8B\xB4\x30\x87\x19\x86\x56\xD3\x76\xB9\x7F\x07\x39\x84\xB7\x38\x86\x2F\x98\x40\xC1\x75\x26\x01\x86\x16\x40\x0C\xC6\x55\x1D\x80\x6E\xC5\x81\x19\x90\x3E\x72\x7C\x13\x4C\x85\x4C\x19\x83\x3D\x71\xF4\x10\x86\x3B\x86\xAC\x7D\x61\x4D\x16\x86\x2C\x0E\xE7\x04\x0A\x6D\x8F\x12\x5C\x84\xDF\x4B\x3E\xDE\x83\x26\x4A\x0D\x3C\x60\x14\x29\x58\x51\x09\x59\x6A\x81\x65\x72\x3A\xC1\x68\xA6\x78\x0D\x20\x77\x09\xCF\x4C\x28\x31\x87\x97\x0F\xC3\x13\x63\x3F\x1A\x3F\x44\x08\x1F\x86\x56", }; vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream); } @@ -11775,98 +11926,101 @@ namespace vl::presentation::remoteprotocol L"[1][RType] END [ENDING]", L"[2][RType]< \"bool\" @ >", L"[3][RType]< \"char\" @ >", - L"[4][RType]< \"double\" @ >", - L"[5][RType]< \"float\" @ >", - L"[6][RType]< \"int\" @ >", - L"[7][RType]< \"key\" @ >", - L"[8][RType]< \"string\" @ >", - L"[9][RType]< NAME @ >", - L"[10][RType]< RType \"[\" \"]\" @ >", - L"[11][RType]< RType \"[\" @ \"]\" >", - L"[12][RType]< RType @ \"[\" \"]\" >", - L"[13][RAttributeParameter] BEGIN ", - L"[14][RAttributeParameter] END [ENDING]", - L"[15][RAttributeParameter]CPP_NAME @", - L"[16][RAttribute] BEGIN ", - L"[17][RAttribute] END [ENDING]", - L"[18][RAttribute]< \"[\" @ ATT_NAME [ \"(\" RAttributeParameter \")\" ] \"]\" >", - L"[19][RAttribute]< \"[\" ATT_NAME @ [ \"(\" RAttributeParameter \")\" ] \"]\" >", - L"[20][RAttribute]< \"[\" ATT_NAME [ \"(\" @ RAttributeParameter \")\" ] \"]\" >", - L"[21][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter \")\" @ ] \"]\" >", - L"[22][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter \")\" ] \"]\" @ >", - L"[23][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter @ \")\" ] \"]\" >", - L"[24][REnumMember] BEGIN ", - L"[25][REnumMember] END [ENDING]", - L"[26][REnumMember]< NAME \",\" @ >", - L"[27][REnumMember]< NAME @ \",\" >", - L"[28][REnum] BEGIN ", - L"[29][REnum] END [ENDING]", - L"[30][REnum]< \"enum\" @ NAME \"{\" { REnumMember } \"}\" >", - L"[31][REnum]< \"enum\" NAME \"{\" @ { REnumMember } \"}\" >", - L"[32][REnum]< \"enum\" NAME \"{\" { REnumMember @ } \"}\" >", - L"[33][REnum]< \"enum\" NAME \"{\" { REnumMember } \"}\" @ >", - L"[34][REnum]< \"enum\" NAME @ \"{\" { REnumMember } \"}\" >", - L"[35][RStructMember] BEGIN ", - L"[36][RStructMember] END [ENDING]", - L"[37][RStructMember]< \"var\" @ NAME \":\" RType \";\" >", - L"[38][RStructMember]< \"var\" NAME \":\" @ RType \";\" >", - L"[39][RStructMember]< \"var\" NAME \":\" RType \";\" @ >", - L"[40][RStructMember]< \"var\" NAME \":\" RType @ \";\" >", - L"[41][RStructMember]< \"var\" NAME @ \":\" RType \";\" >", - L"[42][RStruct] BEGIN ", - L"[43][RStruct] END [ENDING]", - L"[44][RStruct]< \"struct\" @ NAME \"{\" { RStructMember } \"}\" >", - L"[45][RStruct]< \"struct\" NAME \"{\" @ { RStructMember } \"}\" >", - L"[46][RStruct]< \"struct\" NAME \"{\" { RStructMember @ } \"}\" >", - L"[47][RStruct]< \"struct\" NAME \"{\" { RStructMember } \"}\" @ >", - L"[48][RStruct]< \"struct\" NAME @ \"{\" { RStructMember } \"}\" >", - L"[49][RMessageRequest] BEGIN ", - L"[50][RMessageRequest] END [ENDING]", - L"[51][RMessageRequest]< \"request\" \":\" @ RType \";\" >", - L"[52][RMessageRequest]< \"request\" \":\" RType \";\" @ >", - L"[53][RMessageRequest]< \"request\" \":\" RType @ \";\" >", - L"[54][RMessageRequest]< \"request\" @ \":\" RType \";\" >", - L"[55][RMessageResponse] BEGIN ", - L"[56][RMessageResponse] END [ENDING]", - L"[57][RMessageResponse]< \"response\" \":\" @ RType \";\" >", - L"[58][RMessageResponse]< \"response\" \":\" RType \";\" @ >", - L"[59][RMessageResponse]< \"response\" \":\" RType @ \";\" >", - L"[60][RMessageResponse]< \"response\" @ \":\" RType \";\" >", - L"[61][RMessage] BEGIN ", - L"[62][RMessage] END [ENDING]", - L"[63][RMessage]< \"message\" @ NAME \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" >", - L"[64][RMessage]< \"message\" NAME \"{\" @ [ RMessageRequest ] [ RMessageResponse ] \"}\" >", - L"[65][RMessage]< \"message\" NAME \"{\" [ RMessageRequest @ ] [ RMessageResponse ] \"}\" >", - L"[66][RMessage]< \"message\" NAME \"{\" [ RMessageRequest ] [ RMessageResponse @ ] \"}\" >", - L"[67][RMessage]< \"message\" NAME \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" @ >", - L"[68][RMessage]< \"message\" NAME @ \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" >", - L"[69][REventRequest] BEGIN ", - L"[70][REventRequest] END [ENDING]", - L"[71][REventRequest]< \"request\" \":\" @ RType \";\" >", - L"[72][REventRequest]< \"request\" \":\" RType \";\" @ >", - L"[73][REventRequest]< \"request\" \":\" RType @ \";\" >", - L"[74][REventRequest]< \"request\" @ \":\" RType \";\" >", - L"[75][REvent] BEGIN ", - L"[76][REvent] END [ENDING]", - L"[77][REvent]< \"event\" @ NAME \"{\" [ REventRequest ] \"}\" >", - L"[78][REvent]< \"event\" NAME \"{\" @ [ REventRequest ] \"}\" >", - L"[79][REvent]< \"event\" NAME \"{\" [ REventRequest @ ] \"}\" >", - L"[80][REvent]< \"event\" NAME \"{\" [ REventRequest ] \"}\" @ >", - L"[81][REvent]< \"event\" NAME @ \"{\" [ REventRequest ] \"}\" >", - L"[82][RDeclDetail] BEGIN ", - L"[83][RDeclDetail] END [ENDING]", - L"[84][RDeclDetail]<< !REnum @ >>", - L"[85][RDeclDetail]<< !REvent @ >>", - L"[86][RDeclDetail]<< !RMessage @ >>", - L"[87][RDeclDetail]<< !RStruct @ >>", - L"[88][RDecl] BEGIN ", - L"[89][RDecl] END [ENDING]", - L"[90][RDecl]<< { RAttribute @ } !RDeclDetail >>", - L"[91][RDecl]<< { RAttribute } !RDeclDetail @ >>", - L"[92][Schema] BEGIN ", - L"[93][Schema] END [ENDING]", - L"[94][Schema]< RDecl @ { RDecl } >", - L"[95][Schema]< RDecl { RDecl @ } >", + L"[4][RType]< \"color\" @ >", + L"[5][RType]< \"double\" @ >", + L"[6][RType]< \"float\" @ >", + L"[7][RType]< \"int\" @ >", + L"[8][RType]< \"key\" @ >", + L"[9][RType]< \"string\" @ >", + L"[10][RType]< NAME @ >", + L"[11][RType]< RType \"?\" @ >", + L"[12][RType]< RType \"[\" \"]\" @ >", + L"[13][RType]< RType \"[\" @ \"]\" >", + L"[14][RType]< RType @ \"?\" >", + L"[15][RType]< RType @ \"[\" \"]\" >", + L"[16][RAttributeParameter] BEGIN ", + L"[17][RAttributeParameter] END [ENDING]", + L"[18][RAttributeParameter]CPP_NAME @", + L"[19][RAttribute] BEGIN ", + L"[20][RAttribute] END [ENDING]", + L"[21][RAttribute]< \"[\" @ ATT_NAME [ \"(\" RAttributeParameter \")\" ] \"]\" >", + L"[22][RAttribute]< \"[\" ATT_NAME @ [ \"(\" RAttributeParameter \")\" ] \"]\" >", + L"[23][RAttribute]< \"[\" ATT_NAME [ \"(\" @ RAttributeParameter \")\" ] \"]\" >", + L"[24][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter \")\" @ ] \"]\" >", + L"[25][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter \")\" ] \"]\" @ >", + L"[26][RAttribute]< \"[\" ATT_NAME [ \"(\" RAttributeParameter @ \")\" ] \"]\" >", + L"[27][REnumMember] BEGIN ", + L"[28][REnumMember] END [ENDING]", + L"[29][REnumMember]< NAME \",\" @ >", + L"[30][REnumMember]< NAME @ \",\" >", + L"[31][REnum] BEGIN ", + L"[32][REnum] END [ENDING]", + L"[33][REnum]< \"enum\" @ NAME \"{\" { REnumMember } \"}\" >", + L"[34][REnum]< \"enum\" NAME \"{\" @ { REnumMember } \"}\" >", + L"[35][REnum]< \"enum\" NAME \"{\" { REnumMember @ } \"}\" >", + L"[36][REnum]< \"enum\" NAME \"{\" { REnumMember } \"}\" @ >", + L"[37][REnum]< \"enum\" NAME @ \"{\" { REnumMember } \"}\" >", + L"[38][RStructMember] BEGIN ", + L"[39][RStructMember] END [ENDING]", + L"[40][RStructMember]< \"var\" @ NAME \":\" RType \";\" >", + L"[41][RStructMember]< \"var\" NAME \":\" @ RType \";\" >", + L"[42][RStructMember]< \"var\" NAME \":\" RType \";\" @ >", + L"[43][RStructMember]< \"var\" NAME \":\" RType @ \";\" >", + L"[44][RStructMember]< \"var\" NAME @ \":\" RType \";\" >", + L"[45][RStruct] BEGIN ", + L"[46][RStruct] END [ENDING]", + L"[47][RStruct]< \"struct\" @ NAME \"{\" { RStructMember } \"}\" >", + L"[48][RStruct]< \"struct\" NAME \"{\" @ { RStructMember } \"}\" >", + L"[49][RStruct]< \"struct\" NAME \"{\" { RStructMember @ } \"}\" >", + L"[50][RStruct]< \"struct\" NAME \"{\" { RStructMember } \"}\" @ >", + L"[51][RStruct]< \"struct\" NAME @ \"{\" { RStructMember } \"}\" >", + L"[52][RMessageRequest] BEGIN ", + L"[53][RMessageRequest] END [ENDING]", + L"[54][RMessageRequest]< \"request\" \":\" @ RType \";\" >", + L"[55][RMessageRequest]< \"request\" \":\" RType \";\" @ >", + L"[56][RMessageRequest]< \"request\" \":\" RType @ \";\" >", + L"[57][RMessageRequest]< \"request\" @ \":\" RType \";\" >", + L"[58][RMessageResponse] BEGIN ", + L"[59][RMessageResponse] END [ENDING]", + L"[60][RMessageResponse]< \"response\" \":\" @ RType \";\" >", + L"[61][RMessageResponse]< \"response\" \":\" RType \";\" @ >", + L"[62][RMessageResponse]< \"response\" \":\" RType @ \";\" >", + L"[63][RMessageResponse]< \"response\" @ \":\" RType \";\" >", + L"[64][RMessage] BEGIN ", + L"[65][RMessage] END [ENDING]", + L"[66][RMessage]< \"message\" @ NAME \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" >", + L"[67][RMessage]< \"message\" NAME \"{\" @ [ RMessageRequest ] [ RMessageResponse ] \"}\" >", + L"[68][RMessage]< \"message\" NAME \"{\" [ RMessageRequest @ ] [ RMessageResponse ] \"}\" >", + L"[69][RMessage]< \"message\" NAME \"{\" [ RMessageRequest ] [ RMessageResponse @ ] \"}\" >", + L"[70][RMessage]< \"message\" NAME \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" @ >", + L"[71][RMessage]< \"message\" NAME @ \"{\" [ RMessageRequest ] [ RMessageResponse ] \"}\" >", + L"[72][REventRequest] BEGIN ", + L"[73][REventRequest] END [ENDING]", + L"[74][REventRequest]< \"request\" \":\" @ RType \";\" >", + L"[75][REventRequest]< \"request\" \":\" RType \";\" @ >", + L"[76][REventRequest]< \"request\" \":\" RType @ \";\" >", + L"[77][REventRequest]< \"request\" @ \":\" RType \";\" >", + L"[78][REvent] BEGIN ", + L"[79][REvent] END [ENDING]", + L"[80][REvent]< \"event\" @ NAME \"{\" [ REventRequest ] \"}\" >", + L"[81][REvent]< \"event\" NAME \"{\" @ [ REventRequest ] \"}\" >", + L"[82][REvent]< \"event\" NAME \"{\" [ REventRequest @ ] \"}\" >", + L"[83][REvent]< \"event\" NAME \"{\" [ REventRequest ] \"}\" @ >", + L"[84][REvent]< \"event\" NAME @ \"{\" [ REventRequest ] \"}\" >", + L"[85][RDeclDetail] BEGIN ", + L"[86][RDeclDetail] END [ENDING]", + L"[87][RDeclDetail]<< !REnum @ >>", + L"[88][RDeclDetail]<< !REvent @ >>", + L"[89][RDeclDetail]<< !RMessage @ >>", + L"[90][RDeclDetail]<< !RStruct @ >>", + L"[91][RDecl] BEGIN ", + L"[92][RDecl] END [ENDING]", + L"[93][RDecl]<< { RAttribute @ } !RDeclDetail >>", + L"[94][RDecl]<< { RAttribute } !RDeclDetail @ >>", + L"[95][Schema] BEGIN ", + L"[96][Schema] END [ENDING]", + L"[97][Schema]< RDecl @ { RDecl } >", + L"[98][Schema]< RDecl { RDecl @ } >", }; return results[index]; } @@ -11938,6 +12092,8 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpMessageRequest); case GuiRemoteProtocolClasses::MessageResponse: return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpMessageResponse); + case GuiRemoteProtocolClasses::OptionalType: + return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpOptionalType); case GuiRemoteProtocolClasses::PrimitiveType: return vl::Ptr(new vl::presentation::remoteprotocol::GuiRpPrimitiveType); case GuiRemoteProtocolClasses::ReferenceType: @@ -11976,6 +12132,8 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpMessageRequest::type, object, field, value, cppFieldName); case GuiRemoteProtocolFields::MessageResponse_type: return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpMessageResponse::type, object, field, value, cppFieldName); + case GuiRemoteProtocolFields::OptionalType_element: + return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpOptionalType::element, object, field, value, cppFieldName); case GuiRemoteProtocolFields::Schema_declarations: return vl::glr::AssemblerSetObjectField(&vl::presentation::remoteprotocol::GuiRpSchema::declarations, object, field, value, cppFieldName); case GuiRemoteProtocolFields::StructDecl_members: @@ -12034,6 +12192,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"MessageDecl", L"MessageRequest", L"MessageResponse", + L"OptionalType", L"PrimitiveType", L"ReferenceType", L"Schema", @@ -12042,7 +12201,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"Type", }; vl::vint index = (vl::vint)type; - return 0 <= index && index < 16 ? results[index] : nullptr; + return 0 <= index && index < 17 ? results[index] : nullptr; } const wchar_t* GuiRemoteProtocolCppTypeName(GuiRemoteProtocolClasses type) @@ -12058,6 +12217,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"vl::presentation::remoteprotocol::GuiRpMessageDecl", L"vl::presentation::remoteprotocol::GuiRpMessageRequest", L"vl::presentation::remoteprotocol::GuiRpMessageResponse", + L"vl::presentation::remoteprotocol::GuiRpOptionalType", L"vl::presentation::remoteprotocol::GuiRpPrimitiveType", L"vl::presentation::remoteprotocol::GuiRpReferenceType", L"vl::presentation::remoteprotocol::GuiRpSchema", @@ -12066,7 +12226,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"vl::presentation::remoteprotocol::GuiRpType", }; vl::vint index = (vl::vint)type; - return 0 <= index && index < 16 ? results[index] : nullptr; + return 0 <= index && index < 17 ? results[index] : nullptr; } const wchar_t* GuiRemoteProtocolFieldName(GuiRemoteProtocolFields field) @@ -12085,6 +12245,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"MessageDecl::response", L"MessageRequest::type", L"MessageResponse::type", + L"OptionalType::element", L"PrimitiveType::type", L"ReferenceType::name", L"Schema::declarations", @@ -12093,7 +12254,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"StructMember::type", }; vl::vint index = (vl::vint)field; - return 0 <= index && index < 19 ? results[index] : nullptr; + return 0 <= index && index < 20 ? results[index] : nullptr; } const wchar_t* GuiRemoteProtocolCppFieldName(GuiRemoteProtocolFields field) @@ -12112,6 +12273,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"vl::presentation::remoteprotocol::GuiRpMessageDecl::response", L"vl::presentation::remoteprotocol::GuiRpMessageRequest::type", L"vl::presentation::remoteprotocol::GuiRpMessageResponse::type", + L"vl::presentation::remoteprotocol::GuiRpOptionalType::element", L"vl::presentation::remoteprotocol::GuiRpPrimitiveType::type", L"vl::presentation::remoteprotocol::GuiRpReferenceType::name", L"vl::presentation::remoteprotocol::GuiRpSchema::declarations", @@ -12120,7 +12282,7 @@ GuiRemoteProtocolAstInsReceiver : public vl::glr::AstInsReceiverBase L"vl::presentation::remoteprotocol::GuiRpStructMember::type", }; vl::vint index = (vl::vint)field; - return 0 <= index && index < 19 ? results[index] : nullptr; + return 0 <= index && index < 20 ? results[index] : nullptr; } vl::Ptr GuiRemoteProtocolAstInsReceiver::ResolveAmbiguity(vl::vint32_t type, vl::collections::Array>& candidates) @@ -12171,6 +12333,7 @@ namespace vl::presentation::remoteprotocol L"STRING", L"CHAR", L"KEY", + L"COLOR", L"CPP_NAME", L"ATT_NAME", L"NAME", @@ -12183,6 +12346,7 @@ namespace vl::presentation::remoteprotocol L"COLON", L"SEMICOLON", L"COMMA", + L"QUESTION", L"SPACE", }; vl::vint index = (vl::vint)token; @@ -12206,6 +12370,7 @@ namespace vl::presentation::remoteprotocol L"string", L"char", L"key", + L"color", nullptr, nullptr, nullptr, @@ -12218,6 +12383,7 @@ namespace vl::presentation::remoteprotocol L":", L";", L",", + L"?", nullptr, }; vl::vint index = (vl::vint)token; @@ -12241,9 +12407,10 @@ namespace vl::presentation::remoteprotocol L"string", L"char", L"key", - L"(::[a-zA-Z_][a-zA-Z0-9<>]*){1,}", - L"@[a-zA-Z_][a-zA-Z0-9]*", - L"[a-zA-Z_][a-zA-Z0-9]*", + L"color", + L"(::[a-zA-Z_][a-zA-Z_0-9<>]*){1,}", + L"@[a-zA-Z_][a-zA-Z_0-9]*", + L"[a-zA-Z_][a-zA-Z_0-9]*", L"/{", L"/}", L"/[", @@ -12253,6 +12420,7 @@ namespace vl::presentation::remoteprotocol L":", L";", L",", + L"/?", L"/s+", }; vl::vint index = (vl::vint)token; @@ -12261,19 +12429,19 @@ namespace vl::presentation::remoteprotocol void GuiRemoteProtocolLexerData(vl::stream::IStream& outputStream) { - static const vl::vint dataLength = 1555; // 16760 bytes before compressing + static const vl::vint dataLength = 1604; // 18064 bytes before compressing static const vl::vint dataBlock = 256; - static const vl::vint dataRemain = 19; + static const vl::vint dataRemain = 68; static const vl::vint dataSolidRows = 6; static const vl::vint dataRows = 7; static const char* compressed[] = { - "\x78\x41\x00\x00\x0B\x06\x00\x00\x59\x00\x01\xAD\x01\x84\x81\x80\x16\x82\x09\x08\x84\x8A\x0B\x84\x81\x06\x87\x04\xA0\x11\x84\x88\x14\x88\x83\x14\x17\x84\x87\x86\x84\x80\x18\x83\x1C\x04\xBA\x21\x84\x8B\x1C\x90\x82\x1E\x27\x84\xBE\x0A\x94\x80\x21\x96\x82\x41\x04\x9A\x24\x8B\x2C\x98\x83\x2E\x37\x84\x9F\x3A\x94\x81\x31\x9E\x82\x62\x40\x84\x83\x33\xA4\x80\x32\xA3\x04\xE5\x09\xA4\x86\x34\xA4\x83\x33\x4F\x84\xA8\x32\xA4\x81\x35\xAA\x82\x6A\x58\x84\x8B\x3B\xAC\x80\x36\xAF\x04\xED\x21\xA4\x8E\x34\xB0\x83\x37\x67\x84\xB0\x2A\xB4\x81\x39\xB6\x82\x72\x70\x84\x93\x33\xBC\x80\x3A\xBB\x04\xF5\x39\xA4\x86\x3C\xBC\x83\x3B\x04\xF8\x04\x99\x33\xC4\x82\x3C\xC3\x04\xFB\x09\xC4\x8D\x3C\xC4\x83\x0B\x8F\x91\xC1\x90\xC1\x83\x08\x82\x0A\x04\x96\x04\x9F\x7C\xCF\x7C\x06\x82\x15\x1B\xDD\xC3\xDF\x81\x82\x06\x82\x11\x04\x92\x04\x87\xD6\xD0\x82\x03\x0D\x81\x89\x81\x82\x04\x80\x04\xD6\xB8\x81\x87\x19\xD0\x03\x04\xDE\x02\xBC\xAD\xC0\x02\xE2\xE5\x00\x83\x01\xC1\x84\x81\x09\xEE\xD1\x83\x06\x82\x10\x22\xE3\xD3\xE4\xED\xEA\xEB\x0C\xD2\xD6\xDA\xF8", - "\xE1\x82\xED\xCE\x0C\x04\xDC\xC0\x02\xF4\xF1\xF2\xF3\x80\xE5\xE8\xE7\xE3\xFB\xF1\xF4\xF6\xF5\xF0\xEF\xF2\xEE\xF4\xF9\xEE\xEF\xFB\xF8\x9D\xE2\xF9\xF5\xEB\xFF\xFB\xFA\xF1\x40\x83\x7D\x7B\x04\x81\x4A\x05\x81\x03\x81\x8B\x7B\x06\x08\xBE\x7C\x7F\x83\xDB\x76\x7F\x82\x83\x11\x8A\x86\x85\x82\x18\x82\x8A\x85\x83\x04\x5C\x0C\x87\x85\x10\xA1\x8D\x7E\x84\xFC\x54\x87\x77\x87\x00\x1D\x08\x8B\x86\x17\xAC\x89\x87\x8A\x24\xA2\x83\x85\x8C\xF8\x66\x83\x89\x8B\x04\x5E\x00\x8C\x8E\x3C\xAF\x8D\x8E\x8B\x32\x81\x9F\x3E\x8D\x25\xB4\x8A\x7F\x8E\x3E\x89\x92\x83\x07\x48\xAE\x8E\x7A\x90\x32\x84\x99\x7E\x94\xA3\x4E\x9D\x90\x8A\x12\x7F\x87\x94\x88\x50\xA1\x84\x97\x7F\x46\x9C\x66\x96\x96\x17\xA1\x0B\x96\x92\x48\x9D\x9E\x95\x98\x15\x80\x05\x8F\x99\x63\x89\x92\x08\x9C\x69\xAA\x93\x8D\x77\x51\xAC\x91\x9E\x7B\x23\x34\x94\x98\x9A\x3D\xB6\x97\x9E\x9B\x79\xB8\x9E\x76\x8B\x24\x3E\x90\xA3\xA2\x7B\xAC\x92\xA0\x75\x25\x0E\xAF\xA3\xA4\x94\x95\xA6\xA7\xA5\xD4\x66\x01\x8E\xA6\x01\x5C\xA0\x02\xA7\xA0\x84\x41\xA9\xA7\xA2\xA5\xA4\xAB\xA9\x9F\xA6\xA9\xA8\xAA", - "\xA3\xAB\xAE\xA9\xAB\xB0\xAA\xA8\xA7\x8D\x84\xA2\x8F\x96\x98\x8A\x8D\xAF\x9E\xAE\x18\xB3\xAE\xAF\xAF\xC0\x81\xB2\xB3\xB0\xC4\x85\xB6\xB3\xB1\xC8\x89\xBA\xB3\xB2\xCC\x8D\xBE\xB3\xB3\xD0\x91\xB2\xB7\xB4\xD4\x95\xB6\xB7\xB5\xD8\x99\xB7\xB7\x09\x04\x5C\xB1\x42\xB7\x00\x20\xBA\xB7\xB8\xE4\xB7\xAD\x9B\x9B\xBB\xB9\xA8\x91\x45\xE9\x9C\x91\xB2\xB9\x27\x86\xAD\x98\xAF\xF4\xAA\xBF\x9F\xB0\xF0\xB4\xA8\xB8\xA3\xF6\xBC\xB7\x84\x46\xF7\x82\xB9\xBC\x75\xE6\xAE\x8A\x09\xBF\xF5\xAD\xB2\x7C\xBE\x92\x84\xCA\x9C\xC2\x10\xC1\x4B\x09\xBF\x0C\xF2\xB0\x85\xC1\x11\xFE\xBB\xA3\x46\x1A\xC3\xC6\x9E\xC7\x55\x8F\xCA\xC1\xC2\x49\x83\x41\x7E\x0B\x8A\x95\xC5\xAF\x9A\x16\xF4\xA4\xC8\xAF\x2F\x19\xCF\x92\xC0\x0D\xD3\x78\xC7\xC8\x32\xE8\x8E\x46\xC2\x2A\xC1\x97\xCD\xC7\xFD\xB1\x09\xCD\x7C\x3D\xC5\xAB\xC9\xBC\x40\xF8\xCA\xD2\x7C\x32\x35\x9F\xB9\xCD\x21\xED\xC4\x77\x0C\x43\xC9\xD6\xD6\x80\x45\xF6\xA2\xCB\xD5\x55\xFC\xA4\x0F\x7A\xE3\xB5\x01\x8E\xD8\x01\x64\xD0\x02\xD9\x68\xC4\x49\xD9\xD9\x6A\xED\xDC\xDB\xDB\x67\xEE\xD1\xDC\xDC\x6B\xF3\xD6\xDD\xDD\x78", - "\xF2\xD3\xB2\x0D\x50\xDD\x6C\xDE\xD4\xD3\x7F\xD0\x02\xE0\x84\xC4\x45\xE1\x40\x87\xC3\xE6\xE3\xE2\x88\xCC\xEA\xE1\xE3\x90\xCF\xE2\xE5\xE2\x94\xCE\xE2\xE0\x7E\xE0\x99\xED\xB5\xDF\xE4\x9D\xE6\xB0\xC8\x47\x80\xE1\xD4\xD7\x4B\xEF\xC8\x89\xD6\x2C\xC7\xDE\xC9\xD7\x04\x77\x0C\xEA\xBB\xC0\xA0\xE8\xAE\xE8\xA1\xE4\xEA\xC4\x0E\xAF\xCB\xC4\xCC\xED\x87\x9B\xD4\xCA\x48\xA5\xC8\x90\x49\xC0\x4F\xFC\xE7\xB8\x98\xC1\xC9\xF9\x91\x49\x4B\xE8\xE7\xC6\xEF\xB9\xE6\xE1\x40\x4A\xC4\xF1\xEC\xE7\x90\xD0\xCA\xFC\xAD\x0F\x55\xCE\xF3\xA3\xBE\xD2\xD8\x8B\x4A\xF6\x67\x9E\xF5\x92\xF1\xE1\xE9\xF9\xC6\xF9\x53\xAC\x9F\x0D\xF4\xF0\xF0\xEF\xAE\xEC\xD8\xE8\xFF\x48\xF9\xF8\xF6\xEC\xFB\xBE\xE0\xF1\xFB\xA1\x4C\xCA\x7B\x7C\xF2\x2A\x7E\x61\xFC\x6A\x79\x80\xC2\x42\x08\x41\x43\x09\x3A\x05\x81\x26\x81\x2B\x70\x80\x7E\x10\x84\x82\x82\x15\x87\x81\x16\x99\x80\x06\x9B\x80\x01\x0B\x9D\x82\x83\x1F\x9C\x82\x07\xA3\x80\x84\x12\x86\x7B\x52\x97\x72\x45\x0A\xDE\x35\x73\xC8\x6D\x83\x72\x96\x71\x86\x0B\xB2\x80\x87\x19\xB6\x85\x86\x04\x98\x50\xFD\x3F\x67\x80\xDB\x61\x7A", - "\x80\xBD\x76\x7E\x01\xD5\x64\x09\xF2\x7B\x71\x87\xFC\x63\x82\x78\x45\x0E\x7F\x1E\xB3\x65\x78\x48\x83\x81\xFF\x43\x87\x42\x23\x3E\x78\x88\xC7\x7E\x3B\x11\x4D\x8C\x8B\x13\x8F\x53\x87\xD9\x78\x40\x12\x5D\x8E\x87\xEB\x7E\x67\x7A\x3C\x84\x8D\x12\x39\x78\x8A\xA4\x53\x8D\x8C\x54\x96\x69\x1B\xFA\x5A\x88\x32\xB1\x4A\x09\x46\x90\x8B\x19\xC2\x80\x8E\x0C\x4B\x0E\x8E\x66\x86\x6B\x1E\xD1\x83\x77\x3E\x8E\x89\x65\x09\x8B\x81\x03\xA0\x83\x34\x09\xB7\x3E\x84\x21\x91\x90\x24\x93\x95\x85\x4A\xA2\x86\x92\x92\x98\x92\x23\xC5\x5C\x09\x40\x9E\x77\x93\xDF\x62\x91\x1D\xF1\x87\x91\xEA\x73\x78\x8D\x61\x85\x96\xED\x4D\x09\x8E\xEB\x5E\x8D\x80\x84\x95\x7E\xC6\x4E\x00\x90\x9E\x47\x8B\x90\x6F\x8E\x47\x13\x35\x9A\x63\x39\xB0\x91\x97\xBC\x8E\x3C\x14\x08\x9A\x8E\x51\x81\x8E\x90\x28\x51\x0B\x15\xB7\x96\x99\x79\x41\x9D\x7B\xCC\x9A\x68\x1F\x82\x42\x0B\x67\x8D\x7A\x5B\x53\x11\x45\x36\x81\x2B\x9A\x00\x1D\x9F\x9B\x04\x20\x9C\x37\xE1\x94\x9D\x71\xA6\x9E\x9B\xE5\x88\x9F\x39\xE2\x9A\x9D\x76\xAC\x9F\x9D\xE9\x9E\x96\xCD\x29\x96\x9B\x3E\xB2\x9B\x74\xC0\x84", - "\x94\x19\xF7\x95\x77\x7C\xB2\x3C\x0A\xF5\x9C\x54\x3F\x85\x9E\x9E\x55\xBC\x55\x0A\xAD\x87\x97\x2B\xF3\x93\x9B\x80\xAB\x3E\x0A\xC4\x8E\x95\x2C\xEE\x83\x94\x64\xBA\x9E\x94\xBE\x57\x0A\x22\xF2\x5A\xA3\x80\x1D\xA3\x65\x1F\xB8\x3F\x47\xA3\xA4\x20\x92\x9E\xA5\xA4\x28\xA7\xA6\x4A\x80\x06\xA4\x96\xA9\xA6\xA5\x2B\xAD\xA6\x4C\xAF\xA3\xA7\x85\xAA\x48\x8C\x0D\xB7\xA2\x45\x8B\x53\xA0\x59\x85\xA6\xA1\xD7\x85\x9A\x34\xB1\x9E\x44\x2C\x00\xAD\x97\xC2\x5F\xA0\x03\x9C\xAF\xA5\xD1\x21\xA7\x3E\x35\xB0\xA6\x54\xD1\xA4\xAA\x9A\x96\xA9\xA6\x57\xB3\xA9\x56\xCF\xA2\xA9\xD4\x7F\xA2\xA7\x06\xAC\x4E\x3F\x5F\x1C\x32\xB2\x9C\x37\x1E\xEF\x1F\x1D\x00\x00\x25\x21\x80\x11\x3E\xAD\xD0\x31\xAC\x5C\xF3\xA0\x01\xB7\xB5\xAA\xAE\x77\xB4\xAC\x65\x00\x0C\x40\xBA\xA9\x31\x20\xAB\x35\x33\x65\x20\x39\x32\x82\x20\x39\x3E\x07\x54\xAE\x5D\x8B\xB8\xAE\xC6\x8A\xB5\xB1\x90\xA1\x21\x5F\x80\x0F\x38\x03\x6D\xAF\xB1\x98\xB9\xAE\x66\xF6\xA7\x37\xCC\xB6\xAD\x34\xC3\x24\x21\x65\x80\x0B\x38\xCF\x91\xB2\xB3\xBB\x39\xB3\x67\x4D\x3C\xAF\xD7\x27\xB6\xB1\x9A\xB3\x36\x66\x93", - "\xB5\x37\x80\x3E\x36\xB4\x01\x2C\x20\x6B\xC8\x31\x20\xE0\x34\xAD\x38\x04\x20", + "\x90\x46\x00\x00\x3C\x06\x00\x00\x5E\x00\x01\xAE\x01\x84\x81\x81\x16\x82\x09\x08\x84\x8A\x0B\x84\x81\x06\x87\x04\xA0\x11\x84\x88\x14\x88\x83\x14\x17\x84\xAC\x1A\x84\x80\x18\x83\x1C\x04\xBA\x21\x84\x8B\x1C\x90\x82\x1E\x27\x84\xBE\x0A\x94\x87\x1D\x96\x82\x40\x30\x84\x81\x24\x82\x2C\x83\x2D\x37\x84\x9D\x3A\x94\x87\x2D\x9E\x82\x61\x40\x84\x82\x33\xA4\x83\x30\xA3\x04\xE4\x09\xA4\x85\x34\xA4\x82\x33\x4F\x84\xA7\x32\xA4\x80\x35\xAA\x82\x69\x58\x84\x8A\x3B\xAC\x83\x34\xAF\x04\xEC\x21\xA4\x8D\x34\xB0\x82\x37\x67\x84\xAF\x2A\xB4\x80\x39\xB6\x82\x71\x70\x84\x92\x33\xBC\x83\x38\xBB\x04\xF4\x39\xA4\x85\x3C\xBC\x82\x3B\x7F\x84\xB7\x24\x88\x3C\x81\x3C\xC3\x04\xFA\x09\xC4\x8B\x3C\xC4\x83\x3E\x8F\x84\x98\x12\xC4\xC9\x83\xC9\x80\x13\x04\x94\x04\x86\x0C\x83\x7F\xCF\xFF\x0C\x04\x95\x0E\xC8\xD2\xD3\x0B\x10\x81\x8E\x04\x81\x0C\x82\x08\x82\xAB\xAA\xC4\x86\x0D\x81\x81\x85\x80\x02\x04\x88\x10\xDC\xD9\x83\x03\xDE\x00\x0B\x00\xE4\x00\xE1\xD8\x00\xE3\xC6\x85\x04\x83\x05\xE4\x81\x01\xE6\xB2\x81\x8F\x04\x80\x0D\xD2\xD3\xEB\xD8\xD9\xDA\xFA", + "\x06\xEA\xEE\xEE\xD3\xDC\x81\x9B\xE4\x89\x0C\x81\xF0\x00\xE7\xE9\xE6\xEB\xF1\x82\xF5\xF6\xF6\xE8\xF0\xEE\xF1\xFF\xF5\xF8\xFB\xFB\xF3\xF9\xDD\xFF\xEC\xFD\xFC\xD1\xF3\xFE\x7C\x70\x81\x76\xFA\x76\x75\x80\x7E\xF2\x49\x86\x7F\x06\x0A\x88\x86\x80\x7C\x1C\x0D\x83\x81\x80\x14\x9E\x73\x85\x85\xD7\x57\x80\x7A\x84\x1C\x8F\x8E\x86\x83\x20\x87\x83\x7D\x07\x1D\xA0\x88\x87\x89\x19\xBB\x78\x8A\x86\xFF\x65\x87\x7A\x07\x2E\xB1\x8F\x86\x88\x32\xA6\x88\x8B\x8D\x2C\xA7\x89\x8F\x3F\x34\xB6\x7F\x05\x8D\x3D\xA1\x80\x91\x8D\x37\xB8\x8A\x8A\x8E\x47\xBC\x83\x93\x8C\x4B\xB7\x72\x44\x93\x50\x82\x96\x7D\x91\x2B\x89\x95\x87\x8E\x41\x99\x9D\x91\x08\x4D\x9A\x93\x94\x95\x18\xBB\x87\x95\x92\x5E\x92\x96\x9B\x79\x22\x1D\x9A\x9B\x97\x60\x94\x82\x9A\x9B\x64\xAB\x97\x99\x8D\x23\x32\x91\x91\x9B\x63\xA2\x70\x98\x96\x76\x84\x44\x0A\x9C\x25\x3D\x91\x94\x9E\x70\xBA\x94\x94\x9F\x51\xA7\x76\x0A\xA0\x73\x89\xAD\x90\xA1\x27\xA7\x06\x94\xA4\x94\x95\xA6\xA7\xA5\x98\xA7\x85\x46\xA1\xD7\x5B\xA0\x02\xA7\xA0\x96\x41\x41\xA8\xA3\xA2\xAF\xA6\xA9\xA4\xA7\xA5\xAB\xAA", + "\xAA\xAD\xA9\xAB\xAB\xA8\xA6\xA9\xA4\x81\x93\x81\x88\xA1\xA3\xB8\xA5\x9A\xAE\x9C\xB3\xBD\xAE\xAF\xAF\xC0\x81\xB2\xB3\xB0\xC4\x85\xB6\xB3\xB1\xC8\x89\xBA\xB3\xB2\xCC\x8D\xBE\xB3\xB3\xD0\x91\xB2\xB7\xB4\xD4\x95\xB6\xB7\xB5\xD8\x99\xBA\xB7\xB6\xDC\xA7\x88\x45\x40\xDF\x80\x01\xB9\xB8\xDD\xA5\xB7\xB7\x9B\xB6\xB1\x9E\xA3\xBA\xB9\xB5\x8A\x08\xA3\xC2\xA8\xBE\x7F\xAD\xBB\xAC\xB5\xBD\xBB\xEC\xB1\xB5\xAF\xBC\xEA\xB8\xBE\xBF\xBD\x41\xAB\x04\x91\xB0\xF2\xBD\x74\xBD\x89\x1B\x76\xBC\xA0\xC0\xF0\x7A\xBC\xA6\x91\x0F\xED\x8A\xC3\xC4\xFF\xB0\x77\x40\xC5\xF3\x4E\xC0\x01\x9B\x07\xD8\xCB\xC1\x89\x03\x5E\xC1\xC7\xAC\x05\xC2\x8D\xBC\xC3\x22\xE6\x9F\x08\x7C\x1E\x69\xCA\xC4\xC7\x27\xDF\xC4\xC5\x0C\x32\xF6\x80\xB1\xC9\xDF\x5D\xC5\xC5\xCA\xF7\xB2\x0F\xA0\xC1\xFB\x86\xC1\xCC\xCF\x72\xB3\x05\xCD\xC6\x40\xE3\xC1\x9B\xD0\x3B\xCD\xD8\xC8\x00\x34\x03\xC7\xCD\xD0\x26\xCA\xD7\x79\x0D\x47\xD9\xDE\xC9\xD2\x1B\xFB\x9C\xD3\xD3\x07\xB6\x0A\xD4\xAE\x2F\xDE\xD6\xD7\xD8\x60\xF2\x97\x0D\xC3\xDD\xB8\x09\x92\xDB\x01\x70\xD0\x02\xDC\x74\xC4\x45\xDD\xDC\x76", + "\xF9\xD8\xDF\xDE\x73\xFA\xDD\xDC\xDF\x77\xFF\xD2\xE1\xE0\x84\xFE\xD2\xB0\x48\x4A\xD5\x88\xE1\xD7\xD8\x4B\xEE\xE3\x47\x90\xC1\x4F\xE2\xE4\x91\xC0\x03\xE6\xE5\x95\xD7\xEA\xE5\xE6\x9C\xD4\xEE\xE4\xE6\x9F\xFD\x73\xB9\x46\xE0\x94\xD6\xBB\xE9\xC5\xB8\xC6\x87\xD7\x68\xED\xE3\xA0\xD7\x30\xE7\xD4\xD0\xC5\x22\x73\xEE\xBD\xD9\x87\xAC\xE6\xED\x90\x25\x7B\xE5\x88\xEE\x45\xBA\xCF\xD1\x0F\xAE\xF7\x78\x49\xBE\xB0\xE6\xDC\xE1\x8A\xBE\xCD\xF0\x8B\x4A\x5B\xD3\xD9\xE1\xA1\xCB\xDB\x8E\xF1\xDA\xEC\xAE\x48\xF2\xF4\xD5\xD5\x92\xEE\xD3\x35\xF1\x47\xF6\xE9\x78\xAA\xE3\x7B\xF7\xD8\xE6\x94\x4F\xF8\xDB\xFF\xA6\xF8\xAD\xE8\xC5\xF9\xFB\xBD\xC0\xD0\xCD\xF7\x67\xE7\x42\x12\xFF\xFE\x1F\xB5\xFE\xF7\xFD\x4A\x56\x3F\x10\x7C\x70\x7C\x8A\x7E\x78\x49\xF1\x6C\x7D\x01\x80\x04\x08\x78\x49\x79\x77\x09\x8B\x83\xBD\x45\x05\x79\x03\x8B\x69\x82\xF3\x64\x83\x9D\x41\x56\x08\x82\x07\x0D\x3B\x1D\x81\x21\x08\x80\x83\x84\xED\x23\x87\x84\x04\x28\x86\x08\xA9\x8C\x85\x15\xAE\x80\x00\x2A\x90\x85\x0B\xB2\x8F\x85\x18\xB6\x83\x86\x37\x8F\x87\xE1\x64\x7A\x3B\xC5\x7D\x85", + "\x73\xA0\x61\x8B\xE6\x1F\x73\x88\x21\x80\x8D\x88\x48\x87\x88\x0F\xCA\x71\x76\x00\x99\x82\x81\xE9\x76\x81\x9E\x4E\x8A\x82\x46\x48\x0F\x67\xDC\x6D\x8B\xF9\x20\x49\x09\x2A\x90\x8B\x89\x10\x80\x83\x14\xDB\x8F\x88\x5C\x4A\x0C\x80\x52\x94\x7B\x16\xCB\x0E\x8A\x09\x92\x6E\x7D\x60\x8C\x78\x15\xEC\x5C\x09\x36\x91\x8F\x81\xC1\x7A\x76\x1B\xEC\x5D\x09\x0A\xB8\x8E\x7E\x64\x96\x8C\x1A\xFF\x8F\x7F\x40\x9F\x8E\x79\x4E\x18\x88\x1C\xD3\x79\x5C\x0C\xA3\x6F\x09\x82\x8C\x91\xA5\x6F\x78\x3A\xE1\x51\x93\x8F\x36\x6B\x92\x18\xEA\x80\x7E\x4C\xA5\x88\x0A\x0E\x80\x5B\x08\x9F\x8C\x53\x18\xA6\x81\x49\x39\x94\x86\x2A\xA9\x9C\x94\x1C\xAE\x95\x86\xAF\x8B\x95\x2C\xA6\x95\x59\x28\x31\x88\x75\xB8\x9C\x5E\x24\xC2\x6E\x91\x43\x9E\x97\x8D\xBE\x54\x92\x1C\x86\x9F\x96\x05\x92\x0A\x91\xC1\x97\x96\xC4\x73\x8D\x69\x29\x17\x95\x4C\x69\x8D\x90\x33\xF7\x54\x0B\x67\x80\x9D\x57\xC2\x96\x7B\x34\xD6\x91\x4B\x2A\x3C\x54\x90\x08\x9B\x9A\x2F\xF3\x36\x0B\x41\x99\x8C\x89\x9D\x85\x8E\x3A\xDF\x97\x9D\x30\x84\x9F\x40\x57\x1C\x99\xD3\x51\x9A\x96\x71\x85\x9F\x9E\xF4\x7D", + "\x58\x16\x49\x4B\x9F\x80\x3D\x98\x00\xFF\x81\xA0\x41\x02\xAE\x9F\x81\x86\xA5\xA0\x08\xA0\xA3\x41\x8A\xA9\xA0\x82\x8C\xA7\xA1\x0E\xB1\xA3\x42\xF4\x9C\x96\x7B\xAB\x9B\x9C\xBF\x60\x9F\x05\x96\xA2\x9F\x32\x94\xA5\x6A\x1C\xBF\x41\x16\x1D\xA8\x98\x6C\x8A\x98\x7F\x7A\x97\xA3\x02\xB6\x26\x80\x8D\xA3\x89\x9D\x24\xBF\x40\x4E\x51\x7A\x92\x2D\xB0\xA0\xA3\x38\xB9\x92\xAF\x5C\x0E\x83\xEE\x3C\xA1\x20\x3F\xA0\x81\x50\xDA\x31\xA9\xA2\x84\x26\xA8\x40\xA7\xAA\x52\xC9\xAC\xA8\x00\x08\xAE\xA9\x4B\xB0\xA9\x53\xCF\xA4\xAB\xA8\x95\xAD\xA9\x1F\xB9\x65\x4A\xB1\xAB\x81\xAC\xAB\x75\x97\xF8\x97\x92\x57\xDB\x8F\x9D\x06\x7B\x21\xA7\x1E\xA1\x59\x50\xA4\x9B\x79\xA7\x84\xA9\x49\x57\xB2\xAA\x5C\xF1\xA4\xAE\xAB\xB6\xAB\xAA\x77\xB3\xAD\x5E\xEE\xAE\xA4\x4E\x95\x94\xAB\x2A\xBD\x3E\x3F\x5F\x1F\x33\x3F\x20\x36\xB0\xFD\x1F\x04\x40\x05\x21\x21\xD6\x0D\xB4\x35\x90\xAF\xB2\x64\x80\x0E\xB0\xCA\x91\xB6\xB2\x93\xB7\x30\x00\x24\x43\xB3\xD7\x18\x32\x33\xA3\x3C\x30\x41\x28\x31\x21\xF2\x0B\x44\x20\x11\x53\xB1\x65\xAB\xB7\xB2\xD6\xAA\xB5\xB5\xB0\xB3\xB0\x67\x80", + "\x05\x3B\x80\x29\xB4\xB1\xAE\xB8\xB2\x6E\xB9\xB5\xB3\xDD\x2F\xB7\xB7\x00\x0F\x22\x74\x54\x3E\x39\xD8\xBB\xB6\xB8\xBF\x20\xBA\x68\x13\xB3\x3B\x80\x33\xB4\x36\xC0\xBC\xB6\x42\x13\xB6\x39\xD9\xB9\x31\x20\xC2\x31\xB9\x6D\x00\x0D\xB8\x00\x0C\x39\x20\xC4\x2C\xB8\x41\x4A\x31\x20", }; vl::glr::DecompressSerializedData(compressed, true, dataSolidRows, dataRows, dataBlock, dataRemain, outputStream); } diff --git a/Import/GacUICompiler.h b/Import/GacUICompiler.h index fd3386e5..1e5d2f3a 100644 --- a/Import/GacUICompiler.h +++ b/Import/GacUICompiler.h @@ -1082,6 +1082,7 @@ namespace vl::presentation::remoteprotocol class GuiRpMessageDecl; class GuiRpMessageRequest; class GuiRpMessageResponse; + class GuiRpOptionalType; class GuiRpPrimitiveType; class GuiRpReferenceType; class GuiRpSchema; @@ -1099,6 +1100,7 @@ namespace vl::presentation::remoteprotocol String = 4, Char = 5, Key = 6, + Color = 7, }; class GuiRpType abstract : public vl::glr::ParsingAstBase, vl::reflection::Description @@ -1109,6 +1111,7 @@ namespace vl::presentation::remoteprotocol public: virtual void Visit(GuiRpPrimitiveType* node) = 0; virtual void Visit(GuiRpReferenceType* node) = 0; + virtual void Visit(GuiRpOptionalType* node) = 0; virtual void Visit(GuiRpArrayType* node) = 0; }; @@ -1132,6 +1135,14 @@ namespace vl::presentation::remoteprotocol void Accept(GuiRpType::IVisitor* visitor) override; }; + class GuiRpOptionalType : public GuiRpType, vl::reflection::Description + { + public: + vl::Ptr element; + + void Accept(GuiRpType::IVisitor* visitor) override; + }; + class GuiRpArrayType : public GuiRpType, vl::reflection::Description { public: @@ -1243,6 +1254,7 @@ namespace vl::reflection::description DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveTypes) DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpPrimitiveType) DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpReferenceType) + DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpOptionalType) DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpArrayType) DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpAttribute) DECL_TYPE_INFO(vl::presentation::remoteprotocol::GuiRpDeclaration) @@ -1271,6 +1283,11 @@ namespace vl::reflection::description INVOKE_INTERFACE_PROXY(Visit, node); } + void Visit(vl::presentation::remoteprotocol::GuiRpOptionalType* node) override + { + INVOKE_INTERFACE_PROXY(Visit, node); + } + void Visit(vl::presentation::remoteprotocol::GuiRpArrayType* node) override { INVOKE_INTERFACE_PROXY(Visit, node); @@ -1341,6 +1358,7 @@ namespace vl::presentation::remoteprotocol::json_visitor virtual void PrintFields(GuiRpMessageDecl* node); virtual void PrintFields(GuiRpMessageRequest* node); virtual void PrintFields(GuiRpMessageResponse* node); + virtual void PrintFields(GuiRpOptionalType* node); virtual void PrintFields(GuiRpPrimitiveType* node); virtual void PrintFields(GuiRpReferenceType* node); virtual void PrintFields(GuiRpSchema* node); @@ -1351,6 +1369,7 @@ namespace vl::presentation::remoteprotocol::json_visitor protected: void Visit(GuiRpPrimitiveType* node) override; void Visit(GuiRpReferenceType* node) override; + void Visit(GuiRpOptionalType* node) override; void Visit(GuiRpArrayType* node) override; void Visit(GuiRpEnumDecl* node) override; @@ -1401,12 +1420,13 @@ namespace vl::presentation::remoteprotocol MessageDecl = 7, MessageRequest = 8, MessageResponse = 9, - PrimitiveType = 10, - ReferenceType = 11, - Schema = 12, - StructDecl = 13, - StructMember = 14, - Type = 15, + OptionalType = 10, + PrimitiveType = 11, + ReferenceType = 12, + Schema = 13, + StructDecl = 14, + StructMember = 15, + Type = 16, }; enum class GuiRemoteProtocolFields : vl::vint32_t @@ -1424,12 +1444,13 @@ namespace vl::presentation::remoteprotocol MessageDecl_response = 10, MessageRequest_type = 11, MessageResponse_type = 12, - PrimitiveType_type = 13, - ReferenceType_name = 14, - Schema_declarations = 15, - StructDecl_members = 16, - StructMember_name = 17, - StructMember_type = 18, + OptionalType_element = 13, + PrimitiveType_type = 14, + ReferenceType_name = 15, + Schema_declarations = 16, + StructDecl_members = 17, + StructMember_name = 18, + StructMember_type = 19, }; extern const wchar_t* GuiRemoteProtocolTypeName(GuiRemoteProtocolClasses type); @@ -1480,22 +1501,24 @@ namespace vl::presentation::remoteprotocol STRING = 11, CHAR = 12, KEY = 13, - CPP_NAME = 14, - ATT_NAME = 15, - NAME = 16, - OPEN_BRACE = 17, - CLOSE_BRACE = 18, - OPEN_ARRAY = 19, - CLOSE_ARRAY = 20, - OPEN = 21, - CLOSE = 22, - COLON = 23, - SEMICOLON = 24, - COMMA = 25, - SPACE = 26, + COLOR = 14, + CPP_NAME = 15, + ATT_NAME = 16, + NAME = 17, + OPEN_BRACE = 18, + CLOSE_BRACE = 19, + OPEN_ARRAY = 20, + CLOSE_ARRAY = 21, + OPEN = 22, + CLOSE = 23, + COLON = 24, + SEMICOLON = 25, + COMMA = 26, + QUESTION = 27, + SPACE = 28, }; - constexpr vl::vint GuiRemoteProtocolTokenCount = 27; + constexpr vl::vint GuiRemoteProtocolTokenCount = 29; extern bool GuiRemoteProtocolTokenDeleter(vl::vint token); extern const wchar_t* GuiRemoteProtocolTokenId(GuiRemoteProtocolTokens token); extern const wchar_t* GuiRemoteProtocolTokenDisplayText(GuiRemoteProtocolTokens token); @@ -1522,20 +1545,20 @@ namespace vl::presentation::remoteprotocol enum class ParserStates { RType = 0, - RAttributeParameter = 13, - RAttribute = 16, - REnumMember = 24, - REnum = 28, - RStructMember = 35, - RStruct = 42, - RMessageRequest = 49, - RMessageResponse = 55, - RMessage = 61, - REventRequest = 69, - REvent = 75, - RDeclDetail = 82, - RDecl = 88, - Schema = 92, + RAttributeParameter = 16, + RAttribute = 19, + REnumMember = 27, + REnum = 31, + RStructMember = 38, + RStruct = 45, + RMessageRequest = 52, + RMessageResponse = 58, + RMessage = 64, + REventRequest = 72, + REvent = 78, + RDeclDetail = 85, + RDecl = 91, + Schema = 95, }; const wchar_t* ParserRuleName(vl::vint index); @@ -1584,6 +1607,7 @@ namespace vl::presentation struct GuiRpSymbols { collections::Dictionary cppMapping; + collections::Dictionary cppNamespaces; collections::SortedList dropRepeatDeclNames; collections::SortedList dropConsecutiveDeclNames; collections::Dictionary enumDecls; diff --git a/Import/GacUIReflection.cpp b/Import/GacUIReflection.cpp index 2990a8da..135d7f56 100644 --- a/Import/GacUIReflection.cpp +++ b/Import/GacUIReflection.cpp @@ -1316,6 +1316,7 @@ Type Declaration (Class) CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedControl) CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedControlHost) CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedCursor) + CLASS_MEMBER_PROPERTY_READONLY_FAST(RelatedHitTestResult) CLASS_MEMBER_PROPERTY_FAST(InternalMargin) CLASS_MEMBER_PROPERTY_FAST(PreferredMinSize) @@ -1327,7 +1328,7 @@ Type Declaration (Class) CLASS_MEMBER_METHOD(RemoveChild, {L"child"}) CLASS_MEMBER_METHOD(MoveChild, {L"child" _ L"newIndex"}) CLASS_MEMBER_METHOD(Render, {L"size"}) - CLASS_MEMBER_METHOD(FindComposition, {L"location" _ L"forMouseEvent"}) + CLASS_MEMBER_METHOD(FindVisibleComposition, {L"location" _ L"forMouseEvent"}) CLASS_MEMBER_GUIEVENT(CachedMinSizeChanged) CLASS_MEMBER_GUIEVENT(CachedBoundsChanged) diff --git a/Import/Vlpp.h b/Import/Vlpp.h index 631e7734..16ff00c8 100644 --- a/Import/Vlpp.h +++ b/Import/Vlpp.h @@ -190,6 +190,21 @@ Basic Types if(bool __scope_variable_flag__=true)\ for(TYPE VARIABLE = VALUE;__scope_variable_flag__;__scope_variable_flag__=false) + /// + /// Base type of all classes. + /// This type has a virtual destructor, making all derived classes destructors virtual. + /// In this way an object is allowed to be deleted using a pointer of a qualified base type pointing to this object. + /// + class Object + { + public: + virtual ~Object() = default; + }; + +/*********************************************************************** +Type Traits +***********************************************************************/ + template struct TypeTuple { @@ -219,28 +234,6 @@ Basic Types template struct RemoveCVRefArrayCtad { using Type = T*; }; - /// - /// Base type of all classes. - /// This type has a virtual destructor, making all derived classes destructors virtual. - /// In this way an object is allowed to be deleted using a pointer of a qualified base type pointing to this object. - /// - class Object - { - public: - virtual ~Object() = default; - }; - - template - union BinaryRetriver - { - T t; - char binary[sizeof(T) > minSize ? sizeof(T) : minSize]; - }; - -/*********************************************************************** -Type Traits -***********************************************************************/ - /// Type for specify and create a representative value for comparing another value of a specific type for containers. /// The element type for containers. template @@ -741,7 +734,7 @@ namespace vl { Reset(); } - else + else if (this != &nullable) { if constexpr (std::is_copy_assignable_v) { @@ -768,7 +761,7 @@ namespace vl { Reset(); } - else + else if (this != &nullable) { if constexpr (std::is_move_assignable_v) { @@ -5163,6 +5156,7 @@ vl::Func /// Type of the functor to copy. /// The functor to copy. It could be a lambda expression, or any types that has operator() members. template + requires(!std::is_same_v, Func>) Func(C&& function) requires ( std::is_invocable_v @@ -6044,6 +6038,525 @@ Range-Based For-Loop Iterator with Index #endif +/*********************************************************************** +.\PRIMITIVES\VARIANT.H +***********************************************************************/ +/*********************************************************************** +Author: Zihan Chen (vczh) +Licensed under https://github.com/vczh-libraries/License +***********************************************************************/ + +#ifndef VCZH_VARIANT +#define VCZH_VARIANT + + +#ifdef VCZH_CHECK_MEMORY_LEAKS_NEW +#undef new +#endif + +namespace vl +{ + template + struct VariantIndex + { + static constexpr vint value = I; + }; + + template + struct Overloading : TCallbacks ... + { + using TCallbacks::operator()...; + }; + + template + Overloading(TCallbacks&&...) -> Overloading...>; +} + +namespace vl::variant_internal +{ + template + consteval T MaxOf(T first, TArgs ...others) + { + T result = first; + T nexts[] = { others... }; + for (T next : nexts) + { + if (result < next) result = next; + } + return result; + } + template + consteval T MaxOf(T first) + { + return first; + } + + template + struct VariantElement + { + template + requires(std::is_same_v) + static consteval VariantIndex IndexOf() { return {}; } + + static consteval VariantIndex IndexOfCast(const T&) { return {}; } + static consteval VariantIndex IndexOfCast(T&&) { return {}; } + + template + static bool i_Apply(vint index, char* buffer, TCallback&& callback) + { + if (I != index) return false; + callback(*reinterpret_cast(buffer)); + return true; + } + + template + static bool i_Apply(vint index, const char* buffer, TCallback&& callback) + { + if (I != index) return false; + callback(*reinterpret_cast(buffer)); + return true; + } + + static bool i_CopyCtor(vint index, char* buffer, const char* source) + { + if constexpr (std::is_copy_constructible_v) + { + if (I != index) return false; + new (buffer)T(*reinterpret_cast(source)); + return true; + } + else + { + return false; + } + } + + static bool i_MoveCtor(vint index, char* buffer, char* source) + { + if constexpr (std::is_move_constructible_v) + { + if (I != index) return false; + new (buffer)T(std::move(*reinterpret_cast(source))); + return true; + } + else + { + return false; + } + } + + static bool i_Dtor(vint index, char* buffer) + { + if (I != index) return false; + reinterpret_cast(buffer)->~T(); + return true; + } + + static bool i_CopyAssign(vint index, char* buffer, const char* source) + { + if constexpr (std::is_copy_assignable_v) + { + if (I != index) return false; + *reinterpret_cast(buffer) = *reinterpret_cast(source); + return true; + } + else + { + return false; + } + } + + static bool i_MoveAssign(vint index, char* buffer, char* source) + { + if constexpr (std::is_move_constructible_v) + { + if (I != index) return false; + *reinterpret_cast(buffer) = std::move(*reinterpret_cast(source)); + return true; + } + else + { + return false; + } + } + + template + static void Ctor(VariantIndex, char* buffer, TArgs&& ...args) + { + new (buffer)T(std::forward(args)...); + } + + static void DefaultCtor(VariantIndex, char* buffer) + { + new (buffer)T(); + } + + static void CopyCtor(VariantIndex, char* buffer, const T& source) + { + new (buffer)T(source); + } + + static void MoveCtor(VariantIndex, char* buffer, T&& source) + { + new (buffer)T(std::move(source)); + } + + template + static void Assign(VariantIndex, char* buffer, TArg&& value) + { + *reinterpret_cast(buffer) = std::forward(value); + } + + static void CopyAssign(VariantIndex, char* buffer, const T& source) + { + *reinterpret_cast(buffer) = source; + } + + static void MoveAssign(VariantIndex, char* buffer, T&& source) + { + *reinterpret_cast(buffer) = std::move(source); + } + }; + + template + struct VariantElementPack; + + template + struct VariantElementPack, TElements...> : VariantElement... + { + using VariantElement::IndexOf...; + using VariantElement::IndexOfCast...; + using VariantElement::DefaultCtor...; + using VariantElement::Ctor...; + using VariantElement::CopyCtor...; + using VariantElement::MoveCtor...; + using VariantElement::Assign...; + using VariantElement::CopyAssign...; + using VariantElement::MoveAssign...; + + template + static void Apply(vint index, char* buffer, TCallback&& callback) + { + bool result = (VariantElement::i_Apply(index, buffer, std::forward(callback)) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::Apply(...)#Internal error: none of elements are selected."); + } + + template + static void Apply(vint index, const char* buffer, TCallback&& callback) + { + bool result = (VariantElement::i_Apply(index, buffer, std::forward(callback)) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::Apply(...)#Internal error: none of elements are selected."); + } + + static void CopyCtor(vint index, char* buffer, const char* source) + { + bool result = (VariantElement::i_CopyCtor(index, buffer, source) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::CopyCtor(...)#Internal error: none of elements are selected."); + } + + static void MoveCtor(vint index, char* buffer, char* source) + { + bool result = (VariantElement::i_MoveCtor(index, buffer, source) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::MoveCtor(...)#Internal error: none of elements are selected."); + } + + static void Dtor(vint index, char* buffer) + { + bool result = (VariantElement::i_Dtor(index, buffer) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::Dtor(...)#Internal error: none of elements are selected."); + } + + static void CopyAssign(vint index, char* buffer, const char* source) + { + bool result = (VariantElement::i_CopyAssign(index, buffer, source) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::CopyAssign(...)#Internal error: none of elements are selected."); + } + + static void MoveAssign(vint index, char* buffer, char* source) + { + bool result = (VariantElement::i_MoveAssign(index, buffer, source) || ...); + CHECK_ERROR(result, L"vl::variant_internal::VariantElementPack<...>::MoveAssign(...)#Internal error: none of elements are selected."); + } + }; +} + +namespace vl +{ + template + concept VariantElementType = requires() + { + std::is_same_v>; + }; + + template + class alignas(TElements...) Variant + { + public: + template + friend class Variant; + + using ElementPack = variant_internal::VariantElementPack, TElements...>; + + template + static constexpr vint IndexOf = decltype(ElementPack::template IndexOf())::value; + + template + static constexpr vint IndexOfCast = decltype(ElementPack::template IndexOfCast(std::declval()))::value; + + static constexpr std::size_t MaxSize = variant_internal::MaxOf(sizeof(TElements)...); + vint index = -1; + char buffer[MaxSize]; + + public: + Variant() + requires(std::is_default_constructible_v>>) + : index(0) + { + ElementPack::DefaultCtor(VariantIndex<0>{}, buffer); + } + + Variant(const Variant& variant) + : index(variant.index) + { + ElementPack::CopyCtor(index, buffer, variant.buffer); + } + + Variant(Variant&& variant) + : index(variant.index) + { + ElementPack::MoveCtor(index, buffer, variant.buffer); + } + + template + requires((std::is_same_v || ...)) + Variant(const T& element) + { + constexpr auto i = IndexOf; + index = i; + ElementPack::CopyCtor(VariantIndex{}, buffer, element); + } + + template + requires((std::is_same_v || ...)) + Variant(T&& element) + { + constexpr auto i = IndexOf; + index = i; + ElementPack::MoveCtor(VariantIndex{}, buffer, std::move(element)); + } + + template + Variant(VariantIndex i, TArgs&& ...args) + : index(I) + { + ElementPack::Ctor(i, buffer, std::forward(args)...); + } + + template + requires( + !std::is_same_v, Variant> && + ((!std::is_same_v, TElements>) && ...) + ) + Variant(T&& value) + { + constexpr auto i = IndexOfCast; + index = i; + ElementPack::Ctor(VariantIndex{}, buffer, std::forward(value)); + } + + ~Variant() + { + ElementPack::Dtor(index, buffer); + } + + Variant& operator=(const Variant& variant) + { + if (this != &variant) + { + if (index == variant.index) + { + ElementPack::CopyAssign(index, buffer, variant.buffer); + } + else + { + ElementPack::Dtor(index, buffer); + index = variant.index; + ElementPack::CopyCtor(index, buffer, variant.buffer); + } + } + return *this; + } + + Variant& operator=(Variant&& variant) + { + if (this != &variant) + { + if (index == variant.index) + { + ElementPack::MoveAssign(index, buffer, variant.buffer); + } + else + { + ElementPack::Dtor(index, buffer); + index = variant.index; + ElementPack::MoveCtor(index, buffer, variant.buffer); + } + } + return *this; + } + + template + requires((std::is_same_v || ...)) + Variant& operator=(const T& element) + { + constexpr auto i = IndexOf; + if (index == i) + { + ElementPack::CopyAssign(VariantIndex{}, buffer, element); + } + else + { + ElementPack::Dtor(index, buffer); + index = i; + ElementPack::CopyCtor(VariantIndex{}, buffer, element); + } + return *this; + } + + template + requires((std::is_same_v || ...)) + Variant& operator=(T&& element) + { + constexpr auto i = IndexOf; + if (index == i) + { + ElementPack::MoveAssign(VariantIndex{}, buffer, std::move(element)); + } + else + { + ElementPack::Dtor(index, buffer); + index = i; + ElementPack::MoveCtor(VariantIndex{}, buffer, std::move(element)); + } + return *this; + } + + template + Variant& Set(VariantIndex i, T&& value) + { + if (index == I) + { + ElementPack::Assign(i, buffer, std::forward(value)); + } + else + { + ElementPack::Dtor(index, buffer); + index = I; + ElementPack::Ctor(i, buffer, std::forward(value)); + } + return *this; + } + + template + requires( + !std::is_same_v, Variant> && + ((!std::is_same_v, TElements>) && ...) + ) + Variant& operator=(T&& value) + { + constexpr auto i = IndexOfCast; + return Set(VariantIndex{}, std::forward(value)); + } + + vint Index() const + { + return index; + } + + template + requires((std::is_same_v || ...)) + T& Get()& + { + auto result = TryGet(); + CHECK_ERROR(result != nullptr, L"vl::Variant::Get()#Content does not match the type."); + return *result; + } + + template + requires((std::is_same_v || ...)) + T&& Get()&& + { + auto result = TryGet(); + CHECK_ERROR(result != nullptr, L"vl::Variant::Get()#Content does not match the type."); + return std::move(*result); + } + + template + requires((std::is_same_v || ...)) + const T& Get() const& + { + auto result = TryGet(); + CHECK_ERROR(result != nullptr, L"vl::Variant::Get()#Content does not match the type."); + return *result; + } + + template + requires((std::is_same_v || ...)) + T* TryGet() + { + return const_cast(static_cast*>(this)->TryGet()); + } + + template + requires((std::is_same_v || ...)) + const T* TryGet() const + { + constexpr auto i = IndexOf; + return index == i ? reinterpret_cast(buffer) : nullptr; + } + + template + void Apply(TCallback&& callback) + { + ElementPack::Apply(index, buffer, std::forward(callback)); + } + + template + void Apply(TCallback&& callback) const + { + ElementPack::Apply(index, buffer, std::forward(callback)); + } + + template + bool TryApply(TCallback&& callback) + { + bool result = true; + Apply(Overloading( + std::forward(callback), + [&result](...) { result = false; } + )); + return result; + } + + template + bool TryApply(TCallback&& callback) const + { + bool result = true; + Apply(Overloading( + std::forward(callback), + [&result](...) { result = false; } + )); + return result; + } + }; +} + +#ifdef VCZH_CHECK_MEMORY_LEAKS_NEW +#define new VCZH_CHECK_MEMORY_LEAKS_NEW +#endif + +#endif + /*********************************************************************** .\STRINGS\STRING.H ***********************************************************************/ diff --git a/Tools/Reflection32.bin b/Tools/Reflection32.bin index d071f5f8..dbc90493 100644 Binary files a/Tools/Reflection32.bin and b/Tools/Reflection32.bin differ diff --git a/Tools/Reflection64.bin b/Tools/Reflection64.bin index cc489c0c..12396da8 100644 Binary files a/Tools/Reflection64.bin and b/Tools/Reflection64.bin differ diff --git a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp index f677f0d7..fa34bf94 100644 --- a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/FullControlTest/Source/DemoPartialClasses.cpp @@ -21053,7 +21053,7 @@ Class (::demo::ElementTabPageConstructor) } (this->__vwsn_precompile_6 = ::vl::Ptr<::vl::presentation::elements::GuiSolidBorderElement>(::vl::reflection::description::Element_Constructor<::vl::presentation::elements::GuiSolidBorderElement>())); { - ::vl::__vwsn::This(this->__vwsn_precompile_6.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint32_t>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint32_t>(5); return __vwsn_temp__; }()); + ::vl::__vwsn::This(this->__vwsn_precompile_6.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint>(5); return __vwsn_temp__; }()); } { ::vl::__vwsn::This(this->__vwsn_precompile_6.Obj())->SetColor(::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString::Unmanaged(L"#FFFF00"))); @@ -21101,7 +21101,7 @@ Class (::demo::ElementTabPageConstructor) } (this->__vwsn_precompile_12 = ::vl::Ptr<::vl::presentation::elements::GuiSolidBackgroundElement>(::vl::reflection::description::Element_Constructor<::vl::presentation::elements::GuiSolidBackgroundElement>())); { - ::vl::__vwsn::This(this->__vwsn_precompile_12.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint32_t>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint32_t>(5); return __vwsn_temp__; }()); + ::vl::__vwsn::This(this->__vwsn_precompile_12.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint>(5); return __vwsn_temp__; }()); } { ::vl::__vwsn::This(this->__vwsn_precompile_12.Obj())->SetColor(::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString::Unmanaged(L"#FFFF00"))); @@ -21296,7 +21296,7 @@ Class (::demo::ElementTabPageConstructor) ::vl::__vwsn::This(this->__vwsn_precompile_30.Obj())->SetColor1(::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString::Unmanaged(L"#FFFF00"))); } { - ::vl::__vwsn::This(this->__vwsn_precompile_30.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint32_t>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint32_t>(5); return __vwsn_temp__; }()); + ::vl::__vwsn::This(this->__vwsn_precompile_30.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint>(5); return __vwsn_temp__; }()); } { ::vl::__vwsn::This(this->__vwsn_precompile_30.Obj())->SetDirection(::vl::presentation::elements::GuiGradientBackgroundElement::Direction::Horizontal); @@ -21319,7 +21319,7 @@ Class (::demo::ElementTabPageConstructor) ::vl::__vwsn::This(this->__vwsn_precompile_32.Obj())->SetColor1(::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString::Unmanaged(L"#FFFF00"))); } { - ::vl::__vwsn::This(this->__vwsn_precompile_32.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint32_t>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint32_t>(5); return __vwsn_temp__; }()); + ::vl::__vwsn::This(this->__vwsn_precompile_32.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint>(5); return __vwsn_temp__; }()); } { ::vl::__vwsn::This(this->__vwsn_precompile_32.Obj())->SetDirection(::vl::presentation::elements::GuiGradientBackgroundElement::Direction::Vertical); @@ -21342,7 +21342,7 @@ Class (::demo::ElementTabPageConstructor) ::vl::__vwsn::This(this->__vwsn_precompile_34.Obj())->SetColor1(::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString::Unmanaged(L"#FFFF00"))); } { - ::vl::__vwsn::This(this->__vwsn_precompile_34.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint32_t>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint32_t>(5); return __vwsn_temp__; }()); + ::vl::__vwsn::This(this->__vwsn_precompile_34.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint>(5); return __vwsn_temp__; }()); } { ::vl::__vwsn::This(this->__vwsn_precompile_34.Obj())->SetDirection(::vl::presentation::elements::GuiGradientBackgroundElement::Direction::Slash); @@ -21365,7 +21365,7 @@ Class (::demo::ElementTabPageConstructor) ::vl::__vwsn::This(this->__vwsn_precompile_36.Obj())->SetColor1(::vl::__vwsn::Parse<::vl::presentation::Color>(::vl::WString::Unmanaged(L"#FFFF00"))); } { - ::vl::__vwsn::This(this->__vwsn_precompile_36.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint32_t>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint32_t>(5); return __vwsn_temp__; }()); + ::vl::__vwsn::This(this->__vwsn_precompile_36.Obj())->SetShape([&](){ ::vl::presentation::elements::ElementShape __vwsn_temp__; __vwsn_temp__.shapeType = ::vl::presentation::elements::ElementShapeType::RoundRect; __vwsn_temp__.radiusX = static_cast<::vl::vint>(10); __vwsn_temp__.radiusY = static_cast<::vl::vint>(5); return __vwsn_temp__; }()); } { ::vl::__vwsn::This(this->__vwsn_precompile_36.Obj())->SetDirection(::vl::presentation::elements::GuiGradientBackgroundElement::Direction::Backslash); diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 index 4f22d111..fd2859d2 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x64 differ diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 index 2f2e9353..757e6b40 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin.x86 differ