mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-22 23:36:46 +08:00
Update HelloWorld/CppXml
This commit is contained in:
+65
-70
@@ -47,7 +47,7 @@ Serialization (Color)
|
||||
return true;
|
||||
}
|
||||
|
||||
IValueType::CompareResult TypedValueSerializerProvider<Color>::Compare(const presentation::Color& a, const presentation::Color& b)
|
||||
IBoxedValue::CompareResult TypedValueSerializerProvider<Color>::Compare(const presentation::Color& a, const presentation::Color& b)
|
||||
{
|
||||
return TypedValueSerializerProvider<vuint32_t>::Compare(a.value, b.value);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ Serialization (DocumentFontSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
IValueType::CompareResult TypedValueSerializerProvider<DocumentFontSize>::Compare(const presentation::DocumentFontSize& a, const presentation::DocumentFontSize& b)
|
||||
IBoxedValue::CompareResult TypedValueSerializerProvider<DocumentFontSize>::Compare(const presentation::DocumentFontSize& a, const presentation::DocumentFontSize& b)
|
||||
{
|
||||
return TypedValueSerializerProvider<WString>::Compare(a.ToString(), b.ToString());
|
||||
}
|
||||
@@ -99,7 +99,7 @@ Serialization (GlobalStringKey)
|
||||
return true;
|
||||
}
|
||||
|
||||
IValueType::CompareResult TypedValueSerializerProvider<GlobalStringKey>::Compare(const presentation::GlobalStringKey& a, const presentation::GlobalStringKey& b)
|
||||
IBoxedValue::CompareResult TypedValueSerializerProvider<GlobalStringKey>::Compare(const presentation::GlobalStringKey& a, const presentation::GlobalStringKey& b)
|
||||
{
|
||||
return TypedValueSerializerProvider<WString>::Compare(a.ToString(), b.ToString());
|
||||
}
|
||||
@@ -644,6 +644,7 @@ GuiApplicationMain
|
||||
DestroyPluginManager();
|
||||
DestroyGlobalTypeManager();
|
||||
ThreadLocalStorage::DisposeStorages();
|
||||
FinalizeGlobalStorage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24181,76 +24182,10 @@ namespace vl
|
||||
{
|
||||
namespace templates
|
||||
{
|
||||
using namespace description;
|
||||
using namespace collections;
|
||||
using namespace controls;
|
||||
using namespace compositions;
|
||||
|
||||
/***********************************************************************
|
||||
GuiTemplate::IFactory
|
||||
***********************************************************************/
|
||||
|
||||
class GuiTemplateReflectableFactory : public Object, public virtual GuiTemplate::IFactory
|
||||
{
|
||||
protected:
|
||||
List<ITypeDescriptor*> types;
|
||||
|
||||
public:
|
||||
GuiTemplateReflectableFactory(const List<ITypeDescriptor*>& _types)
|
||||
{
|
||||
CopyFrom(types, _types);
|
||||
}
|
||||
|
||||
GuiTemplate* CreateTemplate(const description::Value& viewModel)override
|
||||
{
|
||||
FOREACH(ITypeDescriptor*, type, types)
|
||||
{
|
||||
auto group = type->GetConstructorGroup();
|
||||
vint count = group->GetMethodCount();
|
||||
for (vint i = 0; i < count; i++)
|
||||
{
|
||||
auto ctor = group->GetMethod(i);
|
||||
if (ctor->GetReturn()->GetDecorator() == ITypeInfo::RawPtr && ctor->GetParameterCount() <= 1)
|
||||
{
|
||||
Array<Value> arguments(ctor->GetParameterCount());
|
||||
if (ctor->GetParameterCount() == 1)
|
||||
{
|
||||
if (!viewModel.CanConvertTo(ctor->GetParameter(0)->GetType()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
arguments[0] = viewModel;
|
||||
}
|
||||
return dynamic_cast<GuiTemplate*>(ctor->Invoke(Value(), arguments).GetRawPtr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WString message = L"Unable to create a template from types {";
|
||||
FOREACH_INDEXER(ITypeDescriptor*, type, index, types)
|
||||
{
|
||||
if (index > 0) message += L", ";
|
||||
message += type->GetTypeName();
|
||||
}
|
||||
message += L"} using view model: ";
|
||||
if (viewModel.IsNull())
|
||||
{
|
||||
message += L"null.";
|
||||
}
|
||||
else
|
||||
{
|
||||
message += viewModel.GetTypeDescriptor()->GetTypeName() + L".";
|
||||
}
|
||||
|
||||
throw ArgumentException(message);
|
||||
}
|
||||
};
|
||||
|
||||
Ptr<GuiTemplate::IFactory> GuiTemplate::IFactory::CreateTemplateFactory(const collections::List<description::ITypeDescriptor*>& types)
|
||||
{
|
||||
return new GuiTemplateReflectableFactory(types);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
GuiTemplate
|
||||
***********************************************************************/
|
||||
@@ -26409,6 +26344,62 @@ GuiBindableDataEditor
|
||||
Helper Functions
|
||||
***********************************************************************/
|
||||
|
||||
class GuiTemplateReflectableFactory : public Object, public virtual GuiTemplate::IFactory
|
||||
{
|
||||
protected:
|
||||
List<ITypeDescriptor*> types;
|
||||
|
||||
public:
|
||||
GuiTemplateReflectableFactory(const List<ITypeDescriptor*>& _types)
|
||||
{
|
||||
CopyFrom(types, _types);
|
||||
}
|
||||
|
||||
GuiTemplate* CreateTemplate(const description::Value& viewModel)override
|
||||
{
|
||||
FOREACH(ITypeDescriptor*, type, types)
|
||||
{
|
||||
auto group = type->GetConstructorGroup();
|
||||
vint count = group->GetMethodCount();
|
||||
for (vint i = 0; i < count; i++)
|
||||
{
|
||||
auto ctor = group->GetMethod(i);
|
||||
if (ctor->GetReturn()->GetDecorator() == ITypeInfo::RawPtr && ctor->GetParameterCount() <= 1)
|
||||
{
|
||||
Array<Value> arguments(ctor->GetParameterCount());
|
||||
if (ctor->GetParameterCount() == 1)
|
||||
{
|
||||
if (!viewModel.CanConvertTo(ctor->GetParameter(0)->GetType()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
arguments[0] = viewModel;
|
||||
}
|
||||
return dynamic_cast<GuiTemplate*>(ctor->Invoke(Value(), arguments).GetRawPtr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WString message = L"Unable to create a template from types {";
|
||||
FOREACH_INDEXER(ITypeDescriptor*, type, index, types)
|
||||
{
|
||||
if (index > 0) message += L", ";
|
||||
message += type->GetTypeName();
|
||||
}
|
||||
message += L"} using view model: ";
|
||||
if (viewModel.IsNull())
|
||||
{
|
||||
message += L"null.";
|
||||
}
|
||||
else
|
||||
{
|
||||
message += viewModel.GetTypeDescriptor()->GetTypeName() + L".";
|
||||
}
|
||||
|
||||
throw ArgumentException(message);
|
||||
}
|
||||
};
|
||||
|
||||
void SplitBySemicolon(const WString& input, collections::List<WString>& fragments)
|
||||
{
|
||||
const wchar_t* attValue = input.Buffer();
|
||||
@@ -26445,12 +26436,16 @@ Helper Functions
|
||||
.Where([](ITypeDescriptor* type){return type != 0; })
|
||||
);
|
||||
|
||||
return GuiTemplate::IFactory::CreateTemplateFactory(types);
|
||||
return new GuiTemplateReflectableFactory(types);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef INITIALIZE_FACTORY_FROM_TEMPLATE
|
||||
#undef GET_FACTORY_FROM_TEMPLATE
|
||||
#undef GET_FACTORY_FROM_TEMPLATE_OPT
|
||||
|
||||
/***********************************************************************
|
||||
CONTROLS\TEXTEDITORPACKAGE\GUIDOCUMENTVIEWER.CPP
|
||||
***********************************************************************/
|
||||
|
||||
+98
-38
@@ -3481,8 +3481,8 @@ Resource
|
||||
|
||||
enum class GuiResourceUsage
|
||||
{
|
||||
DevelopmentTool,
|
||||
Application,
|
||||
DataOnly,
|
||||
InstanceClass,
|
||||
};
|
||||
|
||||
/// <summary>Resource. A resource is a root resource folder that does not have a name.</summary>
|
||||
@@ -3529,6 +3529,7 @@ Resource
|
||||
void SavePrecompiledBinary(stream::IStream& stream);
|
||||
|
||||
/// <summary>Precompile this resource to improve performance.</summary>
|
||||
/// <param name="callback">A callback to receive progress.</param>
|
||||
/// <param name="errors">All collected errors during precompiling a resource.</param>
|
||||
void Precompile(IGuiResourcePrecompileCallback* callback, collections::List<WString>& errors);
|
||||
|
||||
@@ -3687,18 +3688,15 @@ Resource Type Resolver
|
||||
enum PassNames
|
||||
{
|
||||
Workflow_Collect = 0,
|
||||
Workflow_CompileViewModel = 1,
|
||||
Workflow_CompileShared = 2,
|
||||
Workflow_Max = Workflow_CompileShared,
|
||||
Workflow_Compile = 1,
|
||||
Workflow_Max = Workflow_Compile,
|
||||
|
||||
Instance_CollectInstanceTypes = 3,
|
||||
Instance_ValidateDependency = 4,
|
||||
Instance_GenerateTemporaryClass = 5,
|
||||
Instance_CompileTemporaryClass = 6,
|
||||
Instance_GenerateInstanceCtor = 7,
|
||||
Instance_CompileInstanceCtor = 8,
|
||||
Instance_GenerateInstanceClass = 9,
|
||||
Instance_CompileInstanceClass = 10,
|
||||
Instance_CollectInstanceTypes = 2,
|
||||
Instance_CompileInstanceTypes = 3,
|
||||
Instance_CollectEventHandlers = 4,
|
||||
Instance_CompileEventHandlers = 5,
|
||||
Instance_GenerateInstanceClass = 6,
|
||||
Instance_CompileInstanceClass = 7,
|
||||
Instance_Max = Instance_CompileInstanceClass,
|
||||
};
|
||||
|
||||
@@ -3747,7 +3745,7 @@ Resource Type Resolver
|
||||
/// Pass 1: Script (initialize shared scripts)
|
||||
/// Pass 2: Script (initialize instance scripts)
|
||||
/// </summary>
|
||||
class IGuiResourceTypeResolver_Initialize : public virtual IDescriptable, public Description<IGuiResourceTypeResolver_Precompile>
|
||||
class IGuiResourceTypeResolver_Initialize : public virtual IDescriptable, public Description<IGuiResourceTypeResolver_Initialize>
|
||||
{
|
||||
public:
|
||||
/// <summary>Get the maximum pass index that the initializer needs.</summary>
|
||||
@@ -3853,11 +3851,11 @@ Resource Resolver Manager
|
||||
virtual vint GetMaxInitializePassIndex() = 0;
|
||||
/// <summary>Get names of all per resource resolvers for a pass.</summary>
|
||||
/// <param name="passIndex">The pass index.</param>
|
||||
/// <param name="resolvers">Names of resolvers</param>
|
||||
/// <param name="names">Names of resolvers</param>
|
||||
virtual void GetPerResourceResolverNames(vint passIndex, collections::List<WString>& names) = 0;
|
||||
/// <summary>Get names of all per pass resolvers for a pass.</summary>
|
||||
/// <param name="passIndex">The pass index.</param>
|
||||
/// <param name="resolvers">Names of resolvers</param>
|
||||
/// <param name="names">Names of resolvers</param>
|
||||
virtual void GetPerPassResolverNames(vint passIndex, collections::List<WString>& names) = 0;
|
||||
};
|
||||
|
||||
@@ -5837,6 +5835,8 @@ Event
|
||||
public:
|
||||
Ptr<IGuiGraphicsEventHandler> handler;
|
||||
};
|
||||
|
||||
virtual bool IsAttached() = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@@ -5849,14 +5849,20 @@ Event
|
||||
|
||||
class FunctionHandler : public Object, public IGuiGraphicsEventHandler
|
||||
{
|
||||
protected:
|
||||
FunctionType handler;
|
||||
public:
|
||||
bool isAttached = true;
|
||||
FunctionType handler;
|
||||
|
||||
FunctionHandler(const FunctionType& _handler)
|
||||
:handler(_handler)
|
||||
{
|
||||
}
|
||||
|
||||
bool IsAttached()override
|
||||
{
|
||||
return isAttached;
|
||||
}
|
||||
|
||||
void Execute(GuiGraphicsComposition* sender, T& argument)
|
||||
{
|
||||
handler(sender, argument);
|
||||
@@ -5953,6 +5959,8 @@ Event
|
||||
{
|
||||
if((*currentHandler)->handler == typedHandler)
|
||||
{
|
||||
(*currentHandler)->handler->isAttached = false;
|
||||
|
||||
auto next=(*currentHandler)->next;
|
||||
(*currentHandler)=next;
|
||||
return true;
|
||||
@@ -6264,6 +6272,61 @@ Event Receiver
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Workflow to C++ Codegen Helpers
|
||||
***********************************************************************/
|
||||
|
||||
namespace __vwsn
|
||||
{
|
||||
template<typename T>
|
||||
struct EventHelper<presentation::compositions::GuiGraphicsEvent<T>>
|
||||
{
|
||||
using Event = presentation::compositions::GuiGraphicsEvent<T>;
|
||||
using Sender = presentation::compositions::GuiGraphicsComposition;
|
||||
using IGuiGraphicsEventHandler = presentation::compositions::IGuiGraphicsEventHandler;
|
||||
using Handler = Func<void(Sender*, T*)>;
|
||||
|
||||
class EventHandlerImpl : public Object, public reflection::description::IEventHandler
|
||||
{
|
||||
public:
|
||||
Ptr<IGuiGraphicsEventHandler> handler;
|
||||
|
||||
EventHandlerImpl(Ptr<IGuiGraphicsEventHandler> _handler)
|
||||
:handler(_handler)
|
||||
{
|
||||
}
|
||||
|
||||
bool IsAttached()override
|
||||
{
|
||||
return handler->IsAttached();
|
||||
}
|
||||
};
|
||||
|
||||
static Ptr<reflection::description::IEventHandler> Attach(Event& e, Handler handler)
|
||||
{
|
||||
return MakePtr<EventHandlerImpl>(e.AttachLambda([=](Sender* sender, T& args)
|
||||
{
|
||||
handler(sender, &args);
|
||||
}));
|
||||
}
|
||||
|
||||
static bool Detach(Event& e, Ptr<reflection::description::IEventHandler> handler)
|
||||
{
|
||||
auto impl = handler.Cast<EventHandlerImpl>();
|
||||
if (!impl) return false;
|
||||
return e.Detach(impl->handler);
|
||||
}
|
||||
|
||||
static auto Invoke(Event& e)
|
||||
{
|
||||
return [&](Sender* sender, T* args)
|
||||
{
|
||||
e.ExecuteWithNewSender(*args, sender);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -11192,7 +11255,7 @@ TextList Style Provider
|
||||
void OnStyleCheckedChanged(TextItemStyleController* style);
|
||||
public:
|
||||
/// <summary>Create a item style provider with a specified item style provider callback.</summary>
|
||||
/// <param name="_textItemStyleProvider">The item style provider callback.</param>
|
||||
/// <param name="_bulletFactory">The factory object to create the control styles for bullet before a text item.</param>
|
||||
TextItemStyleProvider(IBulletFactory* _bulletFactory);
|
||||
~TextItemStyleProvider();
|
||||
|
||||
@@ -11302,7 +11365,7 @@ TextList Control
|
||||
public:
|
||||
/// <summary>Create a Text list control in virtual mode.</summary>
|
||||
/// <param name="_styleProvider">The style provider for this control.</param>
|
||||
/// <param name="_itemStyleProvider">The item style provider callback for this control.</param>
|
||||
/// <param name="_bulletFactory">The factory object to create the control styles for bullet before a text item.</param>
|
||||
/// <param name="_itemProvider">The item provider for this control.</param>
|
||||
GuiVirtualTextList(IStyleProvider* _styleProvider, list::TextItemStyleProvider::IBulletFactory* _bulletFactory, GuiListControl::IItemProvider* _itemProvider);
|
||||
~GuiVirtualTextList();
|
||||
@@ -11315,7 +11378,7 @@ TextList Control
|
||||
IStyleProvider* GetTextListStyleProvider();
|
||||
/// <summary>Set the item style provider.</summary>
|
||||
/// <returns>The old item style provider.</returns>
|
||||
/// <param name="itemStyleProvider">The new item style provider.</param>
|
||||
/// <param name="bulletFactory">The factory object to create the control styles for bullet before a text item.</param>
|
||||
Ptr<GuiListControl::IItemStyleProvider> ChangeItemStyle(list::TextItemStyleProvider::IBulletFactory* bulletFactory);
|
||||
};
|
||||
|
||||
@@ -11327,7 +11390,7 @@ TextList Control
|
||||
public:
|
||||
/// <summary>Create a Text list control.</summary>
|
||||
/// <param name="_styleProvider">The style provider for this control.</param>
|
||||
/// <param name="_itemStyleProvider">The item style provider callback for this control.</param>
|
||||
/// <param name="_bulletFactory">The factory object to create the control styles for bullet before a text item.</param>
|
||||
GuiTextList(IStyleProvider* _styleProvider, list::TextItemStyleProvider::IBulletFactory* _bulletFactory);
|
||||
~GuiTextList();
|
||||
|
||||
@@ -11827,7 +11890,7 @@ ListView ItemStyleProvider
|
||||
class IListViewItemContentProvider : public virtual IDescriptable, public Description<IListViewItemContentProvider>
|
||||
{
|
||||
public:
|
||||
/// <summary>Create a default and preferred <see cref="T:vl.presentation.controls.compositions.IGuiAxis"/> for the related item style provider.</summary>
|
||||
/// <summary>Create a default and preferred <see cref="compositions::IGuiAxis"/> for the related item style provider.</summary>
|
||||
/// <returns>The created item coordinate transformer.</returns>
|
||||
virtual compositions::IGuiAxis* CreatePreferredAxis()=0;
|
||||
/// <summary>Create a default and preferred <see cref="GuiListControl::IItemArranger"/> for the related item style provider.</summary>
|
||||
@@ -12411,6 +12474,7 @@ ListView
|
||||
void NotifyUpdateInternal(vint start, vint count, vint newCount)override;
|
||||
public:
|
||||
/// <summary>Create a container.</summary>
|
||||
/// <param name="_itemProvider">The item provider in the same control to receive notifications.</param>
|
||||
ListViewDataColumns(IListViewItemProvider* _itemProvider);
|
||||
~ListViewDataColumns();
|
||||
};
|
||||
@@ -12426,6 +12490,7 @@ ListView
|
||||
void NotifyUpdateInternal(vint start, vint count, vint newCount)override;
|
||||
public:
|
||||
/// <summary>Create a container.</summary>
|
||||
/// <param name="_itemProvider">The item provider in the same control to receive notifications.</param>
|
||||
ListViewColumns(IListViewItemProvider* _itemProvider);
|
||||
~ListViewColumns();
|
||||
};
|
||||
@@ -13412,6 +13477,7 @@ ComboBox with GuiListControl
|
||||
void SetSelectedIndex(vint value);
|
||||
|
||||
/// <summary>Get the selected item.</summary>
|
||||
/// <returns>The selected item.</returns>
|
||||
description::Value GetSelectedItem();
|
||||
/// <summary>Get the item provider in the list control.</summary>
|
||||
/// <returns>The item provider in the list control.</returns>
|
||||
@@ -16710,8 +16776,7 @@ GuiBindableTextList
|
||||
public:
|
||||
/// <summary>Create a bindable Text list control.</summary>
|
||||
/// <param name="_styleProvider">The style provider for this control.</param>
|
||||
/// <param name="_itemStyleProvider">The item style provider callback for this control.</param>
|
||||
/// <param name="_itemSource">The item source.</param>
|
||||
/// <param name = "_bulletFactory">The factory object to create the control styles for bullet before a text item.</param>
|
||||
GuiBindableTextList(IStyleProvider* _styleProvider, list::TextItemStyleProvider::IBulletFactory* _bulletFactory);
|
||||
~GuiBindableTextList();
|
||||
|
||||
@@ -16724,7 +16789,7 @@ GuiBindableTextList
|
||||
/// <returns>The item source.</returns>
|
||||
Ptr<description::IValueEnumerable> GetItemSource();
|
||||
/// <summary>Set the item source.</summary>
|
||||
/// <param name="itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
/// <param name="_itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
void SetItemSource(Ptr<description::IValueEnumerable> _itemSource);
|
||||
|
||||
/// <summary>Get the text property name to get the item text from an item.</summary>
|
||||
@@ -16833,7 +16898,6 @@ GuiBindableListView
|
||||
public:
|
||||
/// <summary>Create a bindable List view control.</summary>
|
||||
/// <param name="_styleProvider">The style provider for this control.</param>
|
||||
/// <param name="_itemSource">The item source.</param>
|
||||
GuiBindableListView(IStyleProvider* _styleProvider);
|
||||
~GuiBindableListView();
|
||||
|
||||
@@ -16848,7 +16912,7 @@ GuiBindableListView
|
||||
/// <returns>The item source.</returns>
|
||||
Ptr<description::IValueEnumerable> GetItemSource();
|
||||
/// <summary>Set the item source.</summary>
|
||||
/// <param name="itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
/// <param name="_itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
void SetItemSource(Ptr<description::IValueEnumerable> _itemSource);
|
||||
|
||||
/// <summary>Large image property name changed event.</summary>
|
||||
@@ -16972,7 +17036,6 @@ GuiBindableTreeView
|
||||
public:
|
||||
/// <summary>Create a bindable Tree view control.</summary>
|
||||
/// <param name="_styleProvider">The style provider for this control.</param>
|
||||
/// <param name="_itemSource">The item source.</param>
|
||||
GuiBindableTreeView(IStyleProvider* _styleProvider);
|
||||
~GuiBindableTreeView();
|
||||
|
||||
@@ -16987,7 +17050,7 @@ GuiBindableTreeView
|
||||
/// <returns>The item source.</returns>
|
||||
description::Value GetItemSource();
|
||||
/// <summary>Set the item source.</summary>
|
||||
/// <param name="itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
/// <param name="_itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
void SetItemSource(description::Value _itemSource);
|
||||
|
||||
/// <summary>Get the text property name to get the item text from an item.</summary>
|
||||
@@ -17100,7 +17163,6 @@ GuiBindableDataGrid
|
||||
public:
|
||||
/// <summary>Create a bindable Data grid control.</summary>
|
||||
/// <param name="_styleProvider">The style provider for this control.</param>
|
||||
/// <param name="_itemSource">The item source.</param>
|
||||
/// <param name="_viewModelContext">The view mode context, which will be passed to every visualizers and editors in this grid.</param>
|
||||
GuiBindableDataGrid(IStyleProvider* _styleProvider, const description::Value& _viewModelContext = description::Value());
|
||||
~GuiBindableDataGrid();
|
||||
@@ -17109,7 +17171,7 @@ GuiBindableDataGrid
|
||||
/// <returns>The item source.</returns>
|
||||
Ptr<description::IValueEnumerable> GetItemSource();
|
||||
/// <summary>Set the item source.</summary>
|
||||
/// <param name="itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
/// <param name="_itemSource">The item source. Null is acceptable if you want to clear all data.</param>
|
||||
void SetItemSource(Ptr<description::IValueEnumerable> _itemSource);
|
||||
|
||||
/// <summary>Insert a column.</summary>
|
||||
@@ -18066,8 +18128,6 @@ namespace vl
|
||||
/// <returns>The created template.</returns>
|
||||
/// <param name="viewModel">The view model for binding.</param>
|
||||
virtual GuiTemplate* CreateTemplate(const description::Value& viewModel) = 0;
|
||||
|
||||
static Ptr<IFactory> CreateTemplateFactory(const collections::List<description::ITypeDescriptor*>& types);
|
||||
};
|
||||
|
||||
/// <summary>Create a template.</summary>
|
||||
@@ -19203,7 +19263,7 @@ IGuiResourceManager
|
||||
class IGuiResourceManager : public IDescriptable, public Description<IGuiResourceManager>
|
||||
{
|
||||
public:
|
||||
virtual bool SetResource(const WString& name, Ptr<GuiResource> resource, GuiResourceUsage usage = GuiResourceUsage::Application) = 0;
|
||||
virtual bool SetResource(const WString& name, Ptr<GuiResource> resource, GuiResourceUsage usage = GuiResourceUsage::DataOnly) = 0;
|
||||
virtual Ptr<GuiResource> GetResource(const WString& name) = 0;
|
||||
virtual Ptr<GuiResource> GetResourceFromClassName(const WString& classFullName) = 0;
|
||||
};
|
||||
@@ -19245,7 +19305,7 @@ Serialization
|
||||
static presentation::Color GetDefaultValue();
|
||||
static bool Serialize(const presentation::Color& input, WString& output);
|
||||
static bool Deserialize(const WString& input, presentation::Color& output);
|
||||
static IValueType::CompareResult Compare(const presentation::Color& a, const presentation::Color& b);
|
||||
static IBoxedValue::CompareResult Compare(const presentation::Color& a, const presentation::Color& b);
|
||||
};
|
||||
|
||||
template<>
|
||||
@@ -19254,7 +19314,7 @@ Serialization
|
||||
static presentation::DocumentFontSize GetDefaultValue();
|
||||
static bool Serialize(const presentation::DocumentFontSize& input, WString& output);
|
||||
static bool Deserialize(const WString& input, presentation::DocumentFontSize& output);
|
||||
static IValueType::CompareResult Compare(const presentation::DocumentFontSize& a, const presentation::DocumentFontSize& b);
|
||||
static IBoxedValue::CompareResult Compare(const presentation::DocumentFontSize& a, const presentation::DocumentFontSize& b);
|
||||
};
|
||||
|
||||
template<>
|
||||
@@ -19263,7 +19323,7 @@ Serialization
|
||||
static presentation::GlobalStringKey GetDefaultValue();
|
||||
static bool Serialize(const presentation::GlobalStringKey& input, WString& output);
|
||||
static bool Deserialize(const WString& input, presentation::GlobalStringKey& output);
|
||||
static IValueType::CompareResult Compare(const presentation::GlobalStringKey& a, const presentation::GlobalStringKey& b);
|
||||
static IBoxedValue::CompareResult Compare(const presentation::GlobalStringKey& a, const presentation::GlobalStringKey& b);
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
|
||||
+424
-982
File diff suppressed because one or more lines are too long
+18
-53
@@ -298,46 +298,6 @@ Instance Namespace
|
||||
GlobalStringKey className;
|
||||
};
|
||||
|
||||
// Workflow: <instance>.<name>
|
||||
// C++: <instance>->Get<name>()
|
||||
// <instance>->Set<name>()
|
||||
class GuiInstanceProperty : public Object, public Description<GuiInstanceProperty>
|
||||
{
|
||||
public:
|
||||
GlobalStringKey name;
|
||||
WString typeName;
|
||||
WString value;
|
||||
};
|
||||
|
||||
// Workflow: <instance>.<name>
|
||||
// C++: <instance>-><name>()
|
||||
class GuiInstanceState : public Object, public Description<GuiInstanceState>
|
||||
{
|
||||
public:
|
||||
GlobalStringKey name;
|
||||
WString typeName;
|
||||
WString value;
|
||||
};
|
||||
|
||||
// Workflow: <instance>.<name>
|
||||
// C++: <instance>->Get<name>()
|
||||
class GuiInstanceComponent : public Object, public Description<GuiInstanceComponent>
|
||||
{
|
||||
public:
|
||||
GlobalStringKey name;
|
||||
WString typeName;
|
||||
WString expression;
|
||||
};
|
||||
|
||||
// Workflow: <instance>.<name>
|
||||
// C++: <instance>-><name>
|
||||
class GuiInstanceEvent : public Object, public Description<GuiInstanceComponent>
|
||||
{
|
||||
public:
|
||||
GlobalStringKey name;
|
||||
WString eventArgsClass;
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
Instance Context
|
||||
***********************************************************************/
|
||||
@@ -356,10 +316,6 @@ Instance Context
|
||||
};
|
||||
typedef collections::Dictionary<GlobalStringKey, Ptr<NamespaceInfo>> NamespaceMap;
|
||||
typedef collections::List<Ptr<GuiInstanceParameter>> ParameterList;
|
||||
typedef collections::List<Ptr<GuiInstanceProperty>> PropertyList;
|
||||
typedef collections::List<Ptr<GuiInstanceState>> StateList;
|
||||
typedef collections::List<Ptr<GuiInstanceComponent>> ComponentList;
|
||||
typedef collections::List<Ptr<GuiInstanceEvent>> EventList;
|
||||
typedef collections::List<Ptr<GuiInstanceStyleContext>> StyleContextList;
|
||||
|
||||
class ElementName : public Object
|
||||
@@ -385,10 +341,7 @@ Instance Context
|
||||
collections::List<WString> stylePaths;
|
||||
|
||||
ParameterList parameters;
|
||||
PropertyList properties;
|
||||
StateList states;
|
||||
ComponentList components;
|
||||
EventList events;
|
||||
WString memberScript;
|
||||
|
||||
bool appliedStyles = false;
|
||||
StyleContextList styles;
|
||||
@@ -442,6 +395,10 @@ GacUI Reflection: Instance Loader
|
||||
Interfaces:
|
||||
***********************************************************************/
|
||||
|
||||
#ifdef VCZH_DEBUG_NO_REFLECTION
|
||||
static_assert(false, "Don't use GacUICompiler.(h|cpp) if VCZH_DEBUG_NO_REFLECTION is defined.");
|
||||
#endif
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_GUIINSTANCELOADER
|
||||
#define VCZH_PRESENTATION_REFLECTION_GUIINSTANCELOADER
|
||||
|
||||
@@ -786,6 +743,10 @@ namespace vl
|
||||
|
||||
struct ResolvingResult : public Object, public Description<ResolvingResult>
|
||||
{
|
||||
Ptr<GuiInstanceContext> context;
|
||||
reflection::description::ITypeDescriptor* rootTypeDescriptor = nullptr;
|
||||
collections::List<WString> sharedModules;
|
||||
|
||||
Ptr<workflow::WfModule> moduleForValidate;
|
||||
Ptr<workflow::WfBlockStatement> moduleContent;
|
||||
|
||||
@@ -800,6 +761,7 @@ namespace vl
|
||||
};
|
||||
}
|
||||
extern workflow::analyzer::WfLexicalScopeManager* Workflow_GetSharedManager();
|
||||
extern Ptr<workflow::analyzer::WfLexicalScopeManager> Workflow_TransferSharedManager();
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
@@ -810,7 +772,6 @@ WorkflowCompiler (Parser)
|
||||
extern Ptr<workflow::WfStatement> Workflow_ParseStatement(const WString& code, types::ErrorList& errors);
|
||||
extern WString Workflow_ModuleToString(Ptr<workflow::WfModule> module);
|
||||
extern Ptr<workflow::WfExpression> Workflow_ParseTextValue(description::ITypeDescriptor* typeDescriptor, const WString& textValue, types::ErrorList& errors);
|
||||
extern Ptr<workflow::WfExpression> Workflow_CreateValue(const description::Value& value, types::ErrorList& errors);
|
||||
|
||||
/***********************************************************************
|
||||
WorkflowCompiler (Installation)
|
||||
@@ -829,7 +790,7 @@ WorkflowCompiler (Compile)
|
||||
|
||||
extern Ptr<workflow::WfModule> Workflow_CreateModuleWithUsings(Ptr<GuiInstanceContext> context);
|
||||
extern Ptr<workflow::WfClassDeclaration> Workflow_InstallClass(const WString& className, Ptr<workflow::WfModule> module);
|
||||
extern Ptr<workflow::WfBlockStatement> Workflow_InstallCtorClass(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, description::ITypeDescriptor* rootTypeDescriptor, Ptr<workflow::WfModule> module);
|
||||
extern Ptr<workflow::WfBlockStatement> Workflow_InstallCtorClass(types::ResolvingResult& resolvingResult, Ptr<workflow::WfModule> module);
|
||||
|
||||
extern void Workflow_CreatePointerVariable(Ptr<workflow::WfClassDeclaration> ctorClass, GlobalStringKey name, description::ITypeDescriptor* type, description::ITypeInfo* typeOverride);
|
||||
extern void Workflow_CreateVariablesForReferenceValues(Ptr<workflow::WfClassDeclaration> ctorClass, types::ResolvingResult& resolvingResult);
|
||||
@@ -865,10 +826,14 @@ WorkflowCompiler (Compile)
|
||||
}
|
||||
};
|
||||
|
||||
extern description::ITypeDescriptor* Workflow_CollectReferences(types::ResolvingResult& resolvingResult, types::ErrorList& errors);
|
||||
extern void Workflow_GenerateCreating(types::ResolvingResult& resolvingResult, Ptr<workflow::WfBlockStatement> statements, types::ErrorList& errors);
|
||||
extern void Workflow_GenerateBindings(types::ResolvingResult& resolvingResult, Ptr<workflow::WfBlockStatement> statements, types::ErrorList& errors);
|
||||
|
||||
extern InstanceLoadingSource FindInstanceLoadingSource(Ptr<GuiInstanceContext> context, GuiConstructorRepr* ctor);
|
||||
extern bool Workflow_ValidateStatement(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, description::ITypeDescriptor* rootTypeDescriptor, types::ErrorList& errors, const WString& code, Ptr<workflow::WfStatement> statement);
|
||||
extern Ptr<workflow::WfModule> Workflow_PrecompileInstanceContext(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, types::ErrorList& errors);
|
||||
extern Ptr<workflow::WfModule> Workflow_GenerateInstanceClass(Ptr<GuiInstanceContext> context, types::ResolvingResult& resolvingResult, types::ErrorList& errors, vint passIndex);
|
||||
extern bool Workflow_ValidateStatement(types::ResolvingResult& resolvingResult, types::ErrorList& errors, const WString& code, Ptr<workflow::WfStatement> statement);
|
||||
extern Ptr<workflow::WfModule> Workflow_PrecompileInstanceContext(types::ResolvingResult& resolvingResult, types::ErrorList& errors);
|
||||
extern Ptr<workflow::WfModule> Workflow_GenerateInstanceClass(types::ResolvingResult& resolvingResult, types::ErrorList& errors, vint passIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ Compiled Workflow Type Resolver (Workflow)
|
||||
|
||||
vint GetMaxPassIndex()override
|
||||
{
|
||||
return 3;
|
||||
return 2;
|
||||
}
|
||||
|
||||
void Initialize(Ptr<GuiResourceItem> resource, GuiResourceInitializeContext& context)override
|
||||
@@ -74,31 +74,18 @@ Compiled Workflow Type Resolver (Workflow)
|
||||
switch (context.passIndex)
|
||||
{
|
||||
case 0:
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::ViewModel)
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::Shared)
|
||||
{
|
||||
if (context.usage == GuiResourceUsage::DevelopmentTool)
|
||||
if (context.usage == GuiResourceUsage::InstanceClass)
|
||||
{
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::Shared)
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::InstanceClass)
|
||||
{
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (compiled->type == GuiInstanceCompiledWorkflow::InstanceCtor)
|
||||
{
|
||||
if (context.usage == GuiResourceUsage::Application)
|
||||
{
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
}
|
||||
else if (compiled->type == GuiInstanceCompiledWorkflow::InstanceClass)
|
||||
{
|
||||
if (context.usage == GuiResourceUsage::DevelopmentTool)
|
||||
if (context.usage == GuiResourceUsage::InstanceClass)
|
||||
{
|
||||
compiled->Initialize(true);
|
||||
}
|
||||
@@ -740,8 +727,8 @@ Type Declaration
|
||||
END_CLASS_MEMBER(GuiResourcePathResolver)
|
||||
|
||||
BEGIN_ENUM_ITEM(GuiResourceUsage)
|
||||
ENUM_CLASS_ITEM(DevelopmentTool)
|
||||
ENUM_CLASS_ITEM(Application)
|
||||
ENUM_CLASS_ITEM(DataOnly)
|
||||
ENUM_CLASS_ITEM(InstanceClass)
|
||||
END_ENUM_ITEM(GuiResourceUsage)
|
||||
|
||||
BEGIN_INTERFACE_MEMBER_NOPROXY(IGuiResourceManager)
|
||||
@@ -3655,8 +3642,6 @@ Type Declaration
|
||||
END_CLASS_MEMBER(GuiTemplate)
|
||||
|
||||
BEGIN_INTERFACE_MEMBER(GuiTemplate::IFactory)
|
||||
CLASS_MEMBER_EXTERNALCTOR(Ptr<GuiTemplate::IFactory>(const List<ITypeDescriptor*>&), { L"types" }, vl::presentation::templates::GuiTemplate::IFactory::CreateTemplateFactory)
|
||||
|
||||
CLASS_MEMBER_METHOD(CreateTemplate, NO_PARAMETER)
|
||||
END_INTERFACE_MEMBER(GuiTemplate::IFactory)
|
||||
|
||||
|
||||
+53
-192
@@ -4,6 +4,7 @@ DEVELOPER: Zihan Chen(vczh)
|
||||
***********************************************************************/
|
||||
#include "Vlpp.h"
|
||||
#include "VlppWorkflow.h"
|
||||
#include "VlppWorkflowCompiler.h"
|
||||
#include "GacUI.h"
|
||||
|
||||
/***********************************************************************
|
||||
@@ -17,6 +18,10 @@ GacUI Reflection: Basic
|
||||
Interfaces:
|
||||
***********************************************************************/
|
||||
|
||||
#ifdef VCZH_DEBUG_NO_REFLECTION
|
||||
static_assert(false, "Don't use GacUIReflection.(h|cpp) if VCZH_DEBUG_NO_REFLECTION is defined.");
|
||||
#endif
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_GUIREFLECTIONBASIC
|
||||
#define VCZH_PRESENTATION_REFLECTION_GUIREFLECTIONBASIC
|
||||
|
||||
@@ -2059,57 +2064,6 @@ Type Loader
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
GUIINSTANCECOMPILEDWORKFLOW.H
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
GacUI Reflection: Shared Script
|
||||
|
||||
Interfaces:
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_GUIINSTANCECOMPILEDWORKFLOW
|
||||
#define VCZH_PRESENTATION_REFLECTION_GUIINSTANCECOMPILEDWORKFLOW
|
||||
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace workflow
|
||||
{
|
||||
class WfModule;
|
||||
}
|
||||
|
||||
namespace presentation
|
||||
{
|
||||
class GuiInstanceCompiledWorkflow : public Object, public Description<GuiInstanceCompiledWorkflow>
|
||||
{
|
||||
public:
|
||||
enum AssemblyType
|
||||
{
|
||||
ViewModel,
|
||||
Shared,
|
||||
InstanceCtor,
|
||||
InstanceClass,
|
||||
TemporaryClass,
|
||||
};
|
||||
|
||||
collections::List<WString> codes;
|
||||
collections::List<Ptr<workflow::WfModule>> modules;
|
||||
Ptr<stream::MemoryStream> binaryToLoad;
|
||||
|
||||
AssemblyType type = AssemblyType::Shared;
|
||||
Ptr<workflow::runtime::WfAssembly> assembly;
|
||||
Ptr<workflow::runtime::WfRuntimeGlobalContext> context;
|
||||
|
||||
void Initialize(bool initializeContext);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
TYPEDESCRIPTORS\GUIREFLECTIONEVENTS.H
|
||||
***********************************************************************/
|
||||
@@ -2155,43 +2109,6 @@ Type List
|
||||
GuiEventInfoImpl
|
||||
***********************************************************************/
|
||||
|
||||
class GuiEventInfoCpp : public Object, public IEventInfo::ICpp
|
||||
{
|
||||
public:
|
||||
WString handlerType;
|
||||
WString attachTemplate;
|
||||
WString detachTemplate;
|
||||
WString invokeTemplate;
|
||||
|
||||
GuiEventInfoCpp()
|
||||
:handlerType(L"::vl::Ptr<::vl::presentation::compositions::IGuiGraphicsEventHandler>", false)
|
||||
, attachTemplate(L"$This->GetEventReceiver()->$Name.AttachLambda($Handler)", false)
|
||||
, detachTemplate(L"$This->GetEventReceiver()->$Name.Detach($Handler)", false)
|
||||
, invokeTemplate(L"$This->GetEventReceiver()->$Name.Execute($Arguments)", false)
|
||||
{
|
||||
}
|
||||
|
||||
const WString& GetHandlerType()override
|
||||
{
|
||||
return handlerType;
|
||||
}
|
||||
|
||||
const WString& GetAttachTemplate()override
|
||||
{
|
||||
return attachTemplate;
|
||||
}
|
||||
|
||||
const WString& GetDetachTemplate()override
|
||||
{
|
||||
return detachTemplate;
|
||||
}
|
||||
|
||||
const WString& GetInvokeTemplate()override
|
||||
{
|
||||
return invokeTemplate;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class GuiEventInfoImpl : public EventInfoImpl
|
||||
{
|
||||
@@ -2203,63 +2120,41 @@ GuiEventInfoImpl
|
||||
typedef Func<GuiGraphicsEvent<T>*(DescriptableObject*, bool)> EventRetriverFunction;
|
||||
|
||||
EventRetriverFunction eventRetriver;
|
||||
Ptr<GuiEventInfoCpp> cpp;
|
||||
|
||||
void AttachInternal(DescriptableObject* thisObject, IEventHandler* eventHandler)override
|
||||
Ptr<IEventHandler> AttachInternal(DescriptableObject* thisObject, Ptr<IValueFunctionProxy> handler)override
|
||||
{
|
||||
if(thisObject)
|
||||
{
|
||||
if(EventHandlerImpl* handlerImpl=dynamic_cast<EventHandlerImpl*>(eventHandler))
|
||||
GuiGraphicsEvent<T>* eventObject=eventRetriver(thisObject, true);
|
||||
auto func = [=](GuiGraphicsComposition* sender, T* arguments)
|
||||
{
|
||||
GuiGraphicsEvent<T>* eventObject=eventRetriver(thisObject, true);
|
||||
if(eventObject)
|
||||
{
|
||||
auto handler=eventObject->AttachLambda(
|
||||
[=](GuiGraphicsComposition* sender, T& arguments)
|
||||
{
|
||||
Value senderObject = BoxValue<GuiGraphicsComposition*>(sender, Description<GuiGraphicsComposition>::GetAssociatedTypeDescriptor());
|
||||
Value argumentsObject = BoxValue<T*>(&arguments, Description<T>::GetAssociatedTypeDescriptor());
|
||||
Value senderObject = BoxValue<GuiGraphicsComposition*>(sender, Description<GuiGraphicsComposition>::GetAssociatedTypeDescriptor());
|
||||
Value argumentsObject = BoxValue<T*>(arguments, Description<T>::GetAssociatedTypeDescriptor());
|
||||
|
||||
collections::Array<Value> eventArgs(2);
|
||||
eventArgs[0] = senderObject;
|
||||
eventArgs[1] = argumentsObject;
|
||||
eventHandler->Invoke(Value::From(thisObject), eventArgs);
|
||||
});
|
||||
handlerImpl->SetDescriptableTag(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
auto eventArgs = IValueList::Create();
|
||||
eventArgs->Add(senderObject);
|
||||
eventArgs->Add(argumentsObject);
|
||||
handler->Invoke(eventArgs);
|
||||
};
|
||||
return __vwsn::EventAttach(*eventObject, func);
|
||||
}
|
||||
|
||||
void DetachInternal(DescriptableObject* thisObject, IEventHandler* eventHandler)override
|
||||
bool DetachInternal(DescriptableObject* thisObject, Ptr<IEventHandler> handler)override
|
||||
{
|
||||
if(thisObject)
|
||||
GuiGraphicsEvent<T>* eventObject = eventRetriver(thisObject, false);
|
||||
if(eventObject)
|
||||
{
|
||||
if(EventHandlerImpl* handlerImpl=dynamic_cast<EventHandlerImpl*>(eventHandler))
|
||||
{
|
||||
GuiGraphicsEvent<T>* eventObject=eventRetriver(thisObject, false);
|
||||
if(eventObject)
|
||||
{
|
||||
auto handler=handlerImpl->GetDescriptableTag().Cast<presentation::compositions::IGuiGraphicsEventHandler>();
|
||||
if(handler)
|
||||
{
|
||||
eventObject->Detach(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
return __vwsn::EventDetach(*eventObject, handler);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InvokeInternal(DescriptableObject* thisObject, collections::Array<Value>& arguments)override
|
||||
void InvokeInternal(DescriptableObject* thisObject, Ptr<IValueList> arguments)override
|
||||
{
|
||||
if(thisObject)
|
||||
GuiGraphicsEvent<T>* eventObject=eventRetriver(thisObject, false);
|
||||
if(eventObject)
|
||||
{
|
||||
GuiGraphicsEvent<T>* eventObject=eventRetriver(thisObject, false);
|
||||
if(eventObject)
|
||||
{
|
||||
T* value=UnboxValue<T*>(arguments[1], Description<T>::GetAssociatedTypeDescriptor());
|
||||
eventObject->Execute(*value);
|
||||
}
|
||||
auto sender = UnboxValue<GuiGraphicsComposition*>(arguments->Get(0), Description<GuiGraphicsComposition>::GetAssociatedTypeDescriptor());
|
||||
auto value=UnboxValue<T*>(arguments->Get(1), Description<T>::GetAssociatedTypeDescriptor());
|
||||
eventObject->ExecuteWithNewSender(*value, sender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2272,7 +2167,6 @@ GuiEventInfoImpl
|
||||
GuiEventInfoImpl(ITypeDescriptor* _ownerTypeDescriptor, const WString& _name, const EventRetriverFunction& _eventRetriver)
|
||||
:EventInfoImpl(_ownerTypeDescriptor, _name)
|
||||
, eventRetriver(_eventRetriver)
|
||||
, cpp(MakePtr<GuiEventInfoCpp>())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2282,7 +2176,7 @@ GuiEventInfoImpl
|
||||
|
||||
ICpp* GetCpp()override
|
||||
{
|
||||
return cpp.Obj();
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2364,83 +2258,50 @@ Type Loader
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
GUIINSTANCEPARTIALCLASS.H
|
||||
GUIINSTANCECOMPILEDWORKFLOW.H
|
||||
***********************************************************************/
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
GacUI Reflection: Instance Loader
|
||||
GacUI Reflection: Shared Script
|
||||
|
||||
Interfaces:
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_GUIINSTANCEPARTIALCLASS
|
||||
#define VCZH_PRESENTATION_REFLECTION_GUIINSTANCEPARTIALCLASS
|
||||
#ifndef VCZH_PRESENTATION_REFLECTION_GUIINSTANCECOMPILEDWORKFLOW
|
||||
#define VCZH_PRESENTATION_REFLECTION_GUIINSTANCECOMPILEDWORKFLOW
|
||||
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace workflow
|
||||
{
|
||||
class WfModule;
|
||||
}
|
||||
|
||||
namespace presentation
|
||||
{
|
||||
using namespace reflection;
|
||||
|
||||
/***********************************************************************
|
||||
PartialClass
|
||||
***********************************************************************/
|
||||
|
||||
template<typename T>
|
||||
class GuiInstancePartialClass
|
||||
class GuiInstanceCompiledWorkflow : public Object, public Description<GuiInstanceCompiledWorkflow>
|
||||
{
|
||||
typedef reflection::description::Value Value;
|
||||
private:
|
||||
WString className;
|
||||
Value ctorInstance;
|
||||
|
||||
protected:
|
||||
bool InitializeFromResource()
|
||||
{
|
||||
if (ctorInstance.IsNull())
|
||||
{
|
||||
auto rootInstance = Value::From(dynamic_cast<T*>(this));
|
||||
auto resource = GetResourceManager()->GetResourceFromClassName(className);
|
||||
auto ctorFullName = className + L"<Ctor>";
|
||||
auto td = description::GetTypeDescriptor(ctorFullName);
|
||||
if (!td) return false;
|
||||
|
||||
auto ctor = td->GetConstructorGroup()->GetMethod(0);
|
||||
collections::Array<Value> arguments;
|
||||
ctorInstance = ctor->Invoke(Value(), arguments);
|
||||
|
||||
auto initialize = td->GetMethodGroupByName(L"<initialize-instance>", false)->GetMethod(0);
|
||||
{
|
||||
arguments.Resize(2);
|
||||
auto resolver = MakePtr<GuiResourcePathResolver>(resource, resource->GetWorkingDirectory());
|
||||
arguments[0] = rootInstance;
|
||||
arguments[1] = Value::From(resolver.Obj());
|
||||
initialize->Invoke(ctorInstance, arguments);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename TControl>
|
||||
void LoadInstanceReference(const WString& name, TControl*& reference)
|
||||
{
|
||||
reference = ctorInstance.GetProperty(name).GetRawPtr()->template SafeAggregationCast<TControl>();
|
||||
}
|
||||
public:
|
||||
GuiInstancePartialClass(const WString& _className)
|
||||
:className(_className)
|
||||
enum AssemblyType
|
||||
{
|
||||
}
|
||||
Shared,
|
||||
InstanceClass,
|
||||
TemporaryClass,
|
||||
};
|
||||
|
||||
collections::List<WString> codes;
|
||||
collections::List<Ptr<workflow::WfModule>> modules;
|
||||
Ptr<workflow::analyzer::WfLexicalScopeManager> metadata;
|
||||
Ptr<stream::MemoryStream> binaryToLoad;
|
||||
|
||||
virtual ~GuiInstancePartialClass()
|
||||
{
|
||||
}
|
||||
AssemblyType type = AssemblyType::Shared;
|
||||
Ptr<workflow::runtime::WfAssembly> assembly;
|
||||
Ptr<workflow::runtime::WfRuntimeGlobalContext> context;
|
||||
|
||||
void Initialize(bool initializeContext);
|
||||
};
|
||||
|
||||
#define GUI_INSTANCE_REFERENCE(NAME) LoadInstanceReference(L ## #NAME, this->NAME)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+230
-160
File diff suppressed because it is too large
Load Diff
+1519
-1042
File diff suppressed because it is too large
Load Diff
+29
-19
@@ -125,7 +125,7 @@ WfRuntimeCallStackInfo
|
||||
|
||||
Ptr<IValueReadonlyDictionary> WfRuntimeCallStackInfo::GetLocalArguments()
|
||||
{
|
||||
return GetVariables(assembly->functions[functionIndex]->argumentNames, localVariables, cachedLocalArguments);
|
||||
return GetVariables(assembly->functions[functionIndex]->argumentNames, arguments, cachedLocalArguments);
|
||||
}
|
||||
|
||||
Ptr<IValueReadonlyDictionary> WfRuntimeCallStackInfo::GetCapturedVariables()
|
||||
@@ -3875,12 +3875,12 @@ WfRuntimeThreadContext
|
||||
CONTEXT_ACTION(PopValue(thisValue), L"failed to pop a value from the stack.");
|
||||
CALL_DEBUGGER(callback->BreakInvoke(thisValue.GetRawPtr(), ins.eventParameter));
|
||||
|
||||
Array<Value> arguments(ins.countParameter);
|
||||
auto arguments = IValueList::Create();
|
||||
for (vint i = 0; i < ins.countParameter; i++)
|
||||
{
|
||||
Value argument;
|
||||
CONTEXT_ACTION(PopValue(argument), L"failed to pop a value from the stack.");
|
||||
arguments[ins.countParameter - i - 1] = argument;
|
||||
arguments->Insert(0, argument);
|
||||
}
|
||||
|
||||
ins.eventParameter->Invoke(thisValue, arguments);
|
||||
@@ -3945,11 +3945,12 @@ WfRuntimeThreadContext
|
||||
}
|
||||
case WfInsCode::DetachEvent:
|
||||
{
|
||||
Value operand;
|
||||
Value thisValue, operand;
|
||||
CONTEXT_ACTION(PopValue(operand), L"failed to pop a value from the stack.");
|
||||
CONTEXT_ACTION(PopValue(thisValue), L"failed to pop a value from the stack.");
|
||||
CALL_DEBUGGER(callback->BreakDetach(thisValue.GetRawPtr(), ins.eventParameter));
|
||||
auto handler = UnboxValue<Ptr<IEventHandler>>(operand);
|
||||
CALL_DEBUGGER(callback->BreakDetach(handler->GetOwnerObject().GetRawPtr(), handler->GetOwnerEvent()));
|
||||
auto result = handler->Detach();
|
||||
auto result = ins.eventParameter->Detach(thisValue, handler);
|
||||
CONTEXT_ACTION(PushValue(BoxValue(result)), L"failed to push a value to the stack.");
|
||||
return WfRuntimeExecutionAction::ExecuteInstruction;
|
||||
}
|
||||
@@ -4835,19 +4836,28 @@ WfEvent
|
||||
return GetInfoRecord<EventRecord>(this, thisObject, EventRecordInternalPropertyName, createIfNotExist);
|
||||
}
|
||||
|
||||
void WfEvent::AttachInternal(DescriptableObject* thisObject, IEventHandler* eventHandler)
|
||||
Ptr<IEventHandler> WfEvent::AttachInternal(DescriptableObject* thisObject, Ptr<IValueFunctionProxy> handler)
|
||||
{
|
||||
auto record = GetEventRecord(thisObject, true);
|
||||
record->handlers.Add(this, eventHandler);
|
||||
auto result = MakePtr<EventHandlerImpl>(handler);
|
||||
record->handlers.Add(this, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void WfEvent::DetachInternal(DescriptableObject* thisObject, IEventHandler* eventHandler)
|
||||
bool WfEvent::DetachInternal(DescriptableObject* thisObject, Ptr<IEventHandler> handler)
|
||||
{
|
||||
auto impl = handler.Cast<EventHandlerImpl>();
|
||||
if (!impl)return false;
|
||||
auto record = GetEventRecord(thisObject, true);
|
||||
record->handlers.Remove(this, eventHandler);
|
||||
if (record->handlers.Remove(this, impl.Obj()))
|
||||
{
|
||||
impl->isAttached = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void WfEvent::InvokeInternal(DescriptableObject* thisObject, collections::Array<Value>& arguments)
|
||||
void WfEvent::InvokeInternal(DescriptableObject* thisObject, Ptr<IValueList> arguments)
|
||||
{
|
||||
auto record = GetEventRecord(thisObject, false);
|
||||
if (record)
|
||||
@@ -4856,9 +4866,9 @@ WfEvent
|
||||
if (index != -1)
|
||||
{
|
||||
auto& values = record->handlers.GetByIndex(index);
|
||||
FOREACH(IEventHandler*, handler, values)
|
||||
FOREACH(Ptr<EventHandlerImpl>, handler, values)
|
||||
{
|
||||
handler->Invoke(Value::From(thisObject), arguments);
|
||||
handler->proxy->Invoke(arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5177,9 +5187,9 @@ WfStruct
|
||||
return Value::From(new IValueType::TypedBox<WfStructInstance>, owner);
|
||||
}
|
||||
|
||||
IValueType::CompareResult WfStruct::WfValueType::Compare(const Value& a, const Value& b)
|
||||
IBoxedValue::CompareResult WfStruct::WfValueType::Compare(const Value& a, const Value& b)
|
||||
{
|
||||
return IValueType::CompareResult::NotComparable;
|
||||
return IBoxedValue::NotComparable;
|
||||
}
|
||||
|
||||
WfStruct::WfStruct(const WString& typeName)
|
||||
@@ -5300,7 +5310,7 @@ WfEnum
|
||||
return Value::From(new IValueType::TypedBox<WfEnumInstance>, owner);
|
||||
}
|
||||
|
||||
IValueType::CompareResult WfEnum::WfValueType::Compare(const Value& a, const Value& b)
|
||||
IBoxedValue::CompareResult WfEnum::WfValueType::Compare(const Value& a, const Value& b)
|
||||
{
|
||||
auto ea = a.GetBoxedValue().Cast<IValueType::TypedBox<WfEnumInstance>>();
|
||||
if (!ea)
|
||||
@@ -5314,9 +5324,9 @@ WfEnum
|
||||
throw ArgumentTypeMismtatchException(L"eb", owner, Value::BoxedValue, b);
|
||||
}
|
||||
|
||||
if (ea->value.value < eb->value.value) return IValueType::Smaller;
|
||||
if (ea->value.value > eb->value.value)return IValueType::Greater;
|
||||
return IValueType::Equal;
|
||||
if (ea->value.value < eb->value.value) return IBoxedValue::Smaller;
|
||||
if (ea->value.value > eb->value.value)return IBoxedValue::Greater;
|
||||
return IBoxedValue::Equal;
|
||||
}
|
||||
|
||||
WfEnum::WfEnum(bool isFlags, const WString& typeName)
|
||||
|
||||
+29
-8
@@ -74,7 +74,7 @@ Instruction
|
||||
InvokeEvent, // IEventInfo*, count : Value-1, ..., Value-n, Value-this -> Value ;
|
||||
InvokeBaseCtor, // IMethodInfo*, count : Value-1, ..., Value-n, Value-this -> <null> ;
|
||||
AttachEvent, // IEventInfo* : Value-this, <function> -> <Listener> ;
|
||||
DetachEvent, // : <Listener> -> bool ;
|
||||
DetachEvent, // IEventInfo* : Value-this, <Listener> -> bool ;
|
||||
InstallTry, // label : () -> () ;
|
||||
UninstallTry, // count : () -> () ;
|
||||
RaiseException, // : Value -> () ; (trap)
|
||||
@@ -147,7 +147,7 @@ Instruction
|
||||
APPLY_EVENT_COUNT(InvokeEvent)\
|
||||
APPLY_METHOD_COUNT(InvokeBaseCtor)\
|
||||
APPLY_EVENT(AttachEvent)\
|
||||
APPLY(DetachEvent)\
|
||||
APPLY_EVENT(DetachEvent)\
|
||||
APPLY_LABEL(InstallTry)\
|
||||
APPLY_COUNT(UninstallTry)\
|
||||
APPLY(RaiseException)\
|
||||
@@ -443,9 +443,28 @@ Event
|
||||
typedef reflection::description::ITypeDescriptor ITypeDescriptor;
|
||||
typedef reflection::description::ITypeInfo ITypeInfo;
|
||||
typedef reflection::description::IEventHandler IEventHandler;
|
||||
typedef reflection::description::IValueFunctionProxy IValueFunctionProxy;
|
||||
typedef reflection::description::IValueList IValueList;
|
||||
typedef reflection::description::Value Value;
|
||||
typedef collections::Group<WfEvent*, IEventHandler*> EventHandlerGroup;
|
||||
|
||||
class EventHandlerImpl : public Object, public IEventHandler
|
||||
{
|
||||
public:
|
||||
bool isAttached = true;
|
||||
Ptr<IValueFunctionProxy> proxy;
|
||||
|
||||
EventHandlerImpl(Ptr<IValueFunctionProxy> _proxy)
|
||||
:proxy(_proxy)
|
||||
{
|
||||
}
|
||||
|
||||
bool IsAttached()override
|
||||
{
|
||||
return isAttached;
|
||||
}
|
||||
};
|
||||
|
||||
typedef collections::Group<WfEvent*, Ptr<EventHandlerImpl>> EventHandlerGroup;
|
||||
class EventRecord : public Object
|
||||
{
|
||||
public:
|
||||
@@ -456,9 +475,9 @@ Event
|
||||
protected:
|
||||
|
||||
Ptr<EventRecord> GetEventRecord(DescriptableObject* thisObject, bool createIfNotExist);
|
||||
void AttachInternal(DescriptableObject* thisObject, IEventHandler* eventHandler)override;
|
||||
void DetachInternal(DescriptableObject* thisObject, IEventHandler* eventHandler)override;
|
||||
void InvokeInternal(DescriptableObject* thisObject, collections::Array<Value>& arguments)override;
|
||||
Ptr<IEventHandler> AttachInternal(DescriptableObject* thisObject, Ptr<IValueFunctionProxy> handler)override;
|
||||
bool DetachInternal(DescriptableObject* thisObject, Ptr<IEventHandler> handler)override;
|
||||
void InvokeInternal(DescriptableObject* thisObject, Ptr<IValueList> arguments)override;
|
||||
Ptr<ITypeInfo> GetHandlerTypeInternal()override;
|
||||
public:
|
||||
WfEvent(ITypeDescriptor* ownerTypeDescriptor, const WString& name);
|
||||
@@ -612,6 +631,7 @@ Custom Type
|
||||
using FieldMap = collections::Dictionary<WString, Ptr<WfStructField>>;
|
||||
using IPropertyInfo = reflection::description::IPropertyInfo;
|
||||
using IValueType = reflection::description::IValueType;
|
||||
using IBoxedValue = reflection::description::IBoxedValue;
|
||||
|
||||
protected:
|
||||
class WfValueType : public Object, public virtual IValueType
|
||||
@@ -625,7 +645,7 @@ Custom Type
|
||||
WfValueType(WfStruct* _owner);
|
||||
|
||||
Value CreateDefault()override;
|
||||
CompareResult Compare(const Value& a, const Value& b)override;
|
||||
IBoxedValue::CompareResult Compare(const Value& a, const Value& b)override;
|
||||
};
|
||||
|
||||
protected:
|
||||
@@ -647,6 +667,7 @@ Custom Type
|
||||
{
|
||||
using EnumItemMap = collections::Dictionary<WString, vuint64_t>;
|
||||
using IValueType = reflection::description::IValueType;
|
||||
using IBoxedValue = reflection::description::IBoxedValue;
|
||||
using IEnumType = reflection::description::IEnumType;
|
||||
using Value = reflection::description::Value;
|
||||
|
||||
@@ -660,7 +681,7 @@ Custom Type
|
||||
WfValueType(WfEnum* _owner);
|
||||
|
||||
Value CreateDefault()override;
|
||||
CompareResult Compare(const Value& a, const Value& b)override;
|
||||
IBoxedValue::CompareResult Compare(const Value& a, const Value& b)override;
|
||||
};
|
||||
|
||||
class WfEnumType : public Object, public virtual IEnumType
|
||||
|
||||
+7408
-263
File diff suppressed because one or more lines are too long
+362
-78
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -69,7 +69,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -69,7 +69,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -83,11 +83,6 @@
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="UI\Source\HelloWorldPartialClasses.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Lib\GacUI\GacUI.vcxproj">
|
||||
<Project>{8018d622-66ba-4e65-9d03-bdac37ea9a54}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="UI\Resource.xml" />
|
||||
</ItemGroup>
|
||||
@@ -95,6 +90,11 @@
|
||||
<ClInclude Include="UI\Source\HelloWorld.h" />
|
||||
<ClInclude Include="UI\Source\HelloWorldPartialClasses.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Lib\GacUILite\GacUILite.vcxproj">
|
||||
<Project>{96c559ca-9718-4bec-a053-28a0ab6a8ca2}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -2,14 +2,10 @@
|
||||
<Resource>
|
||||
<Folder name="GacGenConfig">
|
||||
<Folder name="Cpp">
|
||||
<Text name="Output">Source</Text>
|
||||
<Text name="Include">GacUIReflection.h</Text>
|
||||
<Text name="SourceFolder">Source</Text>
|
||||
<Text name="Resource">..\..\UIRes\CppXml.bin</Text>
|
||||
<Text name="NormalInclude">GacUI.h</Text>
|
||||
<Text name="Name">HelloWorld</Text>
|
||||
<Text name="Prefix"></Text>
|
||||
</Folder>
|
||||
<Folder name="Res">
|
||||
<Text name="Output">..\..\UIRes</Text>
|
||||
<Text name="PrecompiledBinary">CppXml.bin</Text>
|
||||
</Folder>
|
||||
</Folder>
|
||||
<Folder name="MainWindow">
|
||||
|
||||
@@ -1,16 +1,35 @@
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
GacUI::HelloWorld
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
This file is generated by: Vczh GacUI Resource Code Generator
|
||||
************************************************************************
|
||||
DO NOT MODIFY
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_HelloWorld
|
||||
#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_HelloWorld
|
||||
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_HELLOWORLD
|
||||
#define VCZH_WORKFLOW_COMPILER_GENERATED_HELLOWORLD
|
||||
|
||||
#include "HelloWorldPartialClasses.h"
|
||||
|
||||
/***********************************************************************
|
||||
Reflection
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl
|
||||
{
|
||||
namespace reflection
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
DECL_TYPE_INFO(::helloworld::MainWindow)
|
||||
DECL_TYPE_INFO(::helloworld::MainWindowConstructor)
|
||||
#endif
|
||||
|
||||
extern bool LoadHelloWorldTypes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,42 +1,116 @@
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
GacUI::Partial Classes
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
This file is generated by: Vczh GacUI Resource Code Generator
|
||||
************************************************************************
|
||||
DO NOT MODIFY
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#include "HelloWorld.h"
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4250)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wparentheses-equality"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
#endif
|
||||
|
||||
#define GLOBAL_SYMBOL ::vl_workflow_global::HelloWorld::
|
||||
#define GLOBAL_NAME ::vl_workflow_global::HelloWorld::Instance().
|
||||
#define GLOBAL_OBJ &::vl_workflow_global::HelloWorld::Instance()
|
||||
#define USERIMPL(...)
|
||||
|
||||
/***********************************************************************
|
||||
Global Variables
|
||||
***********************************************************************/
|
||||
|
||||
BEGIN_GLOBAL_STORAGE_CLASS(vl_workflow_global_HelloWorld)
|
||||
vl_workflow_global::HelloWorld instance;
|
||||
INITIALIZE_GLOBAL_STORAGE_CLASS
|
||||
FINALIZE_GLOBAL_STORAGE_CLASS
|
||||
END_GLOBAL_STORAGE_CLASS(vl_workflow_global_HelloWorld)
|
||||
|
||||
namespace vl_workflow_global
|
||||
{
|
||||
/***********************************************************************
|
||||
Global Functions
|
||||
***********************************************************************/
|
||||
|
||||
HelloWorld& HelloWorld::Instance()
|
||||
{
|
||||
return Getvl_workflow_global_HelloWorld().instance;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Class (::helloworld::MainWindowConstructor)
|
||||
***********************************************************************/
|
||||
|
||||
namespace helloworld
|
||||
{
|
||||
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
|
||||
void MainWindowConstructor::__vwsn_initialize_instance_(::helloworld::MainWindow* __vwsn_this_, ::vl::presentation::GuiResourcePathResolver* __vwsn_resolver_)
|
||||
{
|
||||
(::vl::__vwsn::This(this)->__vwsn_precompile_0 = __vwsn_this_);
|
||||
(::vl::__vwsn::This(this)->__vwsn_precompile_2 = ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_0)->GetBoundsComposition());
|
||||
{
|
||||
::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_2)->SetPreferredMinSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = 480; __vwsn_temp__.y = 320; return __vwsn_temp__; }());
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_0)->SetClientSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = 480; __vwsn_temp__.y = 320; return __vwsn_temp__; }());
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_0)->SetText(::vl::WString(L"Hello, world!", false));
|
||||
}
|
||||
{
|
||||
auto __vwsn_controlStyle_ = ::vl::__vwsn::This(::vl::presentation::theme::GetCurrentTheme())->CreateLabelStyle();
|
||||
(::vl::__vwsn::This(this)->__vwsn_precompile_1 = new ::vl::presentation::controls::GuiLabel(__vwsn_controlStyle_));
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_1)->SetFont([&](){ ::vl::presentation::FontProperties __vwsn_temp__; __vwsn_temp__.fontFamily = ::vl::WString(L"Segoe UI", false); __vwsn_temp__.size = 32; __vwsn_temp__.antialias = true; return __vwsn_temp__; }());
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_1)->SetText(::vl::WString(L"Welcome to GacUI Library!", false));
|
||||
}
|
||||
{
|
||||
::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_0)->AddChild(::vl::__vwsn::Ensure(static_cast<::vl::presentation::controls::GuiControl*>(::vl::__vwsn::This(this)->__vwsn_precompile_1)));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnCreate()
|
||||
MainWindowConstructor::MainWindowConstructor()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
|
||||
/***********************************************************************
|
||||
Class (::helloworld::MainWindow)
|
||||
***********************************************************************/
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: ::vl::presentation::controls::GuiWindow(::vl::__vwsn::This(::vl::presentation::theme::GetCurrentTheme())->CreateWindowStyle())
|
||||
{
|
||||
InitializeComponents();
|
||||
OnCreate();
|
||||
auto __vwsn_resource_ = ::vl::__vwsn::This(::vl::presentation::GetResourceManager())->GetResourceFromClassName(::vl::WString(L"helloworld::MainWindow", false));
|
||||
auto __vwsn_resolver_ = ::vl::Ptr<::vl::presentation::GuiResourcePathResolver>(new ::vl::presentation::GuiResourcePathResolver(__vwsn_resource_, ::vl::__vwsn::This(__vwsn_resource_.Obj())->GetWorkingDirectory()));
|
||||
::vl::__vwsn::This(this)->__vwsn_initialize_instance_(this, ::vl::__vwsn::Ensure(static_cast<::vl::presentation::GuiResourcePathResolver*>(__vwsn_resolver_.Obj())));
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
OnDestroy();
|
||||
ClearSubscriptions();
|
||||
::vl::__vwsn::This(this)->ClearSubscriptions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#undef GLOBAL_SYMBOL
|
||||
#undef GLOBAL_NAME
|
||||
#undef GLOBAL_OBJ
|
||||
#undef USERIMPL
|
||||
|
||||
/***********************************************************************
|
||||
Reflection
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl
|
||||
{
|
||||
@@ -44,47 +118,55 @@ namespace vl
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
#define _ ,
|
||||
IMPL_CPP_TYPE_INFO(helloworld::MainWindow)
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
IMPL_CPP_TYPE_INFO(::helloworld::MainWindow)
|
||||
IMPL_CPP_TYPE_INFO(::helloworld::MainWindowConstructor)
|
||||
|
||||
BEGIN_CLASS_MEMBER(helloworld::MainWindow)
|
||||
CLASS_MEMBER_BASE(::vl::presentation::controls::GuiWindow)
|
||||
CLASS_MEMBER_CONSTRUCTOR(helloworld::MainWindow*(), NO_PARAMETER)
|
||||
END_CLASS_MEMBER(helloworld::MainWindow)
|
||||
#define _ ,
|
||||
BEGIN_CLASS_MEMBER(::helloworld::MainWindow)
|
||||
END_CLASS_MEMBER(::helloworld::MainWindow)
|
||||
|
||||
#undef _
|
||||
BEGIN_CLASS_MEMBER(::helloworld::MainWindowConstructor)
|
||||
CLASS_MEMBER_METHOD(__vwsn_initialize_instance_, { L"__vwsn_this_" _ L"__vwsn_resolver_" })
|
||||
CLASS_MEMBER_FIELD(__vwsn_precompile_0)
|
||||
CLASS_MEMBER_FIELD(__vwsn_precompile_1)
|
||||
CLASS_MEMBER_FIELD(__vwsn_precompile_2)
|
||||
END_CLASS_MEMBER(::helloworld::MainWindowConstructor)
|
||||
|
||||
class HelloWorldResourceLoader : public Object, public ITypeLoader
|
||||
#undef _
|
||||
class HelloWorldTypeLoader : public Object, public ITypeLoader
|
||||
{
|
||||
public:
|
||||
void Load(ITypeManager* manager)
|
||||
{
|
||||
ADD_TYPE_INFO(helloworld::MainWindow)
|
||||
ADD_TYPE_INFO(::helloworld::MainWindow)
|
||||
ADD_TYPE_INFO(::helloworld::MainWindowConstructor)
|
||||
}
|
||||
|
||||
void Unload(ITypeManager* manager)
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
class HelloWorldResourcePlugin : public Object, public vl::presentation::controls::IGuiPlugin
|
||||
bool LoadHelloWorldTypes()
|
||||
{
|
||||
public:
|
||||
void Load()override
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (auto manager = GetGlobalTypeManager())
|
||||
{
|
||||
GetGlobalTypeManager()->AddTypeLoader(new HelloWorldResourceLoader);
|
||||
return manager->AddTypeLoader(MakePtr<HelloWorldTypeLoader>());
|
||||
}
|
||||
|
||||
void AfterLoad()override
|
||||
{
|
||||
}
|
||||
|
||||
void Unload()override
|
||||
{
|
||||
}
|
||||
};
|
||||
GUI_REGISTER_PLUGIN(HelloWorldResourcePlugin)
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
@@ -1,76 +1,79 @@
|
||||
/***********************************************************************
|
||||
Vczh Library++ 3.0
|
||||
Developer: Zihan Chen(vczh)
|
||||
GacUI::Partial Classes
|
||||
/***********************************************************************
|
||||
!!!!!! DO NOT MODIFY !!!!!!
|
||||
|
||||
This file is generated by: Vczh GacUI Resource Code Generator
|
||||
************************************************************************
|
||||
DO NOT MODIFY
|
||||
GacGen.exe Resource.xml
|
||||
|
||||
This file is generated by Workflow compiler
|
||||
https://github.com/vczh-libraries
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef VCZH_GACUI_RESOURCE_CODE_GENERATOR_HelloWorld_PARTIAL_CLASSES
|
||||
#define VCZH_GACUI_RESOURCE_CODE_GENERATOR_HelloWorld_PARTIAL_CLASSES
|
||||
#ifndef VCZH_WORKFLOW_COMPILER_GENERATED_HELLOWORLDPARTIALCLASSES
|
||||
#define VCZH_WORKFLOW_COMPILER_GENERATED_HELLOWORLDPARTIALCLASSES
|
||||
|
||||
#include "GacUIReflection.h"
|
||||
#include "GacUI.h"
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4250)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wparentheses-equality"
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wparentheses-equality"
|
||||
#endif
|
||||
|
||||
namespace helloworld
|
||||
{
|
||||
class MainWindowConstructor;
|
||||
class MainWindow;
|
||||
|
||||
template<typename TImpl>
|
||||
class MainWindow_ : public ::vl::presentation::controls::GuiWindow, public vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>, public vl::reflection::Description<TImpl>
|
||||
class MainWindowConstructor : public ::vl::Object, public ::vl::reflection::Description<MainWindowConstructor>
|
||||
{
|
||||
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
|
||||
private:
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<MainWindowConstructor>;
|
||||
#endif
|
||||
protected:
|
||||
|
||||
void InitializeComponents()
|
||||
{
|
||||
if (InitializeFromResource())
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
::helloworld::MainWindow* __vwsn_precompile_0 = static_cast<::helloworld::MainWindow*>(nullptr);
|
||||
::vl::presentation::controls::GuiLabel* __vwsn_precompile_1 = static_cast<::vl::presentation::controls::GuiLabel*>(nullptr);
|
||||
::vl::presentation::compositions::GuiBoundsComposition* __vwsn_precompile_2 = static_cast<::vl::presentation::compositions::GuiBoundsComposition*>(nullptr);
|
||||
void __vwsn_initialize_instance_(::helloworld::MainWindow* __vwsn_this_, ::vl::presentation::GuiResourcePathResolver* __vwsn_resolver_);
|
||||
public:
|
||||
MainWindow_()
|
||||
:vl::presentation::GuiInstancePartialClass<::vl::presentation::controls::GuiWindow>(L"helloworld::MainWindow")
|
||||
,::vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle())
|
||||
{
|
||||
}
|
||||
MainWindowConstructor();
|
||||
};
|
||||
|
||||
}
|
||||
namespace vl
|
||||
{
|
||||
namespace reflection
|
||||
class MainWindow : public ::vl::presentation::controls::GuiWindow, public ::helloworld::MainWindowConstructor, public ::vl::reflection::Description<MainWindow>
|
||||
{
|
||||
namespace description
|
||||
{
|
||||
DECL_TYPE_INFO(helloworld::MainWindow)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace helloworld
|
||||
{
|
||||
class MainWindow : public helloworld::MainWindow_<helloworld::MainWindow>
|
||||
{
|
||||
friend class helloworld::MainWindow_<helloworld::MainWindow>;
|
||||
friend struct vl::reflection::description::CustomTypeDescriptorSelector<helloworld::MainWindow>;
|
||||
protected:
|
||||
|
||||
// #region CLASS_MEMBER_GUIEVENT_HANDLER (DO NOT PUT OTHER CONTENT IN THIS #region.)
|
||||
void OnCreate();
|
||||
void OnDestroy();
|
||||
// #endregion CLASS_MEMBER_GUIEVENT_HANDLER
|
||||
friend class ::helloworld::MainWindowConstructor;
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<MainWindow>;
|
||||
#endif
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow();
|
||||
};
|
||||
|
||||
}
|
||||
/***********************************************************************
|
||||
Global Variables and Functions
|
||||
***********************************************************************/
|
||||
|
||||
namespace vl_workflow_global
|
||||
{
|
||||
class HelloWorld
|
||||
{
|
||||
public:
|
||||
|
||||
static HelloWorld& Instance();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#if defined( _MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
@@ -73,24 +73,34 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\Import\GacUI.cpp">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\GacUIReflection.cpp">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\GacUIWindows.cpp">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\Vlpp.cpp">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\VlppWorkflow.cpp">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\Import\GacUI.h" />
|
||||
<ClInclude Include="..\..\..\Import\GacUIReflection.h" />
|
||||
<ClInclude Include="..\..\..\Import\GacUIWindows.h" />
|
||||
<ClInclude Include="..\..\..\Import\Vlpp.h" />
|
||||
<ClInclude Include="..\..\..\Import\VlppWorkflow.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GacUILite\GacUILite.vcxproj">
|
||||
<Project>{96c559ca-9718-4bec-a053-28a0ab6a8ca2}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -21,6 +21,15 @@
|
||||
<ClCompile Include="..\..\..\Import\VlppWorkflow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\GacUI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\GacUIWindows.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\Import\Vlpp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\Import\GacUIReflection.h">
|
||||
@@ -29,5 +38,14 @@
|
||||
<ClInclude Include="..\..\..\Import\VlppWorkflow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\Import\GacUI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\Import\GacUIWindows.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\Import\Vlpp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -46,7 +46,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@@ -62,7 +62,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions);VCZH_DEBUG_NO_REFLECTION</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
||||
Reference in New Issue
Block a user