#include "GuiBasicControls.h"
#include "GuiApplication.h"
#include "Templates/GuiThemeStyleFactory.h"
#include "../GraphicsHost/GuiGraphicsHost.h"
namespace
 
{
	
namespace
 
	{
		
namespace
 
		{
			
using
 namespace
 elements
;
			
using
 namespace
 compositions
;
			
using
 namespace
 collections
;
			
using
 namespace
 reflection
::
description
;
			
void
 ::
()
			{
				
 = 
true
;
			}
			
::
(
* 
)
				:owner(
)
			{
			}
			
::
()
			{
			}
			
bool
 ::
()
			{
				
return
 ;
			}
			
<
> 
::
()
			{
				
if
 (!
)
				{
					
  new
 (
this
);
				}
				
return
 ;
			}
			
void
 ::
BeforeControlTemplateUninstalled
()
			{
			}
			
void
 ::
AfterControlTemplateInstalled
(
bool
 )
			{
				
->
(
);
				
->
(
);
				
->
(
);
				
->
(
);
				
->
(
);
				
->
(
);
			}
			
void
 ::
CheckAndStoreControlTemplate
(
templates
::
* 
)
			{
				
 = 
;
			}
			
void
 ::
EnsureControlTemplateExists
()
			{
				
if
 (!
)
				{
					
();
				}
			}
			
void
 ::
()
			{
				
bool
  = 
 == 
nullptr
;
				
if
 (
)
				{
					
BeforeControlTemplateUninstalled
();
					
->
()->
(
);
					
->
(
);
					
(
);
					
 = 
nullptr
;
				}
				
if
 (
)
				{
					
CheckAndStoreControlTemplate
(
{}));
				}
				
else
				{
					
CheckAndStoreControlTemplate
(
theme
::
()->
(
)
{}));
				}
				
if
 (
)
				{
					
->
(
(
0
, 
0
, 
0
, 
0
));
					
->
()->
(
);
					
->
(
);
					
->
()->
(
);
					
AfterControlTemplateInstalled
(
initialize
);
				}
			}
			
void
 ::
(
* 
)
			{
				
* 
=
->
;
				
.
(
);
				
->
=
this
;
				
->
(
oldParent
, 
->
);
				
->
();
				
->
();
				
if
 (
auto
  = 
->
())
				{
					
host
->
();
				}
			}
			
void
 ::
(
* 
)
			{
				
* 
=
->
;
				
->
=
0
;
				
.
(
);
				
->
(
oldParent
, 
->
);
				
if
 (
auto
  = 
->
())
				{
					
host
->
();
				}
			}
			
void
 ::
(
* 
, 
* 
)
			{
				
();
			}
			
void
 ::
()
			{
				{
					
GuiControlSignalEventArgs
(
);
					
arguments
.
 = 
::
;
					
.
(
arguments
);
				}
				
for
(
 =
0
;
i
<
.
();
i
++)
				{
					
i
]->
();
				}
			}
			
void
 ::
()
			{
				{
					
GuiControlSignalEventArgs
(
);
					
arguments
.
 = 
::
;
					
.
(
arguments
);
				}
				
for
(
 =
0
;
i
<
.
();
i
++)
				{
					
i
]->
();
				}
			}
			
void
 ::
(
elements
::
* 
)
			{
				
GuiControlSignalEventArgs
(
);
				
arguments
.
 = 
::
;
				
.
(
arguments
);
			}
			
void
 ::
OnBeforeReleaseGraphicsHost
()
			{
				
for
(
 =
0
;
i
<
.
();
i
++)
				{
					
i
]->
OnBeforeReleaseGraphicsHost
();
				}
			}
			
void
 ::
()
			{
				
bool
  = 
 && (
 == 
0
 ? 
true
 : 
->
());
				
if
 (
 != 
newValue
)
				{
					
 = 
newValue
;
					
if
 (
)
					{
						
->
(
);
					}
					
.
(
());
					
for
 (
  = 
0
; 
i
 < 
.
(); 
i
++)
					{
						
i
]->
();
					}
				}
			}
			
void
 ::
()
			{
				
auto
  =
					
 ? 
.
() :
					
 ? 
->
() :
					
()->
()->
();
				
if
 (
  newValue
)
				{
					
  newValue
;
					
if
 (
)
					{
						
->
(
);
					}
					
.
(
());
					
for
 (
  = 
0
; 
i
 < 
.
(); 
i
++)
					{
						
i
]->
();
					}
				}
			}
			
void
 ::
