#include "GuiApplication.h"
#include "Templates/GuiThemeStyleFactory.h"
extern
void
();
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
compositions
;
using
namespace
theme
;
using
namespace
description
;
void
::
(
compositions
::
*
,
compositions
::
&
)
{
if
(
->
())
{
->
()->
.
(
);
}
FOREACH(GuiGraphicsComposition*, subComposition, composition->Children())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
*>&
= ::
vl
::
collections
::
(
->
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
*
;
__foreach_iterator__
.
(
subComposition
);)
{
(
subComposition
,
);
}
}
void
::
()
{
for
(
=
0
;
i
<
.
();
i
++)
{
=
i
]->
();
i
]->
.
(
arguments
);
(
i
]->
(),
arguments
);
}
}
::
()
:locale(
::
())
{
()->
()->
(
this
);
}
::
()
{
if
(
)
{
delete
;
=
0
;
}
()->
()->
(
this
);
}
*
::
GetThreadContextNativeWindow
(
*
)
{
return
nullptr
;
}
void
::
(
*
)
{
.
(
);
}
void
::
(
*
)
{
.
(
);
}
void
::(
* )
{
=
.
(
);
if
(
index
==-
1
)
{
.
(
);
}
}
void
::(
* )
{
if
(
.
(
))
{
}
}
void
::
(
compositions
::
*
,
compositions
::
&
)
{
=
true
;
}
void
::
(
compositions
::
*
,
compositions
::
&
)
{
=
false
;
if
(
)
{
();
}
}
::
()
{
return
;
}
void
::
(
)
{
if
(
)
{
;
);
}
}
void
::
(
*
)
{
if
(!
)
{
=
;
()->
()->
(
->
());
=
nullptr
;
}
}
*
::
()
{
return
;
}
const
collections
::
<
*>&
::
()
{
return
;
}
*
::
(
)
{
*
=
()->
()->
(
);
if
(
nativeWindow
)
{
for
(
=
0
;
i
<
.
();
i
++)
{
*
=
i
];
if
(
window
->
() ==
nativeWindow
)
{
return
window
;
}
}
}
return
0
;
}
void
::
(
*
,
*
,
,
)
{
*
=
dynamic_cast
<
*>(
->
());
if
(
!=
ownerWindow
)
{
delete
;
=
0
;
}
if
(!
)
{
=
new
(
theme
::
::
);
if
(
ownerWindow
)
{
if
(
auto
=
ownerWindow
->
TypedControlTemplateObject
(
true
)->
())
{
->
(
tooltipStyle
);
}
}
->
()->
()->
.
(
this
, &
::
);
->
()->
()->
.
(
this
, &
::
);
}
=
false
;
=
false
;
=
ownerWindow
;
=
;
->
SetTemporaryContentControl
(
);
->
(
);
->
(
(
10
,
10
));
->
(
,
);
}
void
::
()
{
if
(
)
{
if
(
)
{
=
true
;
}
else
{
=
false
;
->
();
}
}
}
*
::
()
{
if
(!
)
return
0
;
if
(!
->
GetTemporaryContentControl
())
return
0
;
return
;
}
::
()
{
return
()->
();
}
::
()
{
=
();
for
(
=
path
.
()-
1
;
i
>=
0
;
i
--)
{
if
(
path
i
]==
L'\\'
||
path
i
]==
L'/'
)
{
return
path
.
(
0
,
i
+
1
);
}
}
return
L""
;
}
bool
::
(
*
)
{
return
()->
()->
(
GetThreadContextNativeWindow
(
));
}
void
::
(
const
<
void
()>&
)
{
()->
()->
(
);
}
void
::
(
*
,
const
<
void
()>&
)
{
()->
()->
(
GetThreadContextNativeWindow
(
),
);
}
bool
::
InvokeInMainThreadAndWait
(
*
,
const
<
void
()>&
,
)
{
CHECK_ERROR(!IsInMainThread(controlHost), L"GuiApplication::InvokeInMainThreadAndWait(GuiControlHost*, const Func<void()>&, vint)#This function cannot be called in UI thread.");
do
{
if
(!(!
(
)))
throw
(
L"GuiApplication::InvokeInMainThreadAndWait(GuiControlHost*, const Func<void()>&, vint)#This function cannot be called in UI thread."
);}
while
(
0
);
return
()->
()->
InvokeInMainThreadAndWait
(
GetThreadContextNativeWindow
(
),
,
);
}
<
>
::
(
const
<
void
()>&
,
)
{
return
()->
()->
(
,
);
}
<
>
::
(
const
<
void
()>&
,
)
{
return
()->
()->
(
,
);
}
void
::
(
*
,
const
<
void
()>&
)
{
if
(
(
))
{
return
);
}
else
{
InvokeInMainThreadAndWait
(
, [&proc]()
{
);
});
}
}
class
:
public
,
public
{
protected
:
<
<
>>
;
bool
;
public
:
()
:loaded(
false
)
{
}
()
{
();
}
void
(
<
>
)
override
{
CHECK_ERROR(!loaded, L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Load function has already been executed.");
do
{
if
(!(!
))
throw
(
L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Load function has already been executed."
);}
while
(
0
);
auto
=
();
if
(
name
!=
L""
)
{
FOREACH(Ptr<IGuiPlugin>, plugin, plugins)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
plugin
);)
{
CHECK_ERROR(plugin->GetName() != name, L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Duplicated plugin name.");
do
{
if
(!(
plugin
() !=
name
))
throw
(
L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Duplicated plugin name."
);}
while
(
0
);
}
}
.
(
);
}
void
()
override
{
CHECK_ERROR(!loaded, L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Load function has already been executed.");
do
{
if
(!(!
))
throw
(
L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Load function has already been executed."
);}
while
(
0
);
=
true
;
<
>
;
<
,
>
;
<
,
<
>>
;
FOREACH(Ptr<IGuiPlugin>, plugin, plugins)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
plugin
);)
{
auto
=
plugin
();
pluginsToLoad
.
(
name
,
plugin
);
<
>
;
plugin
(
dependencies
);
FOREACH(WString, dependency, dependencies)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
dependencies
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
dependency
);)
{
loading
.
(
name
,
dependency
);
}
}
while
(
pluginsToLoad
.
() >
0
)
{
=
pluginsToLoad
.
();
{
FOREACH_INDEXER(WString, name, index, pluginsToLoad.Keys())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
pluginsToLoad
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
name
);
index
++)
{
if
(!
loading
.
().
(
name
))
{
for
(
=
loading
.
() -
1
;
i
>=
0
;
i
--)
{
loading
.
(
loading
.
()
i
],
name
);
}
loaded
.
(
name
);
auto
=
pluginsToLoad
.
()
index
];
pluginsToLoad
.
(
name
);
plugin
();
break
;
}
}
}
if
(
count
==
pluginsToLoad
.
())
{
;
FOREACH(Ptr<IGuiPlugin>, plugin, pluginsToLoad.Values())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
pluginsToLoad
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
plugin
);)
{
message
+=
L"Cannot load plugin \""
+
plugin
() +
L"\" because part of its dependencies are not ready:"
;
<
>
;
plugin
(
dependencies
);
bool
=
true
;
FOREACH(WString, dependency, dependencies)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
>&
= ::
vl
::
collections
::
(
dependencies
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
;
__foreach_iterator__
.
(
dependency
);)
{
if
(!
loaded
.
(
dependency
))
{
message
+=
L" \""
+
dependency
+
L"\";"
;
}
}
message
+=
L"\r\n"
;
}
throw
(
message
);
}
}
}
void
()
override
{
CHECK_ERROR(loaded, L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Load function has not been executed.");
do
{
if
(!(
))
throw
(
L"GuiPluginManager::AddPlugin(Ptr<IGuiPlugin>)#Load function has not been executed."
);}
while
(
0
);
=
false
;
FOREACH(Ptr<IGuiPlugin>, plugin, plugins)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
plugin
);)
{
plugin
();
}
}
bool
()
override
{
return
;
}
};
*
=
0
;
*
=
0
;
*
()
{
return
application
;
}
*
()
{
if
(!
pluginManager
)
{
pluginManager
=
new
;
}
return
pluginManager
;
}
void
()
{
if
(
pluginManager
)
{
delete
pluginManager
;
pluginManager
=
0
;
}
}
class
:
public
,
public
,
public
<
>
{
public
:
void
(
const
<
void
()>&
)
override
{
()->
(
()->
(),
);
}
void
(
const
<
void
()>&
)
override
{
()->
(
);
}
void
(
const
<
void
()>&
,
)
override
{
()->
(
,
);
}
};
class
OtherThreadAsyncScheduler
:
public
,
public
,
public
<
>
{
public
:
void
(
const
<
void
()>&
)
override
{
()->
(
);
}
void
(
const
<
void
()>&
)
override
{
()->
(
);
}
void
(
const
<
void
()>&
,
)
override
{
()->
(
,
);
}
};
void
()
{
()->
()->
();
theme
::
();
#ifndef VCZH_DEBUG_NO_REFLECTION
()->
();
#endif
()->
();
{
;
application
= &
app
;
::
RegisterSchedulerForCurrentThread
(
new
);
::
(
new
OtherThreadAsyncScheduler
);
();
::
UnregisterDefaultScheduler
();
::
UnregisterSchedulerForCurrentThread
();
}
application
=
nullptr
;
();
theme
::
();
::
();
();
#ifndef VCZH_DEBUG_NO_REFLECTION
();
#endif
}
}
}
}
void
()
{
vl
::
presentation
::
controls
::
();
}