#ifndef VCZH_PRESENTATION_ELEMENTS_GUIGRAPHICSRENDERERSWINDOWSDIRECT2D
#define VCZH_PRESENTATION_ELEMENTS_GUIGRAPHICSRENDERERSWINDOWSDIRECT2D
#include "GuiGraphicsWindowsDirect2D.h"
namespace
{
namespace
{
namespace
{
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;\
class
GuiFocusRectangleElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(GuiFocusRectangleElement, GuiFocusRectangleElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiFocusRectangleElementRenderer
*
=
new
GuiFocusRectangleElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiFocusRectangleElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
*
=
nullptr
;
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
void
(
)
override
;
void
()
override
;
};
class
GuiSolidBorderElementRenderer
:
public
,
public
{
DEFINE_BRUSH_ELEMENT_RENDERER(GuiSolidBorderElement, GuiSolidBorderElementRenderer, ID2D1SolidColorBrush, Color)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiSolidBorderElementRenderer
*
=
new
GuiSolidBorderElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiSolidBorderElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
*
=
nullptr
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiSolidBorderElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
Gui3DBorderElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(Gui3DBorderElement, Gui3DBorderElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
Gui3DBorderElementRenderer
*
=
new
Gui3DBorderElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
Gui3DBorderElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
;
*
=
nullptr
;
*
=
nullptr
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
Gui3DBorderElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
Gui3DSplitterElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(Gui3DSplitterElement, Gui3DSplitterElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
Gui3DSplitterElementRenderer
*
=
new
Gui3DSplitterElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
Gui3DSplitterElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
;
*
=
nullptr
;
*
=
nullptr
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
Gui3DSplitterElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiSolidBackgroundElementRenderer
:
public
,
public
{
DEFINE_BRUSH_ELEMENT_RENDERER(GuiSolidBackgroundElement, GuiSolidBackgroundElementRenderer, ID2D1SolidColorBrush, Color)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiSolidBackgroundElementRenderer
*
=
new
GuiSolidBackgroundElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
GuiSolidBackgroundElement
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
GuiSolidBackgroundElement
::
(),
new
GuiSolidBackgroundElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
GuiSolidBackgroundElement
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
*
=
nullptr
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiSolidBackgroundElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiGradientBackgroundElementRenderer
:
public
,
public
{
typedef
collections
::
<
,
>
;
DEFINE_BRUSH_ELEMENT_RENDERER(GuiGradientBackgroundElement, GuiGradientBackgroundElementRenderer, ID2D1LinearGradientBrush, ColorPair)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiGradientBackgroundElementRenderer
*
=
new
GuiGradientBackgroundElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
GuiGradientBackgroundElement
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
GuiGradientBackgroundElement
::
(),
new
GuiGradientBackgroundElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
GuiGradientBackgroundElement
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
*
=
nullptr
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiGradientBackgroundElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiInnerShadowElementRenderer
:
public
,
public
{
typedef
collections
::
<
,
>
;
DEFINE_GUI_GRAPHICS_RENDERER(GuiInnerShadowElement, GuiInnerShadowElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiInnerShadowElementRenderer
*
=
new
GuiInnerShadowElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiInnerShadowElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
;
*
=
nullptr
;
*
=
nullptr
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiInnerShadowElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiSolidLabelElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(GuiSolidLabelElement, GuiSolidLabelElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiSolidLabelElementRenderer
*
=
new
GuiSolidLabelElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiSolidLabelElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
;
;
*
=
nullptr
;
Direct2DTextFormatPackage
*
=
nullptr
;
*
=
nullptr
;
= -
1
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
();
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiSolidLabelElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiImageFrameElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(GuiImageFrameElement, GuiImageFrameElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiImageFrameElementRenderer
*
=
new
GuiImageFrameElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiImageFrameElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
<
>
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiImageFrameElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiPolygonElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(GuiPolygonElement, GuiPolygonElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiPolygonElementRenderer
*
=
new
GuiPolygonElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiPolygonElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
;
;
*
=
nullptr
;
*
=
nullptr
;
collections
::
<
>
;
<
>
;
void
();
void
();
void
(
);
void
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiPolygonElementRenderer
();
void
(
)
override
;
void
()
override
;
};
class
GuiColorizedTextElementRenderer
:
public
,
public
,
protected
::
{
DEFINE_GUI_GRAPHICS_RENDERER(GuiColorizedTextElement, GuiColorizedTextElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiColorizedTextElementRenderer
*
=
new
GuiColorizedTextElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiColorizedTextElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
public
:
struct
{
;
*
;
;
*
;
};
struct
{
;
;
;
bool
(
const
&
){
return
false
;}
bool
(
const
&
){
return
true
;}
};
typedef
collections
::
<
>
;
protected
:
;
Direct2DTextFormatPackage
*
;
;
;
*
;
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
(
IWindowsDirect2DRenderTarget
*
);
void
();
void
();
text
::
*
();
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
void
(
)
override
;
void
()
override
;
};
class
GuiDirect2DElementRenderer
:
public
,
public
{
DEFINE_GUI_GRAPHICS_RENDERER(GuiDirect2DElement, GuiDirect2DElementRenderer, IWindowsDirect2DRenderTarget)
public
:
class
:
public
,
public
IGuiGraphicsRendererFactory
{
public
:
*
() {
GuiDirect2DElementRenderer
*
=
new
GuiDirect2DElementRenderer
;
renderer
->
=
this
;
renderer
->
=
0
;
renderer
->
=
0
;
return
renderer
; } };
protected
:
IGuiGraphicsRendererFactory
*
;
*
;
IWindowsDirect2DRenderTarget
*
;
;
public
:
static
void
() {
auto
=
GetGuiGraphicsResourceManager
();
do
{
if
(!(
manager
!=
nullptr
))
throw
(
L"SetGuiGraphicsResourceManager must be called before registering element renderers."
);}
while
(
0
);
manager
->
(
::
(),
new
GuiDirect2DElementRenderer
::
); }
IGuiGraphicsRendererFactory
*
()
override
{
return
; }
void
(
*
)
override
{
=
dynamic_cast
<
*>(
);
(); }
void
()
override
{
(); }
void
(
*
)
override
{
IWindowsDirect2DRenderTarget
*
=
;
=
dynamic_cast
<
IWindowsDirect2DRenderTarget
*>(
);
RenderTargetChangedInternal
(
oldRenderTarget
,
); }
()
override
{
return
; }
protected
:
void
();
void
();
void
RenderTargetChangedInternal
(
IWindowsDirect2DRenderTarget
*
,
IWindowsDirect2DRenderTarget
*
);
public
:
GuiDirect2DElementRenderer
();
~
GuiDirect2DElementRenderer
();
void
(
)
override
;
void
()
override
;
};
}
}
}
#endif