(
compositions
::
* 
, 
compositions
::
& 
)
			{
				
if
 (!
)
				{
					
 = 
true
;
					
if
 (
)
					{
						
->
(
true
);
					}
					
.
(
());
				}
			}
			
void
 ::
(
compositions
::
* 
, 
compositions
::
& 
)
			{
				
if
 (
)
				{
					
 = 
false
;
					
if
 (
)
					{
						
->
(
false
);
					}
					
.
(
());
				}
			}
			
void
 ::
(
compositions
::
* 
)
			{
				
if
 (
 != 
)
				{
					
if
 (
)
					{
						
->
()->
.
(
);
						
->
()->
.
(
);
						
  nullptr
;
						
  nullptr
;
					}
					
 = 
;
					
if
 (
)
					{
						
->
(
);
					}
					
if
 (
)
					{
						
  ->
()->
.
(
this
, &
::
);
						
  ->
()->
.
(
this
, &
::
);
					}
					
else
					{
						
 (
);
						
(
, 
arguments
);
					}
				}
			}
			
bool
 ::
IsControlVisibleAndEnabled
()
			{
				
* 
 = 
this
;
				
while
 (
control
)
				{
					
if
 (!
control
->
() || !
control
->
())
					{
						
return
 false
;
					}
					
control
 = 
control
->
();
				}
				
return
 true
;
			}
			
bool
 ::
()
			{
				
return
 IsControlVisibleAndEnabled
();
			}
			
bool
 ::
()
			{
				
return
  != 
nullptr
 && 
 != 
L""
;
			}
			
compositions
::
* 
::
()
			{
				
return
 ;
			}
			
compositions
::
* 
::
()
			{
				
return
 ;
			}
			
void
 ::
()
			{
				
();
			}
			
bool
 ::
()
			{
				
return
 IsControlVisibleAndEnabled
();
			}
			
bool
 ::
()
			{
				
return
  != 
nullptr
;
			}
			
bool
 ::
(
* 
, 
bool
 )
			{
				
* 
=
dynamic_cast
<
*>(
);
				
if
(
value
->
()->
())
				{
					
if
 (!
) 
return
 false
;
				}
				
(
value
);
				
return
 true
;
			}
			
::
(
theme
::
 )
				:controlThemeName(
)
				, displayFont(
()->
()->
())
			{
				{
					
 = 
new
 ;
					
->
(
this
);
					
->
(
::
LimitToElementAndChildren
);
					
 = 
new
 ;
					
->
(
true
);
					
->
(
::
LimitToElementAndChildren
);
					
->
(
(
0
, 
0
, 
0
, 
0
));
					
->
(
);
				}
				{
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
					
.
(
);
				}
				
 = &
::
;
			}
			
::
()
			{
				
if
 (
)
				{
					
();
				}
				
				
if
 (!
)
				{
					
(
);
				}
				
if
 (
)
				{
					
					
if
 (
->
()->
())
					{
						
->
()->
()->
(
->
());
					}
					
delete
 ;
				}
				
for
 (
  = 
0
; 
i
 < 
.
(); 
i
++)
				{
					
delete
 i
];
				}
				
.
();
				
				
if
 (!
)
				{
					
delete
 ;
				}
			}
			
void
 ::
(
<
void
()> 
)
			{
				
auto
  = 
();
				
if
 (
controlHost
 && 
->
())
				{
					
auto
  = 
();
					
()->
(
controlHost
, [=]()
					{
						
if
 (!
flag
())
						{
							
);
						}
					});
				}
				
else
				{
					
);
				}
			}
			
compositions
::
 ::
()
			{
				
return
 (
);
			}
			
theme
::
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
theme
::
 )
			{
				
SetControlThemeNameAndTemplate
(
, 
);
			}
			
::
ControlTemplatePropertyType
::
()
			{
				
return
 ;
			}
			
void
 ::
(
const
 ControlTemplatePropertyType
& 
)
			{
				
SetControlThemeNameAndTemplate
(
, 
);
			}
			
void
 ::
SetControlThemeNameAndTemplate
(
theme
::
 , 
const
 ControlTemplatePropertyType
& 
)
			{
				
bool
  = (
 != 
);
				
bool
  = (
 || 
);
				
if
 (
themeChanged
 || 
templateChanged
)
				{
					
 = 
;
					
  ;
					
();
					
					
if
 (
themeChanged
)
					{
						
.
(
());
					}
					
if
 (
templateChanged
)
					{
						
.
(
());
					}
				}
			}
			
templates
::
* 
::
()
			{
				
EnsureControlTemplateExists
();
				
return
 ;
			}
			
compositions
::
* 
::
()
			{
				
EnsureControlTemplateExists
();
				
return
 ;
			}
			
