mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-09-27 18:59:19 +08:00
Fixed all tutorials!
This commit is contained in:
+119
-101
@@ -4723,62 +4723,67 @@ namespace vl
|
||||
using namespace reflection::description;
|
||||
using namespace templates;
|
||||
|
||||
Value ReadProperty(const Value& thisObject, const WString& propertyName)
|
||||
template<typename T>
|
||||
struct DefaultValueOf
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (!thisObject.IsNull() && propertyName != L"")
|
||||
static T Get()
|
||||
{
|
||||
auto td = thisObject.GetTypeDescriptor();
|
||||
auto info = td->GetPropertyByName(propertyName, true);
|
||||
if (info && info->IsReadable())
|
||||
{
|
||||
return info->GetValue(thisObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
return TypedValueSerializerProvider<T>::GetDefaultValue();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct DefaultValueOf<Ptr<T>>
|
||||
{
|
||||
static Ptr<T> Get()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct DefaultValueOf<Value>
|
||||
{
|
||||
static Value Get()
|
||||
{
|
||||
return Value();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
T ReadProperty(const Value& thisObject, const ItemProperty<T>& propertyName)
|
||||
{
|
||||
if (!thisObject.IsNull() && propertyName)
|
||||
{
|
||||
return propertyName(thisObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
return DefaultValueOf<T>::Get();
|
||||
}
|
||||
return thisObject;
|
||||
#else
|
||||
CHECK_FAIL(L"ReadProperty(const Value&, const WString&)#This function cannot be called without reflection enabled.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void WriteProperty(Value& thisObject, const WString& propertyName, const Value& newValue)
|
||||
template<typename T>
|
||||
T ReadProperty(const Value& thisObject, const WritableItemProperty<T>& propertyName)
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (!thisObject.IsNull() && propertyName != L"")
|
||||
auto defaultValue = DefaultValueOf<T>::Get();
|
||||
if (!thisObject.IsNull() && propertyName)
|
||||
{
|
||||
auto td = thisObject.GetTypeDescriptor();
|
||||
auto info = td->GetPropertyByName(propertyName, true);
|
||||
if (info && info->IsWritable())
|
||||
{
|
||||
info->SetValue(thisObject, newValue);
|
||||
}
|
||||
return propertyName(thisObject, defaultValue, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
#else
|
||||
CHECK_FAIL(L"WriteProperty(const Value&, const WString&, const Value&)#This function cannot be called without reflection enabled.");
|
||||
#endif
|
||||
}
|
||||
|
||||
WString GetValueText(const Value& value)
|
||||
template<typename T>
|
||||
void WriteProperty(const Value& thisObject, const WritableItemProperty<T>& propertyName, const T& value)
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (auto td = value.GetTypeDescriptor())
|
||||
if (!thisObject.IsNull() && propertyName)
|
||||
{
|
||||
if (auto st = td->GetSerializableType())
|
||||
{
|
||||
WString result;
|
||||
st->Serialize(value, result);
|
||||
return result;
|
||||
}
|
||||
return L"<" + td->GetTypeName() + L">";
|
||||
propertyName(thisObject, value, true);
|
||||
}
|
||||
return L"";
|
||||
#else
|
||||
CHECK_FAIL(L"GetValueText(const Value&)#This function cannot be called without reflection enabled.");
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -4916,7 +4921,7 @@ GuiBindableTextList::ItemSource
|
||||
{
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount())
|
||||
{
|
||||
return GetValueText(ReadProperty(itemSource->Get(itemIndex), textProperty));
|
||||
return ReadProperty(itemSource->Get(itemIndex), textProperty);
|
||||
}
|
||||
}
|
||||
return L"";
|
||||
@@ -4924,21 +4929,13 @@ GuiBindableTextList::ItemSource
|
||||
|
||||
bool GuiBindableTextList::ItemSource::GetChecked(vint itemIndex)
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (itemSource)
|
||||
{
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount())
|
||||
{
|
||||
auto value = ReadProperty(itemSource->Get(itemIndex), checkedProperty);
|
||||
if (value.GetTypeDescriptor() == description::GetTypeDescriptor<bool>())
|
||||
{
|
||||
return UnboxValue<bool>(value);
|
||||
}
|
||||
return ReadProperty(itemSource->Get(itemIndex), checkedProperty);
|
||||
}
|
||||
}
|
||||
#else
|
||||
CHECK_FAIL(L"GuiBindableTextList::ItemSource::GetChecked(vint)#This function cannot be called without reflection enabled.");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4949,7 +4946,7 @@ GuiBindableTextList::ItemSource
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount())
|
||||
{
|
||||
auto thisValue = itemSource->Get(itemIndex);
|
||||
WriteProperty(thisValue, checkedProperty, BoxValue(value));
|
||||
WriteProperty(thisValue, checkedProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4981,12 +4978,12 @@ GuiBindableTextList
|
||||
itemSource->SetItemSource(_itemSource);
|
||||
}
|
||||
|
||||
const WString& GuiBindableTextList::GetTextProperty()
|
||||
ItemProperty<WString> GuiBindableTextList::GetTextProperty()
|
||||
{
|
||||
return itemSource->textProperty;
|
||||
}
|
||||
|
||||
void GuiBindableTextList::SetTextProperty(const WString& value)
|
||||
void GuiBindableTextList::SetTextProperty(const ItemProperty<WString>& value)
|
||||
{
|
||||
if (itemSource->textProperty != value)
|
||||
{
|
||||
@@ -4996,12 +4993,12 @@ GuiBindableTextList
|
||||
}
|
||||
}
|
||||
|
||||
const WString& GuiBindableTextList::GetCheckedProperty()
|
||||
WritableItemProperty<bool> GuiBindableTextList::GetCheckedProperty()
|
||||
{
|
||||
return itemSource->checkedProperty;
|
||||
}
|
||||
|
||||
void GuiBindableTextList::SetCheckedProperty(const WString& value)
|
||||
void GuiBindableTextList::SetCheckedProperty(const WritableItemProperty<bool>& value)
|
||||
{
|
||||
if (itemSource->checkedProperty != value)
|
||||
{
|
||||
@@ -5197,8 +5194,7 @@ GuiBindableListView::ItemSource
|
||||
{
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount())
|
||||
{
|
||||
auto value = ReadProperty(itemSource->Get(itemIndex), smallImageProperty);
|
||||
return value.GetSharedPtr().Cast<GuiImageData>();
|
||||
return ReadProperty(itemSource->Get(itemIndex), smallImageProperty);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -5210,8 +5206,7 @@ GuiBindableListView::ItemSource
|
||||
{
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount())
|
||||
{
|
||||
auto value = ReadProperty(itemSource->Get(itemIndex), largeImageProperty);
|
||||
return value.GetSharedPtr().Cast<GuiImageData>();
|
||||
return ReadProperty(itemSource->Get(itemIndex), largeImageProperty);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -5223,7 +5218,7 @@ GuiBindableListView::ItemSource
|
||||
{
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount() && columns.Count()>0)
|
||||
{
|
||||
return GetValueText(ReadProperty(itemSource->Get(itemIndex), columns[0]->GetTextProperty()));
|
||||
return ReadProperty(itemSource->Get(itemIndex), columns[0]->GetTextProperty());
|
||||
}
|
||||
}
|
||||
return L"";
|
||||
@@ -5235,7 +5230,7 @@ GuiBindableListView::ItemSource
|
||||
{
|
||||
if (0 <= itemIndex && itemIndex < itemSource->GetCount() && 0 <= index && index < columns.Count() - 1)
|
||||
{
|
||||
return GetValueText(ReadProperty(itemSource->Get(itemIndex), columns[index + 1]->GetTextProperty()));
|
||||
return ReadProperty(itemSource->Get(itemIndex), columns[index + 1]->GetTextProperty());
|
||||
}
|
||||
}
|
||||
return L"";
|
||||
@@ -5378,12 +5373,12 @@ GuiBindableListView
|
||||
itemSource->SetItemSource(_itemSource);
|
||||
}
|
||||
|
||||
const WString& GuiBindableListView::GetLargeImageProperty()
|
||||
ItemProperty<Ptr<GuiImageData>> GuiBindableListView::GetLargeImageProperty()
|
||||
{
|
||||
return itemSource->largeImageProperty;
|
||||
}
|
||||
|
||||
void GuiBindableListView::SetLargeImageProperty(const WString& value)
|
||||
void GuiBindableListView::SetLargeImageProperty(const ItemProperty<Ptr<GuiImageData>>& value)
|
||||
{
|
||||
if (itemSource->largeImageProperty != value)
|
||||
{
|
||||
@@ -5393,12 +5388,12 @@ GuiBindableListView
|
||||
}
|
||||
}
|
||||
|
||||
const WString& GuiBindableListView::GetSmallImageProperty()
|
||||
ItemProperty<Ptr<GuiImageData>> GuiBindableListView::GetSmallImageProperty()
|
||||
{
|
||||
return itemSource->smallImageProperty;
|
||||
}
|
||||
|
||||
void GuiBindableListView::SetSmallImageProperty(const WString& value)
|
||||
void GuiBindableListView::SetSmallImageProperty(const ItemProperty<Ptr<GuiImageData>>& value)
|
||||
{
|
||||
if (itemSource->smallImageProperty != value)
|
||||
{
|
||||
@@ -5421,15 +5416,12 @@ GuiBindableTreeView::ItemSourceNode
|
||||
|
||||
void GuiBindableTreeView::ItemSourceNode::PrepareChildren()
|
||||
{
|
||||
#ifndef VCZH_DEBUG_NO_REFLECTION
|
||||
if (!childrenVirtualList)
|
||||
{
|
||||
auto value = ReadProperty(itemSource, rootProvider->childrenProperty);
|
||||
if (auto td = value.GetTypeDescriptor())
|
||||
if (auto value = ReadProperty(itemSource, rootProvider->childrenProperty))
|
||||
{
|
||||
if (td->CanConvertTo(description::GetTypeDescriptor<IValueObservableList>()))
|
||||
if (auto ol = value.Cast<IValueObservableList>())
|
||||
{
|
||||
auto ol = UnboxValue<Ptr<IValueObservableList>>(value);
|
||||
itemChangedEventHandler = ol->ItemChanged.Add([this](vint start, vint oldCount, vint newCount)
|
||||
{
|
||||
callback->OnBeforeItemModified(this, start, oldCount, newCount);
|
||||
@@ -5444,14 +5436,13 @@ GuiBindableTreeView::ItemSourceNode
|
||||
});
|
||||
childrenVirtualList = ol;
|
||||
}
|
||||
else if (td->CanConvertTo(description::GetTypeDescriptor<IValueReadonlyList>()))
|
||||
else if (auto rl = value.Cast<IValueReadonlyList>())
|
||||
{
|
||||
childrenVirtualList = UnboxValue<Ptr<IValueReadonlyList>>(value);
|
||||
childrenVirtualList = rl;
|
||||
}
|
||||
else if (td->CanConvertTo(description::GetTypeDescriptor<IValueEnumerable>()))
|
||||
else
|
||||
{
|
||||
auto e = UnboxValue<Ptr<IValueEnumerable>>(value);
|
||||
childrenVirtualList = IValueList::Create(GetLazyList<Value>(e));
|
||||
childrenVirtualList = IValueList::Create(GetLazyList<Value>(value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5468,9 +5459,6 @@ GuiBindableTreeView::ItemSourceNode
|
||||
children.Add(node);
|
||||
}
|
||||
}
|
||||
#else
|
||||
CHECK_FAIL(L"GuiBindableTreeView::ItemSourceNode::PrepareChildren()#This function cannot be called without reflection enabled.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void GuiBindableTreeView::ItemSourceNode::UnprepareChildren()
|
||||
@@ -5680,8 +5668,7 @@ GuiBindableTreeView::ItemSource
|
||||
{
|
||||
if (auto itemSourceNode = dynamic_cast<ItemSourceNode*>(node))
|
||||
{
|
||||
auto value = ReadProperty(itemSourceNode->GetItemSource(), imageProperty);
|
||||
return value.GetSharedPtr().Cast<GuiImageData>();
|
||||
return ReadProperty(itemSourceNode->GetItemSource(), imageProperty);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -5690,7 +5677,7 @@ GuiBindableTreeView::ItemSource
|
||||
{
|
||||
if (auto itemSourceNode = dynamic_cast<ItemSourceNode*>(node))
|
||||
{
|
||||
return GetValueText(ReadProperty(itemSourceNode->GetItemSource(), textProperty));
|
||||
return ReadProperty(itemSourceNode->GetItemSource(), textProperty);
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
@@ -5723,12 +5710,12 @@ GuiBindableTreeView
|
||||
itemSource->SetItemSource(_itemSource);
|
||||
}
|
||||
|
||||
const WString& GuiBindableTreeView::GetTextProperty()
|
||||
ItemProperty<WString> GuiBindableTreeView::GetTextProperty()
|
||||
{
|
||||
return itemSource->textProperty;
|
||||
}
|
||||
|
||||
void GuiBindableTreeView::SetTextProperty(const WString& value)
|
||||
void GuiBindableTreeView::SetTextProperty(const ItemProperty<WString>& value)
|
||||
{
|
||||
if (itemSource->textProperty != value)
|
||||
{
|
||||
@@ -5738,12 +5725,12 @@ GuiBindableTreeView
|
||||
}
|
||||
}
|
||||
|
||||
const WString& GuiBindableTreeView::GetImageProperty()
|
||||
ItemProperty<Ptr<GuiImageData>> GuiBindableTreeView::GetImageProperty()
|
||||
{
|
||||
return itemSource->imageProperty;
|
||||
}
|
||||
|
||||
void GuiBindableTreeView::SetImageProperty(const WString& value)
|
||||
void GuiBindableTreeView::SetImageProperty(const ItemProperty<Ptr<GuiImageData>>& value)
|
||||
{
|
||||
if (itemSource->imageProperty != value)
|
||||
{
|
||||
@@ -5753,12 +5740,12 @@ GuiBindableTreeView
|
||||
}
|
||||
}
|
||||
|
||||
const WString& GuiBindableTreeView::GetChildrenProperty()
|
||||
ItemProperty<Ptr<IValueEnumerable>> GuiBindableTreeView::GetChildrenProperty()
|
||||
{
|
||||
return itemSource->childrenProperty;
|
||||
}
|
||||
|
||||
void GuiBindableTreeView::SetChildrenProperty(const WString& value)
|
||||
void GuiBindableTreeView::SetChildrenProperty(const ItemProperty<Ptr<IValueEnumerable>>& value)
|
||||
{
|
||||
if (itemSource->childrenProperty != value)
|
||||
{
|
||||
@@ -5814,7 +5801,14 @@ GuiBindableDataColumn
|
||||
|
||||
WString BindableDataColumn::GetCellText(vint row)
|
||||
{
|
||||
return GetValueText(GetCellValue(row));
|
||||
if (dataProvider->itemSource)
|
||||
{
|
||||
if (0 <= row && row < dataProvider->itemSource->GetCount())
|
||||
{
|
||||
return ReadProperty(dataProvider->itemSource->Get(row), textProperty);
|
||||
}
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
|
||||
description::Value BindableDataColumn::GetCellValue(vint row)
|
||||
@@ -5840,13 +5834,32 @@ GuiBindableDataColumn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemProperty<WString> BindableDataColumn::GetTextProperty()
|
||||
{
|
||||
return textProperty;
|
||||
}
|
||||
|
||||
const WString& BindableDataColumn::GetValueProperty()
|
||||
void BindableDataColumn::SetTextProperty(const ItemProperty<WString>& value)
|
||||
{
|
||||
if (textProperty != value)
|
||||
{
|
||||
textProperty = value;
|
||||
if (commandExecutor)
|
||||
{
|
||||
commandExecutor->OnDataProviderColumnChanged();
|
||||
}
|
||||
compositions::GuiEventArgs arguments;
|
||||
TextPropertyChanged.Execute(arguments);
|
||||
}
|
||||
}
|
||||
|
||||
WritableItemProperty<Value> BindableDataColumn::GetValueProperty()
|
||||
{
|
||||
return valueProperty;
|
||||
}
|
||||
|
||||
void BindableDataColumn::SetValueProperty(const WString& value)
|
||||
void BindableDataColumn::SetValueProperty(const WritableItemProperty<Value>& value)
|
||||
{
|
||||
if (valueProperty != value)
|
||||
{
|
||||
@@ -9307,6 +9320,11 @@ GuiListControl
|
||||
GuiSelectableListControl
|
||||
***********************************************************************/
|
||||
|
||||
void GuiSelectableListControl::NotifySelectionChanged()
|
||||
{
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
}
|
||||
|
||||
void GuiSelectableListControl::OnItemModified(vint start, vint count, vint newCount)
|
||||
{
|
||||
GuiListControl::OnItemModified(start, count, newCount);
|
||||
@@ -9493,7 +9511,7 @@ GuiSelectableListControl
|
||||
}
|
||||
selectedItems.Add(itemIndex);
|
||||
OnItemSelectionChanged(itemIndex, value);
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
NotifySelectionChanged();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -9501,7 +9519,7 @@ GuiSelectableListControl
|
||||
if(selectedItems.Remove(itemIndex))
|
||||
{
|
||||
OnItemSelectionChanged(itemIndex, value);
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
NotifySelectionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9531,7 +9549,7 @@ GuiSelectableListControl
|
||||
}
|
||||
selectedItemIndexEnd=itemIndex;
|
||||
SetMultipleItemsSelectedSilently(selectedItemIndexStart, selectedItemIndexEnd, true);
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
NotifySelectionChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -9547,7 +9565,7 @@ GuiSelectableListControl
|
||||
selectedItems.RemoveAt(index);
|
||||
}
|
||||
OnItemSelectionChanged(itemIndex, index==-1);
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
NotifySelectionChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -9555,7 +9573,7 @@ GuiSelectableListControl
|
||||
OnItemSelectionCleared();
|
||||
selectedItems.Add(itemIndex);
|
||||
OnItemSelectionChanged(itemIndex, true);
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
NotifySelectionChanged();
|
||||
}
|
||||
selectedItemIndexStart=itemIndex;
|
||||
selectedItemIndexEnd=itemIndex;
|
||||
@@ -9622,7 +9640,7 @@ GuiSelectableListControl
|
||||
{
|
||||
selectedItems.Clear();
|
||||
OnItemSelectionCleared();
|
||||
SelectionChanged.Execute(GetNotifyEventArguments());
|
||||
NotifySelectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12266,12 +12284,12 @@ ListViewColumn
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
const WString& ListViewColumn::GetTextProperty()
|
||||
ItemProperty<WString> ListViewColumn::GetTextProperty()
|
||||
{
|
||||
return textProperty;
|
||||
}
|
||||
|
||||
void ListViewColumn::SetTextProperty(const WString& value)
|
||||
void ListViewColumn::SetTextProperty(const ItemProperty<WString>& value)
|
||||
{
|
||||
textProperty = value;
|
||||
NotifyUpdate();
|
||||
|
||||
+47
-28
@@ -10901,6 +10901,7 @@ Selectable List Control
|
||||
vint selectedItemIndexStart;
|
||||
vint selectedItemIndexEnd;
|
||||
|
||||
void NotifySelectionChanged();
|
||||
void OnItemModified(vint start, vint count, vint newCount)override;
|
||||
void OnStyleInstalled(vint itemIndex, IItemStyleController* style)override;
|
||||
void OnStyleUninstalled(IItemStyleController* style)override;
|
||||
@@ -11692,6 +11693,12 @@ namespace vl
|
||||
{
|
||||
class GuiListViewBase;
|
||||
|
||||
template<typename T>
|
||||
using ItemProperty = Func<T(const reflection::description::Value&)>;
|
||||
|
||||
template<typename T>
|
||||
using WritableItemProperty = Func<T(const reflection::description::Value&, T, bool)>;
|
||||
|
||||
namespace list
|
||||
{
|
||||
|
||||
@@ -12424,7 +12431,7 @@ ListView
|
||||
protected:
|
||||
ListViewColumns* owner;
|
||||
WString text;
|
||||
WString textProperty;
|
||||
ItemProperty<WString> textProperty;
|
||||
vint size;
|
||||
GuiMenu* dropdownPopup;
|
||||
GuiListViewColumnHeader::ColumnSortingState sortingState;
|
||||
@@ -12444,10 +12451,10 @@ ListView
|
||||
void SetText(const WString& value);
|
||||
/// <summary>Get the text property of this item.</summary>
|
||||
/// <returns>The text property of this item.</returns>
|
||||
const WString& GetTextProperty();
|
||||
ItemProperty<WString> GetTextProperty();
|
||||
/// <summary>Set the text property of this item.</summary>
|
||||
/// <param name="value">The text property of this item.</param>
|
||||
void SetTextProperty(const WString& value);
|
||||
void SetTextProperty(const ItemProperty<WString>& value);
|
||||
/// <summary>Get the size of this item.</summary>
|
||||
/// <returns>The size of this item.</returns>
|
||||
vint GetSize();
|
||||
@@ -16745,8 +16752,8 @@ GuiBindableTextList
|
||||
Ptr<description::IValueReadonlyList> itemSource;
|
||||
|
||||
public:
|
||||
WString textProperty;
|
||||
WString checkedProperty;
|
||||
ItemProperty<WString> textProperty;
|
||||
WritableItemProperty<bool> checkedProperty;
|
||||
|
||||
public:
|
||||
ItemSource();
|
||||
@@ -16804,17 +16811,17 @@ GuiBindableTextList
|
||||
|
||||
/// <summary>Get the text property name to get the item text from an item.</summary>
|
||||
/// <returns>The text property name.</returns>
|
||||
const WString& GetTextProperty();
|
||||
ItemProperty<WString> GetTextProperty();
|
||||
/// <summary>Set the text property name to get the item text from an item.</summary>
|
||||
/// <param name="value">The text property name.</param>
|
||||
void SetTextProperty(const WString& value);
|
||||
void SetTextProperty(const ItemProperty<WString>& value);
|
||||
|
||||
/// <summary>Get the checked property name to get the check state from an item.</summary>
|
||||
/// <returns>The checked property name.</returns>
|
||||
const WString& GetCheckedProperty();
|
||||
WritableItemProperty<bool> GetCheckedProperty();
|
||||
/// <summary>Set the checked property name to get the check state from an item.</summary>
|
||||
/// <param name="value">The checked property name.</param>
|
||||
void SetCheckedProperty(const WString& value);
|
||||
void SetCheckedProperty(const WritableItemProperty<bool>& value);
|
||||
|
||||
/// <summary>Get the selected item.</summary>
|
||||
/// <returns>Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned.</returns>
|
||||
@@ -16845,8 +16852,8 @@ GuiBindableListView
|
||||
Ptr<description::IValueReadonlyList> itemSource;
|
||||
|
||||
public:
|
||||
WString largeImageProperty;
|
||||
WString smallImageProperty;
|
||||
ItemProperty<Ptr<GuiImageData>> largeImageProperty;
|
||||
ItemProperty<Ptr<GuiImageData>> smallImageProperty;
|
||||
|
||||
public:
|
||||
ItemSource();
|
||||
@@ -16932,17 +16939,17 @@ GuiBindableListView
|
||||
|
||||
/// <summary>Get the large image property name to get the large image from an item.</summary>
|
||||
/// <returns>The large image property name.</returns>
|
||||
const WString& GetLargeImageProperty();
|
||||
ItemProperty<Ptr<GuiImageData>> GetLargeImageProperty();
|
||||
/// <summary>Set the large image property name to get the large image from an item.</summary>
|
||||
/// <param name="value">The large image property name.</param>
|
||||
void SetLargeImageProperty(const WString& value);
|
||||
void SetLargeImageProperty(const ItemProperty<Ptr<GuiImageData>>& value);
|
||||
|
||||
/// <summary>Get the small image property name to get the small image from an item.</summary>
|
||||
/// <returns>The small image property name.</returns>
|
||||
const WString& GetSmallImageProperty();
|
||||
ItemProperty<Ptr<GuiImageData>> GetSmallImageProperty();
|
||||
/// <summary>Set the small image property name to get the small image from an item.</summary>
|
||||
/// <param name="value">The small image property name.</param>
|
||||
void SetSmallImageProperty(const WString& value);
|
||||
void SetSmallImageProperty(const ItemProperty<Ptr<GuiImageData>>& value);
|
||||
|
||||
/// <summary>Get the selected item.</summary>
|
||||
/// <returns>Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned.</returns>
|
||||
@@ -16956,6 +16963,7 @@ GuiBindableTreeView
|
||||
/// <summary>A bindable Tree view control.</summary>
|
||||
class GuiBindableTreeView : public GuiVirtualTreeView, public Description<GuiBindableTreeView>
|
||||
{
|
||||
using IValueEnumerable = reflection::description::IValueEnumerable;
|
||||
protected:
|
||||
class ItemSource;
|
||||
|
||||
@@ -17006,9 +17014,9 @@ GuiBindableTreeView
|
||||
{
|
||||
friend class ItemSourceNode;
|
||||
public:
|
||||
WString textProperty;
|
||||
WString imageProperty;
|
||||
WString childrenProperty;
|
||||
ItemProperty<WString> textProperty;
|
||||
ItemProperty<Ptr<GuiImageData>> imageProperty;
|
||||
ItemProperty<Ptr<IValueEnumerable>> childrenProperty;
|
||||
Ptr<ItemSourceNode> rootNode;
|
||||
|
||||
public:
|
||||
@@ -17065,24 +17073,24 @@ GuiBindableTreeView
|
||||
|
||||
/// <summary>Get the text property name to get the item text from an item.</summary>
|
||||
/// <returns>The text property name.</returns>
|
||||
const WString& GetTextProperty();
|
||||
ItemProperty<WString> GetTextProperty();
|
||||
/// <summary>Set the text property name to get the item text from an item.</summary>
|
||||
/// <param name="value">The text property name.</param>
|
||||
void SetTextProperty(const WString& value);
|
||||
void SetTextProperty(const ItemProperty<WString>& value);
|
||||
|
||||
/// <summary>Get the image property name to get the image from an item.</summary>
|
||||
/// <returns>The image property name.</returns>
|
||||
const WString& GetImageProperty();
|
||||
ItemProperty<Ptr<GuiImageData>> GetImageProperty();
|
||||
/// <summary>Set the image property name to get the image from an item.</summary>
|
||||
/// <param name="value">The image property name.</param>
|
||||
void SetImageProperty(const WString& value);
|
||||
void SetImageProperty(const ItemProperty<Ptr<GuiImageData>>& value);
|
||||
|
||||
/// <summary>Get the children property name to get the children from an item.</summary>
|
||||
/// <returns>The children property name.</returns>
|
||||
const WString& GetChildrenProperty();
|
||||
ItemProperty<Ptr<IValueEnumerable>> GetChildrenProperty();
|
||||
/// <summary>Set the children property name to get the children from an item.</summary>
|
||||
/// <param name="value">The children property name.</param>
|
||||
void SetChildrenProperty(const WString& value);
|
||||
void SetChildrenProperty(const ItemProperty<Ptr<IValueEnumerable>>& value);
|
||||
|
||||
/// <summary>Get the selected item.</summary>
|
||||
/// <returns>Returns the selected item. If there are multiple selected items, or there is no selected item, null will be returned.</returns>
|
||||
@@ -17101,9 +17109,12 @@ GuiBindableDataGrid
|
||||
class BindableDataColumn : public StructuredColummProviderBase, public Description<BindableDataColumn>
|
||||
{
|
||||
friend class BindableDataProvider;
|
||||
|
||||
using Value = reflection::description::Value;
|
||||
protected:
|
||||
BindableDataProvider* dataProvider;
|
||||
WString valueProperty;
|
||||
ItemProperty<WString> textProperty;
|
||||
WritableItemProperty<Value> valueProperty;
|
||||
|
||||
public:
|
||||
BindableDataColumn();
|
||||
@@ -17111,6 +17122,7 @@ GuiBindableDataGrid
|
||||
|
||||
/// <summary>Value property name changed event.</summary>
|
||||
compositions::GuiNotifyEvent ValuePropertyChanged;
|
||||
compositions::GuiNotifyEvent TextPropertyChanged;
|
||||
|
||||
void SaveCellData(vint row, IDataEditor* dataEditor)override;
|
||||
WString GetCellText(vint row)override;
|
||||
@@ -17123,13 +17135,20 @@ GuiBindableDataGrid
|
||||
/// <param name="row">The row index of the item.</param>
|
||||
/// <param name="value">The value property name.</param>
|
||||
void SetCellValue(vint row, description::Value value);
|
||||
|
||||
/// <summary>Get the text property name to get the cell text from an item.</summary>
|
||||
/// <returns>The text property name.</returns>
|
||||
ItemProperty<WString> GetTextProperty();
|
||||
/// <summary>Set the text property name to get the cell text from an item.</summary>
|
||||
/// <param name="value">The text property name.</param>
|
||||
void SetTextProperty(const ItemProperty<WString>& value);
|
||||
|
||||
/// <summary>Get the value property name to get the cell value from an item.</summary>
|
||||
/// <returns>The value property name.</returns>
|
||||
const WString& GetValueProperty();
|
||||
/// <summary>Set the value property name to get the cell value to an item.</summary>
|
||||
WritableItemProperty<Value> GetValueProperty();
|
||||
/// <summary>Set the value property name to get the cell value from an item.</summary>
|
||||
/// <param name="value">The value property name.</param>
|
||||
void SetValueProperty(const WString& value);
|
||||
void SetValueProperty(const WritableItemProperty<Value>& value);
|
||||
|
||||
/// <summary>Get the view model context which will be used as a view model to create visualizers and editors.</summary>
|
||||
/// <returns>The value model context.</returns>
|
||||
|
||||
+450
-116
File diff suppressed because it is too large
Load Diff
+73
-52
@@ -253,9 +253,11 @@ Instance Representation
|
||||
|
||||
typedef collections::Dictionary<GlobalStringKey, Ptr<SetterValue>> SetteValuerMap;
|
||||
typedef collections::Dictionary<GlobalStringKey, Ptr<EventValue>> EventHandlerMap;
|
||||
typedef collections::Dictionary<GlobalStringKey, WString> EnvironmentVariableMap;
|
||||
public:
|
||||
SetteValuerMap setters; // empty key means default property
|
||||
EventHandlerMap eventHandlers;
|
||||
EnvironmentVariableMap environmentVariables;
|
||||
GlobalStringKey instanceName;
|
||||
|
||||
void Accept(IVisitor* visitor)override{visitor->Visit(this);}
|
||||
@@ -326,12 +328,13 @@ Instance Context
|
||||
WString name;
|
||||
WString binding;
|
||||
|
||||
bool IsCtorName(){ return category==L"" && name!=L"" && binding==L""; }
|
||||
bool IsReferenceAttributeName(){ return namespaceName==L"" && category==L"ref" && name!=L"" && binding==L""; }
|
||||
bool IsPropertyAttributeName(){ return namespaceName==L"" && category==L"" && name!=L""; }
|
||||
bool IsPropertyElementName(){ return namespaceName==L"" && category==L"att" && name!=L""; }
|
||||
bool IsEventAttributeName(){ return namespaceName==L"" && category==L"ev" && name!=L""; }
|
||||
bool IsEventElementName(){ return namespaceName==L"" && category==L"ev" && name!=L""; }
|
||||
bool IsCtorName() { return category == L"" && name != L"" && binding == L""; }
|
||||
bool IsReferenceAttributeName() { return namespaceName == L"" && category == L"ref" && name != L"" && binding == L""; }
|
||||
bool IsEnvironmentAttributeName() { return namespaceName == L"" && category == L"env" && name != L""; }
|
||||
bool IsPropertyAttributeName() { return namespaceName == L"" && category == L"" && name != L""; }
|
||||
bool IsPropertyElementName() { return namespaceName == L"" && category == L"att" && name != L""; }
|
||||
bool IsEventAttributeName() { return namespaceName == L"" && category == L"ev" && name != L""; }
|
||||
bool IsEventElementName() { return namespaceName == L"" && category == L"ev" && name != L""; }
|
||||
};
|
||||
public:
|
||||
Ptr<GuiConstructorRepr> instance;
|
||||
@@ -409,6 +412,11 @@ namespace vl
|
||||
{
|
||||
using namespace reflection;
|
||||
|
||||
namespace types
|
||||
{
|
||||
struct ResolvingResult;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Instance Loader
|
||||
***********************************************************************/
|
||||
@@ -509,11 +517,11 @@ Instance Loader
|
||||
virtual Ptr<GuiInstancePropertyInfo> GetPropertyType(const PropertyInfo& propertyInfo);
|
||||
|
||||
virtual bool CanCreate(const TypeInfo& typeInfo);
|
||||
virtual Ptr<workflow::WfBaseConstructorCall> CreateRootInstance(const TypeInfo& typeInfo, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> InitializeRootInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> CreateInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> AssignParameters(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfExpression> GetParameter(const PropertyInfo& propertyInfo, GlobalStringKey variableName, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfBaseConstructorCall> CreateRootInstance(types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> InitializeRootInstance(types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> CreateInstance(types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfStatement> AssignParameters(types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors);
|
||||
virtual Ptr<workflow::WfExpression> GetParameter(types::ResolvingResult& resolvingResult, const PropertyInfo& propertyInfo, GlobalStringKey variableName, collections::List<WString>& errors);
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
@@ -526,15 +534,15 @@ Instance Binder
|
||||
virtual GlobalStringKey GetBindingName() = 0;
|
||||
virtual bool ApplicableToConstructorArgument() = 0;
|
||||
virtual bool RequirePropertyExist() = 0;
|
||||
virtual Ptr<workflow::WfExpression> GenerateConstructorArgument(IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
virtual Ptr<workflow::WfStatement> GenerateInstallStatement(GlobalStringKey variableName, description::IPropertyInfo* propertyInfo, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
virtual Ptr<workflow::WfExpression> GenerateConstructorArgument(types::ResolvingResult& resolvingResult, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
virtual Ptr<workflow::WfStatement> GenerateInstallStatement(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, description::IPropertyInfo* propertyInfo, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
};
|
||||
|
||||
class IGuiInstanceEventBinder : public IDescriptable, public Description<IGuiInstanceEventBinder>
|
||||
{
|
||||
public:
|
||||
virtual GlobalStringKey GetBindingName() = 0;
|
||||
virtual Ptr<workflow::WfStatement> GenerateInstallStatement(GlobalStringKey variableName, description::IEventInfo* eventInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
virtual Ptr<workflow::WfStatement> GenerateInstallStatement(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, description::IEventInfo* eventInfo, const WString& code, collections::List<WString>& errors) = 0;
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
@@ -741,24 +749,26 @@ namespace vl
|
||||
typedef collections::Dictionary<GlobalStringKey, Ptr<description::ITypeInfo>> TypeOverrideMap;
|
||||
typedef collections::Dictionary<GuiValueRepr*, PropertyResolving> PropertyResolvingMap;
|
||||
typedef collections::List<WString> ErrorList;
|
||||
typedef collections::Group<GlobalStringKey, WString> EnvironmentVariableGroup;
|
||||
|
||||
struct ResolvingResult : public Object, public Description<ResolvingResult>
|
||||
{
|
||||
Ptr<GuiInstanceContext> context;
|
||||
reflection::description::ITypeDescriptor* rootTypeDescriptor = nullptr;
|
||||
collections::List<WString> sharedModules;
|
||||
Ptr<GuiInstanceContext> context; // compiling context
|
||||
reflection::description::ITypeDescriptor* rootTypeDescriptor = nullptr; // type of the context
|
||||
collections::List<WString> sharedModules; // code of all shared workflow scripts
|
||||
EnvironmentVariableGroup envVars; // current environment variable value stacks
|
||||
|
||||
Ptr<workflow::WfModule> moduleForValidate;
|
||||
Ptr<workflow::WfBlockStatement> moduleContent;
|
||||
Ptr<workflow::WfModule> moduleForValidate; // module skeleton for validating statements
|
||||
Ptr<workflow::WfBlockStatement> moduleContent; // placeholder in moduleForValidate for validating statements
|
||||
|
||||
collections::List<GlobalStringKey> referenceNames;
|
||||
collections::List<GlobalStringKey> referenceNames; // all reference names
|
||||
IGuiInstanceLoader::ArgumentMap rootCtorArguments;
|
||||
IGuiInstanceLoader* rootLoader = nullptr;
|
||||
IGuiInstanceLoader::TypeInfo rootTypeInfo;
|
||||
|
||||
VariableTypeInfoMap typeInfos;
|
||||
TypeOverrideMap typeOverrides;
|
||||
PropertyResolvingMap propertyResolvings;
|
||||
VariableTypeInfoMap typeInfos; // type of references
|
||||
TypeOverrideMap typeOverrides; // extra type information of references
|
||||
PropertyResolvingMap propertyResolvings; // information of property values which are calling constructors
|
||||
};
|
||||
}
|
||||
extern workflow::analyzer::WfLexicalScopeManager* Workflow_GetSharedManager();
|
||||
@@ -778,12 +788,12 @@ WorkflowCompiler (Parser)
|
||||
WorkflowCompiler (Installation)
|
||||
***********************************************************************/
|
||||
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallUriProperty(GlobalStringKey variableName, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& protocol, const WString& path, collections::List<WString>& errors);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallBindProperty(GlobalStringKey variableName, description::IPropertyInfo* propertyInfo, Ptr<workflow::WfExpression> bindExpression);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvalProperty(GlobalStringKey variableName, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, Ptr<workflow::WfExpression> evalExpression, collections::List<WString>& errors);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvent(GlobalStringKey variableName, description::IEventInfo* eventInfo, const WString& handlerName);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallUriProperty(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, const WString& protocol, const WString& path, collections::List<WString>& errors);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallBindProperty(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, description::IPropertyInfo* propertyInfo, Ptr<workflow::WfExpression> bindExpression);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvalProperty(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, IGuiInstanceLoader* loader, const IGuiInstanceLoader::PropertyInfo& prop, Ptr<GuiInstancePropertyInfo> propInfo, Ptr<workflow::WfExpression> evalExpression, collections::List<WString>& errors);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvent(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, description::IEventInfo* eventInfo, const WString& handlerName);
|
||||
extern Ptr<workflow::WfFunctionDeclaration> Workflow_GenerateEventHandler(description::IEventInfo* eventInfo);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvalEvent(GlobalStringKey variableName, description::IEventInfo* eventInfo, Ptr<workflow::WfStatement> evalStatement);
|
||||
extern Ptr<workflow::WfStatement> Workflow_InstallEvalEvent(types::ResolvingResult& resolvingResult, GlobalStringKey variableName, description::IEventInfo* eventInfo, Ptr<workflow::WfStatement> evalStatement);
|
||||
|
||||
/***********************************************************************
|
||||
WorkflowCompiler (Compile)
|
||||
@@ -835,6 +845,21 @@ WorkflowCompiler (Compile)
|
||||
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);
|
||||
|
||||
#define WORKFLOW_ENVIRONMENT_VARIABLE_ADD\
|
||||
FOREACH_INDEXER(GlobalStringKey, envVar, index, repr->environmentVariables.Keys())\
|
||||
{\
|
||||
auto value = repr->environmentVariables.Values()[index];\
|
||||
resolvingResult.envVars.Add(envVar, value);\
|
||||
}\
|
||||
|
||||
#define WORKFLOW_ENVIRONMENT_VARIABLE_REMOVE\
|
||||
FOREACH_INDEXER(GlobalStringKey, envVar, index, repr->environmentVariables.Keys())\
|
||||
{\
|
||||
auto value = repr->environmentVariables.Values()[index];\
|
||||
resolvingResult.envVars.Remove(envVar, value);\
|
||||
}\
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1210,8 +1235,17 @@ GuiVrtualTypeInstanceLoader
|
||||
return typeName == typeInfo.typeName;
|
||||
}
|
||||
|
||||
Ptr<workflow::WfExpression> CreateInstance_ControlTemplate(const TypeInfo& typeInfo, Ptr<workflow::WfExpression> controlTemplate, collections::List<WString>& errors)
|
||||
Ptr<workflow::WfExpression> CreateInstance_ControlTemplate(const TypeInfo& typeInfo, ArgumentMap& arguments, collections::List<WString>& errors)
|
||||
{
|
||||
Ptr<WfExpression> controlTemplate;
|
||||
{
|
||||
auto index = arguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
|
||||
if (index != -1)
|
||||
{
|
||||
controlTemplate = arguments.GetByIndex(index)[0].expression;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlTemplate)
|
||||
{
|
||||
if (auto controlTemplateTd = GetControlTemplateType(controlTemplate, typeInfo, errors))
|
||||
@@ -1236,40 +1270,27 @@ GuiVrtualTypeInstanceLoader
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<workflow::WfBaseConstructorCall> CreateRootInstance(const TypeInfo& typeInfo, ArgumentMap& arguments, collections::List<WString>& errors)override
|
||||
Ptr<workflow::WfBaseConstructorCall> CreateRootInstance(types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, ArgumentMap& arguments, collections::List<WString>& errors)override
|
||||
{
|
||||
auto controlType = TypeInfoRetriver<TControl>::CreateTypeInfo();
|
||||
auto index = arguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
|
||||
if (index != -1)
|
||||
if (auto createStyleExpr = CreateInstance_ControlTemplate(typeInfo, arguments, errors))
|
||||
{
|
||||
auto controlTemplate = arguments.GetByIndex(index)[0].expression;
|
||||
if (auto createStyleExpr = CreateInstance_ControlTemplate(typeInfo, controlTemplate, errors))
|
||||
{
|
||||
auto createControl = MakePtr<WfBaseConstructorCall>();
|
||||
createControl->type = GetTypeFromTypeInfo(controlType.Obj());
|
||||
createControl->arguments.Add(createStyleExpr);
|
||||
return createControl;
|
||||
}
|
||||
auto createControl = MakePtr<WfBaseConstructorCall>();
|
||||
createControl->type = GetTypeFromTypeInfo(TypeInfoRetriver<TControl>::CreateTypeInfo().Obj());
|
||||
createControl->arguments.Add(createStyleExpr);
|
||||
return createControl;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Ptr<workflow::WfStatement> CreateInstance(const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors)override
|
||||
Ptr<workflow::WfStatement> CreateInstance(types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, collections::List<WString>& errors)override
|
||||
{
|
||||
CHECK_ERROR(typeName == typeInfo.typeName, L"GuiTemplateControlInstanceLoader::CreateInstance# Wrong type info is provided.");
|
||||
vint indexControlTemplate = arguments.Keys().IndexOf(GlobalStringKey::_ControlTemplate);
|
||||
|
||||
Ptr<WfExpression> createStyleExpr;
|
||||
auto createStyleExpr = CreateInstance_ControlTemplate(typeInfo, arguments, errors);
|
||||
if (!createStyleExpr)
|
||||
{
|
||||
Ptr<WfExpression> controlTemplate;
|
||||
if (indexControlTemplate != -1)
|
||||
{
|
||||
controlTemplate = arguments.GetByIndex(indexControlTemplate)[0].expression;
|
||||
}
|
||||
if (!(createStyleExpr = CreateInstance_ControlTemplate(typeInfo, controlTemplate, errors)))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto block = MakePtr<WfBlockStatement>();
|
||||
|
||||
@@ -3059,6 +3059,7 @@ Type Declaration
|
||||
|
||||
CLASS_MEMBER_METHOD(GetCellValue, { L"row" })
|
||||
CLASS_MEMBER_METHOD(SetCellValue, { L"row" _ L"value" })
|
||||
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(TextProperty)
|
||||
CLASS_MEMBER_PROPERTY_GUIEVENT_FAST(ValueProperty)
|
||||
CLASS_MEMBER_PROPERTY_READONLY_FAST(ViewModelContext)
|
||||
END_CLASS_MEMBER(BindableDataColumn)
|
||||
|
||||
Reference in New Issue
Block a user