(NOT READY) Update release

This commit is contained in:
Zihan Chen
2017-06-22 23:21:01 -07:00
parent 496e042251
commit a3671237eb
22 changed files with 832 additions and 604 deletions
+2 -2
View File
@@ -10037,14 +10037,14 @@ ListViewColumns
void ListViewColumns::AfterInsert(vint index, const Ptr<ListViewColumn>& value)
{
ItemsBase<Ptr<ListViewColumn>>::AfterInsert(index, value);
collections::ObservableListBase<Ptr<ListViewColumn>>::AfterInsert(index, value);
value->owner = this;
}
void ListViewColumns::BeforeRemove(vint index, const Ptr<ListViewColumn>& value)
{
value->owner = 0;
ItemsBase<Ptr<ListViewColumn>>::BeforeRemove(index, value);
collections::ObservableListBase<Ptr<ListViewColumn>>::BeforeRemove(index, value);
}
void ListViewColumns::NotifyUpdateInternal(vint start, vint count, vint newCount)
+8 -248
View File
@@ -9165,246 +9165,6 @@ Basic Construction
{
}
};
namespace list
{
/***********************************************************************
List interface common implementation
***********************************************************************/
template<typename T, typename K=typename KeyType<T>::Type>
class ItemsBase : public Object, public virtual collections::IEnumerable<T>
{
protected:
collections::List<T, K> items;
virtual void NotifyUpdateInternal(vint start, vint count, vint newCount)
{
}
virtual bool QueryInsert(vint index, const T& value)
{
return true;
}
virtual void BeforeInsert(vint index, const T& value)
{
}
virtual void AfterInsert(vint index, const T& value)
{
}
virtual bool QueryRemove(vint index, const T& value)
{
return true;
}
virtual void BeforeRemove(vint index, const T& value)
{
}
virtual void AfterRemove(vint index, vint count)
{
}
public:
ItemsBase()
{
}
~ItemsBase()
{
}
collections::IEnumerator<T>* CreateEnumerator()const
{
return items.CreateEnumerator();
}
bool NotifyUpdate(vint start, vint count=1)
{
if(start<0 || start>=items.Count() || count<=0 || start+count>items.Count())
{
return false;
}
else
{
NotifyUpdateInternal(start, count, count);
return true;
}
}
bool Contains(const K& item)const
{
return items.Contains(item);
}
vint Count()const
{
return items.Count();
}
vint Count()
{
return items.Count();
}
const T& Get(vint index)const
{
return items.Get(index);
}
const T& operator[](vint index)const
{
return items.Get(index);
}
vint IndexOf(const K& item)const
{
return items.IndexOf(item);
}
vint Add(const T& item)
{
return Insert(items.Count(), item);
}
bool Remove(const K& item)
{
vint index=items.IndexOf(item);
if(index==-1) return false;
return RemoveAt(index);
}
bool RemoveAt(vint index)
{
if (0 <= index && index < items.Count() && QueryRemove(index, items[index]))
{
BeforeRemove(index, items[index]);
T item = items[index];
items.RemoveAt(index);
AfterRemove(index, 1);
NotifyUpdateInternal(index, 1, 0);
return true;
}
return false;
}
bool RemoveRange(vint index, vint count)
{
if(count<=0) return false;
if (0 <= index && index<items.Count() && index + count <= items.Count())
{
for (vint i = 0; i < count; i++)
{
if (!QueryRemove(index + 1, items[index + i])) return false;
}
for (vint i = 0; i < count; i++)
{
BeforeRemove(index + i, items[index + i]);
}
items.RemoveRange(index, count);
AfterRemove(index, count);
NotifyUpdateInternal(index, count, 0);
return true;
}
return false;
}
bool Clear()
{
vint count = items.Count();
for (vint i = 0; i < count; i++)
{
if (!QueryRemove(i, items[i])) return false;
}
for (vint i = 0; i < count; i++)
{
BeforeRemove(i, items[i]);
}
items.Clear();
AfterRemove(0, count);
NotifyUpdateInternal(0, count, 0);
return true;
}
vint Insert(vint index, const T& item)
{
if (0 <= index && index <= items.Count() && QueryInsert(index, item))
{
BeforeInsert(index, item);
items.Insert(index, item);
AfterInsert(index, item);
NotifyUpdateInternal(index, 0, 1);
return index;
}
else
{
return -1;
}
}
bool Set(vint index, const T& item)
{
if (0 <= index && index < items.Count())
{
if (QueryRemove(index, items[index]) && QueryInsert(index, item))
{
BeforeRemove(index, items[index]);
items.RemoveAt(index);
AfterRemove(index, 1);
BeforeInsert(index, item);
items.Insert(index, item);
AfterInsert(index, item);
NotifyUpdateInternal(index, 1, 1);
return true;
}
}
return false;
}
};
template<typename T>
class ObservableList : public ItemsBase<T>
{
protected:
Ptr<description::IValueObservableList> observableList;
void NotifyUpdateInternal(vint start, vint count, vint newCount)override
{
if (observableList)
{
observableList->ItemChanged(start, count, newCount);
}
}
public:
Ptr<description::IValueObservableList> GetWrapper()
{
if (!observableList)
{
observableList = new description::ValueObservableListWrapper<ObservableList<T>*>(this);
}
return observableList;
}
};
}
}
}
namespace collections
{
namespace randomaccess_internal
{
template<typename T>
struct RandomAccessable<presentation::controls::list::ItemsBase<T>>
{
static const bool CanRead = true;
static const bool CanResize = false;
};
}
}
}
@@ -10534,7 +10294,7 @@ Tab Control
~GuiTabPage();
};
class GuiTabPageList : public list::ItemsBase<GuiTabPage*>
class GuiTabPageList : public collections::ObservableListBase<GuiTabPage*>
{
protected:
GuiTab* tab;
@@ -11295,7 +11055,7 @@ Predefined ItemProvider
};
template<typename T>
class ListProvider : public ItemProviderBase, public ItemsBase<T>
class ListProvider : public ItemProviderBase, public collections::ObservableListBase<T>
{
protected:
void NotifyUpdateInternal(vint start, vint count, vint newCount)override
@@ -12218,7 +11978,7 @@ ListViewItemProvider
{
class ListViewItem;
class ListViewSubItems : public ItemsBase<WString>
class ListViewSubItems : public collections::ObservableListBase<WString>
{
friend class ListViewItem;
protected:
@@ -12346,7 +12106,7 @@ ListViewItemProvider
};
/// <summary>List view data column container.</summary>
class ListViewDataColumns : public ItemsBase<vint>
class ListViewDataColumns : public collections::ObservableListBase<vint>
{
protected:
IListViewItemProvider* itemProvider;
@@ -12360,7 +12120,7 @@ ListViewItemProvider
};
/// <summary>List view column container.</summary>
class ListViewColumns : public ItemsBase<Ptr<ListViewColumn>>
class ListViewColumns : public collections::ObservableListBase<Ptr<ListViewColumn>>
{
friend class ListViewColumn;
protected:
@@ -12722,7 +12482,7 @@ MemoryNodeProvider
typedef collections::IEnumerator<Ptr<MemoryNodeProvider>> ChildListEnumerator;
public:
class NodeCollection : public list::ItemsBase<Ptr<MemoryNodeProvider>>
class NodeCollection : public collections::ObservableListBase<Ptr<MemoryNodeProvider>>
{
friend class MemoryNodeProvider;
protected:
@@ -16395,7 +16155,7 @@ DataColumn
void SetValueProperty(const WritableItemProperty<description::Value>& value);
};
class DataColumns : public ItemsBase<Ptr<DataColumn>>
class DataColumns : public collections::ObservableListBase<Ptr<DataColumn>>
{
friend class DataColumn;
protected:
@@ -16726,7 +16486,7 @@ Toolstrip Item Collection
***********************************************************************/
/// <summary>Toolstrip item collection.</summary>
class GuiToolstripCollection : public list::ItemsBase<GuiControl*>
class GuiToolstripCollection : public collections::ObservableListBase<GuiControl*>
{
public:
class IContentCallback : public Interface
+43 -6
View File
@@ -18126,15 +18126,12 @@ IValueList
Ptr<IValueList> IValueList::Create()
{
Ptr<List<Value>> list = new List<Value>;
return new ValueListWrapper<Ptr<List<Value>>>(list);
return Create(LazyList<Value>());
}
Ptr<IValueList> IValueList::Create(Ptr<IValueReadonlyList> values)
{
Ptr<List<Value>> list = new List<Value>;
CopyFrom(*list.Obj(), GetLazyList<Value>(values));
return new ValueListWrapper<Ptr<List<Value>>>(list);
return Create(GetLazyList<Value>(values));
}
Ptr<IValueList> IValueList::Create(collections::LazyList<Value> values)
@@ -18144,6 +18141,44 @@ IValueList
return new ValueListWrapper<Ptr<List<Value>>>(list);
}
/***********************************************************************
IObservableList
***********************************************************************/
class ReversedObservableList : public ObservableListBase<Value>
{
protected:
void NotifyUpdateInternal(vint start, vint count, vint newCount)override
{
if (observableList)
{
observableList->ItemChanged(start, count, newCount);
}
}
public:
IValueObservableList* observableList = nullptr;
};
Ptr<IValueObservableList> IValueObservableList::Create()
{
return Create(LazyList<Value>());
}
Ptr<IValueObservableList> IValueObservableList::Create(Ptr<IValueReadonlyList> values)
{
return Create(GetLazyList<Value>(values));
}
Ptr<IValueObservableList> IValueObservableList::Create(collections::LazyList<Value> values)
{
auto list = MakePtr<ReversedObservableList>();
CopyFrom(*list.Obj(), values);
auto wrapper = MakePtr<ValueObservableListWrapper<Ptr<ReversedObservableList>>>(list);
list->observableList = wrapper.Obj();
return wrapper;
}
/***********************************************************************
IValueDictionary
***********************************************************************/
@@ -19507,7 +19542,9 @@ LoadPredefinedTypes
END_INTERFACE_MEMBER(IValueList)
BEGIN_INTERFACE_MEMBER(IValueObservableList)
CLASS_MEMBER_BASE(IValueReadonlyList)
CLASS_MEMBER_BASE(IValueList)
CLASS_MEMBER_EXTERNALCTOR(Ptr<IValueObservableList>(), NO_PARAMETER, vl::reflection::description::IValueObservableList::Create)
CLASS_MEMBER_EXTERNALCTOR(Ptr<IValueObservableList>(Ptr<IValueReadonlyList>), { L"values" }, vl::reflection::description::IValueObservableList::Create)
CLASS_MEMBER_EVENT(ItemChanged)
END_INTERFACE_MEMBER(IValueObservableList)
+355 -14
View File
@@ -8947,6 +8947,7 @@ ITypeDescriptor (type)
Array,
List,
SortedList,
ObservableList,
Dictionary,
NativeCollectionReference,
};
@@ -10970,11 +10971,15 @@ Collections
static Ptr<IValueList> Create(collections::LazyList<Value> values);
};
class IValueObservableList : public virtual IValueReadonlyList, public Description<IValueObservableList>
class IValueObservableList : public virtual IValueList, public Description<IValueObservableList>
{
typedef void ItemChangedProc(vint index, vint oldCount, vint newCount);
public:
Event<ItemChangedProc> ItemChanged;
static Ptr<IValueObservableList> Create();
static Ptr<IValueObservableList> Create(Ptr<IValueReadonlyList> values);
static Ptr<IValueObservableList> Create(collections::LazyList<Value> values);
};
class IValueReadonlyDictionary : public virtual IDescriptable, public Description<IValueReadonlyDictionary>
@@ -11318,6 +11323,12 @@ Interfaces:
namespace vl
{
namespace collections
{
template<typename T>
class ObservableList;
}
namespace reflection
{
namespace description
@@ -11769,8 +11780,9 @@ TypeFlagTester
EnumerableType =1<<1,
ReadonlyListType =1<<2,
ListType =1<<3,
ReadonlyDictionaryType =1<<4,
DictionaryType =1<<5,
ObservableListType =1<<4,
ReadonlyDictionaryType =1<<5,
DictionaryType =1<<6,
};
template<typename T>
@@ -11835,6 +11847,17 @@ TypeFlagTester
static const TypeFlags Result=sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer))==sizeof(void*)?TypeFlags::ListType:TypeFlags::NonGenericType;
};
template<typename TDerived>
struct TypeFlagTester<TDerived, TypeFlags::ObservableListType>
{
template<typename T>
static void* Inherit(collections::ObservableList<T>* source) {}
static char Inherit(void* source) {}
static char Inherit(const void* source) {}
static const TypeFlags Result = sizeof(Inherit(((ValueRetriver<TDerived>*)0)->pointer)) == sizeof(void*) ? TypeFlags::ObservableListType : TypeFlags::NonGenericType;
};
template<typename TDerived>
struct TypeFlagTester<TDerived, TypeFlags::ReadonlyDictionaryType>
{
@@ -11891,6 +11914,12 @@ TypeFlagSelector
static const TypeFlags Result=TypeFlags::ListType;
};
template<typename T>
struct TypeFlagSelectorCase<T, (TypeFlags)((vint)TypeFlags::ObservableListType|(vint)TypeFlags::ListType|(vint)TypeFlags::ReadonlyListType)>
{
static const TypeFlags Result = TypeFlags::ObservableListType;
};
template<typename T>
struct TypeFlagSelectorCase<T, (TypeFlags)((vint)TypeFlags::ReadonlyListType)>
{
@@ -11920,6 +11949,7 @@ TypeFlagSelector
| (vint)TypeFlagTester<T, TypeFlags::EnumerableType>::Result
| (vint)TypeFlagTester<T, TypeFlags::ReadonlyListType>::Result
| (vint)TypeFlagTester<T, TypeFlags::ListType>::Result
| (vint)TypeFlagTester<T, TypeFlags::ObservableListType>::Result
| (vint)TypeFlagTester<T, TypeFlags::ReadonlyDictionaryType>::Result
| (vint)TypeFlagTester<T, TypeFlags::DictionaryType>::Result
)
@@ -11999,6 +12029,12 @@ TypeHintTester
static const TypeInfoHint Result = TypeInfoHint::SortedList;
};
template<typename T>
struct TypeHintTester<collections::ObservableList<T>>
{
static const TypeInfoHint Result = TypeInfoHint::ObservableList;
};
template<typename K, typename V>
struct TypeHintTester<collections::Dictionary<K, V>>
{
@@ -12696,16 +12732,6 @@ Collection Wrappers
}
};
template<typename T>
class ValueObservableListWrapper : public ValueReadonlyListWrapper<T>, public virtual IValueObservableList
{
public:
ValueObservableListWrapper(const T& _wrapperPointer)
:ValueReadonlyListWrapper<T>(_wrapperPointer)
{
}
};
template<typename T>
class ValueListWrapper : public ValueReadonlyListWrapper<T>, public virtual IValueList
{
@@ -12755,6 +12781,16 @@ Collection Wrappers
}
};
template<typename T>
class ValueObservableListWrapper : public ValueListWrapper<T>, public virtual IValueObservableList
{
public:
ValueObservableListWrapper(const T& _wrapperPointer)
:ValueListWrapper<T>(_wrapperPointer)
{
}
};
#undef WRAPPER_POINTER
template<typename T>
@@ -12934,6 +12970,34 @@ DetailTypeInfoRetriver<TContainer>
#endif
};
template<typename T>
struct DetailTypeInfoRetriver<T, TypeFlags::ObservableListType>
{
typedef DetailTypeInfoRetriver<T, TypeFlags::NonGenericType> UpLevelRetriver;
static const ITypeInfo::Decorator Decorator = UpLevelRetriver::Decorator;
typedef IValueObservableList Type;
typedef typename UpLevelRetriver::TempValueType TempValueType;
typedef typename UpLevelRetriver::ResultReferenceType ResultReferenceType;
typedef typename UpLevelRetriver::ResultNonReferenceType ResultNonReferenceType;
#ifndef VCZH_DEBUG_NO_REFLECTION
static Ptr<ITypeInfo> CreateTypeInfo(TypeInfoHint hint)
{
typedef typename DetailTypeInfoRetriver<T, TypeFlags::NonGenericType>::Type ContainerType;
typedef typename ContainerType::ElementType ElementType;
auto arrayType = MakePtr<TypeDescriptorTypeInfo>(Description<IValueObservableList>::GetAssociatedTypeDescriptor(), hint);
auto genericType = MakePtr<GenericTypeInfo>(arrayType);
genericType->AddGenericArgument(TypeInfoRetriver<ElementType>::CreateTypeInfo());
auto type = MakePtr<SharedPtrTypeInfo>(genericType);
return type;
}
#endif
};
template<typename T>
struct DetailTypeInfoRetriver<T, TypeFlags::ReadonlyDictionaryType>
{
@@ -13076,6 +13140,19 @@ ParameterAccessor<TContainer>
}
};
template<typename T>
struct ParameterAccessor<collections::ObservableList<T>, TypeFlags::ObservableListType>
{
static Value BoxParameter(collections::ObservableList<T>& object, ITypeDescriptor* typeDescriptor)
{
ITypeDescriptor* td = nullptr;
#ifndef VCZH_DEBUG_NO_REFLECTION
td = Description<IValueObservableList>::GetAssociatedTypeDescriptor();
#endif
return BoxValue<Ptr<IValueObservableList>>(object.GetWrapper(), td);
}
};
template<typename T>
struct ParameterAccessor<T, TypeFlags::ReadonlyDictionaryType>
{
@@ -13131,6 +13208,246 @@ ParameterAccessor<TContainer>
};
}
}
namespace collections
{
template<typename T, typename K = typename KeyType<T>::Type>
class ObservableListBase : public Object, public virtual collections::IEnumerable<T>
{
protected:
collections::List<T, K> items;
virtual void NotifyUpdateInternal(vint start, vint count, vint newCount)
{
}
virtual bool QueryInsert(vint index, const T& value)
{
return true;
}
virtual void BeforeInsert(vint index, const T& value)
{
}
virtual void AfterInsert(vint index, const T& value)
{
}
virtual bool QueryRemove(vint index, const T& value)
{
return true;
}
virtual void BeforeRemove(vint index, const T& value)
{
}
virtual void AfterRemove(vint index, vint count)
{
}
public:
ObservableListBase()
{
}
~ObservableListBase()
{
}
collections::IEnumerator<T>* CreateEnumerator()const
{
return items.CreateEnumerator();
}
bool NotifyUpdate(vint start, vint count = 1)
{
if (start<0 || start >= items.Count() || count <= 0 || start + count>items.Count())
{
return false;
}
else
{
NotifyUpdateInternal(start, count, count);
return true;
}
}
bool Contains(const K& item)const
{
return items.Contains(item);
}
vint Count()const
{
return items.Count();
}
vint Count()
{
return items.Count();
}
const T& Get(vint index)const
{
return items.Get(index);
}
const T& operator[](vint index)const
{
return items.Get(index);
}
vint IndexOf(const K& item)const
{
return items.IndexOf(item);
}
vint Add(const T& item)
{
return Insert(items.Count(), item);
}
bool Remove(const K& item)
{
vint index = items.IndexOf(item);
if (index == -1) return false;
return RemoveAt(index);
}
bool RemoveAt(vint index)
{
if (0 <= index && index < items.Count() && QueryRemove(index, items[index]))
{
BeforeRemove(index, items[index]);
T item = items[index];
items.RemoveAt(index);
AfterRemove(index, 1);
NotifyUpdateInternal(index, 1, 0);
return true;
}
return false;
}
bool RemoveRange(vint index, vint count)
{
if (count <= 0) return false;
if (0 <= index && index<items.Count() && index + count <= items.Count())
{
for (vint i = 0; i < count; i++)
{
if (!QueryRemove(index + 1, items[index + i])) return false;
}
for (vint i = 0; i < count; i++)
{
BeforeRemove(index + i, items[index + i]);
}
items.RemoveRange(index, count);
AfterRemove(index, count);
NotifyUpdateInternal(index, count, 0);
return true;
}
return false;
}
bool Clear()
{
vint count = items.Count();
for (vint i = 0; i < count; i++)
{
if (!QueryRemove(i, items[i])) return false;
}
for (vint i = 0; i < count; i++)
{
BeforeRemove(i, items[i]);
}
items.Clear();
AfterRemove(0, count);
NotifyUpdateInternal(0, count, 0);
return true;
}
vint Insert(vint index, const T& item)
{
if (0 <= index && index <= items.Count() && QueryInsert(index, item))
{
BeforeInsert(index, item);
items.Insert(index, item);
AfterInsert(index, item);
NotifyUpdateInternal(index, 0, 1);
return index;
}
else
{
return -1;
}
}
bool Set(vint index, const T& item)
{
if (0 <= index && index < items.Count())
{
if (QueryRemove(index, items[index]) && QueryInsert(index, item))
{
BeforeRemove(index, items[index]);
items.RemoveAt(index);
AfterRemove(index, 1);
BeforeInsert(index, item);
items.Insert(index, item);
AfterInsert(index, item);
NotifyUpdateInternal(index, 1, 1);
return true;
}
}
return false;
}
};
template<typename T>
class ObservableList : public ObservableListBase<T>
{
protected:
Ptr<reflection::description::IValueObservableList> observableList;
void NotifyUpdateInternal(vint start, vint count, vint newCount)override
{
if (observableList)
{
observableList->ItemChanged(start, count, newCount);
}
}
public:
Ptr<reflection::description::IValueObservableList> GetWrapper()
{
if (!observableList)
{
observableList = new reflection::description::ValueObservableListWrapper<ObservableList<T>*>(this);
}
return observableList;
}
};
namespace randomaccess_internal
{
template<typename T>
struct RandomAccessable<ObservableListBase<T>>
{
static const bool CanRead = true;
static const bool CanResize = false;
};
template<typename T>
struct RandomAccessable<ObservableList<T>>
{
static const bool CanRead = true;
static const bool CanResize = false;
};
}
}
}
#endif
@@ -13398,6 +13715,30 @@ namespace vl
}
};
struct CreateObservableList
{
using IValueObservableList = reflection::description::IValueObservableList;
Ptr<IValueObservableList> list;
CreateObservableList()
:list(IValueObservableList::Create())
{
}
CreateObservableList(Ptr<IValueObservableList> _list)
:list(_list)
{
}
template<typename T>
CreateObservableList Add(const T& value)
{
list->Add(Box(value));
return{ list };
}
};
struct CreateDictionary
{
using IValueDictionary = reflection::description::IValueDictionary;
@@ -15208,7 +15549,7 @@ Interface Implementation Proxy (Implement)
}
END_INTERFACE_PROXY(IValueList)
BEGIN_INTERFACE_PROXY_SHAREDPTR(IValueObservableList, IValueReadonlyList)
BEGIN_INTERFACE_PROXY_SHAREDPTR(IValueObservableList, IValueList)
END_INTERFACE_PROXY(IValueObservableList)
BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(IValueReadonlyDictionary)
+12
View File
@@ -3519,6 +3519,18 @@ WfRuntimeThreadContext
CONTEXT_ACTION(PushValue(Value::From(list)), L"failed to push a value to the stack.");
return WfRuntimeExecutionAction::ExecuteInstruction;
}
case WfInsCode::CreateObservableList:
{
auto list = IValueObservableList::Create();
Value operand;
for (vint i = 0; i < ins.countParameter; i++)
{
CONTEXT_ACTION(PopValue(operand), L"failed to pop a value from the stack.");
list->Add(operand);
}
CONTEXT_ACTION(PushValue(Value::From(list)), L"failed to push a value to the stack.");
return WfRuntimeExecutionAction::ExecuteInstruction;
}
case WfInsCode::CreateMap:
{
auto map = IValueDictionary::Create();
+2
View File
@@ -50,6 +50,7 @@ Instruction
Pop, // : Value -> () ;
Return, // : Value -> Value ; (exit function)
CreateArray, // count : Value-count, ..., Value-1 -> <array> ; {1 2 3} -> <3 2 1>
CreateObservableList, // count : Value-count, ..., Value-1 -> <observable-list> ; {1 2 3} -> <3 2 1>
CreateMap, // count : Value-count, ..., Value-1 -> <map> ; {1:2 3:4} -> <3 4 1 2>
CreateClosureContext, // count : Value-1, ..., Value-count -> <closure-context> ;
CreateClosure, // : <closure-context>, Value-function-index -> <closure> ;
@@ -122,6 +123,7 @@ Instruction
APPLY(Pop)\
APPLY(Return)\
APPLY_COUNT(CreateArray)\
APPLY_COUNT(CreateObservableList)\
APPLY_COUNT(CreateMap)\
APPLY_COUNT(CreateClosureContext)\
APPLY(CreateClosure)\
File diff suppressed because one or more lines are too long
+23
View File
@@ -149,6 +149,7 @@ namespace vl
class WfNullableType;
class WfEnumerableType;
class WfMapType;
class WfObservableListType;
class WfFunctionType;
class WfChildType;
class WfNamespaceDeclaration;
@@ -262,6 +263,7 @@ namespace vl
virtual void Visit(WfNullableType* node)=0;
virtual void Visit(WfEnumerableType* node)=0;
virtual void Visit(WfMapType* node)=0;
virtual void Visit(WfObservableListType* node)=0;
virtual void Visit(WfFunctionType* node)=0;
virtual void Visit(WfChildType* node)=0;
};
@@ -476,6 +478,16 @@ namespace vl
static vl::Ptr<WfMapType> Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens);
};
class WfObservableListType : public WfType, vl::reflection::Description<WfObservableListType>
{
public:
vl::Ptr<WfType> element;
void Accept(WfType::IVisitor* visitor)override;
static vl::Ptr<WfObservableListType> Convert(vl::Ptr<vl::parsing::ParsingTreeNode> node, const vl::collections::List<vl::regex::RegexToken>& tokens);
};
class WfFunctionType : public WfType, vl::reflection::Description<WfFunctionType>
{
public:
@@ -1549,6 +1561,7 @@ namespace vl
DECL_TYPE_INFO(vl::workflow::WfEnumerableType)
DECL_TYPE_INFO(vl::workflow::WfMapWritability)
DECL_TYPE_INFO(vl::workflow::WfMapType)
DECL_TYPE_INFO(vl::workflow::WfObservableListType)
DECL_TYPE_INFO(vl::workflow::WfFunctionType)
DECL_TYPE_INFO(vl::workflow::WfChildType)
DECL_TYPE_INFO(vl::workflow::WfNamespaceDeclaration)
@@ -1700,6 +1713,11 @@ namespace vl
INVOKE_INTERFACE_PROXY(Visit, node);
}
void Visit(vl::workflow::WfObservableListType* node)override
{
INVOKE_INTERFACE_PROXY(Visit, node);
}
void Visit(vl::workflow::WfFunctionType* node)override
{
INVOKE_INTERFACE_PROXY(Visit, node);
@@ -2185,6 +2203,7 @@ namespace vl
void CopyFields(WfNullableType* from, WfNullableType* to);
void CopyFields(WfEnumerableType* from, WfEnumerableType* to);
void CopyFields(WfMapType* from, WfMapType* to);
void CopyFields(WfObservableListType* from, WfObservableListType* to);
void CopyFields(WfFunctionType* from, WfFunctionType* to);
void CopyFields(WfChildType* from, WfChildType* to);
@@ -2200,6 +2219,7 @@ namespace vl
void Visit(WfNullableType* node)override;
void Visit(WfEnumerableType* node)override;
void Visit(WfMapType* node)override;
void Visit(WfObservableListType* node)override;
void Visit(WfFunctionType* node)override;
void Visit(WfChildType* node)override;
};
@@ -2595,6 +2615,7 @@ namespace vl
virtual void Traverse(WfNullableType* node);
virtual void Traverse(WfEnumerableType* node);
virtual void Traverse(WfMapType* node);
virtual void Traverse(WfObservableListType* node);
virtual void Traverse(WfFunctionType* node);
virtual void Traverse(WfChildType* node);
@@ -2610,6 +2631,7 @@ namespace vl
void Visit(WfNullableType* node)override;
void Visit(WfEnumerableType* node)override;
void Visit(WfMapType* node)override;
void Visit(WfObservableListType* node)override;
void Visit(WfFunctionType* node)override;
void Visit(WfChildType* node)override;
};
@@ -3020,6 +3042,7 @@ namespace vl
void Visit(WfNullableType* node)override;
void Visit(WfEnumerableType* node)override;
void Visit(WfMapType* node)override;
void Visit(WfObservableListType* node)override;
void Visit(WfFunctionType* node)override;
void Visit(WfChildType* node)override;
};
BIN
View File
Binary file not shown.
Binary file not shown.
+5 -5
View File
@@ -24,10 +24,10 @@ class Category : public Object, public ICategory
friend class ViewModel;
friend class Contact;
protected:
ICategory* parent;
WString name;
list::ObservableList<Ptr<ICategory>> folders;
list::ObservableList<Ptr<IContact>> contacts;
ICategory* parent;
WString name;
ObservableList<Ptr<ICategory>> folders;
ObservableList<Ptr<IContact>> contacts;
public:
Category(ICategory* _parent)
@@ -150,7 +150,7 @@ public:
class RootCategory : public Object, public ICategory
{
protected:
list::ObservableList<Ptr<ICategory>> folders;
ObservableList<Ptr<ICategory>> folders;
public:
RootCategory()
@@ -37,8 +37,8 @@
prop Parent : ICategory* {const, not observe}
prop Name : string {const, not observe}
prop Image : presentation::GuiImageData^ {const, not observe}
prop Folders : ObservableList^ {const, not observe}
prop Contacts : ObservableList^ {const, not observe}
prop Folders : observe ICategory^[] {const, not observe}
prop Contacts : observe IContact^[] {const, not observe}
}
interface IViewModel
@@ -14,7 +14,7 @@
<ref.Ctor>
<![CDATA[
{
var tempData : MyDataItem^[] =
var tempData : observe MyDataItem^[] =
{
new MyDataItem^("涼宮 春日", Female, Lime, (cast DateTime "1988-08-08 00:00:00.000"), "http://www.haruhi.tv/")
new MyDataItem^("キョン", Male, Black, (cast DateTime "1988-08-08 00:00:00.000"), "http://www.haruhi.tv/")
@@ -2494,7 +2494,7 @@ Class (::demo::MainWindow)
void MainWindow::__vwsn_instance_ctor_()
{
auto tempData = (::vl::__vwsn::CreateList().Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"涼宮 春日", false), ::demo::MyGender::Female, ::demo::MyCategory::Lime, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1988-08-08 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"キョン", false), ::demo::MyGender::Male, ::demo::MyCategory::Black, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1988-08-08 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"长门 有希", false), ::demo::MyGender::Female, ::demo::MyCategory::White, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"2000-08-06 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"朝比奈 实玖瑠", false), ::demo::MyGender::Female, ::demo::MyCategory::Red, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1987-08-30 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"古泉 一树", false), ::demo::MyGender::Male, ::demo::MyCategory::Blue, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1986-08-12 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false))))).list;
auto tempData = (::vl::__vwsn::CreateObservableList().Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"涼宮 春日", false), ::demo::MyGender::Female, ::demo::MyCategory::Lime, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1988-08-08 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"キョン", false), ::demo::MyGender::Male, ::demo::MyCategory::Black, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1988-08-08 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"长门 有希", false), ::demo::MyGender::Female, ::demo::MyCategory::White, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"2000-08-06 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"朝比奈 实玖瑠", false), ::demo::MyGender::Female, ::demo::MyCategory::Red, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1987-08-30 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false)))).Add(::vl::Ptr<::demo::MyDataItem>(new ::demo::MyDataItem(::vl::WString(L"古泉 一树", false), ::demo::MyGender::Male, ::demo::MyCategory::Blue, ::vl::__vwsn::Parse<::vl::DateTime>(::vl::WString(L"1986-08-12 00:00:00.000", false)), ::vl::WString(L"http://www.haruhi.tv/", false))))).list;
auto largeImage = ::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(this->ResolveResource(::vl::WString(L"res", false), ::vl::WString(L"Images/Large", false), true).Obj()));
auto smallImage = ::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(this->ResolveResource(::vl::WString(L"res", false), ::vl::WString(L"Images/Small", false), true).Obj()));
{
+1 -27
View File
@@ -12,32 +12,6 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
return SetupWindowsDirect2DRenderer();
}
class ViewModel : public Object, public IViewModel
{
public:
list::ObservableList<Ptr<MyTextItem>> textItems;
Ptr<IValueObservableList> GetTextItems()override
{
return textItems.GetWrapper();
}
void AddTextItem(Ptr<MyTextItem> item)override
{
textItems.Add(item);
}
void RemoveTextItem(vint32_t index)override
{
textItems.RemoveAt(index);
}
void ClearTextItems()override
{
textItems.Clear();
}
};
void GuiMain()
{
{
@@ -45,7 +19,7 @@ void GuiMain()
auto resource = GuiResource::LoadPrecompiledBinary(fileStream);
GetResourceManager()->SetResource(L"Resource", resource);
}
demo::MainWindow window(new ViewModel);
demo::MainWindow window;
window.MoveToScreenCenter();
GetApplication()->Run(&window);
}
@@ -7,12 +7,11 @@
listView.Items.Add(item);
});
var itemsToBind : ListViewItem^[] = {};
var itemsToBind : observe ListViewItem^[] = {};
LoadListView(this, func(item : ListViewItem^):void
{
itemsToBind.Add(item);
});
/* itemsToBind is not ObservableList so the ItemSource property should be assigned after the data is prepared. */
bindableListView.ItemSource = itemsToBind;
}
]]>
@@ -11,13 +11,12 @@
<Instance name="MainWindowResource">
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow" xmlns:demo="demo::*">
<ref.Parameter Name="ViewModel" Class="demo::IViewModel"/>
<Window ref.Name="self" Text="ListControls" ClientSize="x:640 y:480">
<att.BoundsComposition-set PreferredMinSize="x:640 y:480"/>
<Tab>
<att.BoundsComposition-set AlignmentToParent="left:5 top:5 right:5 bottom:5"/>
<att.Pages>
<demo:TextListTabPage Alt="T" ViewModel-eval="ViewModel"/>
<demo:TextListTabPage Alt="T"/>
<demo:ListViewTabPage Alt="L"/>
<demo:TreeViewTabPage Alt="R"/>
</att.Pages>
@@ -49,15 +48,6 @@
prop Name : string = "" {not observe}
prop Checked : bool = false {not observe}
}
interface IViewModel
{
prop TextItems : ObservableList^ {const, not observe}
func AddTextItem(item : MyTextItem^) : void;
func RemoveTextItem(index : int) : void;
func ClearTextItems() : void;
}
}
]]>
</Workflow>
@@ -23,7 +23,6 @@ namespace vl
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
DECL_TYPE_INFO(::demo::IViewModel)
DECL_TYPE_INFO(::demo::ListViewTabPage)
DECL_TYPE_INFO(::demo::ListViewTabPageConstructor)
DECL_TYPE_INFO(::demo::MainWindow)
@@ -33,25 +32,6 @@ namespace vl
DECL_TYPE_INFO(::demo::TextListTabPageConstructor)
DECL_TYPE_INFO(::demo::TreeViewTabPage)
DECL_TYPE_INFO(::demo::TreeViewTabPageConstructor)
BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(::demo::IViewModel)
void AddTextItem(::vl::Ptr<::demo::MyTextItem> item) override
{
INVOKE_INTERFACE_PROXY(AddTextItem, item);
}
void ClearTextItems() override
{
INVOKE_INTERFACE_PROXY_NOPARAMS(ClearTextItems);
}
::vl::Ptr<::vl::reflection::description::IValueObservableList> GetTextItems() override
{
INVOKEGET_INTERFACE_PROXY_NOPARAMS(GetTextItems);
}
void RemoveTextItem(::vl::vint32_t index) override
{
INVOKE_INTERFACE_PROXY(RemoveTextItem, index);
}
END_INTERFACE_PROXY(::demo::IViewModel)
#endif
extern bool LoadDemoTypes();
@@ -429,7 +429,6 @@ Closures
(i = (i + static_cast<::vl::vint32_t>(1)));
}
}
if (static_cast<bool>(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetTextItems()))
{
{
auto __vwsn_for_begin_i = static_cast<::vl::vint32_t>(0);
@@ -440,7 +439,7 @@ Closures
{
auto textItem = ::vl::Ptr<::demo::MyTextItem>(new ::demo::MyTextItem());
::vl::__vwsn::This(textItem.Obj())->SetName(::vl::__vwsn::ToString((::vl::__vwsn::This(__vwsnthis_0->self)->counter + i)));
::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->AddTextItem(textItem);
::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->itemsToBind.Obj())->Add(::vl::__vwsn::Box(textItem));
}
(i = (i + static_cast<::vl::vint32_t>(1)));
}
@@ -466,12 +465,11 @@ Closures
(i = (i + static_cast<::vl::vint32_t>(1)));
}
}
if (static_cast<bool>(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetTextItems()))
{
auto i = static_cast<::vl::vint32_t>(0);
while ((i < ::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetTextItems().Obj())->GetCount()))
while ((i < ::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->itemsToBind.Obj())->GetCount()))
{
::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->RemoveTextItem(i);
::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->itemsToBind.Obj())->RemoveAt(i);
(i = (i + static_cast<::vl::vint32_t>(1)));
}
}
@@ -494,12 +492,11 @@ Closures
(i = (i + static_cast<::vl::vint32_t>(1)));
}
}
if (static_cast<bool>(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetTextItems()))
{
auto i = static_cast<::vl::vint32_t>(1);
while ((i < ::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetTextItems().Obj())->GetCount()))
while ((i < ::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->itemsToBind.Obj())->GetCount()))
{
::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->RemoveTextItem(i);
::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->itemsToBind.Obj())->RemoveAt(i);
(i = (i + static_cast<::vl::vint32_t>(1)));
}
}
@@ -515,10 +512,7 @@ Closures
void __vwsnf16_Demo_demo_TextListTabPageConstructor___vwsn_initialize_instance__::operator()(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs* arguments) const
{
::vl::__vwsn::This(::vl::__vwsn::UnboxCollection<::vl::reflection::description::IValueList>(::vl::__vwsn::This(__vwsnthis_0->textList)->GetItems()).Obj())->Clear();
if (static_cast<bool>(::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->GetTextItems()))
{
::vl::__vwsn::This(__vwsnthis_0->ViewModel.Obj())->ClearTextItems();
}
::vl::__vwsn::This(::vl::__vwsn::This(__vwsnthis_0->self)->itemsToBind.Obj())->Clear();
}
//-------------------------------------------------------------------
@@ -696,7 +690,7 @@ Closures
//-------------------------------------------------------------------
__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__::__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__(::vl::Ptr<::vl::reflection::description::IValueList> __vwsnctor_itemsToBind, ::demo::ListViewTabPage* __vwsnctorthis_0)
__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__::__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__(::vl::Ptr<::vl::reflection::description::IValueObservableList> __vwsnctor_itemsToBind, ::demo::ListViewTabPage* __vwsnctorthis_0)
:itemsToBind(__vwsnctor_itemsToBind)
, __vwsnthis_0(::vl::__vwsn::This(__vwsnctorthis_0))
{
@@ -1006,7 +1000,7 @@ Class (::demo::ListViewTabPage)
void ListViewTabPage::__vwsn_instance_ctor_()
{
GLOBAL_NAME LoadListView(static_cast<::vl::presentation::controls::GuiInstanceRootObject*>(this), LAMBDA(::vl_workflow_global::__vwsnf8_Demo_demo_ListViewTabPage___vwsn_instance_ctor__(this)));
auto itemsToBind = ::vl::reflection::description::IValueList::Create();
auto itemsToBind = ::vl::reflection::description::IValueObservableList::Create();
GLOBAL_NAME LoadListView(static_cast<::vl::presentation::controls::GuiInstanceRootObject*>(this), LAMBDA(::vl_workflow_global::__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__(itemsToBind, this)));
::vl::__vwsn::This(this->bindableListView)->SetItemSource(::vl::Ptr<::vl::reflection::description::IValueEnumerable>(itemsToBind));
}
@@ -1023,7 +1017,6 @@ Class (::demo::MainWindowConstructor)
void MainWindowConstructor::__vwsn_initialize_instance_(::demo::MainWindow* __vwsn_this_)
{
(this->self = __vwsn_this_);
(this->ViewModel = ::vl::__vwsn::This(__vwsn_this_)->GetViewModel());
(this->__vwsn_precompile_5 = ::vl::__vwsn::This(this->self)->GetBoundsComposition());
{
::vl::__vwsn::This(this->__vwsn_precompile_5)->SetPreferredMinSize([&](){ ::vl::presentation::Size __vwsn_temp__; __vwsn_temp__.x = static_cast<::vl::vint32_t>(640); __vwsn_temp__.y = static_cast<::vl::vint32_t>(480); return __vwsn_temp__; }());
@@ -1038,7 +1031,7 @@ Class (::demo::MainWindowConstructor)
auto __vwsn_controlStyle_ = ::vl::__vwsn::This(::vl::presentation::theme::GetCurrentTheme())->CreateTabStyle();
(this->__vwsn_precompile_0 = new ::vl::presentation::controls::GuiTab(__vwsn_controlStyle_));
}
(this->__vwsn_precompile_2 = new ::demo::TextListTabPage(this->ViewModel));
(this->__vwsn_precompile_2 = new ::demo::TextListTabPage());
{
::vl::__vwsn::This(this->__vwsn_precompile_2)->SetAlt(::vl::WString(L"T", false));
}
@@ -1079,15 +1072,9 @@ Class (::demo::MainWindowConstructor)
Class (::demo::MainWindow)
***********************************************************************/
::vl::Ptr<::demo::IViewModel> MainWindow::GetViewModel()
{
return this->__vwsn_parameter_ViewModel;
}
MainWindow::MainWindow(::vl::Ptr<::demo::IViewModel> __vwsn_ctor_parameter_ViewModel)
MainWindow::MainWindow()
: ::vl::presentation::controls::GuiWindow(::vl::__vwsn::This(::vl::presentation::theme::GetCurrentTheme())->CreateWindowStyle())
{
(this->__vwsn_parameter_ViewModel = __vwsn_ctor_parameter_ViewModel);
auto __vwsn_resource_ = ::vl::__vwsn::This(::vl::presentation::GetResourceManager())->GetResourceFromClassName(::vl::WString(L"demo::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)->SetResourceResolver(__vwsn_resolver_);
@@ -1106,7 +1093,6 @@ Class (::demo::TextListTabPageConstructor)
void TextListTabPageConstructor::__vwsn_initialize_instance_(::demo::TextListTabPage* __vwsn_this_)
{
(this->self = __vwsn_this_);
(this->ViewModel = ::vl::__vwsn::This(__vwsn_this_)->GetViewModel());
{
::vl::__vwsn::This(this->self)->SetText(::vl::WString(L"TextList", false));
}
@@ -1374,7 +1360,7 @@ Class (::demo::TextListTabPageConstructor)
::vl::__vwsn::EventAttach(::vl::__vwsn::This(this->__vwsn_precompile_21)->Clicked, __vwsn_event_handler_);
}
{
::vl::__vwsn::This(this->bindableTextList)->SetItemSource(::vl::Ptr<::vl::reflection::description::IValueEnumerable>(::vl::__vwsn::This(this->ViewModel.Obj())->GetTextItems()));
::vl::__vwsn::This(this->bindableTextList)->SetItemSource(::vl::Ptr<::vl::reflection::description::IValueEnumerable>(::vl::__vwsn::This(this->self)->itemsToBind));
}
}
@@ -1386,15 +1372,9 @@ Class (::demo::TextListTabPageConstructor)
Class (::demo::TextListTabPage)
***********************************************************************/
::vl::Ptr<::demo::IViewModel> TextListTabPage::GetViewModel()
{
return this->__vwsn_parameter_ViewModel;
}
TextListTabPage::TextListTabPage(::vl::Ptr<::demo::IViewModel> __vwsn_ctor_parameter_ViewModel)
TextListTabPage::TextListTabPage()
: ::vl::presentation::controls::GuiTabPage(::vl::__vwsn::This(::vl::presentation::theme::GetCurrentTheme())->CreateCustomControlStyle())
{
(this->__vwsn_parameter_ViewModel = __vwsn_ctor_parameter_ViewModel);
auto __vwsn_resource_ = ::vl::__vwsn::This(::vl::presentation::GetResourceManager())->GetResourceFromClassName(::vl::WString(L"demo::TextListTabPage", 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)->SetResourceResolver(__vwsn_resolver_);
@@ -1731,10 +1711,6 @@ Class (::demo::MyTextItem)
{
}
/***********************************************************************
Class (::demo::IViewModel)
***********************************************************************/
}
#undef GLOBAL_SYMBOL
#undef GLOBAL_NAME
@@ -1752,7 +1728,6 @@ namespace vl
namespace description
{
#ifndef VCZH_DEBUG_NO_REFLECTION
IMPL_CPP_TYPE_INFO(demo::IViewModel)
IMPL_CPP_TYPE_INFO(demo::ListViewTabPage)
IMPL_CPP_TYPE_INFO(demo::ListViewTabPageConstructor)
IMPL_CPP_TYPE_INFO(demo::MainWindow)
@@ -1764,14 +1739,6 @@ namespace vl
IMPL_CPP_TYPE_INFO(demo::TreeViewTabPageConstructor)
#define _ ,
BEGIN_INTERFACE_MEMBER(::demo::IViewModel)
CLASS_MEMBER_METHOD(AddTextItem, { L"item" })
CLASS_MEMBER_METHOD(ClearTextItems, NO_PARAMETER)
CLASS_MEMBER_METHOD(GetTextItems, NO_PARAMETER)
CLASS_MEMBER_METHOD(RemoveTextItem, { L"index" })
CLASS_MEMBER_PROPERTY_READONLY(TextItems, GetTextItems)
END_INTERFACE_MEMBER(::demo::IViewModel)
BEGIN_CLASS_MEMBER(::demo::ListViewTabPage)
CLASS_MEMBER_CONSTRUCTOR(::demo::ListViewTabPage*(), NO_PARAMETER)
CLASS_MEMBER_METHOD(__vwsn_instance_ctor_, NO_PARAMETER)
@@ -1809,10 +1776,7 @@ namespace vl
END_CLASS_MEMBER(::demo::ListViewTabPageConstructor)
BEGIN_CLASS_MEMBER(::demo::MainWindow)
CLASS_MEMBER_CONSTRUCTOR(::demo::MainWindow*(::vl::Ptr<::demo::IViewModel>), { L"__vwsn_ctor_parameter_ViewModel" })
CLASS_MEMBER_METHOD(GetViewModel, NO_PARAMETER)
CLASS_MEMBER_FIELD(__vwsn_parameter_ViewModel)
CLASS_MEMBER_PROPERTY_READONLY(ViewModel, GetViewModel)
CLASS_MEMBER_CONSTRUCTOR(::demo::MainWindow*(), NO_PARAMETER)
END_CLASS_MEMBER(::demo::MainWindow)
BEGIN_CLASS_MEMBER(::demo::MainWindowConstructor)
@@ -1824,7 +1788,6 @@ namespace vl
CLASS_MEMBER_FIELD(__vwsn_precompile_3)
CLASS_MEMBER_FIELD(__vwsn_precompile_4)
CLASS_MEMBER_FIELD(__vwsn_precompile_5)
CLASS_MEMBER_FIELD(ViewModel)
CLASS_MEMBER_FIELD(self)
END_CLASS_MEMBER(::demo::MainWindowConstructor)
@@ -1841,11 +1804,9 @@ namespace vl
END_CLASS_MEMBER(::demo::MyTextItem)
BEGIN_CLASS_MEMBER(::demo::TextListTabPage)
CLASS_MEMBER_CONSTRUCTOR(::demo::TextListTabPage*(::vl::Ptr<::demo::IViewModel>), { L"__vwsn_ctor_parameter_ViewModel" })
CLASS_MEMBER_METHOD(GetViewModel, NO_PARAMETER)
CLASS_MEMBER_FIELD(__vwsn_parameter_ViewModel)
CLASS_MEMBER_PROPERTY_READONLY(ViewModel, GetViewModel)
CLASS_MEMBER_CONSTRUCTOR(::demo::TextListTabPage*(), NO_PARAMETER)
CLASS_MEMBER_FIELD(counter)
CLASS_MEMBER_FIELD(itemsToBind)
END_CLASS_MEMBER(::demo::TextListTabPage)
BEGIN_CLASS_MEMBER(::demo::TextListTabPageConstructor)
@@ -1876,7 +1837,6 @@ namespace vl
CLASS_MEMBER_FIELD(__vwsn_precompile_7)
CLASS_MEMBER_FIELD(__vwsn_precompile_8)
CLASS_MEMBER_FIELD(__vwsn_precompile_9)
CLASS_MEMBER_FIELD(ViewModel)
CLASS_MEMBER_FIELD(bindableTextList)
CLASS_MEMBER_FIELD(comboView)
CLASS_MEMBER_FIELD(self)
@@ -1953,7 +1913,6 @@ namespace vl
public:
void Load(ITypeManager* manager)
{
ADD_TYPE_INFO(::demo::IViewModel)
ADD_TYPE_INFO(::demo::ListViewTabPage)
ADD_TYPE_INFO(::demo::ListViewTabPageConstructor)
ADD_TYPE_INFO(::demo::MainWindow)
@@ -60,7 +60,6 @@ namespace demo
class TreeViewTabPageConstructor;
class TreeViewTabPage;
class MyTextItem;
class IViewModel;
class ListViewTabPageConstructor : public ::vl::Object, public ::vl::reflection::Description<ListViewTabPageConstructor>
{
@@ -133,7 +132,6 @@ namespace demo
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<MainWindowConstructor>;
#endif
protected:
::vl::Ptr<::demo::IViewModel> ViewModel = ::vl::Ptr<::demo::IViewModel>();
::demo::MainWindow* self = static_cast<::demo::MainWindow*>(nullptr);
::vl::presentation::controls::GuiTab* __vwsn_precompile_0 = static_cast<::vl::presentation::controls::GuiTab*>(nullptr);
::vl::presentation::compositions::GuiBoundsComposition* __vwsn_precompile_1 = static_cast<::vl::presentation::compositions::GuiBoundsComposition*>(nullptr);
@@ -153,9 +151,7 @@ namespace demo
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<MainWindow>;
#endif
public:
::vl::Ptr<::demo::IViewModel> __vwsn_parameter_ViewModel = ::vl::Ptr<::demo::IViewModel>();
::vl::Ptr<::demo::IViewModel> GetViewModel();
MainWindow(::vl::Ptr<::demo::IViewModel> __vwsn_ctor_parameter_ViewModel);
MainWindow();
~MainWindow();
};
@@ -172,7 +168,6 @@ namespace demo
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<TextListTabPageConstructor>;
#endif
protected:
::vl::Ptr<::demo::IViewModel> ViewModel = ::vl::Ptr<::demo::IViewModel>();
::demo::TextListTabPage* self = static_cast<::demo::TextListTabPage*>(nullptr);
::vl::presentation::controls::GuiComboBoxListControl* comboView = static_cast<::vl::presentation::controls::GuiComboBoxListControl*>(nullptr);
::vl::presentation::controls::GuiTextList* textList = static_cast<::vl::presentation::controls::GuiTextList*>(nullptr);
@@ -222,9 +217,8 @@ namespace demo
#endif
public:
::vl::vint32_t counter = static_cast<::vl::vint32_t>(0);
::vl::Ptr<::demo::IViewModel> __vwsn_parameter_ViewModel = ::vl::Ptr<::demo::IViewModel>();
::vl::Ptr<::demo::IViewModel> GetViewModel();
TextListTabPage(::vl::Ptr<::demo::IViewModel> __vwsn_ctor_parameter_ViewModel);
::vl::Ptr<::vl::reflection::description::IValueObservableList> itemsToBind = ::vl::reflection::description::IValueObservableList::Create();
TextListTabPage();
~TextListTabPage();
};
@@ -326,18 +320,6 @@ namespace demo
MyTextItem();
};
class IViewModel : public virtual ::vl::reflection::IDescriptable, public ::vl::reflection::Description<IViewModel>
{
#ifndef VCZH_DEBUG_NO_REFLECTION
friend struct ::vl::reflection::description::CustomTypeDescriptorSelector<IViewModel>;
#endif
public:
virtual ::vl::Ptr<::vl::reflection::description::IValueObservableList> GetTextItems() = 0;
virtual void AddTextItem(::vl::Ptr<::demo::MyTextItem> item) = 0;
virtual void RemoveTextItem(::vl::vint32_t index) = 0;
virtual void ClearTextItems() = 0;
};
}
/***********************************************************************
Global Variables and Functions
@@ -522,10 +504,10 @@ Closures
struct __vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__
{
::vl::Ptr<::vl::reflection::description::IValueList> itemsToBind;
::vl::Ptr<::vl::reflection::description::IValueObservableList> itemsToBind;
::demo::ListViewTabPage* __vwsnthis_0;
__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__(::vl::Ptr<::vl::reflection::description::IValueList> __vwsnctor_itemsToBind, ::demo::ListViewTabPage* __vwsnctorthis_0);
__vwsnf9_Demo_demo_ListViewTabPage___vwsn_instance_ctor__(::vl::Ptr<::vl::reflection::description::IValueObservableList> __vwsnctor_itemsToBind, ::demo::ListViewTabPage* __vwsnctorthis_0);
void operator()(::vl::Ptr<::vl::presentation::controls::list::ListViewItem> item) const;
};
@@ -2,9 +2,9 @@
<ref.Members>
<![CDATA[
var counter : int = 0;
var itemsToBind : observe MyTextItem^[] = {};
]]>
</ref.Members>
<ref.Parameter Name="ViewModel" Class="demo::IViewModel"/>
<TabPage ref.Name="self" Text="TextList">
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" CellPadding="5">
<att.Rows>
@@ -76,13 +76,12 @@
textList.Items.Add(textItem);
}
if (ViewModel.TextItems is not null)
{
for (i in range [0, 9])
{
var textItem = new demo::MyTextItem^();
textItem.Name = cast string (self.counter + i);
ViewModel.AddTextItem(textItem);
self.itemsToBind.Add(textItem);
}
}
@@ -107,12 +106,11 @@
}
}
if (ViewModel.TextItems is not null)
{
var i = 0;
while (i < ViewModel.TextItems.Count)
while (i < self.itemsToBind.Count)
{
ViewModel.RemoveTextItem(i);
self.itemsToBind.RemoveAt(i);
i = i + 1;
}
}
@@ -136,12 +134,11 @@
}
}
if (ViewModel.TextItems is not null)
{
var i = 1;
while (i < ViewModel.TextItems.Count)
while (i < self.itemsToBind.Count)
{
ViewModel.RemoveTextItem(i);
self.itemsToBind.RemoveAt(i);
i = i + 1;
}
}
@@ -157,11 +154,7 @@
<![CDATA[
{
textList.Items.Clear();
if (ViewModel.TextItems is not null)
{
ViewModel.ClearTextItems();
}
self.itemsToBind.Clear();
}
]]>
</ev.Clicked-eval>
@@ -173,7 +166,7 @@
<Cell Site="row:1 column:2">
<BindableTextList ref.Name="bindableTextList" Alt="B" env.ItemType="demo::MyTextItem^" HorizontalAlwaysVisible="false" VerticalAlwaysVisible="false">
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
<att.ItemSource-eval>ViewModel.TextItems</att.ItemSource-eval>
<att.ItemSource-eval>self.itemsToBind</att.ItemSource-eval>
<att.TextProperty>Name</att.TextProperty>
<att.CheckedProperty>Checked</att.CheckedProperty>
</BindableTextList>
Binary file not shown.