compositions
::
* 
::
()
			{
				
EnsureControlTemplateExists
();
				
return
 ;
			}
			
compositions
::
* 
::
()
			{
				
EnsureControlTemplateExists
();
				
return
 ;
			}
			
* 
::
()
			{
				
return
 ;
			}
			
 ::
()
			{
				
return
 .
();
			}
			
* 
::
(
 )
			{
				
return
 ];
			}
			
bool
 ::
(
* 
)
			{
				
return
 ()->
(
->
());
			}
			
bool
 ::
(
* 
)
			{
				
return
 .
(
);
			}
			
* 
::
()
			{
				
return
 ?
->
():
0
;
			}
			
bool
 ::
()
			{
				
return
 ;
			}
			
bool
 ::
()
			{
				
return
 ;
			}
			
bool
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
bool
 )
			{
				
 = 
;
			}
			
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
 )
			{
				
  = 
 < 
0
 ? -
1
 : 
;
				
if
 (
 != 
newTabPriority
)
				{
					
 = 
newTabPriority
;
					
if
 (
auto
  = 
->
())
					{
						
host
->
();
					}
				}
			}
			
bool
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
bool
 )
			{
				
if
(
!=
)
				{
					
=
;
					
.
(
());
					
();
				}
			}
			
bool
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
bool
 )
			{
				
->
(
);
				
if
(
!=
)
				{
					
=
;
					
.
(
());
				}
			}
			
const
 & 
::
()
			{
				
return
 ;
			}
			
bool
 ::
(
const
 & 
)
			{
				
if
 (!
::
(
)) 
return
 false
;
				
if
 (
 != 
)
				{
					
  ;
					
.
(
());
				}
				
return
 true
;
			}
			
void
 ::
(
compositions
::
* 
)
			{
				
 = 
;
			}
			
const
 & 
::
()
			{
				
return
 ;
			}
			
void
 ::
(
const
 & 
)
			{
				
if
 (
 != 
)
				{
					
  ;
					
if
 (
)
					{
						
->
(
);
					}
					
.
(
());
				}
			}
			
const
 <
>& 
::
()
			{
				
return
 ;
			}
			
void
 ::
(
const
 <
>& 
)
			{
				
if
 (
  )
				{
					
  ;
					
.
(
());
					
();
				}
			}
			
const
 & 
::
()
			{
				
return
 ;
			}
			
			
description
::
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
const
 description
::
& 
)
			{
				
if
 (
  )
				{
					
  ;
					
if
 (
)
					{
						
->
(
);
					}
					
.
(
());
				}
			}
			
void
 ::
()
			{
				
if
 (
)
				{
					
if
 (
auto
  = 
->
())
					{
						
host
->
(
);
					}
				}
			}
			
description
::
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
const
 description
::
& 
)
			{
				
;
			}
			
* 
::
()
			{
				
return
 ;
			}
			
* 
::
(
* 
)
			{
				
* 
=
;
				
=
;
				
return
 oldTooltipControl
;
			}
			
 ::
()
			{
				
return
 ;
			}
			
void
 ::
(
 )
			{
				
=
;
			}
			
bool
 ::
(
 )
			{
				
if
(!
) 
return
 false
;
				
()->
(
this
, 
, 
, 
);
				
return
 true
;
			}
			
void
 ::
()
			{
				
if
(
()->
()==
this
)
				{
					
()->
();
				}
			}
			
* 
::
(
const
 & 
)
			{
				
if
 (
 == 
::
)
				{
					
return
 (
*)
this
;
				}
				
else
 if
 (
 == 
::
)
				{
					
return
 nullptr
;
				}
				
else
 if
 (
 == 
::
)
				{
					
return
 (
*)
this
;
				}
				
else
				{
					
  = 
.
().
(
);
					
if
 (
index
 != -
1
)
					{
						
return
 .
()
index
].
();
					}
					
if
 (
)
					{
						
return
 ->
(
);
					}
				}
				
return
 nullptr
;
			}
			
bool
 ::
(
const
 & 
, 
<
> 
)
			{
				
if
 (
.
().
(
))
				{
					
return
 false
;
				}
				
.
(
, 
);
				
();
				
return
 true
;
			}
			
controls
::
* 
::
GetControlHostForInstance
()
			{
				
return
 ();
			}
			
void
 ::
()
			{
				
::
();
				
OnControlHostForInstanceChanged
();
			}
			
::
(
theme
::
 )
				:
(
)
			{
			}
			
::
()
			{
				
();
				
FinalizeInstanceRecursively
(
this
);
			}
		}
	}
}