diff --git a/Import/GacUI.cpp b/Import/GacUI.cpp index fa19f432..8452e9fa 100644 --- a/Import/GacUI.cpp +++ b/Import/GacUI.cpp @@ -4870,18 +4870,22 @@ GuiBindableTextList::ItemSource if (!itemSource) return 0; return itemSource->GetCount(); } + + WString GuiBindableTextList::ItemSource::GetTextValue(vint itemIndex) + { + if (itemSource) + { + if (0 <= itemIndex && itemIndex < itemSource->GetCount()) + { + return ReadProperty(itemSource->Get(itemIndex), textProperty); + } + } + return L""; + } IDescriptable* GuiBindableTextList::ItemSource::RequestView(const WString& identifier) { - if (identifier == GuiListControl::IItemBindingView::Identifier) - { - return (GuiListControl::IItemBindingView*)this; - } - else if (identifier == GuiListControl::IItemPrimaryTextView::Identifier) - { - return (GuiListControl::IItemPrimaryTextView*)this; - } - else if (identifier == TextItemStyleProvider::ITextItemView::Identifier) + if (identifier == TextItemStyleProvider::ITextItemView::Identifier) { return (TextItemStyleProvider::ITextItemView*)this; } @@ -4909,32 +4913,7 @@ GuiBindableTextList::ItemSource return Value(); } - // ===================== GuiListControl::IItemPrimaryTextView ===================== - - WString GuiBindableTextList::ItemSource::GetPrimaryTextViewText(vint itemIndex) - { - return GetText(itemIndex); - } - - bool GuiBindableTextList::ItemSource::ContainsPrimaryText(vint itemIndex) - { - if (!itemSource) return false; - return 0 <= itemIndex && itemIndex < itemSource->GetCount(); - } - // ===================== list::TextItemStyleProvider::ITextItemView ===================== - - WString GuiBindableTextList::ItemSource::GetText(vint itemIndex) - { - if (itemSource) - { - if (0 <= itemIndex && itemIndex < itemSource->GetCount()) - { - return ReadProperty(itemSource->Get(itemIndex), textProperty); - } - } - return L""; - } bool GuiBindableTextList::ItemSource::GetChecked(vint itemIndex) { @@ -5141,36 +5120,11 @@ GuiBindableListView::ItemSource return itemSource->GetCount(); } - IDescriptable* GuiBindableListView::ItemSource::RequestView(const WString& identifier) + WString GuiBindableListView::ItemSource::GetTextValue(vint itemIndex) { - if (identifier == GuiListControl::IItemBindingView::Identifier) - { - return (GuiListControl::IItemBindingView*)this; - } - else if(identifier==ListViewItemStyleProvider::IListViewItemView::Identifier) - { - return (ListViewItemStyleProvider::IListViewItemView*)this; - } - else if(identifier==ListViewColumnItemArranger::IColumnItemView::Identifier) - { - return (ListViewColumnItemArranger::IColumnItemView*)this; - } - else if(identifier==GuiListControl::IItemPrimaryTextView::Identifier) - { - return (GuiListControl::IItemPrimaryTextView*)this; - } - else - { - return 0; - } + return GetText(itemIndex); } - void GuiBindableListView::ItemSource::ReleaseView(IDescriptable* view) - { - } - - // ===================== GuiListControl::IItemBindingView ===================== - description::Value GuiBindableListView::ItemSource::GetBindingValue(vint itemIndex) { if (itemSource) @@ -5183,16 +5137,24 @@ GuiBindableListView::ItemSource return Value(); } - // ===================== GuiListControl::IItemPrimaryTextView ===================== - - WString GuiBindableListView::ItemSource::GetPrimaryTextViewText(vint itemIndex) + IDescriptable* GuiBindableListView::ItemSource::RequestView(const WString& identifier) { - return GetText(itemIndex); + if(identifier==ListViewItemStyleProvider::IListViewItemView::Identifier) + { + return (ListViewItemStyleProvider::IListViewItemView*)this; + } + else if(identifier==ListViewColumnItemArranger::IColumnItemView::Identifier) + { + return (ListViewColumnItemArranger::IColumnItemView*)this; + } + else + { + return 0; + } } - bool GuiBindableListView::ItemSource::ContainsPrimaryText(vint itemIndex) + void GuiBindableListView::ItemSource::ReleaseView(IDescriptable* view) { - return true; } // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== @@ -5629,17 +5591,23 @@ GuiBindableTreeView::ItemSource return rootNode.Obj(); } + WString GuiBindableTreeView::ItemSource::GetTextValue(tree::INodeProvider* node) + { + return ReadProperty(GetBindingValue(node), textProperty); + } + + description::Value GuiBindableTreeView::ItemSource::GetBindingValue(tree::INodeProvider* node) + { + if (auto itemSourceNode = dynamic_cast(node)) + { + return itemSourceNode->GetItemSource(); + } + return Value(); + } + IDescriptable* GuiBindableTreeView::ItemSource::RequestView(const WString& identifier) { - if(identifier==INodeItemBindingView::Identifier) - { - return (INodeItemBindingView*)this; - } - else if(identifier==INodeItemPrimaryTextView::Identifier) - { - return (INodeItemPrimaryTextView*)this; - } - else if(identifier==ITreeViewItemView::Identifier) + if(identifier==ITreeViewItemView::Identifier) { return (ITreeViewItemView*)this; } @@ -5653,24 +5621,6 @@ GuiBindableTreeView::ItemSource { } - // ===================== tree::INodeItemBindingView ===================== - - description::Value GuiBindableTreeView::ItemSource::GetBindingValue(tree::INodeProvider* node) - { - if (auto itemSourceNode = dynamic_cast(node)) - { - return itemSourceNode->GetItemSource(); - } - return Value(); - } - - // ===================== tree::INodeItemPrimaryTextView ===================== - - WString GuiBindableTreeView::ItemSource::GetPrimaryTextViewText(tree::INodeProvider* node) - { - return GetNodeText(node); - } - // ===================== tree::ITreeViewItemView ===================== Ptr GuiBindableTreeView::ItemSource::GetNodeImage(tree::INodeProvider* node) @@ -6185,11 +6135,11 @@ GuiComboBoxListControl void GuiComboBoxListControl::InstallStyleController(vint itemIndex) { - if (itemBindingView != nullptr && itemStyleProvider) + if (itemStyleProvider) { if (itemIndex != -1) { - auto item = itemBindingView->GetBindingValue(itemIndex); + auto item = containedListControl->GetItemProvider()->GetBindingValue(itemIndex); if (!item.IsNull()) { itemStyleController = itemStyleProvider->CreateItemStyle(item); @@ -6210,18 +6160,15 @@ GuiComboBoxListControl void GuiComboBoxListControl::DisplaySelectedContent(vint itemIndex) { - if(primaryTextView) + if(itemIndex==-1) { - if(itemIndex==-1) - { - SetText(L""); - } - else if(primaryTextView->ContainsPrimaryText(itemIndex)) - { - WString text=primaryTextView->GetPrimaryTextViewText(itemIndex); - SetText(text); - GetSubMenu()->Hide(); - } + SetText(L""); + } + else + { + WString text = containedListControl->GetItemProvider()->GetTextValue(itemIndex); + SetText(text); + GetSubMenu()->Hide(); } RemoveStyleController(); @@ -6291,8 +6238,6 @@ GuiComboBoxListControl containedListControl->SelectionChanged.AttachMethod(this, &GuiComboBoxListControl::OnListControlSelectionChanged); auto itemProvider = containedListControl->GetItemProvider(); - primaryTextView = dynamic_cast(itemProvider->RequestView(GuiListControl::IItemPrimaryTextView::Identifier)); - itemBindingView = dynamic_cast(itemProvider->RequestView(GuiListControl::IItemBindingView::Identifier)); SelectedIndexChanged.SetAssociatedComposition(GetBoundsComposition()); @@ -6303,10 +6248,6 @@ GuiComboBoxListControl GuiComboBoxListControl::~GuiComboBoxListControl() { - if(primaryTextView) - { - containedListControl->GetItemProvider()->ReleaseView(primaryTextView); - } } GuiSelectableListControl* GuiComboBoxListControl::GetContainedListControl() @@ -6367,10 +6308,7 @@ GuiComboBoxListControl auto selectedIndex = GetSelectedIndex(); if (selectedIndex != -1) { - if (itemBindingView) - { - return itemBindingView->GetBindingValue(selectedIndex); - } + return containedListControl->GetItemProvider()->GetBindingValue(selectedIndex); } return description::Value(); } @@ -6397,6 +6335,7 @@ namespace vl { using namespace compositions; using namespace collections; + using namespace description; const wchar_t* const IDataProvider::Identifier = L"vl::presentation::controls::list::IDataProvider"; @@ -6486,6 +6425,16 @@ DataGridItemProvider return dataProvider->GetRowCount(); } + WString DataGridItemProvider::GetTextValue(vint itemIndex) + { + return GetText(itemIndex); + } + + description::Value DataGridItemProvider::GetBindingValue(vint itemIndex) + { + return Value(); + } + IDescriptable* DataGridItemProvider::RequestView(const WString& identifier) { if(identifier==IDataProvider::Identifier) @@ -6500,10 +6449,6 @@ DataGridItemProvider { return (ListViewColumnItemArranger::IColumnItemView*)this; } - else if(identifier==GuiListControl::IItemPrimaryTextView::Identifier) - { - return (GuiListControl::IItemPrimaryTextView*)this; - } else { return 0; @@ -6514,20 +6459,6 @@ DataGridItemProvider { } -// ===================== GuiListControl::IItemPrimaryTextView ===================== - - WString DataGridItemProvider::GetPrimaryTextViewText(vint itemIndex) - { - return GetText(itemIndex); - } - - bool DataGridItemProvider::ContainsPrimaryText(vint itemIndex) - { - return true; - } - -// ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== - Ptr DataGridItemProvider::GetSmallImage(vint itemIndex) { return dataProvider->GetRowSmallImage(itemIndex); @@ -8870,7 +8801,7 @@ StructuredDataProviderBase } /*********************************************************************** -CONTROLS\LISTCONTROLPACKAGE\GUILISTCONTROLS.CPP +CONTROLS\LISTCONTROLPACKAGE\GUILISTCONTROLITEMARRANGERS.CPP ***********************************************************************/ namespace vl @@ -8883,8 +8814,873 @@ namespace vl using namespace elements; using namespace compositions; - const wchar_t* const GuiListControl::IItemPrimaryTextView::Identifier = L"vl::presnetation::controls::GuiListControl::IItemPrimaryTextView"; - const wchar_t* const GuiListControl::IItemBindingView::Identifier = L"vl::presnetation::controls::GuiListControl::IItemBindingView"; + namespace list + { + +/*********************************************************************** +RangedItemArrangerBase +***********************************************************************/ + + void RangedItemArrangerBase::InvalidateAdoptedSize() + { + if (listControl) + { + listControl->AdoptedSizeInvalidated.Execute(listControl->GetNotifyEventArguments()); + } + } + + vint RangedItemArrangerBase::CalculateAdoptedSize(vint expectedSize, vint count, vint itemSize) + { + vint visibleCount = expectedSize / itemSize; + if (count < visibleCount) + { + visibleCount = count; + } + else if (count > visibleCount) + { + vint deltaA = expectedSize - count * itemSize; + vint deltaB = itemSize - deltaA; + if (deltaB < deltaA) + { + visibleCount++; + } + } + return visibleCount * itemSize; + } + + void RangedItemArrangerBase::ClearStyles() + { + startIndex = 0; + if (callback) + { + for (vint i = 0; i < visibleStyles.Count(); i++) + { + auto style = visibleStyles[i]; + callback->ReleaseItem(style); + } + } + visibleStyles.Clear(); + viewBounds = Rect(0, 0, 0, 0); + InvalidateItemSizeCache(); + InvalidateAdoptedSize(); + } + + void RangedItemArrangerBase::OnViewChangedInternal(Rect oldBounds, Rect newBounds) + { + vint endIndex = startIndex + visibleStyles.Count() - 1; + vint newStartIndex = 0; + vint itemCount = itemProvider->Count(); + BeginPlaceItem(true, newBounds, newStartIndex); + if (newStartIndex < 0) newStartIndex = 0; + + StyleList newVisibleStyles; + for (vint i = newStartIndex; i < itemCount; i++) + { + auto style + = startIndex <= i && i <= endIndex + ? visibleStyles[i - startIndex] + : callback->RequestItem(i) + ; + newVisibleStyles.Add(style); + + Rect bounds; + Margin alignmentToParent; + PlaceItem(true, i, style, newBounds, bounds, alignmentToParent); + if (IsItemOutOfViewBounds(i, style, bounds, newBounds)) + { + break; + } + + bounds.x1 -= newBounds.x1; + bounds.x2 -= newBounds.x1; + bounds.y1 -= newBounds.y1; + bounds.y2 -= newBounds.y1; + } + + vint newEndIndex = newStartIndex + newVisibleStyles.Count() - 1; + for (vint i = 0; i < visibleStyles.Count(); i++) + { + vint index = startIndex + i; + if (index < newStartIndex || index > newEndIndex) + { + auto style = visibleStyles[i]; + callback->ReleaseItem(style); + } + } + CopyFrom(visibleStyles, newVisibleStyles); + + if (EndPlaceItem(true, newBounds, newStartIndex)) + { + callback->OnTotalSizeChanged(); + InvalidateAdoptedSize(); + } + startIndex = newStartIndex; + } + + void RangedItemArrangerBase::RearrangeItemBounds() + { + vint newStartIndex = startIndex; + BeginPlaceItem(false, viewBounds, newStartIndex); + for (vint i = 0; i < visibleStyles.Count(); i++) + { + auto style = visibleStyles[i]; + Rect bounds; + Margin alignmentToParent(-1, -1, -1, -1); + PlaceItem(false, startIndex + i, style, viewBounds, bounds, alignmentToParent); + + bounds.x1 -= viewBounds.x1; + bounds.x2 -= viewBounds.x1; + bounds.y1 -= viewBounds.y1; + bounds.y2 -= viewBounds.y1; + + callback->SetStyleAlignmentToParent(style, alignmentToParent); + callback->SetStyleBounds(style, bounds); + } + EndPlaceItem(false, viewBounds, startIndex); + } + + RangedItemArrangerBase::RangedItemArrangerBase() + { + } + + RangedItemArrangerBase::~RangedItemArrangerBase() + { + } + + void RangedItemArrangerBase::OnAttached(GuiListControl::IItemProvider* provider) + { + itemProvider = provider; + if (provider) + { + OnItemModified(0, 0, provider->Count()); + } + } + + void RangedItemArrangerBase::OnItemModified(vint start, vint count, vint newCount) + { + if (callback) + { + vint visibleCount = visibleStyles.Count(); + vint itemCount = itemProvider->Count(); + SortedList reusedStyles; + for (vint i = 0; i < visibleCount; i++) + { + vint index = startIndex + i; + if (index >= itemCount) + { + break; + } + + vint oldIndex = -1; + if (index < start) + { + oldIndex = index; + } + else if (index >= start + newCount) + { + oldIndex = index - newCount + count; + } + + if (oldIndex != -1) + { + if (oldIndex >= startIndex && oldIndex < startIndex + visibleCount) + { + GuiListControl::IItemStyleController* style = visibleStyles[oldIndex - startIndex]; + reusedStyles.Add(style); + visibleStyles.Add(style); + } + else + { + oldIndex = -1; + } + } + if (oldIndex == -1) + { + GuiListControl::IItemStyleController* style = callback->RequestItem(index); + visibleStyles.Add(style); + } + } + + for (vint i = 0; i < visibleCount; i++) + { + GuiListControl::IItemStyleController* style = visibleStyles[i]; + if (!reusedStyles.Contains(style)) + { + callback->ReleaseItem(style); + } + } + + visibleStyles.RemoveRange(0, visibleCount); + if (listControl && listControl->GetStyleProvider()) + { + for (vint i = 0; i < visibleStyles.Count(); i++) + { + listControl->GetStyleProvider()->SetStyleIndex(visibleStyles[i], startIndex + i); + } + } + + callback->OnTotalSizeChanged(); + callback->SetViewLocation(viewBounds.LeftTop()); + InvalidateAdoptedSize(); + } + } + + void RangedItemArrangerBase::AttachListControl(GuiListControl* value) + { + listControl = value; + InvalidateAdoptedSize(); + } + + void RangedItemArrangerBase::DetachListControl() + { + listControl = 0; + } + + GuiListControl::IItemArrangerCallback* RangedItemArrangerBase::GetCallback() + { + return callback; + } + + void RangedItemArrangerBase::SetCallback(GuiListControl::IItemArrangerCallback* value) + { + if (callback != value) + { + ClearStyles(); + } + callback = value; + } + + Size RangedItemArrangerBase::GetTotalSize() + { + if (callback) + { + return OnCalculateTotalSize(); + } + else + { + return Size(0, 0); + } + } + + GuiListControl::IItemStyleController* RangedItemArrangerBase::GetVisibleStyle(vint itemIndex) + { + if (startIndex <= itemIndex && itemIndex < startIndex + visibleStyles.Count()) + { + return visibleStyles[itemIndex - startIndex]; + } + else + { + return 0; + } + } + + vint RangedItemArrangerBase::GetVisibleIndex(GuiListControl::IItemStyleController* style) + { + vint index = visibleStyles.IndexOf(style); + return index == -1 ? -1 : index + startIndex; + } + + void RangedItemArrangerBase::OnViewChanged(Rect bounds) + { + if (!suppressOnViewChanged) + { + suppressOnViewChanged = true; + Rect oldBounds = viewBounds; + viewBounds = bounds; + if (callback) + { + OnViewChangedInternal(oldBounds, viewBounds); + RearrangeItemBounds(); + } + suppressOnViewChanged = false; + } + } + +/*********************************************************************** +FixedHeightItemArranger +***********************************************************************/ + + vint FixedHeightItemArranger::GetWidth() + { + return -1; + } + + vint FixedHeightItemArranger::GetYOffset() + { + return 0; + } + + void FixedHeightItemArranger::BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex) + { + pi_width = GetWidth(); + if (forMoving) + { + pim_rowHeight = rowHeight; + newStartIndex = (newBounds.Top() - GetYOffset()) / rowHeight; + } + } + + void FixedHeightItemArranger::PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent) + { + vint top = GetYOffset() + index * rowHeight; + if (pi_width == -1) + { + alignmentToParent = Margin(0, -1, 0, -1); + bounds = Rect(Point(0, top), Size(0, rowHeight)); + } + else + { + alignmentToParent = Margin(-1, -1, -1, -1); + bounds = Rect(Point(0, top), Size(pi_width, rowHeight)); + } + if (forMoving) + { + vint styleHeight = callback->GetStylePreferredSize(style).y; + if (pim_rowHeight < styleHeight) + { + pim_rowHeight = styleHeight; + } + } + } + + bool FixedHeightItemArranger::IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds) + { + return bounds.Top() >= viewBounds.Bottom(); + } + + bool FixedHeightItemArranger::EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex) + { + if (forMoving) + { + if (pim_rowHeight != rowHeight) + { + vint offset = (pim_rowHeight - rowHeight) * newStartIndex; + rowHeight = pim_rowHeight; + callback->SetViewLocation(Point(0, newBounds.Top() + offset)); + return true; + } + } + return false; + } + + void FixedHeightItemArranger::InvalidateItemSizeCache() + { + rowHeight = 1; + } + + Size FixedHeightItemArranger::OnCalculateTotalSize() + { + vint width = GetWidth(); + if (width < 0) width = 0; + return Size(width, rowHeight * itemProvider->Count() + GetYOffset()); + } + + FixedHeightItemArranger::FixedHeightItemArranger() + :rowHeight(1) + { + } + + FixedHeightItemArranger::~FixedHeightItemArranger() + { + } + + vint FixedHeightItemArranger::FindItem(vint itemIndex, compositions::KeyDirection key) + { + vint count = itemProvider->Count(); + if (count == 0) return -1; + vint groupCount = viewBounds.Height() / rowHeight; + if (groupCount == 0) groupCount = 1; + switch (key) + { + case KeyDirection::Up: + itemIndex--; + break; + case KeyDirection::Down: + itemIndex++; + break; + case KeyDirection::Home: + itemIndex = 0; + break; + case KeyDirection::End: + itemIndex = count; + break; + case KeyDirection::PageUp: + itemIndex -= groupCount; + break; + case KeyDirection::PageDown: + itemIndex += groupCount; + break; + default: + return -1; + } + + if (itemIndex < 0) return 0; + else if (itemIndex >= count) return count - 1; + else return itemIndex; + } + + bool FixedHeightItemArranger::EnsureItemVisible(vint itemIndex) + { + if (callback) + { + if (itemIndex < 0 || itemIndex >= itemProvider->Count()) + { + return false; + } + while (true) + { + vint yOffset = GetYOffset(); + vint top = itemIndex*rowHeight; + vint bottom = top + rowHeight + yOffset; + + if (viewBounds.Height() < rowHeight) + { + if (viewBounds.Top() < bottom && top < viewBounds.Bottom()) + { + break; + } + } + + Point location = viewBounds.LeftTop(); + if (top < viewBounds.Top()) + { + location.y = top; + } + else if (viewBounds.Bottom() < bottom) + { + location.y = bottom - viewBounds.Height(); + } + else + { + break; + } + callback->SetViewLocation(location); + } + return true; + } + return false; + } + + Size FixedHeightItemArranger::GetAdoptedSize(Size expectedSize) + { + if (itemProvider) + { + vint yOffset = GetYOffset(); + vint y = expectedSize.y - yOffset; + vint itemCount = itemProvider->Count(); + return Size(expectedSize.x, yOffset + CalculateAdoptedSize(y, itemCount, rowHeight)); + } + return expectedSize; + } + +/*********************************************************************** +FixedSizeMultiColumnItemArranger +***********************************************************************/ + + void FixedSizeMultiColumnItemArranger::BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex) + { + if (forMoving) + { + pim_itemSize = itemSize; + vint rows = newBounds.Top() / itemSize.y; + if (rows < 0) rows = 0; + vint cols = newBounds.Width() / itemSize.x; + if (cols < 1) cols = 1; + newStartIndex = rows * cols; + } + } + + void FixedSizeMultiColumnItemArranger::PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent) + { + vint rowItems = viewBounds.Width() / itemSize.x; + if (rowItems < 1) rowItems = 1; + + vint row = index / rowItems; + vint col = index % rowItems; + bounds = Rect(Point(col * itemSize.x, row * itemSize.y), itemSize); + if (forMoving) + { + Size styleSize = callback->GetStylePreferredSize(style); + if (pim_itemSize.x < styleSize.x) pim_itemSize.x = styleSize.x; + if (pim_itemSize.y < styleSize.y) pim_itemSize.y = styleSize.y; + } + } + + bool FixedSizeMultiColumnItemArranger::IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds) + { + return bounds.Top() >= viewBounds.Bottom(); + } + + bool FixedSizeMultiColumnItemArranger::EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex) + { + if (forMoving) + { + if (pim_itemSize != itemSize) + { + itemSize = pim_itemSize; + return true; + } + } + return false; + } + + void FixedSizeMultiColumnItemArranger::CalculateRange(Size itemSize, Rect bounds, vint count, vint& start, vint& end) + { + vint startRow = bounds.Top() / itemSize.y; + if (startRow < 0) startRow = 0; + vint endRow = (bounds.Bottom() - 1) / itemSize.y; + vint cols = bounds.Width() / itemSize.x; + if (cols < 1) cols = 1; + + start = startRow*cols; + end = (endRow + 1)*cols - 1; + if (end >= count) end = count - 1; + } + + void FixedSizeMultiColumnItemArranger::InvalidateItemSizeCache() + { + itemSize = Size(1, 1); + } + + Size FixedSizeMultiColumnItemArranger::OnCalculateTotalSize() + { + vint rowItems = viewBounds.Width() / itemSize.x; + if (rowItems < 1) rowItems = 1; + vint rows = itemProvider->Count() / rowItems; + if (itemProvider->Count() % rowItems) rows++; + + return Size(itemSize.x * rowItems, itemSize.y*rows); + } + + FixedSizeMultiColumnItemArranger::FixedSizeMultiColumnItemArranger() + :itemSize(1, 1) + { + } + + FixedSizeMultiColumnItemArranger::~FixedSizeMultiColumnItemArranger() + { + } + + vint FixedSizeMultiColumnItemArranger::FindItem(vint itemIndex, compositions::KeyDirection key) + { + vint count = itemProvider->Count(); + vint columnCount = viewBounds.Width() / itemSize.x; + if (columnCount == 0) columnCount = 1; + vint rowCount = viewBounds.Height() / itemSize.y; + if (rowCount == 0) rowCount = 1; + + switch (key) + { + case KeyDirection::Up: + itemIndex -= columnCount; + break; + case KeyDirection::Down: + itemIndex += columnCount; + break; + case KeyDirection::Left: + itemIndex--; + break; + case KeyDirection::Right: + itemIndex++; + break; + case KeyDirection::Home: + itemIndex = 0; + break; + case KeyDirection::End: + itemIndex = count; + break; + case KeyDirection::PageUp: + itemIndex -= columnCount*rowCount; + break; + case KeyDirection::PageDown: + itemIndex += columnCount*rowCount; + break; + case KeyDirection::PageLeft: + itemIndex -= itemIndex%columnCount; + break; + case KeyDirection::PageRight: + itemIndex += columnCount - itemIndex%columnCount - 1; + break; + default: + return -1; + } + + if (itemIndex < 0) return 0; + else if (itemIndex >= count) return count - 1; + else return itemIndex; + } + + bool FixedSizeMultiColumnItemArranger::EnsureItemVisible(vint itemIndex) + { + if (callback) + { + if (itemIndex < 0 || itemIndex >= itemProvider->Count()) + { + return false; + } + while (true) + { + vint rowHeight = itemSize.y; + vint columnCount = viewBounds.Width() / itemSize.x; + if (columnCount == 0) columnCount = 1; + vint rowIndex = itemIndex / columnCount; + + vint top = rowIndex*rowHeight; + vint bottom = top + rowHeight; + + if (viewBounds.Height() < rowHeight) + { + if (viewBounds.Top() < bottom && top < viewBounds.Bottom()) + { + break; + } + } + + Point location = viewBounds.LeftTop(); + if (top < viewBounds.Top()) + { + location.y = top; + } + else if (viewBounds.Bottom() < bottom) + { + location.y = bottom - viewBounds.Height(); + } + else + { + break; + } + callback->SetViewLocation(location); + } + return true; + } + return false; + } + + Size FixedSizeMultiColumnItemArranger::GetAdoptedSize(Size expectedSize) + { + if (itemProvider) + { + vint count = itemProvider->Count(); + vint columnCount = viewBounds.Width() / itemSize.x; + vint rowCount = viewBounds.Height() / itemSize.y; + return Size( + CalculateAdoptedSize(expectedSize.x, columnCount, itemSize.x), + CalculateAdoptedSize(expectedSize.y, rowCount, itemSize.y) + ); + } + return expectedSize; + } + +/*********************************************************************** +FixedHeightMultiColumnItemArranger +***********************************************************************/ + + void FixedHeightMultiColumnItemArranger::BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex) + { + pi_currentWidth = 0; + pi_totalWidth = 0; + if (forMoving) + { + pim_itemHeight = itemHeight; + vint rows = newBounds.Height() / itemHeight; + if (rows < 1) rows = 1; + vint columns = newBounds.Left() / newBounds.Width(); + newStartIndex = rows * columns; + } + } + + void FixedHeightMultiColumnItemArranger::PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent) + { + vint rows = viewBounds.Height() / itemHeight; + if (rows < 1) rows = 1; + + vint row = index % rows; + if (row == 0) + { + pi_totalWidth += pi_currentWidth; + pi_currentWidth = 0; + } + + Size styleSize = callback->GetStylePreferredSize(style); + if (pi_currentWidth < styleSize.x) pi_currentWidth = styleSize.x; + bounds = Rect(Point(pi_totalWidth + viewBounds.Left(), itemHeight * row), Size(0, 0)); + if (forMoving) + { + if (pim_itemHeight < styleSize.y) pim_itemHeight = styleSize.y; + } + } + + bool FixedHeightMultiColumnItemArranger::IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds) + { + return bounds.Left() >= viewBounds.Right(); + } + + bool FixedHeightMultiColumnItemArranger::EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex) + { + if (forMoving) + { + if (pim_itemHeight != itemHeight) + { + itemHeight = pim_itemHeight; + return true; + } + } + return false; + } + + void FixedHeightMultiColumnItemArranger::CalculateRange(vint itemHeight, Rect bounds, vint& rows, vint& startColumn) + { + rows = bounds.Height() / itemHeight; + if (rows < 1) rows = 1; + startColumn = bounds.Left() / bounds.Width(); + } + + void FixedHeightMultiColumnItemArranger::InvalidateItemSizeCache() + { + itemHeight = 1; + } + + Size FixedHeightMultiColumnItemArranger::OnCalculateTotalSize() + { + vint rows = viewBounds.Height() / itemHeight; + if (rows < 1) rows = 1; + vint columns = itemProvider->Count() / rows; + if (itemProvider->Count() % rows) columns += 1; + return Size(viewBounds.Width() * columns, 0); + } + + FixedHeightMultiColumnItemArranger::FixedHeightMultiColumnItemArranger() + :itemHeight(1) + { + } + + FixedHeightMultiColumnItemArranger::~FixedHeightMultiColumnItemArranger() + { + } + + vint FixedHeightMultiColumnItemArranger::FindItem(vint itemIndex, compositions::KeyDirection key) + { + vint count = itemProvider->Count(); + vint groupCount = viewBounds.Height() / itemHeight; + if (groupCount == 0) groupCount = 1; + switch (key) + { + case KeyDirection::Up: + itemIndex--; + break; + case KeyDirection::Down: + itemIndex++; + break; + case KeyDirection::Left: + itemIndex -= groupCount; + break; + case KeyDirection::Right: + itemIndex += groupCount; + break; + case KeyDirection::Home: + itemIndex = 0; + break; + case KeyDirection::End: + itemIndex = count; + break; + case KeyDirection::PageUp: + itemIndex -= itemIndex%groupCount; + break; + case KeyDirection::PageDown: + itemIndex += groupCount - itemIndex%groupCount - 1; + break; + default: + return -1; + } + + if (itemIndex < 0) return 0; + else if (itemIndex >= count) return count - 1; + else return itemIndex; + } + + bool FixedHeightMultiColumnItemArranger::EnsureItemVisible(vint itemIndex) + { + if (callback) + { + if (itemIndex < 0 || itemIndex >= itemProvider->Count()) + { + return false; + } + while (true) + { + vint rowCount = viewBounds.Height() / itemHeight; + if (rowCount == 0) rowCount = 1; + vint columnIndex = itemIndex / rowCount; + vint minIndex = startIndex; + vint maxIndex = startIndex + visibleStyles.Count() - 1; + + Point location = viewBounds.LeftTop(); + if (minIndex <= itemIndex && itemIndex <= maxIndex) + { + Rect bounds = callback->GetStyleBounds(visibleStyles[itemIndex - startIndex]); + if (0 < bounds.Bottom() && bounds.Top() < viewBounds.Width() && bounds.Width() > viewBounds.Width()) + { + break; + } + else if (bounds.Left() < 0) + { + location.x -= viewBounds.Width(); + } + else if (bounds.Right() > viewBounds.Width()) + { + location.x += viewBounds.Width(); + } + else + { + break; + } + } + else if (columnIndex < minIndex / rowCount) + { + location.x -= viewBounds.Width(); + } + else if (columnIndex >= maxIndex / rowCount) + { + location.x += viewBounds.Width(); + } + else + { + break; + } + callback->SetViewLocation(location); + } + return true; + } + return false; + } + + Size FixedHeightMultiColumnItemArranger::GetAdoptedSize(Size expectedSize) + { + if (itemProvider) + { + vint count = itemProvider->Count(); + return Size(expectedSize.x, CalculateAdoptedSize(expectedSize.y, count, itemHeight)); + } + return expectedSize; + } + } + } + } +} + +/*********************************************************************** +CONTROLS\LISTCONTROLPACKAGE\GUILISTCONTROLS.CPP +***********************************************************************/ + +namespace vl +{ + namespace presentation + { + namespace controls + { + using namespace collections; + using namespace elements; + using namespace compositions; /*********************************************************************** GuiListControl::ItemCallback @@ -8933,22 +9729,18 @@ GuiListControl::ItemCallback GuiListControl::IItemStyleController* GuiListControl::ItemCallback::RequestItem(vint itemIndex) { - vint id = listControl->itemStyleProvider->GetItemStyleId(itemIndex); - IItemStyleController* style = 0; - for (vint i = 0; i < cachedStyles.Count(); i++) + IItemStyleController* style = nullptr; + if (cachedStyles.Count() > 0) { - IItemStyleController* cachedStyle = cachedStyles[i]; - if (cachedStyle->GetItemStyleId() == id) - { - style = cachedStyle; - cachedStyles.RemoveAt(i); - break; - } + vint index = cachedStyles.Count() - 1; + style = cachedStyles[index]; + cachedStyles.RemoveAt(index); } - if (!style) + else { - style = listControl->itemStyleProvider->CreateItemStyle(id); + style = listControl->itemStyleProvider->CreateItemStyle(); } + listControl->itemStyleProvider->Install(style, itemIndex); style->OnInstalled(); auto handler = style->GetBoundsComposition()->BoundsChanged.AttachMethod(this, &ItemCallback::OnStyleBoundsChanged); @@ -9503,12 +10295,7 @@ GuiSelectableListControl vint index = GetSelectedItemIndex(); if (index != -1) { - if (auto view = dynamic_cast(itemProvider->RequestView(IItemPrimaryTextView::Identifier))) - { - WString result = view->GetPrimaryTextViewText(index); - itemProvider->ReleaseView(view); - return result; - } + return itemProvider->GetTextValue(index); } return L""; } @@ -9667,964 +10454,6 @@ GuiSelectableListControl namespace list { -/*********************************************************************** -RangedItemArrangerBase -***********************************************************************/ - - void RangedItemArrangerBase::InvalidateAdoptedSize() - { - if (listControl) - { - listControl->AdoptedSizeInvalidated.Execute(listControl->GetNotifyEventArguments()); - } - } - - vint RangedItemArrangerBase::CalculateAdoptedSize(vint expectedSize, vint count, vint itemSize) - { - vint visibleCount = expectedSize / itemSize; - if (count < visibleCount) - { - visibleCount = count; - } - else if (count > visibleCount) - { - vint deltaA = expectedSize - count * itemSize; - vint deltaB = itemSize - deltaA; - if (deltaB < deltaA) - { - visibleCount++; - } - } - return visibleCount * itemSize; - } - - void RangedItemArrangerBase::ClearStyles() - { - startIndex=0; - if(callback) - { - for(vint i=0;iReleaseItem(style); - } - } - visibleStyles.Clear(); - viewBounds=Rect(0, 0, 0, 0); - OnStylesCleared(); - } - - RangedItemArrangerBase::RangedItemArrangerBase() - :listControl(0) - ,callback(0) - ,startIndex(0) - { - } - - RangedItemArrangerBase::~RangedItemArrangerBase() - { - } - - void RangedItemArrangerBase::OnAttached(GuiListControl::IItemProvider* provider) - { - itemProvider=provider; - if(provider) - { - OnItemModified(0, 0, provider->Count()); - } - } - - void RangedItemArrangerBase::OnItemModified(vint start, vint count, vint newCount) - { - if(callback) - { - vint visibleCount=visibleStyles.Count(); - vint itemCount=itemProvider->Count(); - SortedList reusedStyles; - for(vint i=0;i=itemCount) - { - break; - } - - vint oldIndex=-1; - if(index=start+newCount) - { - oldIndex=index-newCount+count; - } - - if(oldIndex!=-1) - { - if(oldIndex>=startIndex && oldIndexRequestItem(index); - visibleStyles.Add(style); - } - } - - for(vint i=0;iReleaseItem(style); - } - } - - visibleStyles.RemoveRange(0, visibleCount); - if (listControl && listControl->GetStyleProvider()) - { - for (vint i = 0; i < visibleStyles.Count(); i++) - { - listControl->GetStyleProvider()->SetStyleIndex(visibleStyles[i], startIndex + i); - } - } - - callback->OnTotalSizeChanged(); - callback->SetViewLocation(viewBounds.LeftTop()); - InvalidateAdoptedSize(); - } - } - - void RangedItemArrangerBase::AttachListControl(GuiListControl* value) - { - listControl = value; - InvalidateAdoptedSize(); - } - - void RangedItemArrangerBase::DetachListControl() - { - listControl = 0; - } - - GuiListControl::IItemArrangerCallback* RangedItemArrangerBase::GetCallback() - { - return callback; - } - - void RangedItemArrangerBase::SetCallback(GuiListControl::IItemArrangerCallback* value) - { - if(!value) - { - ClearStyles(); - } - callback=value; - } - - Size RangedItemArrangerBase::GetTotalSize() - { - return OnCalculateTotalSize(); - } - - GuiListControl::IItemStyleController* RangedItemArrangerBase::GetVisibleStyle(vint itemIndex) - { - if(startIndex<=itemIndex && itemIndexSetStyleAlignmentToParent(style, Margin(0, -1, 0, -1)); - callback->SetStyleBounds(style, Rect(Point(0, top), Size(0, rowHeight))); - } - else - { - callback->SetStyleAlignmentToParent(style, Margin(-1, -1, -1, -1)); - callback->SetStyleBounds(style, Rect(Point(x0, top), Size(width, rowHeight))); - } - } - } - - vint FixedHeightItemArranger::GetWidth() - { - return -1; - } - - vint FixedHeightItemArranger::GetYOffset() - { - return 0; - } - - void FixedHeightItemArranger::OnStylesCleared() - { - rowHeight=1; - InvalidateAdoptedSize(); - } - - Size FixedHeightItemArranger::OnCalculateTotalSize() - { - if(callback) - { - vint width=GetWidth(); - if(width<0) width=0; - return Size(width, rowHeight*itemProvider->Count()+GetYOffset()); - } - else - { - return Size(0, 0); - } - } - - void FixedHeightItemArranger::OnViewChangedInternal(Rect oldBounds, Rect newBounds) - { - if (callback) - { - if (!suppressOnViewChanged) - { - vint oldVisibleCount = visibleStyles.Count(); - vint newRowHeight = rowHeight; - vint newStartIndex = (newBounds.Top() - GetYOffset()) / rowHeight; - if (newStartIndex < 0) newStartIndex = 0; - - vint endIndex = startIndex + visibleStyles.Count() - 1; - vint newEndIndex = (newBounds.Bottom() - 1) / newRowHeight; - vint itemCount = itemProvider->Count(); - - for (vint i = newStartIndex; i <= newEndIndex && i < itemCount; i++) - { - GuiListControl::IItemStyleController* style = nullptr; - if (startIndex <= i && i <= endIndex) - { - style = visibleStyles[i - startIndex]; - visibleStyles.Add(style); - } - else - { - style = callback->RequestItem(i); - visibleStyles.Add(style); - } - - if (style) - { - vint styleHeight = callback->GetStylePreferredSize(style).y; - if (newRowHeight < styleHeight) - { - newRowHeight = styleHeight; - newEndIndex = newStartIndex + (newBounds.Height() - 1) / newRowHeight + 1; - if (newEndIndex < i) - { - newEndIndex = i; - } - } - } - } - - for (vint i = 0; i < oldVisibleCount; i++) - { - vint index = startIndex + i; - if (index < newStartIndex || newEndIndex < index) - { - GuiListControl::IItemStyleController* style = visibleStyles[i]; - callback->ReleaseItem(style); - } - } - visibleStyles.RemoveRange(0, oldVisibleCount); - - if (rowHeight != newRowHeight) - { - vint offset = oldBounds.Top() - rowHeight*startIndex; - rowHeight = newRowHeight; - suppressOnViewChanged = true; - callback->OnTotalSizeChanged(); - callback->SetViewLocation(Point(0, rowHeight*newStartIndex + offset)); - suppressOnViewChanged = false; - InvalidateAdoptedSize(); - } - startIndex = newStartIndex; - RearrangeItemBounds(); - } - } - } - - FixedHeightItemArranger::FixedHeightItemArranger() - :rowHeight(1) - ,suppressOnViewChanged(false) - { - } - - FixedHeightItemArranger::~FixedHeightItemArranger() - { - } - - vint FixedHeightItemArranger::FindItem(vint itemIndex, compositions::KeyDirection key) - { - vint count=itemProvider->Count(); - if(count==0) return -1; - vint groupCount=viewBounds.Height()/rowHeight; - if(groupCount==0) groupCount=1; - switch(key) - { - case KeyDirection::Up: - itemIndex--; - break; - case KeyDirection::Down: - itemIndex++; - break; - case KeyDirection::Home: - itemIndex=0; - break; - case KeyDirection::End: - itemIndex=count; - break; - case KeyDirection::PageUp: - itemIndex-=groupCount; - break; - case KeyDirection::PageDown: - itemIndex+=groupCount; - break; - default: - return -1; - } - - if(itemIndex<0) return 0; - else if(itemIndex>=count) return count-1; - else return itemIndex; - } - - bool FixedHeightItemArranger::EnsureItemVisible(vint itemIndex) - { - if(callback) - { - if(itemIndex<0 || itemIndex>=itemProvider->Count()) - { - return false; - } - while(true) - { - vint yOffset=GetYOffset(); - vint top=itemIndex*rowHeight; - vint bottom=top+rowHeight+yOffset; - - if(viewBounds.Height()SetViewLocation(location); - } - return true; - } - return false; - } - - Size FixedHeightItemArranger::GetAdoptedSize(Size expectedSize) - { - if (itemProvider) - { - vint offset = GetYOffset(); - vint y = expectedSize.y - offset; - vint itemCount = itemProvider->Count(); - return Size(expectedSize.x, offset + CalculateAdoptedSize(y, itemCount, rowHeight)); - } - return expectedSize; - } - -/*********************************************************************** -FixedSizeMultiColumnItemArranger -***********************************************************************/ - - void FixedSizeMultiColumnItemArranger::RearrangeItemBounds() - { - vint y0=-viewBounds.Top(); - vint rowItems=viewBounds.Width()/itemSize.x; - if(rowItems<1) rowItems=1; - - for(vint i=0;iSetStyleBounds(style, Rect(Point(col*itemSize.x, y0+row*itemSize.y), itemSize)); - } - } - - void FixedSizeMultiColumnItemArranger::CalculateRange(Size itemSize, Rect bounds, vint count, vint& start, vint& end) - { - vint startRow=bounds.Top()/itemSize.y; - if(startRow<0) startRow=0; - vint endRow=(bounds.Bottom()-1)/itemSize.y; - vint cols=bounds.Width()/itemSize.x; - if(cols<1) cols=1; - - start=startRow*cols; - end=(endRow+1)*cols-1; - if(end>=count) end=count-1; - } - - void FixedSizeMultiColumnItemArranger::OnStylesCleared() - { - itemSize=Size(1, 1); - InvalidateAdoptedSize(); - } - - Size FixedSizeMultiColumnItemArranger::OnCalculateTotalSize() - { - if(callback) - { - vint rowItems=viewBounds.Width()/itemSize.x; - if(rowItems<1) rowItems=1; - vint rows=itemProvider->Count()/rowItems; - if(itemProvider->Count()%rowItems) rows++; - - return Size(itemSize.x*rowItems, itemSize.y*rows); - } - else - { - return Size(0, 0); - } - } - - void FixedSizeMultiColumnItemArranger::OnViewChangedInternal(Rect oldBounds, Rect newBounds) - { - if (callback) - { - if (!suppressOnViewChanged) - { - vint oldVisibleCount = visibleStyles.Count(); - Size newItemSize = itemSize; - vint endIndex = startIndex + visibleStyles.Count() - 1; - - vint newStartIndex = 0; - vint newEndIndex = 0; - vint itemCount = itemProvider->Count(); - CalculateRange(newItemSize, newBounds, itemCount, newStartIndex, newEndIndex); - if (newItemSize == Size(1, 1) && newStartIndex < newEndIndex) - { - newEndIndex = newStartIndex; - } - - vint previousStartIndex = -1; - vint previousEndIndex = -1; - - while (true) - { - for (vint i = newStartIndex; i <= newEndIndex; i++) - { - GuiListControl::IItemStyleController* style = nullptr; - if (startIndex <= i && i <= endIndex) - { - style = visibleStyles[i - startIndex]; - visibleStyles.Add(style); - } - else if (ipreviousEndIndex) - { - style = callback->RequestItem(i); - - if (i < previousStartIndex) - { - visibleStyles.Insert(oldVisibleCount + (i - newStartIndex), style); - } - else - { - visibleStyles.Add(style); - } - } - - if (style) - { - Size styleSize = callback->GetStylePreferredSize(style); - if (newItemSize.x < styleSize.x) newItemSize.x = styleSize.x; - if (newItemSize.y < styleSize.y) newItemSize.y = styleSize.y; - } - } - - vint updatedStartIndex = 0; - vint updatedEndIndex = 0; - CalculateRange(newItemSize, newBounds, itemCount, updatedStartIndex, updatedEndIndex); - bool again = updatedStartIndexnewEndIndex; - previousStartIndex = newStartIndex; - previousEndIndex = newEndIndex; - if (updatedStartIndex < newStartIndex) newStartIndex = updatedStartIndex; - if (updatedEndIndex > newEndIndex) newEndIndex = updatedEndIndex; - if (!again) break; - } - - for (vint i = 0; i < oldVisibleCount; i++) - { - vint index = startIndex + i; - if (index < newStartIndex || newEndIndex < index) - { - GuiListControl::IItemStyleController* style = visibleStyles[i]; - callback->ReleaseItem(style); - } - } - visibleStyles.RemoveRange(0, oldVisibleCount); - - if (itemSize != newItemSize) - { - itemSize = newItemSize; - suppressOnViewChanged = true; - callback->OnTotalSizeChanged(); - suppressOnViewChanged = false; - InvalidateAdoptedSize(); - } - startIndex = newStartIndex; - RearrangeItemBounds(); - } - } - } - - FixedSizeMultiColumnItemArranger::FixedSizeMultiColumnItemArranger() - :itemSize(1, 1) - ,suppressOnViewChanged(false) - { - } - - FixedSizeMultiColumnItemArranger::~FixedSizeMultiColumnItemArranger() - { - } - - vint FixedSizeMultiColumnItemArranger::FindItem(vint itemIndex, compositions::KeyDirection key) - { - vint count=itemProvider->Count(); - vint columnCount=viewBounds.Width()/itemSize.x; - if(columnCount==0) columnCount=1; - vint rowCount=viewBounds.Height()/itemSize.y; - if(rowCount==0) rowCount=1; - - switch(key) - { - case KeyDirection::Up: - itemIndex-=columnCount; - break; - case KeyDirection::Down: - itemIndex+=columnCount; - break; - case KeyDirection::Left: - itemIndex--; - break; - case KeyDirection::Right: - itemIndex++; - break; - case KeyDirection::Home: - itemIndex=0; - break; - case KeyDirection::End: - itemIndex=count; - break; - case KeyDirection::PageUp: - itemIndex-=columnCount*rowCount; - break; - case KeyDirection::PageDown: - itemIndex+=columnCount*rowCount; - break; - case KeyDirection::PageLeft: - itemIndex-=itemIndex%columnCount; - break; - case KeyDirection::PageRight: - itemIndex+=columnCount-itemIndex%columnCount-1; - break; - default: - return -1; - } - - if(itemIndex<0) return 0; - else if(itemIndex>=count) return count-1; - else return itemIndex; - } - - bool FixedSizeMultiColumnItemArranger::EnsureItemVisible(vint itemIndex) - { - if(callback) - { - if(itemIndex<0 || itemIndex>=itemProvider->Count()) - { - return false; - } - while(true) - { - vint rowHeight=itemSize.y; - vint columnCount=viewBounds.Width()/itemSize.x; - if(columnCount==0) columnCount=1; - vint rowIndex=itemIndex/columnCount; - - vint top=rowIndex*rowHeight; - vint bottom=top+rowHeight; - - if(viewBounds.Height()SetViewLocation(location); - } - return true; - } - return false; - } - - Size FixedSizeMultiColumnItemArranger::GetAdoptedSize(Size expectedSize) - { - if (itemProvider) - { - vint count = itemProvider->Count(); - vint columnCount = viewBounds.Width() / itemSize.x; - vint rowCount = viewBounds.Height() / itemSize.y; - return Size( - CalculateAdoptedSize(expectedSize.x, columnCount, itemSize.x), - CalculateAdoptedSize(expectedSize.y, rowCount, itemSize.y) - ); - } - return expectedSize; - } - -/*********************************************************************** -FixedHeightMultiColumnItemArranger -***********************************************************************/ - - void FixedHeightMultiColumnItemArranger::RearrangeItemBounds() - { - vint rows=0; - vint startColumn=0; - CalculateRange(itemHeight, viewBounds, rows, startColumn); - vint currentWidth=0; - vint totalWidth=0; - for(vint i=0;iSetStyleBounds(style, Rect(Point(totalWidth, itemHeight*column), Size(0, 0))); - } - } - - void FixedHeightMultiColumnItemArranger::CalculateRange(vint itemHeight, Rect bounds, vint& rows, vint& startColumn) - { - rows=bounds.Height()/itemHeight; - if(rows<1) rows=1; - startColumn=bounds.Left()/bounds.Width(); - } - - void FixedHeightMultiColumnItemArranger::OnStylesCleared() - { - itemHeight=1; - InvalidateAdoptedSize(); - } - - Size FixedHeightMultiColumnItemArranger::OnCalculateTotalSize() - { - if(callback) - { - vint rows=viewBounds.Height()/itemHeight; - if(rows<1) rows=1; - vint columns=itemProvider->Count()/rows; - if(itemProvider->Count()%rows) columns+=1; - return Size(viewBounds.Width()*columns, 0); - } - else - { - return Size(0, 0); - } - } - - void FixedHeightMultiColumnItemArranger::OnViewChangedInternal(Rect oldBounds, Rect newBounds) - { - if (callback) - { - if (!suppressOnViewChanged) - { - vint oldVisibleCount = visibleStyles.Count(); - vint endIndex = startIndex + oldVisibleCount - 1; - - vint newItemHeight = itemHeight; - vint itemCount = itemProvider->Count(); - - vint previousStartIndex = -1; - vint previousEndIndex = -1; - vint newStartIndex = -1; - vint newEndIndex = -1; - - while (true) - { - vint newRows = 0; - vint newStartColumn = 0; - vint currentWidth = 0; - vint totalWidth = 0; - CalculateRange(newItemHeight, newBounds, newRows, newStartColumn); - newStartIndex = newRows*newStartColumn; - vint currentItemHeight = newItemHeight; - - for (vint i = newStartIndex; i < itemCount; i++) - { - if (i%newRows == 0) - { - totalWidth += currentWidth; - currentWidth = 0; - if (totalWidth >= newBounds.Width()) - { - break; - } - } - newEndIndex = i; - - GuiListControl::IItemStyleController* style = nullptr; - if (startIndex <= i && i <= endIndex) - { - style = visibleStyles[i - startIndex]; - visibleStyles.Add(style); - } - else if (ipreviousEndIndex) - { - style = callback->RequestItem(i); - - if (i < previousStartIndex) - { - visibleStyles.Insert(oldVisibleCount + (i - newStartIndex), style); - } - else - { - visibleStyles.Add(style); - } - } - - if (style) - { - Size styleSize = callback->GetStylePreferredSize(style); - if (currentWidth < styleSize.x) currentWidth = styleSize.x; - if (newItemHeight < styleSize.y) newItemHeight = styleSize.y; - if (currentItemHeight != newItemHeight) break; - } - } - - if (previousStartIndex == -1 || previousStartIndex < newStartIndex) previousStartIndex = newStartIndex; - if (previousEndIndex == -1 || previousEndIndex > newEndIndex) previousEndIndex = newEndIndex; - if (currentItemHeight == newItemHeight) - { - break; - } - } - newStartIndex = previousStartIndex; - newEndIndex = previousEndIndex; - - for (vint i = 0; i < oldVisibleCount; i++) - { - vint index = startIndex + i; - if (index < newStartIndex || newEndIndex < index) - { - GuiListControl::IItemStyleController* style = visibleStyles[i]; - callback->ReleaseItem(style); - } - } - visibleStyles.RemoveRange(0, oldVisibleCount); - - if (itemHeight != newItemHeight) - { - itemHeight = newItemHeight; - suppressOnViewChanged = true; - callback->OnTotalSizeChanged(); - suppressOnViewChanged = false; - InvalidateAdoptedSize(); - } - startIndex = newStartIndex; - RearrangeItemBounds(); - } - } - } - - FixedHeightMultiColumnItemArranger::FixedHeightMultiColumnItemArranger() - :itemHeight(1) - ,suppressOnViewChanged(false) - { - } - - FixedHeightMultiColumnItemArranger::~FixedHeightMultiColumnItemArranger() - { - } - - vint FixedHeightMultiColumnItemArranger::FindItem(vint itemIndex, compositions::KeyDirection key) - { - vint count=itemProvider->Count(); - vint groupCount=viewBounds.Height()/itemHeight; - if(groupCount==0) groupCount=1; - switch(key) - { - case KeyDirection::Up: - itemIndex--; - break; - case KeyDirection::Down: - itemIndex++; - break; - case KeyDirection::Left: - itemIndex-=groupCount; - break; - case KeyDirection::Right: - itemIndex+=groupCount; - break; - case KeyDirection::Home: - itemIndex=0; - break; - case KeyDirection::End: - itemIndex=count; - break; - case KeyDirection::PageUp: - itemIndex-=itemIndex%groupCount; - break; - case KeyDirection::PageDown: - itemIndex+=groupCount-itemIndex%groupCount-1; - break; - default: - return -1; - } - - if(itemIndex<0) return 0; - else if(itemIndex>=count) return count-1; - else return itemIndex; - } - - bool FixedHeightMultiColumnItemArranger::EnsureItemVisible(vint itemIndex) - { - if(callback) - { - if(itemIndex<0 || itemIndex>=itemProvider->Count()) - { - return false; - } - while(true) - { - vint rowCount=viewBounds.Height()/itemHeight; - if(rowCount==0) rowCount=1; - vint columnIndex=itemIndex/rowCount; - vint minIndex=startIndex; - vint maxIndex=startIndex+visibleStyles.Count()-1; - - Point location=viewBounds.LeftTop(); - if(minIndex<=itemIndex && itemIndex<=maxIndex) - { - Rect bounds=callback->GetStyleBounds(visibleStyles[itemIndex-startIndex]); - if(0viewBounds.Width()) - { - break; - } - else if(bounds.Left()<0) - { - location.x-=viewBounds.Width(); - } - else if(bounds.Right()>viewBounds.Width()) - { - location.x+=viewBounds.Width(); - } - else - { - break; - } - } - else if(columnIndex=maxIndex/rowCount) - { - location.x+=viewBounds.Width(); - } - else - { - break; - } - callback->SetViewLocation(location); - } - return true; - } - return false; - } - - Size FixedHeightMultiColumnItemArranger::GetAdoptedSize(Size expectedSize) - { - if (itemProvider) - { - vint count = itemProvider->Count(); - return Size(expectedSize.x, CalculateAdoptedSize(expectedSize.y, count, itemHeight)); - } - return expectedSize; - } - /*********************************************************************** ItemStyleControllerBase ***********************************************************************/ @@ -10827,11 +10656,6 @@ ListViewItemStyleProviderBase listControl=0; } - vint ListViewItemStyleProviderBase::GetItemStyleId(vint itemIndex) - { - return 0; - } - void ListViewItemStyleProviderBase::SetStyleSelected(GuiListControl::IItemStyleController* style, bool value) { ListViewItemStyleController* textStyle=dynamic_cast(style); @@ -10982,7 +10806,7 @@ ListViewItemStyleProvider ListViewItemStyleProviderBase::DetachListControl(); } - GuiListControl::IItemStyleController* ListViewItemStyleProvider::CreateItemStyle(vint styleId) + GuiListControl::IItemStyleController* ListViewItemStyleProvider::CreateItemStyle() { ListViewContentItemStyleController* itemStyle=new ListViewContentItemStyleController(this); itemStyles.Add(itemStyle); @@ -11836,8 +11660,8 @@ ListViewColumnItemArranger void ListViewColumnItemArranger::RearrangeItemBounds() { FixedHeightItemArranger::RearrangeItemBounds(); - vint count=columnHeaders->GetParent()->Children().Count(); - columnHeaders->GetParent()->MoveChild(columnHeaders, count-1); + vint count = columnHeaders->GetParent()->Children().Count(); + columnHeaders->GetParent()->MoveChild(columnHeaders, count - 1); columnHeaders->SetBounds(Rect(Point(-viewBounds.Left(), 0), Size(0, 0))); } @@ -12437,16 +12261,6 @@ ListViewItemProvider } } - bool ListViewItemProvider::ContainsPrimaryText(vint itemIndex) - { - return true; - } - - WString ListViewItemProvider::GetPrimaryTextViewText(vint itemIndex) - { - return Get(itemIndex)->text; - } - Ptr ListViewItemProvider::GetSmallImage(vint itemIndex) { return Get(itemIndex)->smallImage; @@ -12573,6 +12387,11 @@ ListViewItemProvider } } + WString ListViewItemProvider::GetTextValue(vint itemIndex) + { + return GetText(itemIndex); + } + description::Value ListViewItemProvider::GetBindingValue(vint itemIndex) { return Value::From(Get(itemIndex)); @@ -12598,14 +12417,6 @@ ListViewItemProvider { return (ListViewColumnItemArranger::IColumnItemView*)this; } - else if(identifier==GuiListControl::IItemPrimaryTextView::Identifier) - { - return (GuiListControl::IItemPrimaryTextView*)this; - } - else if(identifier==GuiListControl::IItemBindingView::Identifier) - { - return (GuiListControl::IItemBindingView*)this; - } else { return 0; @@ -12830,8 +12641,6 @@ TextItemStyleProvider TextItemStyleProvider::TextItemStyleProvider(IBulletFactory* _bulletFactory) :bulletFactory(_bulletFactory) - ,textItemView(0) - ,listControl(0) { } @@ -12841,8 +12650,8 @@ TextItemStyleProvider void TextItemStyleProvider::AttachListControl(GuiListControl* value) { - listControl=dynamic_cast(value); - textItemView=dynamic_cast(value->GetItemProvider()->RequestView(ITextItemView::Identifier)); + listControl = dynamic_cast(value); + textItemView = dynamic_cast(value->GetItemProvider()->RequestView(ITextItemView::Identifier)); } void TextItemStyleProvider::DetachListControl() @@ -12852,12 +12661,7 @@ TextItemStyleProvider listControl=0; } - vint TextItemStyleProvider::GetItemStyleId(vint itemIndex) - { - return 0; - } - - GuiListControl::IItemStyleController* TextItemStyleProvider::CreateItemStyle(vint styleId) + GuiListControl::IItemStyleController* TextItemStyleProvider::CreateItemStyle() { return new TextItemStyleController(this); } @@ -12869,8 +12673,8 @@ TextItemStyleProvider void TextItemStyleProvider::Install(GuiListControl::IItemStyleController* style, vint itemIndex) { - TextItemStyleController* textStyle=dynamic_cast(style); - textStyle->SetText(textItemView->GetText(itemIndex)); + TextItemStyleController* textStyle = dynamic_cast(style); + textStyle->SetText(listControl->GetItemProvider()->GetTextValue(itemIndex)); textStyle->SetChecked(textItemView->GetChecked(itemIndex)); } @@ -12965,19 +12769,14 @@ TextItemProvider ListProvider>::BeforeRemove(item, value); } - bool TextItemProvider::ContainsPrimaryText(vint itemIndex) + WString TextItemProvider::GetTextValue(vint itemIndex) { - return true; + return Get(itemIndex)->GetText(); } - WString TextItemProvider::GetPrimaryTextViewText(vint itemIndex) + description::Value TextItemProvider::GetBindingValue(vint itemIndex) { - return Get(itemIndex)->GetText(); - } - - WString TextItemProvider::GetText(vint itemIndex) - { - return Get(itemIndex)->GetText(); + return Value::From(Get(itemIndex)); } bool TextItemProvider::GetChecked(vint itemIndex) @@ -12990,11 +12789,6 @@ TextItemProvider items[itemIndex]->checked=value; } - description::Value TextItemProvider::GetBindingValue(vint itemIndex) - { - return Value::From(Get(itemIndex)); - } - TextItemProvider::TextItemProvider() :listControl(0) { @@ -13010,17 +12804,9 @@ TextItemProvider { return (TextItemStyleProvider::ITextItemView*)this; } - else if(identifier==GuiListControl::IItemPrimaryTextView::Identifier) - { - return (GuiListControl::IItemPrimaryTextView*)this; - } - else if(identifier==GuiListControl::IItemBindingView::Identifier) - { - return (GuiListControl::IItemBindingView*)this; - } else { - return 0; + return nullptr; } } @@ -13111,8 +12897,6 @@ namespace vl namespace tree { const wchar_t* const INodeItemView::Identifier = L"vl::presentation::controls::tree::INodeItemView"; - const wchar_t* const INodeItemPrimaryTextView::Identifier = L"vl::presentation::cotnrols::tree::INodeItemPrimaryTextView"; - const wchar_t* const INodeItemBindingView::Identifier = L"vl::presentation::cotnrols::tree::INodeItemBindingView"; /*********************************************************************** NodeItemProvider @@ -13290,36 +13074,6 @@ NodeItemProvider return result<0?-1:result; } - bool NodeItemProvider::ContainsPrimaryText(vint itemIndex) - { - if(nodeItemPrimaryTextView) - { - INodeProvider* node=RequestNode(itemIndex); - if(node) - { - bool result=node->GetChildCount()==0; - ReleaseNode(node); - return result; - } - } - return true; - } - - WString NodeItemProvider::GetPrimaryTextViewText(vint itemIndex) - { - if(nodeItemPrimaryTextView) - { - INodeProvider* node=RequestNode(itemIndex); - if(node) - { - WString result=nodeItemPrimaryTextView->GetPrimaryTextViewText(node); - ReleaseNode(node); - return result; - } - } - return L""; - } - INodeProvider* NodeItemProvider::RequestNode(vint index) { if(root->CanGetNodeByVisibleIndex()) @@ -13344,15 +13098,10 @@ NodeItemProvider :root(_root) { root->AttachCallback(this); - nodeItemPrimaryTextView=dynamic_cast(root->RequestView(INodeItemPrimaryTextView::Identifier)); } NodeItemProvider::~NodeItemProvider() { - if(nodeItemPrimaryTextView) - { - root->ReleaseView(nodeItemPrimaryTextView); - } root->DetachCallback(this); } @@ -13366,16 +13115,34 @@ NodeItemProvider return root->GetRootNode()->CalculateTotalVisibleNodes()-1; } + WString NodeItemProvider::GetTextValue(vint itemIndex) + { + if (auto node = RequestNode(itemIndex)) + { + WString result = root->GetTextValue(node); + ReleaseNode(node); + return result; + } + return L""; + } + + description::Value NodeItemProvider::GetBindingValue(vint itemIndex) + { + if (auto node = RequestNode(itemIndex)) + { + Value result = root->GetBindingValue(node); + ReleaseNode(node); + return result; + } + return Value(); + } + IDescriptable* NodeItemProvider::RequestView(const WString& identifier) { if(identifier==INodeItemView::Identifier) { return (INodeItemView*)this; } - else if(identifier==GuiListControl::IItemPrimaryTextView::Identifier) - { - return (GuiListControl::IItemPrimaryTextView*)this; - } else { return root->RequestView(identifier); @@ -13424,24 +13191,9 @@ NodeItemProvider listControl=0; } - vint NodeItemStyleProvider::GetItemStyleId(vint itemIndex) + GuiListControl::IItemStyleController* NodeItemStyleProvider::CreateItemStyle() { - vint result=-1; - if(nodeItemView) - { - INodeProvider* node=nodeItemView->RequestNode(itemIndex); - if(node) - { - result=nodeItemStyleProvider->GetItemStyleId(node); - nodeItemView->ReleaseNode(node); - } - } - return result; - } - - GuiListControl::IItemStyleController* NodeItemStyleProvider::CreateItemStyle(vint styleId) - { - return nodeItemStyleProvider->CreateItemStyle(styleId); + return nodeItemStyleProvider->CreateItemStyle(); } void NodeItemStyleProvider::DestroyItemStyle(GuiListControl::IItemStyleController* style) @@ -14005,11 +13757,6 @@ TreeViewItem TreeViewItemRootProvider ***********************************************************************/ - WString TreeViewItemRootProvider::GetPrimaryTextViewText(INodeProvider* node) - { - return GetNodeText(node); - } - Ptr TreeViewItemRootProvider::GetNodeImage(INodeProvider* node) { MemoryNodeProvider* memoryNode=dynamic_cast(node); @@ -14038,6 +13785,11 @@ TreeViewItemRootProvider return L""; } + WString TreeViewItemRootProvider::GetTextValue(INodeProvider* node) + { + return GetNodeText(node); + } + description::Value TreeViewItemRootProvider::GetBindingValue(INodeProvider* node) { return Value::From(GetTreeViewData(node)); @@ -14057,14 +13809,6 @@ TreeViewItemRootProvider { return (ITreeViewItemView*)this; } - else if(identifier==INodeItemPrimaryTextView::Identifier) - { - return (INodeItemPrimaryTextView*)this; - } - else if(identifier==INodeItemBindingView::Identifier) - { - return (INodeItemBindingView*)this; - } else { return MemoryNodeRootProvider::RequestView(identifier); @@ -14420,12 +14164,7 @@ TreeViewNodeItemStyleProvider } } - vint TreeViewNodeItemStyleProvider::GetItemStyleId(INodeProvider* node) - { - return 0; - } - - INodeItemStyleController* TreeViewNodeItemStyleProvider::CreateItemStyle(vint styleId) + INodeItemStyleController* TreeViewNodeItemStyleProvider::CreateItemStyle() { return new ItemController(this, minIconSize, fitImage); } @@ -25823,8 +25562,6 @@ GuiTextListItemTemplate_ItemStyleProvider GuiTextListItemTemplate_ItemStyleProvider::GuiTextListItemTemplate_ItemStyleProvider(Ptr _factory) :factory(_factory) - , listControl(0) - , bindingView(0) { } @@ -25835,25 +25572,14 @@ GuiTextListItemTemplate_ItemStyleProvider void GuiTextListItemTemplate_ItemStyleProvider::AttachListControl(controls::GuiListControl* value) { listControl = dynamic_cast(value); - bindingView = dynamic_cast(listControl->GetItemProvider()->RequestView(GuiListControl::IItemBindingView::Identifier)); } void GuiTextListItemTemplate_ItemStyleProvider::DetachListControl() { - if (listControl && bindingView) - { - listControl->GetItemProvider()->ReleaseView(bindingView); - } - listControl = 0; - bindingView = 0; + listControl = nullptr; } - vint GuiTextListItemTemplate_ItemStyleProvider::GetItemStyleId(vint itemIndex) - { - return 0; - } - - controls::GuiListControl::IItemStyleController* GuiTextListItemTemplate_ItemStyleProvider::CreateItemStyle(vint styleId) + controls::GuiListControl::IItemStyleController* GuiTextListItemTemplate_ItemStyleProvider::CreateItemStyle() { return new GuiTextListItemTemplate_ItemStyleController(this); } @@ -25867,12 +25593,7 @@ GuiTextListItemTemplate_ItemStyleProvider { if (auto controller = dynamic_cast(style)) { - Value viewModel; - if (bindingView) - { - viewModel = bindingView->GetBindingValue(itemIndex); - } - + Value viewModel = listControl->GetItemProvider()->GetBindingValue(itemIndex); GuiTemplate* itemTemplate = factory->CreateTemplate(viewModel); if (auto listItemTemplate = dynamic_cast(itemTemplate)) { @@ -26025,9 +25746,6 @@ GuiTreeItemTemplate_ItemStyleProvider GuiTreeItemTemplate_ItemStyleProvider::GuiTreeItemTemplate_ItemStyleProvider(Ptr _factory) :factory(_factory) - , treeListControl(0) - , bindingView(0) - , itemStyleProvider(0) { } @@ -26052,7 +25770,6 @@ GuiTreeItemTemplate_ItemStyleProvider if (treeListControl) { treeListControl->GetNodeRootProvider()->AttachCallback(this); - bindingView = dynamic_cast(treeListControl->GetNodeRootProvider()->RequestView(tree::INodeItemBindingView::Identifier)); } } @@ -26061,21 +25778,11 @@ GuiTreeItemTemplate_ItemStyleProvider if (treeListControl) { treeListControl->GetNodeRootProvider()->DetachCallback(this); - if (bindingView) - { - treeListControl->GetNodeRootProvider()->ReleaseView(bindingView); - } } - treeListControl = 0; - bindingView = 0; + treeListControl = nullptr; } - vint GuiTreeItemTemplate_ItemStyleProvider::GetItemStyleId(controls::tree::INodeProvider* node) - { - return 0; - } - - controls::tree::INodeItemStyleController* GuiTreeItemTemplate_ItemStyleProvider::CreateItemStyle(vint styleId) + controls::tree::INodeItemStyleController* GuiTreeItemTemplate_ItemStyleProvider::CreateItemStyle() { return new GuiTreeItemTemplate_ItemStyleController(this); } @@ -26089,12 +25796,7 @@ GuiTreeItemTemplate_ItemStyleProvider { if (auto controller = dynamic_cast(style)) { - Value viewModel; - if (bindingView) - { - viewModel = bindingView->GetBindingValue(node); - } - + Value viewModel = treeListControl->GetNodeRootProvider()->GetBindingValue(node); GuiTemplate* itemTemplate = factory->CreateTemplate(viewModel); if (auto treeItemTemplate = dynamic_cast(itemTemplate)) { diff --git a/Import/GacUI.h b/Import/GacUI.h index ebdf1e9d..41b6860d 100644 --- a/Import/GacUI.h +++ b/Import/GacUI.h @@ -10646,40 +10646,6 @@ List Control virtual void OnTotalSizeChanged()=0; }; - //----------------------------------------------------------- - // Common Views - //----------------------------------------------------------- - - /// Primary text view for . - class IItemPrimaryTextView : public virtual IDescriptable, public Description - { - public: - /// The identifier for this view. - static const wchar_t* const Identifier; - - /// Get the text of an item. - /// The text of an item. - /// The index of the item. - virtual WString GetPrimaryTextViewText(vint itemIndex)=0; - /// Test does an item contain a text. - /// Returns true if an item contains a text. - /// The index of the item. - virtual bool ContainsPrimaryText(vint itemIndex)=0; - }; - - /// Binding view for . - class IItemBindingView : public virtual IDescriptable, public Description - { - public: - /// The identifier for this view. - static const wchar_t* const Identifier; - - /// Get the binding value of an item. - /// The binding value of an item. - /// The index of the item. - virtual description::Value GetBindingValue(vint itemIndex)=0; - }; - //----------------------------------------------------------- // Provider Interfaces //----------------------------------------------------------- @@ -10699,6 +10665,16 @@ List Control /// Get the number of items in this item proivder. /// The number of items in this item proivder. virtual vint Count()=0; + + /// Get the text representation of an item. + /// The text representation of an item. + /// The index of the item. + virtual WString GetTextValue(vint itemIndex) = 0; + /// Get the binding value of an item. + /// The binding value of an item. + /// The index of the item. + virtual description::Value GetBindingValue(vint itemIndex) = 0; + /// Request a view for this item provider. If the specified view is not supported, it returns null. If you want to get a view of type IXXX, use IXXX::Identifier as the identifier. When the view object is no longer needed, Calling to the [M:vl.presentation.controls.GuiListControl.IItemProvider.ReleaseView] is needed. /// The view object. /// The identifier for the requested view. @@ -10742,14 +10718,9 @@ List Control virtual void AttachListControl(GuiListControl* value)=0; /// Called when an item style provider in uninstalled from a . virtual void DetachListControl()=0; - /// Get a item style id from an item index. - /// The item style id. - /// The item index. - virtual vint GetItemStyleId(vint itemIndex)=0; /// Create an item style controller from an item style id. /// The created item style controller. - /// The item style id. - virtual IItemStyleController* CreateItemStyle(vint styleId)=0; + virtual IItemStyleController* CreateItemStyle()=0; /// Destroy an item style controller. /// The item style controller. virtual void DestroyItemStyle(IItemStyleController* style)=0; @@ -11033,7 +11004,7 @@ Selectable List Control /// Returns the index of the selected item. If there are multiple selected items, or there is no selected item, -1 will be returned. vint GetSelectedItemIndex(); /// Get the text of the selected item. - /// Returns the text of the selected item. If there are multiple selected items, or there is no selected item, or is not a valid view for the item provider, an empty string will be returned. + /// Returns the text of the selected item. If there are multiple selected items, or there is no selected item, an empty string will be returned. WString GetSelectedItemText(); /// Get the selection status of an item. @@ -11061,116 +11032,6 @@ Selectable List Control void ClearSelection(); }; -/*********************************************************************** -Predefined ItemArranger -***********************************************************************/ - - namespace list - { - /// Ranged item arranger. This arranger implements most of the common functionality for those arrangers that display a continuing subset of item at a time. - class RangedItemArrangerBase : public Object, virtual public GuiListControl::IItemArranger, public Description - { - typedef collections::List StyleList; - protected: - GuiListControl* listControl; - GuiListControl::IItemArrangerCallback* callback; - GuiListControl::IItemProvider* itemProvider; - Rect viewBounds; - vint startIndex; - StyleList visibleStyles; - - void InvalidateAdoptedSize(); - vint CalculateAdoptedSize(vint expectedSize, vint count, vint itemSize); - - virtual void ClearStyles(); - virtual void OnStylesCleared()=0; - virtual Size OnCalculateTotalSize()=0; - virtual void OnViewChangedInternal(Rect oldBounds, Rect newBounds)=0; - public: - /// Create the arranger. - RangedItemArrangerBase(); - ~RangedItemArrangerBase(); - - void OnAttached(GuiListControl::IItemProvider* provider)override; - void OnItemModified(vint start, vint count, vint newCount)override; - void AttachListControl(GuiListControl* value)override; - void DetachListControl()override; - GuiListControl::IItemArrangerCallback* GetCallback()override; - void SetCallback(GuiListControl::IItemArrangerCallback* value)override; - Size GetTotalSize()override; - GuiListControl::IItemStyleController* GetVisibleStyle(vint itemIndex)override; - vint GetVisibleIndex(GuiListControl::IItemStyleController* style)override; - void OnViewChanged(Rect bounds)override; - }; - - /// Fixed height item arranger. This arranger lists all item with the same height value. This value is the maximum height of all minimum heights of displayed items. - class FixedHeightItemArranger : public RangedItemArrangerBase, public Description - { - protected: - vint rowHeight; - bool suppressOnViewChanged; - - virtual void RearrangeItemBounds(); - virtual vint GetWidth(); - virtual vint GetYOffset(); - void OnStylesCleared()override; - Size OnCalculateTotalSize()override; - void OnViewChangedInternal(Rect oldBounds, Rect newBounds)override; - public: - /// Create the arranger. - FixedHeightItemArranger(); - ~FixedHeightItemArranger(); - - vint FindItem(vint itemIndex, compositions::KeyDirection key)override; - bool EnsureItemVisible(vint itemIndex)override; - Size GetAdoptedSize(Size expectedSize)override; - }; - - /// Fixed size multiple columns item arranger. This arranger adjust all items in multiple lines with the same size. The width is the maximum width of all minimum widths of displayed items. The same to height. - class FixedSizeMultiColumnItemArranger : public RangedItemArrangerBase, public Description - { - protected: - Size itemSize; - bool suppressOnViewChanged; - - virtual void RearrangeItemBounds(); - void CalculateRange(Size itemSize, Rect bounds, vint count, vint& start, vint& end); - void OnStylesCleared()override; - Size OnCalculateTotalSize()override; - void OnViewChangedInternal(Rect oldBounds, Rect newBounds)override; - public: - /// Create the arranger. - FixedSizeMultiColumnItemArranger(); - ~FixedSizeMultiColumnItemArranger(); - - vint FindItem(vint itemIndex, compositions::KeyDirection key)override; - bool EnsureItemVisible(vint itemIndex)override; - Size GetAdoptedSize(Size expectedSize)override; - }; - - /// Fixed size multiple columns item arranger. This arranger adjust all items in multiple columns with the same height. The height is the maximum width of all minimum height of displayed items. Each item will displayed using its minimum width. - class FixedHeightMultiColumnItemArranger : public RangedItemArrangerBase, public Description - { - protected: - vint itemHeight; - bool suppressOnViewChanged; - - virtual void RearrangeItemBounds(); - void CalculateRange(vint itemHeight, Rect bounds, vint& rows, vint& startColumn); - void OnStylesCleared()override; - Size OnCalculateTotalSize()override; - void OnViewChangedInternal(Rect oldBounds, Rect newBounds)override; - public: - /// Create the arranger. - FixedHeightMultiColumnItemArranger(); - ~FixedHeightMultiColumnItemArranger(); - - vint FindItem(vint itemIndex, compositions::KeyDirection key)override; - bool EnsureItemVisible(vint itemIndex)override; - Size GetAdoptedSize(Size expectedSize)override; - }; - } - /*********************************************************************** Predefined ItemStyleController ***********************************************************************/ @@ -11295,16 +11156,12 @@ TextList Style Provider }; /// The required view for . - class ITextItemView : public virtual GuiListControl::IItemPrimaryTextView, public Description + class ITextItemView : public virtual IDescriptable, public Description { public: /// The identifier for this view. static const wchar_t* const Identifier; - /// Get the text of an item. - /// The text of an item. - /// The index of an item. - virtual WString GetText(vint itemIndex)=0; /// Get the check state of an item. /// The check state of an item. /// The index of an item. @@ -11354,8 +11211,8 @@ TextList Style Provider protected: Ptr bulletFactory; - ITextItemView* textItemView; - GuiVirtualTextList* listControl; + ITextItemView* textItemView = nullptr; + GuiVirtualTextList* listControl = nullptr; void OnStyleCheckedChanged(TextItemStyleController* style); public: @@ -11366,8 +11223,7 @@ TextList Style Provider void AttachListControl(GuiListControl* value)override; void DetachListControl()override; - vint GetItemStyleId(vint itemIndex)override; - GuiListControl::IItemStyleController* CreateItemStyle(vint styleId)override; + GuiListControl::IItemStyleController* CreateItemStyle()override; void DestroyItemStyle(GuiListControl::IItemStyleController* style)override; void Install(GuiListControl::IItemStyleController* style, vint itemIndex)override; void SetStyleIndex(GuiListControl::IItemStyleController* style, vint value)override; @@ -11420,7 +11276,6 @@ TextList Data Source class TextItemProvider : public ListProvider> , protected TextItemStyleProvider::ITextItemView - , protected GuiListControl::IItemBindingView , public Description { friend class TextItem; @@ -11431,12 +11286,10 @@ TextList Data Source void AfterInsert(vint item, const Ptr& value)override; void BeforeRemove(vint item, const Ptr& value)override; - bool ContainsPrimaryText(vint itemIndex)override; - WString GetPrimaryTextViewText(vint itemIndex)override; - WString GetText(vint itemIndex)override; + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; bool GetChecked(vint itemIndex)override; void SetCheckedSilently(vint itemIndex, bool value)override; - description::Value GetBindingValue(vint itemIndex)override; public: TextItemProvider(); ~TextItemProvider(); @@ -11513,6 +11366,170 @@ TextList Control #endif +/*********************************************************************** +CONTROLS\LISTCONTROLPACKAGE\GUILISTCONTROLITEMARRANGERS.H +***********************************************************************/ +/*********************************************************************** +Vczh Library++ 3.0 +Developer: Zihan Chen(vczh) +GacUI::Control System + +Interfaces: +***********************************************************************/ + +#ifndef VCZH_PRESENTATION_CONTROLS_GUILISTCONTROLITEMARRANGERS +#define VCZH_PRESENTATION_CONTROLS_GUILISTCONTROLITEMARRANGERS + + +namespace vl +{ + namespace presentation + { + namespace controls + { + +/*********************************************************************** +Predefined ItemArranger +***********************************************************************/ + + namespace list + { + /// Ranged item arranger. This arranger implements most of the common functionality for those arrangers that display a continuing subset of item at a time. + class RangedItemArrangerBase : public Object, virtual public GuiListControl::IItemArranger, public Description + { + typedef collections::List StyleList; + protected: + GuiListControl* listControl = nullptr; + GuiListControl::IItemArrangerCallback* callback = nullptr; + GuiListControl::IItemProvider* itemProvider = nullptr; + + bool suppressOnViewChanged = false; + Rect viewBounds; + vint startIndex = 0; + StyleList visibleStyles; + + protected: + + void InvalidateAdoptedSize(); + vint CalculateAdoptedSize(vint expectedSize, vint count, vint itemSize); + void ClearStyles(); + void OnViewChangedInternal(Rect oldBounds, Rect newBounds); + virtual void RearrangeItemBounds(); + + virtual void BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex) = 0; + virtual void PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent) = 0; + virtual bool IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds) = 0; + virtual bool EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex) = 0; + virtual void InvalidateItemSizeCache() = 0; + virtual Size OnCalculateTotalSize() = 0; + public: + /// Create the arranger. + RangedItemArrangerBase(); + ~RangedItemArrangerBase(); + + void OnAttached(GuiListControl::IItemProvider* provider)override; + void OnItemModified(vint start, vint count, vint newCount)override; + void AttachListControl(GuiListControl* value)override; + void DetachListControl()override; + GuiListControl::IItemArrangerCallback* GetCallback()override; + void SetCallback(GuiListControl::IItemArrangerCallback* value)override; + Size GetTotalSize()override; + GuiListControl::IItemStyleController* GetVisibleStyle(vint itemIndex)override; + vint GetVisibleIndex(GuiListControl::IItemStyleController* style)override; + void OnViewChanged(Rect bounds)override; + }; + + /// Fixed height item arranger. This arranger lists all item with the same height value. This value is the maximum height of all minimum heights of displayed items. + class FixedHeightItemArranger : public RangedItemArrangerBase, public Description + { + private: + vint pi_width = 0; + vint pim_rowHeight = 0; + + protected: + vint rowHeight; + + virtual vint GetWidth(); + virtual vint GetYOffset(); + + void BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex)override; + void PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent)override; + bool IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds)override; + bool EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex)override; + void InvalidateItemSizeCache()override; + Size OnCalculateTotalSize()override; + public: + /// Create the arranger. + FixedHeightItemArranger(); + ~FixedHeightItemArranger(); + + vint FindItem(vint itemIndex, compositions::KeyDirection key)override; + bool EnsureItemVisible(vint itemIndex)override; + Size GetAdoptedSize(Size expectedSize)override; + }; + + /// Fixed size multiple columns item arranger. This arranger adjust all items in multiple lines with the same size. The width is the maximum width of all minimum widths of displayed items. The same to height. + class FixedSizeMultiColumnItemArranger : public RangedItemArrangerBase, public Description + { + private: + Size pim_itemSize; + + protected: + Size itemSize; + + void CalculateRange(Size itemSize, Rect bounds, vint count, vint& start, vint& end); + + void BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex)override; + void PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent)override; + bool IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds)override; + bool EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex)override; + void InvalidateItemSizeCache()override; + Size OnCalculateTotalSize()override; + public: + /// Create the arranger. + FixedSizeMultiColumnItemArranger(); + ~FixedSizeMultiColumnItemArranger(); + + vint FindItem(vint itemIndex, compositions::KeyDirection key)override; + bool EnsureItemVisible(vint itemIndex)override; + Size GetAdoptedSize(Size expectedSize)override; + }; + + /// Fixed size multiple columns item arranger. This arranger adjust all items in multiple columns with the same height. The height is the maximum width of all minimum height of displayed items. Each item will displayed using its minimum width. + class FixedHeightMultiColumnItemArranger : public RangedItemArrangerBase, public Description + { + private: + vint pi_currentWidth = 0; + vint pi_totalWidth = 0; + vint pim_itemHeight = 0; + + protected: + vint itemHeight; + + void CalculateRange(vint itemHeight, Rect bounds, vint& rows, vint& startColumn); + + void BeginPlaceItem(bool forMoving, Rect newBounds, vint& newStartIndex)override; + void PlaceItem(bool forMoving, vint index, GuiListControl::IItemStyleController* style, Rect viewBounds, Rect& bounds, Margin& alignmentToParent)override; + bool IsItemOutOfViewBounds(vint index, GuiListControl::IItemStyleController* style, Rect bounds, Rect viewBounds)override; + bool EndPlaceItem(bool forMoving, Rect newBounds, vint newStartIndex)override; + void InvalidateItemSizeCache()override; + Size OnCalculateTotalSize()override; + public: + /// Create the arranger. + FixedHeightMultiColumnItemArranger(); + ~FixedHeightMultiColumnItemArranger(); + + vint FindItem(vint itemIndex, compositions::KeyDirection key)override; + bool EnsureItemVisible(vint itemIndex)override; + Size GetAdoptedSize(Size expectedSize)override; + }; + } + } + } +} + +#endif + /*********************************************************************** CONTROLS\TOOLSTRIPPACKAGE\GUIMENUCONTROLS.H ***********************************************************************/ @@ -11833,7 +11850,6 @@ ListView Base void AttachListControl(GuiListControl* value)override; void DetachListControl()override; - vint GetItemStyleId(vint itemIndex)override; void SetStyleSelected(GuiListControl::IItemStyleController* style, bool value)override; }; } @@ -11937,7 +11953,7 @@ ListView ItemStyleProvider { public: /// The required view for . - class IListViewItemView : public virtual GuiListControl::IItemPrimaryTextView, public Description + class IListViewItemView : public virtual IDescriptable, public Description { public: /// The identifier for this view. @@ -12056,7 +12072,7 @@ ListView ItemStyleProvider void AttachListControl(GuiListControl* value)override; void DetachListControl()override; - GuiListControl::IItemStyleController* CreateItemStyle(vint styleId)override; + GuiListControl::IItemStyleController* CreateItemStyle()override; void DestroyItemStyle(GuiListControl::IItemStyleController* style)override; void Install(GuiListControl::IItemStyleController* style, vint itemIndex)override; void SetStyleIndex(GuiListControl::IItemStyleController* style, vint value)override; @@ -12612,7 +12628,6 @@ ListView , protected virtual IListViewItemProvider , protected virtual ListViewItemStyleProvider::IListViewItemView , protected virtual ListViewColumnItemArranger::IColumnItemView - , protected GuiListControl::IItemBindingView , public Description { friend class ListViewItem; @@ -12630,8 +12645,6 @@ ListView void NotifyAllItemsUpdate()override; void NotifyAllColumnsUpdate()override; - bool ContainsPrimaryText(vint itemIndex)override; - WString GetPrimaryTextViewText(vint itemIndex)override; Ptr GetSmallImage(vint itemIndex)override; Ptr GetLargeImage(vint itemIndex)override; WString GetText(vint itemIndex)override; @@ -12648,6 +12661,7 @@ ListView GuiMenu* GetDropdownPopup(vint index)override; GuiListViewColumnHeader::ColumnSortingState GetSortingState(vint index)override; + WString GetTextValue(vint itemIndex)override; description::Value GetBindingValue(vint itemIndex)override; public: ListViewItemProvider(); @@ -12830,6 +12844,14 @@ GuiVirtualTreeListControl NodeProvider /// Returns true if this operation succeeded. /// The node provider callback. virtual bool DetachCallback(INodeProviderCallback* value)=0; + /// Get the primary text of a node. + /// The primary text of a node. + /// The node. + virtual WString GetTextValue(INodeProvider* node) = 0; + /// Get the binding value of a node. + /// The binding value of a node. + /// The node. + virtual description::Value GetBindingValue(INodeProvider* node) = 0; /// Request a view for this node provider. If the specified view is not supported, it returns null. If you want to get a view of type IXXX, use IXXX::Identifier as the identifier. When the view object is no longer needed, A call to the [M:vl.presentation.controls.tree.INodeRootProvider.ReleaseView] is needed. /// The view object. /// The identifier for the requested view. @@ -12847,7 +12869,7 @@ GuiVirtualTreeListControl NodeProvider //----------------------------------------------------------- /// The required view for [T:vl.presentation.controls.tree.NodeItemStyleProvider]. [T:vl.presentation.controls.tree.NodeItemProvider] provides this view. In most of the cases, the NodeItemProvider class and this view is not required users to create, or even to touch. [T:vl.presentation.controls.GuiVirtualTreeListControl] already handled all of this. - class INodeItemView : public virtual GuiListControl::IItemPrimaryTextView, public Description + class INodeItemView : public virtual IDescriptable, public Description { public: /// The identifier of this view. @@ -12866,33 +12888,7 @@ GuiVirtualTreeListControl NodeProvider virtual vint CalculateNodeVisibilityIndex(INodeProvider* node)=0; }; - /// The required view for [T:vl.presentation.controls.tree.NodeItemProvider]. This view is always needed to create any customized implementation. - class INodeItemPrimaryTextView : public virtual IDescriptable, public Description - { - public: - /// The identifier of this view. - static const wchar_t* const Identifier; - - /// Get the primary text of a node. - /// The primary text of a node. - /// The node. - virtual WString GetPrimaryTextViewText(INodeProvider* node)=0; - }; - - /// The Binding view for . - class INodeItemBindingView : public virtual IDescriptable, public Description - { - public: - /// The identifier of this view. - static const wchar_t* const Identifier; - - /// Get the binding value of a node. - /// The binding value of a node. - /// The node. - virtual description::Value GetBindingValue(INodeProvider* node)=0; - }; - - /// This is a general implementation to convert an to a . It requires the to provide a . + /// This is a general implementation to convert an to a . class NodeItemProvider : public list::ItemProviderBase , protected virtual INodeProviderCallback @@ -12902,7 +12898,6 @@ GuiVirtualTreeListControl NodeProvider typedef collections::Dictionary NodeIntMap; protected: Ptr root; - INodeItemPrimaryTextView* nodeItemPrimaryTextView; NodeIntMap offsetBeforeChildModifieds; @@ -12915,8 +12910,6 @@ GuiVirtualTreeListControl NodeProvider vint CalculateNodeVisibilityIndexInternal(INodeProvider* node); vint CalculateNodeVisibilityIndex(INodeProvider* node)override; - bool ContainsPrimaryText(vint itemIndex)override; - WString GetPrimaryTextViewText(vint itemIndex)override; INodeProvider* RequestNode(vint index)override; void ReleaseNode(INodeProvider* node)override; public: @@ -12929,6 +12922,8 @@ GuiVirtualTreeListControl NodeProvider /// The node root provider. Ptr GetRoot(); vint Count()override; + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; IDescriptable* RequestView(const WString& identifier)override; void ReleaseView(IDescriptable* view)override; }; @@ -12963,14 +12958,9 @@ GuiVirtualTreeListControl NodeProvider virtual void AttachListControl(GuiListControl* value)=0; /// Called when a node item style provider in uninstalled from a . virtual void DetachListControl()=0; - /// Get a node item style id from a node. - /// The node item style id. - /// The node. - virtual vint GetItemStyleId(INodeProvider* node)=0; /// Create a node item style controller from a node item style id. /// The created node item style controller. - /// The node item style id. - virtual INodeItemStyleController* CreateItemStyle(vint styleId)=0; + virtual INodeItemStyleController* CreateItemStyle()=0; /// Destroy a node item style controller. /// The node item style controller. virtual void DestroyItemStyle(INodeItemStyleController* style)=0; @@ -13004,8 +12994,7 @@ GuiVirtualTreeListControl NodeProvider void AttachListControl(GuiListControl* value)override; void DetachListControl()override; - vint GetItemStyleId(vint itemIndex)override; - GuiListControl::IItemStyleController* CreateItemStyle(vint styleId)override; + GuiListControl::IItemStyleController* CreateItemStyle()override; void DestroyItemStyle(GuiListControl::IItemStyleController* style)override; void Install(GuiListControl::IItemStyleController* style, vint itemIndex)override; void SetStyleIndex(GuiListControl::IItemStyleController* style, vint value)override; @@ -13217,7 +13206,7 @@ TreeView namespace tree { /// The required view for [T:vl.presentation.controls.tree.TreeViewNodeItemStyleProvider]. - class ITreeViewItemView : public virtual INodeItemPrimaryTextView, public Description + class ITreeViewItemView : public virtual IDescriptable, public Description { public: /// The identifier of this view. @@ -13256,14 +13245,13 @@ TreeView class TreeViewItemRootProvider : public MemoryNodeRootProvider , protected virtual ITreeViewItemView - , protected virtual INodeItemBindingView , public Description { protected: - WString GetPrimaryTextViewText(INodeProvider* node)override; Ptr GetNodeImage(INodeProvider* node)override; WString GetNodeText(INodeProvider* node)override; + WString GetTextValue(INodeProvider* node)override; description::Value GetBindingValue(INodeProvider* node)override; public: /// Create a item root provider. @@ -13402,8 +13390,7 @@ TreeView GuiListControl::IItemStyleProvider* GetBindedItemStyleProvider()override; void AttachListControl(GuiListControl* value)override; void DetachListControl()override; - vint GetItemStyleId(INodeProvider* node)override; - INodeItemStyleController* CreateItemStyle(vint styleId)override; + INodeItemStyleController* CreateItemStyle()override; void DestroyItemStyle(INodeItemStyleController* style)override; void Install(INodeItemStyleController* style, INodeProvider* node, vint itemIndex)override; void SetStyleIndex(INodeItemStyleController* style, vint value)override; @@ -13543,8 +13530,6 @@ ComboBox with GuiListControl protected: IStyleController* styleController; GuiSelectableListControl* containedListControl; - GuiListControl::IItemPrimaryTextView* primaryTextView; - GuiListControl::IItemBindingView* itemBindingView; Ptr itemStyleProvider; Ptr itemStyleController; @@ -16455,7 +16440,6 @@ Datagrid ItemProvider class DataGridItemProvider : public Object , public virtual GuiListControl::IItemProvider - , public virtual GuiListControl::IItemPrimaryTextView , public virtual ListViewItemStyleProvider::IListViewItemView , public virtual ListViewColumnItemArranger::IColumnItemView , protected virtual IDataProviderCommandExecutor @@ -16484,14 +16468,11 @@ Datagrid ItemProvider bool AttachCallback(GuiListControl::IItemProviderCallback* value)override; bool DetachCallback(GuiListControl::IItemProviderCallback* value)override; vint Count()override; + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; IDescriptable* RequestView(const WString& identifier)override; void ReleaseView(IDescriptable* view)override; - // ===================== GuiListControl::IItemPrimaryTextView ===================== - - WString GetPrimaryTextViewText(vint itemIndex)override; - bool ContainsPrimaryText(vint itemIndex)override; - // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== Ptr GetSmallImage(vint itemIndex)override; @@ -16842,7 +16823,6 @@ GuiBindableTextList protected: class ItemSource : public list::ItemProviderBase - , protected GuiListControl::IItemBindingView , protected list::TextItemStyleProvider::ITextItemView { protected: @@ -16865,22 +16845,14 @@ GuiBindableTextList // ===================== GuiListControl::IItemProvider ===================== + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; vint Count()override; IDescriptable* RequestView(const WString& identifier)override; void ReleaseView(IDescriptable* view)override; - // ===================== GuiListControl::IItemBindingView ===================== - - description::Value GetBindingValue(vint itemIndex)override; - - // ===================== GuiListControl::IItemPrimaryTextView ===================== - - WString GetPrimaryTextViewText(vint itemIndex)override; - bool ContainsPrimaryText(vint itemIndex)override; - // ===================== list::TextItemStyleProvider::ITextItemView ===================== - WString GetText(vint itemIndex)override; bool GetChecked(vint itemIndex)override; void SetCheckedSilently(vint itemIndex, bool value)override; }; @@ -16937,7 +16909,6 @@ GuiBindableListView class ItemSource : public list::ItemProviderBase , protected virtual list::IListViewItemProvider - , protected GuiListControl::IItemBindingView , protected virtual list::ListViewItemStyleProvider::IListViewItemView , protected virtual list::ListViewColumnItemArranger::IColumnItemView { @@ -16973,18 +16944,11 @@ GuiBindableListView // ===================== GuiListControl::IItemProvider ===================== + WString GetTextValue(vint itemIndex)override; + description::Value GetBindingValue(vint itemIndex)override; vint Count()override; IDescriptable* RequestView(const WString& identifier)override; void ReleaseView(IDescriptable* view)override; - - // ===================== GuiListControl::IItemBindingView ===================== - - description::Value GetBindingValue(vint itemIndex)override; - - // ===================== GuiListControl::IItemPrimaryTextView ===================== - - WString GetPrimaryTextViewText(vint itemIndex)override; - bool ContainsPrimaryText(vint itemIndex)override; // ===================== list::ListViewItemStyleProvider::IListViewItemView ===================== @@ -17107,7 +17071,6 @@ GuiBindableTreeView class ItemSource : public tree::NodeRootProviderBase - , protected virtual tree::INodeItemBindingView , protected virtual tree::ITreeViewItemView { friend class ItemSourceNode; @@ -17129,16 +17092,11 @@ GuiBindableTreeView // ===================== tree::INodeRootProvider ===================== tree::INodeProvider* GetRootNode()override; + WString GetTextValue(tree::INodeProvider* node)override; + description::Value GetBindingValue(tree::INodeProvider* node)override; IDescriptable* RequestView(const WString& identifier)override; void ReleaseView(IDescriptable* view)override; - // ===================== tree::INodeItemBindingView ===================== - - description::Value GetBindingValue(tree::INodeProvider* node)override; - - // ===================== tree::INodeItemPrimaryTextView ===================== - - WString GetPrimaryTextViewText(tree::INodeProvider* node)override; // ===================== tree::ITreeViewItemView ===================== @@ -19126,8 +19084,7 @@ Item Template (GuiTextListItemTemplate) friend class GuiTextListItemTemplate_ItemStyleController; protected: Ptr factory; - controls::GuiVirtualTextList* listControl; - controls::GuiListControl::IItemBindingView* bindingView; + controls::GuiVirtualTextList* listControl = nullptr; public: GuiTextListItemTemplate_ItemStyleProvider(Ptr _factory); @@ -19135,8 +19092,7 @@ Item Template (GuiTextListItemTemplate) void AttachListControl(controls::GuiListControl* value)override; void DetachListControl()override; - vint GetItemStyleId(vint itemIndex)override; - controls::GuiListControl::IItemStyleController* CreateItemStyle(vint styleId)override; + controls::GuiListControl::IItemStyleController* CreateItemStyle()override; void DestroyItemStyle(controls::GuiListControl::IItemStyleController* style)override; void Install(controls::GuiListControl::IItemStyleController* style, vint itemIndex)override; void SetStyleIndex(controls::GuiListControl::IItemStyleController* style, vint value)override; @@ -19186,9 +19142,8 @@ Item Template (GuiTreeItemTemplate) friend class GuiTreeItemTemplate_ItemStyleController; protected: Ptr factory; - controls::GuiVirtualTreeListControl* treeListControl; - controls::tree::INodeItemBindingView* bindingView; - controls::GuiListControl::IItemStyleProvider* itemStyleProvider; + controls::GuiVirtualTreeListControl* treeListControl = nullptr; + controls::GuiListControl::IItemStyleProvider* itemStyleProvider = nullptr; void UpdateExpandingButton(controls::tree::INodeProvider* node); void OnAttached(controls::tree::INodeRootProvider* provider)override; @@ -19205,8 +19160,7 @@ Item Template (GuiTreeItemTemplate) controls::GuiListControl::IItemStyleProvider* GetBindedItemStyleProvider()override; void AttachListControl(controls::GuiListControl* value)override; void DetachListControl()override; - vint GetItemStyleId(controls::tree::INodeProvider* node)override; - controls::tree::INodeItemStyleController* CreateItemStyle(vint styleId)override; + controls::tree::INodeItemStyleController* CreateItemStyle()override; void DestroyItemStyle(controls::tree::INodeItemStyleController* style)override; void Install(controls::tree::INodeItemStyleController* style, controls::tree::INodeProvider* node, vint itemIndex)override; void SetStyleIndex(controls::tree::INodeItemStyleController* style, vint value)override; diff --git a/Import/GacUICompiler.cpp b/Import/GacUICompiler.cpp index fe8f5787..45713026 100644 --- a/Import/GacUICompiler.cpp +++ b/Import/GacUICompiler.cpp @@ -135,48 +135,48 @@ GuiInstancePropertyInfo return new GuiInstancePropertyInfo; } - Ptr GuiInstancePropertyInfo::Assign(description::ITypeDescriptor* typeDescriptor) + Ptr GuiInstancePropertyInfo::Assign(Ptr typeInfo) { - Ptr info = new GuiInstancePropertyInfo; + auto info = MakePtr(); info->support = SupportAssign; - if (typeDescriptor) info->acceptableTypes.Add(typeDescriptor); + if (typeInfo) info->acceptableTypes.Add(typeInfo); return info; } - Ptr GuiInstancePropertyInfo::AssignWithParent(description::ITypeDescriptor* typeDescriptor) + Ptr GuiInstancePropertyInfo::AssignWithParent(Ptr typeInfo) { - Ptr info = Assign(typeDescriptor); + auto info = Assign(typeInfo); info->tryParent = true; return info; } - Ptr GuiInstancePropertyInfo::Collection(description::ITypeDescriptor* typeDescriptor) + Ptr GuiInstancePropertyInfo::Collection(Ptr typeInfo) { - Ptr info = Assign(typeDescriptor); + auto info = Assign(typeInfo); info->support = SupportCollection; return info; } - Ptr GuiInstancePropertyInfo::CollectionWithParent(description::ITypeDescriptor* typeDescriptor) + Ptr GuiInstancePropertyInfo::CollectionWithParent(Ptr typeInfo) { - Ptr info = Collection(typeDescriptor); + auto info = Collection(typeInfo); info->tryParent = true; return info; } - Ptr GuiInstancePropertyInfo::Set(description::ITypeDescriptor* typeDescriptor) + Ptr GuiInstancePropertyInfo::Set(Ptr typeInfo) { - Ptr info = new GuiInstancePropertyInfo; + auto info = MakePtr(); info->support = SupportSet; - if (typeDescriptor) info->acceptableTypes.Add(typeDescriptor); + if (typeInfo) info->acceptableTypes.Add(typeInfo); return info; } - Ptr GuiInstancePropertyInfo::Array(description::ITypeDescriptor* typeDescriptor) + Ptr GuiInstancePropertyInfo::Array(Ptr typeInfo) { - Ptr info = new GuiInstancePropertyInfo; + auto info = MakePtr(); info->support = SupportArray; - if (typeDescriptor) info->acceptableTypes.Add(typeDescriptor); + if (typeInfo) info->acceptableTypes.Add(typeInfo); return info; } @@ -385,64 +385,63 @@ GuiDefaultInstanceLoader //*********************************************************************************** - void ProcessGenericType(ITypeInfo* propType, ITypeInfo*& genericType, ITypeInfo*& elementType, bool& readableList, bool& writableList, bool& collectionType) + ITypeInfo* ProcessGenericType(ITypeInfo* propType, bool& readableList, bool& writableList, bool& collectionType) { - genericType = 0; - elementType = 0; readableList = false; writableList = false; collectionType = false; if (propType->GetDecorator() == ITypeInfo::SharedPtr && propType->GetElementType()->GetDecorator() == ITypeInfo::Generic) { - propType = propType->GetElementType(); - genericType = propType->GetElementType(); + auto genericType = propType->GetElementType(); if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor()) { - elementType = propType->GetGenericArgument(0); readableList = true; writableList = true; collectionType = true; + return genericType->GetGenericArgument(0); } else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor()) { collectionType = true; + return genericType->GetGenericArgument(0); } else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor()) { - elementType = propType->GetGenericArgument(0); readableList = true; collectionType = true; + return genericType->GetGenericArgument(0); } else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor()) { - elementType = propType->GetGenericArgument(0); readableList = true; collectionType = true; + return genericType->GetGenericArgument(0); } else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor()) { collectionType = true; + return nullptr; } else if (genericType->GetTypeDescriptor() == description::GetTypeDescriptor()) { collectionType = true; + return nullptr; } } + return propType; } ITypeInfo* GetPropertyReflectionTypeInfo(const PropertyInfo& propertyInfo, GuiInstancePropertyInfo::Support& support) { support = GuiInstancePropertyInfo::NotSupport; - IPropertyInfo* prop = propertyInfo.typeInfo.typeDescriptor->GetPropertyByName(propertyInfo.propertyName.ToString(), true); + IPropertyInfo* prop = propertyInfo.typeInfo.typeInfo->GetTypeDescriptor()->GetPropertyByName(propertyInfo.propertyName.ToString(), true); if (prop) { ITypeInfo* propType = prop->GetReturn(); - ITypeInfo* genericType = 0; - ITypeInfo* elementType = 0; bool readableList = false; bool writableList = false; bool collectionType = false; - ProcessGenericType(propType, genericType, elementType, readableList, writableList, collectionType); + auto propValueType = ProcessGenericType(propType, readableList, writableList, collectionType); if (prop->IsWritable()) { @@ -451,18 +450,13 @@ GuiDefaultInstanceLoader if (readableList) { support = GuiInstancePropertyInfo::SupportArray; - return elementType; + return propValueType; } } - else if (genericType) - { - support = GuiInstancePropertyInfo::SupportAssign; - return genericType; - } else { support = GuiInstancePropertyInfo::SupportAssign; - return propType; + return propValueType; } } else if (prop->IsReadable()) @@ -472,36 +466,23 @@ GuiDefaultInstanceLoader if (writableList) { support = GuiInstancePropertyInfo::SupportCollection; - return elementType; + return propValueType; } } - else if (!genericType) + else { if (propType->GetDecorator() == ITypeInfo::SharedPtr || propType->GetDecorator() == ITypeInfo::RawPtr) { - support = GuiInstancePropertyInfo::SupportSet; - return propType; + if (propType->GetElementType()->GetDecorator() != ITypeInfo::Generic) + { + support = GuiInstancePropertyInfo::SupportSet; + return propValueType; + } } } } } - return 0; - } - - bool FillPropertyInfo(Ptr propertyInfo, ITypeInfo* propType) - { - switch (propType->GetDecorator()) - { - case ITypeInfo::RawPtr: - case ITypeInfo::SharedPtr: - case ITypeInfo::Nullable: - return FillPropertyInfo(propertyInfo, propType->GetElementType()); - case ITypeInfo::TypeDescriptor: - propertyInfo->acceptableTypes.Add(propType->GetTypeDescriptor()); - return true; - default:; - } - return false; + return nullptr; } void CollectPropertyNames(const TypeInfo& typeInfo, ITypeDescriptor* typeDescriptor, collections::List& propertyNames) @@ -531,14 +512,14 @@ GuiDefaultInstanceLoader void GetPropertyNames(const TypeInfo& typeInfo, collections::List& propertyNames)override { - CollectPropertyNames(typeInfo, typeInfo.typeDescriptor, propertyNames); + CollectPropertyNames(typeInfo, typeInfo.typeInfo->GetTypeDescriptor(), propertyNames); } void GetConstructorParameters(const TypeInfo& typeInfo, collections::List& propertyNames)override { CTOR_PARAM_PREFIX - if (auto ctor = GetInstanceConstructor(typeInfo.typeDescriptor)) + if (auto ctor = GetInstanceConstructor(typeInfo.typeInfo->GetTypeDescriptor())) { vint count = ctor->GetParameterCount(); for (vint i = 0; i < count; i++) @@ -548,65 +529,12 @@ GuiDefaultInstanceLoader } } } - - bool IsItemPropertyName(IPropertyInfo* prop) - { - auto name = prop->GetName(); - return name.Length() >= 8 && name.Right(8) == L"Property"; - } - - bool IsItemPropertyType(ITypeInfo* propType) - { - if (propType->GetDecorator() == ITypeInfo::SharedPtr) - { - auto genericType = propType->GetElementType(); - if (genericType->GetDecorator() == ITypeInfo::Generic && genericType->GetGenericArgumentCount() == 2) - { - if (genericType->GetElementType()->GetTypeDescriptor() == description::GetTypeDescriptor()) - { - if (genericType->GetGenericArgument(1)->GetTypeDescriptor() == description::GetTypeDescriptor()) - { - return true; - } - } - } - } - return false; - } - - bool IsWritableItemPropertyType(ITypeInfo* propType) - { - if (propType->GetDecorator() == ITypeInfo::SharedPtr) - { - auto genericType = propType->GetElementType(); - if (genericType->GetDecorator() == ITypeInfo::Generic && genericType->GetGenericArgumentCount() == 4) - { - if (genericType->GetElementType()->GetTypeDescriptor() == description::GetTypeDescriptor()) - { - if (genericType->GetGenericArgument(1)->GetTypeDescriptor() == description::GetTypeDescriptor() - && genericType->GetGenericArgument(3)->GetTypeDescriptor() == description::GetTypeDescriptor()) - { - if (IsSameType(genericType->GetGenericArgument(0), genericType->GetGenericArgument(2))) - { - return true; - } - } - } - } - } - return false; - } - - bool IsItemProperty(IPropertyInfo* prop) - { - return prop && IsItemPropertyName(prop) && (IsItemPropertyType(prop->GetReturn()) || IsWritableItemPropertyType(prop->GetReturn())); - } PropertyType GetPropertyTypeCached(const PropertyInfo& propertyInfo) { CTOR_PARAM_PREFIX - FieldKey key(propertyInfo.typeInfo.typeDescriptor, propertyInfo.propertyName); + FieldKey key(propertyInfo.typeInfo.typeInfo->GetTypeDescriptor(), propertyInfo.propertyName); vint index = propertyTypes.Keys().IndexOf(key); if (index == -1) { @@ -615,8 +543,9 @@ GuiDefaultInstanceLoader { Ptr result = new GuiInstancePropertyInfo; result->support = support; + result->acceptableTypes.Add(CopyTypeInfo(propType)); - if (auto ctor = GetInstanceConstructor(propertyInfo.typeInfo.typeDescriptor)) + if (auto ctor = GetInstanceConstructor(propertyInfo.typeInfo.typeInfo->GetTypeDescriptor())) { vint count = ctor->GetParameterCount(); for (vint i = 0; i < count; i++) @@ -629,25 +558,17 @@ GuiDefaultInstanceLoader } } - IPropertyInfo* prop = propertyInfo.typeInfo.typeDescriptor->GetPropertyByName(propertyInfo.propertyName.ToString(), true); - if (IsItemProperty(prop)) - { - result->acceptableTypes.Add(description::GetTypeDescriptor()); - } - else if (!FillPropertyInfo(result, propType)) - { - goto UNSUPPORTED; - } - + IPropertyInfo* prop = propertyInfo.typeInfo.typeInfo->GetTypeDescriptor()->GetPropertyByName(propertyInfo.propertyName.ToString(), true); PropertyType value(result, prop); propertyTypes.Add(key, value); return value; } - - UNSUPPORTED: - PropertyType value(GuiInstancePropertyInfo::Unsupported(), 0); - propertyTypes.Add(key, value); - return value; + else + { + PropertyType value(GuiInstancePropertyInfo::Unsupported(), 0); + propertyTypes.Add(key, value); + return value; + } } else { @@ -665,15 +586,15 @@ GuiDefaultInstanceLoader bool CanCreate(const TypeInfo& typeInfo)override { return - GetDefaultConstructor(typeInfo.typeDescriptor) != nullptr || - GetInstanceConstructor(typeInfo.typeDescriptor) != nullptr; + GetDefaultConstructor(typeInfo.typeInfo->GetTypeDescriptor()) != nullptr || + GetInstanceConstructor(typeInfo.typeInfo->GetTypeDescriptor()) != nullptr; } Ptr CreateInstance(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, const TypeInfo& typeInfo, GlobalStringKey variableName, ArgumentMap& arguments, GuiResourceTextPos tagPosition, GuiResourceError::List& errors)override { CTOR_PARAM_PREFIX - auto defaultCtor = GetDefaultConstructor(typeInfo.typeDescriptor); - auto instanceCtor = GetInstanceConstructor(typeInfo.typeDescriptor); + auto defaultCtor = GetDefaultConstructor(typeInfo.typeInfo->GetTypeDescriptor()); + auto instanceCtor = GetInstanceConstructor(typeInfo.typeInfo->GetTypeDescriptor()); auto create = MakePtr(); if (defaultCtor) @@ -798,199 +719,25 @@ GuiDefaultInstanceLoader case GuiInstancePropertyInfo::SupportAssign: { auto& propertyValue = arguments.GetByIndex(index)[0]; - auto propertyValueExpression = propertyValue.expression; - - if (IsItemPropertyName(propertyType.f1)) + if (propertyValue.expression) { - bool isItemProperty = IsItemPropertyType(propertyType.f1->GetReturn()); - bool isWritableItemProperty = IsWritableItemPropertyType(propertyType.f1->GetReturn()); - if (isItemProperty || isWritableItemProperty) - { - auto propertyDescription = propertyValueExpression.Cast()->value.value; - Ptr propertyExpression; - { - propertyExpression = Workflow_ParseExpression(precompileContext, { resolvingResult.resource }, propertyDescription, propertyValue.valuePosition, errors); - if (!propertyExpression) - { - break; - } - }; + auto refValue = MakePtr(); + refValue->name.value = variableName.ToString(); - vint indexItemType = resolvingResult.envVars.Keys().IndexOf(GlobalStringKey::Get(L"ItemType")); - if (indexItemType == -1) - { - auto error - = L"Precompile: env.ItemType must be specified before assigning \"" - + propertyDescription - + L"\" to property \"" - + propertyType.f1->GetName() - + L"\" of type \"" - + propertyType.f1->GetOwnerTypeDescriptor()->GetTypeName() - + L"\"."; - errors.Add(GuiResourceError({ resolvingResult.resource }, attPosition, error)); - break; - } + auto refProp = MakePtr(); + refProp->parent = refValue; + refProp->name.value = prop.ToString(); - Ptr itemType; - { - const auto& values = resolvingResult.envVars.GetByIndex(indexItemType); - auto itemTypeValue = values[values.Count() - 1]; + auto assign = MakePtr(); + assign->op = WfBinaryOperator::Assign; + assign->first = refProp; + assign->second = propertyValue.expression; - itemType = Workflow_ParseType(precompileContext, { resolvingResult.resource }, itemTypeValue->value, itemTypeValue->valuePosition, errors); - if (!itemType) - { - break; - } - }; - - vint indexItemName = resolvingResult.envVars.Keys().IndexOf(GlobalStringKey::Get(L"ItemName")); - WString itemName(L"item", false); - if (indexItemName != -1) - { - const auto& values = resolvingResult.envVars.GetByIndex(indexItemName); - itemName = values[values.Count() - 1]->value; - } - - if (auto refExpr = propertyExpression.Cast()) - { - if (refExpr->name.value != itemName) - { - auto refItem = MakePtr(); - refItem->name.value = itemName; - - auto member = MakePtr(); - member->parent = refItem; - member->name.value = refExpr->name.value; - - propertyExpression = member; - } - } - - auto funcDecl = MakePtr(); - funcDecl->anonymity = WfFunctionAnonymity::Anonymous; - { - auto genericType = propertyType.f1->GetReturn()->GetElementType(); - funcDecl->returnType = GetTypeFromTypeInfo(genericType->GetGenericArgument(0)); - { - auto argument = MakePtr(); - argument->name.value = L""; - argument->type = GetTypeFromTypeInfo(genericType->GetGenericArgument(1)); - funcDecl->arguments.Add(argument); - } - - if (isWritableItemProperty) - { - { - auto argument = MakePtr(); - argument->name.value = L""; - argument->type = GetTypeFromTypeInfo(genericType->GetGenericArgument(2)); - funcDecl->arguments.Add(argument); - } - { - auto argument = MakePtr(); - argument->name.value = L""; - argument->type = GetTypeFromTypeInfo(genericType->GetGenericArgument(3)); - funcDecl->arguments.Add(argument); - } - } - } - - auto funcBlock = MakePtr(); - funcDecl->statement = funcBlock; - - { - auto refItem = MakePtr(); - refItem->name.value = L""; - - auto refCast = MakePtr(); - refCast->strategy = WfTypeCastingStrategy::Strong; - refCast->type = itemType; - refCast->expression = refItem; - - auto varDecl = MakePtr(); - varDecl->name.value = itemName; - varDecl->expression = refCast; - - auto varStat = MakePtr(); - varStat->variable = varDecl; - funcBlock->statements.Add(varStat); - } - - Ptr returnStat; - { - returnStat = MakePtr(); - returnStat->expression = propertyExpression; - } - - if (isItemProperty) - { - funcBlock->statements.Add(returnStat); - } - else if (isWritableItemProperty) - { - auto ifStat = MakePtr(); - funcBlock->statements.Add(ifStat); - { - auto refUpdate = MakePtr(); - refUpdate->name.value = L""; - - ifStat->expression = refUpdate; - } - { - auto block = MakePtr(); - ifStat->trueBranch = block; - - { - auto refValue = MakePtr(); - refValue->name.value = L""; - - auto assignExpr = MakePtr(); - assignExpr->op = WfBinaryOperator::Assign; - assignExpr->first = CopyExpression(propertyExpression); - assignExpr->second = refValue; - - auto stat = MakePtr(); - stat->expression = assignExpr; - block->statements.Add(stat); - } - { - auto returnStat = MakePtr(); - block->statements.Add(returnStat); - - auto returnType = propertyType.f1->GetReturn()->GetElementType()->GetGenericArgument(0); - returnStat->expression = CreateDefaultValue(returnType); - } - } - { - auto block = MakePtr(); - ifStat->falseBranch = block; - - block->statements.Add(returnStat); - } - } - - auto funcExpr = MakePtr(); - funcExpr->function = funcDecl; - propertyValueExpression = funcExpr; - } + auto stat = MakePtr(); + stat->expression = assign; + block->statements.Add(stat); } - - auto refValue = MakePtr(); - refValue->name.value = variableName.ToString(); - - auto refProp = MakePtr(); - refProp->parent = refValue; - refProp->name.value = prop.ToString(); - - auto assign = MakePtr(); - assign->op = WfBinaryOperator::Assign; - assign->first = refProp; - assign->second = propertyValueExpression; - - auto stat = MakePtr(); - stat->expression = assign; - block->statements.Add(stat); } break; default: @@ -1042,6 +789,7 @@ GuiInstanceLoaderManager protected: typedef Dictionary> BinderMap; typedef Dictionary> EventBinderMap; + typedef List> DeserializerList; struct VirtualTypeInfo { @@ -1059,6 +807,7 @@ GuiInstanceLoaderManager Ptr rootLoader; BinderMap binders; EventBinderMap eventBinders; + DeserializerList deserializers; VirtualTypeInfoMap typeInfos; bool IsTypeExists(GlobalStringKey name) @@ -1175,7 +924,7 @@ GuiInstanceLoaderManager IGuiInstanceBinder* GetInstanceBinder(GlobalStringKey bindingName)override { vint index = binders.Keys().IndexOf(bindingName); - return index == -1 ? 0 : binders.Values()[index].Obj(); + return index == -1 ? nullptr : binders.Values()[index].Obj(); } bool AddInstanceEventBinder(Ptr binder)override @@ -1188,7 +937,26 @@ GuiInstanceLoaderManager IGuiInstanceEventBinder* GetInstanceEventBinder(GlobalStringKey bindingName)override { vint index = eventBinders.Keys().IndexOf(bindingName); - return index == -1 ? 0 : eventBinders.Values()[index].Obj(); + return index == -1 ? nullptr : eventBinders.Values()[index].Obj(); + } + + bool AddInstanceDeserializer(Ptr deserializer)override + { + if (deserializers.Contains(deserializer.Obj())) return false; + deserializers.Add(deserializer); + return true; + } + + IGuiInstanceDeserializer* GetInstanceDeserializer(description::ITypeInfo* typeInfo)override + { + FOREACH(Ptr, deserializer, deserializers) + { + if (deserializer->CanDeserialize(typeInfo)) + { + return deserializer.Obj(); + } + } + return nullptr; } bool CreateVirtualType(GlobalStringKey parentType, Ptr loader)override @@ -1263,12 +1031,22 @@ GuiInstanceLoaderManager return 0; } - description::ITypeDescriptor* GetTypeDescriptorForType(GlobalStringKey typeName)override + Ptr GetTypeInfoForType(GlobalStringKey typeName)override { vint index = typeInfos.Keys().IndexOf(typeName); - return index == -1 + auto td = index == -1 ? GetGlobalTypeManager()->GetTypeDescriptor(typeName.ToString()) : typeInfos.Values()[index]->typeDescriptor; + if (!td) return nullptr; + + if (auto ctor = td->GetConstructorGroup()) + { + return CopyTypeInfo(ctor->GetMethod(0)->GetReturn()); + } + else + { + return MakePtr(MakePtr(td, TypeInfoHint::Normal)); + } } void GetVirtualTypes(collections::List& typeNames)override @@ -1613,6 +1391,287 @@ GuiPredefinedInstanceBindersPlugin } } +/*********************************************************************** +GUIINSTANCELOADER_PREDEFINEDINSTANCEDESERIALIZERS.CPP +***********************************************************************/ + +namespace vl +{ + namespace presentation + { + using namespace collections; + using namespace reflection::description; + using namespace workflow; + using namespace workflow::analyzer; + using namespace controls; + +/*********************************************************************** +GuiItemPropertyDeserializer +***********************************************************************/ + + class GuiItemPropertyDeserializer : public Object, public IGuiInstanceDeserializer + { + protected: + Ptr stringType; + + bool IsItemPropertyType(ITypeInfo* propType) + { + if (propType->GetDecorator() == ITypeInfo::SharedPtr) + { + auto genericType = propType->GetElementType(); + if (genericType->GetDecorator() == ITypeInfo::Generic && genericType->GetGenericArgumentCount() == 2) + { + if (genericType->GetElementType()->GetTypeDescriptor() == description::GetTypeDescriptor()) + { + if (genericType->GetGenericArgument(1)->GetTypeDescriptor() == description::GetTypeDescriptor()) + { + return true; + } + } + } + } + return false; + } + + bool IsWritableItemPropertyType(ITypeInfo* propType) + { + if (propType->GetDecorator() == ITypeInfo::SharedPtr) + { + auto genericType = propType->GetElementType(); + if (genericType->GetDecorator() == ITypeInfo::Generic && genericType->GetGenericArgumentCount() == 4) + { + if (genericType->GetElementType()->GetTypeDescriptor() == description::GetTypeDescriptor()) + { + if (genericType->GetGenericArgument(1)->GetTypeDescriptor() == description::GetTypeDescriptor() + && genericType->GetGenericArgument(3)->GetTypeDescriptor() == description::GetTypeDescriptor()) + { + if (IsSameType(genericType->GetGenericArgument(0), genericType->GetGenericArgument(2))) + { + return true; + } + } + } + } + } + return false; + } + + public: + GuiItemPropertyDeserializer() + { + stringType = TypeInfoRetriver::CreateTypeInfo(); + } + + bool CanDeserialize(description::ITypeInfo* typeInfo)override + { + return IsItemPropertyType(typeInfo) || IsWritableItemPropertyType(typeInfo); + } + + description::ITypeInfo* DeserializeAs(description::ITypeInfo* typeInfo)override + { + return stringType.Obj(); + } + + Ptr Deserialize(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, description::ITypeInfo* typeInfo, Ptr valueExpression, GuiResourceTextPos tagPosition, GuiResourceError::List& errors)override + { + auto stringExpr = valueExpression.Cast(); + Ptr propertyExpression; + { + propertyExpression = Workflow_ParseExpression(precompileContext, { resolvingResult.resource }, stringExpr->value.value, tagPosition, errors); + if (!propertyExpression) + { + return nullptr; + } + }; + + vint indexItemType = resolvingResult.envVars.Keys().IndexOf(GlobalStringKey::Get(L"ItemType")); + if (indexItemType == -1) + { + auto error + = L"Precompile: env.ItemType must be specified before deserializing \"" + + stringExpr->value.value + + L"\" to value of type \"" + + typeInfo->GetTypeFriendlyName() + + L"\"."; + errors.Add(GuiResourceError({ resolvingResult.resource }, tagPosition, error)); + return nullptr; + } + + Ptr itemType; + { + const auto& values = resolvingResult.envVars.GetByIndex(indexItemType); + auto itemTypeValue = values[values.Count() - 1]; + + itemType = Workflow_ParseType(precompileContext, { resolvingResult.resource }, itemTypeValue->value, itemTypeValue->valuePosition, errors); + if (!itemType) + { + return nullptr; + } + }; + + vint indexItemName = resolvingResult.envVars.Keys().IndexOf(GlobalStringKey::Get(L"ItemName")); + WString itemName(L"item", false); + if (indexItemName != -1) + { + const auto& values = resolvingResult.envVars.GetByIndex(indexItemName); + itemName = values[values.Count() - 1]->value; + } + + if (auto refExpr = propertyExpression.Cast()) + { + if (refExpr->name.value != itemName) + { + auto refItem = MakePtr(); + refItem->name.value = itemName; + + auto member = MakePtr(); + member->parent = refItem; + member->name.value = refExpr->name.value; + + propertyExpression = member; + } + } + + bool isWritableItemProperty = IsWritableItemPropertyType(typeInfo); + + auto funcDecl = MakePtr(); + funcDecl->anonymity = WfFunctionAnonymity::Anonymous; + { + auto genericType = typeInfo->GetElementType(); + funcDecl->returnType = GetTypeFromTypeInfo(genericType->GetGenericArgument(0)); + { + auto argument = MakePtr(); + argument->name.value = L""; + argument->type = GetTypeFromTypeInfo(genericType->GetGenericArgument(1)); + funcDecl->arguments.Add(argument); + } + + if (isWritableItemProperty) + { + { + auto argument = MakePtr(); + argument->name.value = L""; + argument->type = GetTypeFromTypeInfo(genericType->GetGenericArgument(2)); + funcDecl->arguments.Add(argument); + } + { + auto argument = MakePtr(); + argument->name.value = L""; + argument->type = GetTypeFromTypeInfo(genericType->GetGenericArgument(3)); + funcDecl->arguments.Add(argument); + } + } + } + + auto funcBlock = MakePtr(); + funcDecl->statement = funcBlock; + + { + auto refItem = MakePtr(); + refItem->name.value = L""; + + auto refCast = MakePtr(); + refCast->strategy = WfTypeCastingStrategy::Strong; + refCast->type = itemType; + refCast->expression = refItem; + + auto varDecl = MakePtr(); + varDecl->name.value = itemName; + varDecl->expression = refCast; + + auto varStat = MakePtr(); + varStat->variable = varDecl; + funcBlock->statements.Add(varStat); + } + + Ptr returnStat; + { + returnStat = MakePtr(); + returnStat->expression = propertyExpression; + } + + if (isWritableItemProperty) + { + auto ifStat = MakePtr(); + funcBlock->statements.Add(ifStat); + { + auto refUpdate = MakePtr(); + refUpdate->name.value = L""; + + ifStat->expression = refUpdate; + } + { + auto block = MakePtr(); + ifStat->trueBranch = block; + + { + auto refValue = MakePtr(); + refValue->name.value = L""; + + auto assignExpr = MakePtr(); + assignExpr->op = WfBinaryOperator::Assign; + assignExpr->first = CopyExpression(propertyExpression); + assignExpr->second = refValue; + + auto stat = MakePtr(); + stat->expression = assignExpr; + block->statements.Add(stat); + } + { + auto returnStat = MakePtr(); + block->statements.Add(returnStat); + + auto returnType = typeInfo->GetElementType()->GetGenericArgument(0); + returnStat->expression = CreateDefaultValue(returnType); + } + } + { + auto block = MakePtr(); + ifStat->falseBranch = block; + + block->statements.Add(returnStat); + } + } + else + { + funcBlock->statements.Add(returnStat); + } + + auto funcExpr = MakePtr(); + funcExpr->function = funcDecl; + return funcExpr; + } + }; + +/*********************************************************************** +GuiPredefinedInstanceDeserializersPlugin +***********************************************************************/ + + class GuiPredefinedInstanceDeserializersPlugin : public Object, public IGuiPlugin + { + public: + GuiPredefinedInstanceDeserializersPlugin() + { + } + + void Load()override + { + } + + void AfterLoad()override + { + IGuiInstanceLoaderManager* manager = GetInstanceLoaderManager(); + manager->AddInstanceDeserializer(new GuiItemPropertyDeserializer); + } + + void Unload()override + { + } + }; + GUI_REGISTER_PLUGIN(GuiPredefinedInstanceDeserializersPlugin) + } +} + /*********************************************************************** GUIINSTANCELOADER_PREDEFINEDTYPERESOLVERS.CPP ***********************************************************************/ @@ -2032,7 +2091,7 @@ Instance Type Resolver (Instance) types::ResolvingResult resolvingResult; resolvingResult.resource = resource; resolvingResult.context = obj; - resolvingResult.rootTypeDescriptor = Workflow_CollectReferences(context, resolvingResult, errors); + resolvingResult.rootTypeInfo = Workflow_CollectReferences(context, resolvingResult, errors); if (errors.Count() == previousErrorCount) { @@ -3328,7 +3387,7 @@ GuiAxisInstanceLoader { if (propertyInfo.propertyName == _AxisDirection) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; info->required = true; return info; @@ -3398,10 +3457,10 @@ GuiCompositionInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - auto info = GuiInstancePropertyInfo::Collection(); - info->acceptableTypes.Add(description::GetTypeDescriptor()); - info->acceptableTypes.Add(description::GetTypeDescriptor()); - info->acceptableTypes.Add(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Collection(nullptr); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); + info->acceptableTypes.Add(TypeInfoRetriver>::CreateTypeInfo()); return info; } return IGuiInstanceLoader::GetPropertyType(propertyInfo); @@ -3417,10 +3476,10 @@ GuiCompositionInstanceLoader if (prop == GlobalStringKey::Empty) { auto value = values[0].expression; - auto type = values[0].type; + auto td = values[0].typeInfo->GetTypeDescriptor(); Ptr expr; - if (type->CanConvertTo(description::GetTypeDescriptor())) + if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refComposition = MakePtr(); refComposition->name.value = variableName.ToString(); @@ -3436,7 +3495,7 @@ GuiCompositionInstanceLoader expr = assign; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refBoundsComposition = MakePtr(); refBoundsComposition->parent = value; @@ -3455,7 +3514,7 @@ GuiCompositionInstanceLoader expr = call; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refComposition = MakePtr(); refComposition->name.value = variableName.ToString(); @@ -3530,7 +3589,7 @@ GuiTableCompositionInstanceLoader { if (propertyInfo.propertyName == _Rows || propertyInfo.propertyName == _Columns) { - return GuiInstancePropertyInfo::Array(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Array(TypeInfoRetriver::CreateTypeInfo()); } return IGuiInstanceLoader::GetPropertyType(propertyInfo); } @@ -3659,7 +3718,7 @@ GuiCellCompositionInstanceLoader { if (propertyInfo.propertyName == _Site) { - return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); } return IGuiInstanceLoader::GetPropertyType(propertyInfo); } @@ -3852,14 +3911,14 @@ GuiDocumentItemInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - auto info = GuiInstancePropertyInfo::Collection(); - info->acceptableTypes.Add(description::GetTypeDescriptor()); - info->acceptableTypes.Add(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Collection(nullptr); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); return info; } else if (propertyInfo.propertyName == _Name) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; info->required = true; return info; @@ -3911,17 +3970,17 @@ GuiDocumentItemInstanceLoader if (prop == GlobalStringKey::Empty) { auto value = values[0].expression; - auto type = values[0].type; + auto td = values[0].typeInfo->GetTypeDescriptor(); Ptr compositionExpr; - if (type->CanConvertTo(description::GetTypeDescriptor())) + if (td->CanConvertTo(description::GetTypeDescriptor())) { auto member = MakePtr(); member->parent = value; member->name.value = L"BoundsComposition"; compositionExpr = member; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { compositionExpr = value; } @@ -3981,7 +4040,7 @@ GuiDocumentViewerInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::CollectionWithParent(TypeInfoRetriver>::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -3995,8 +4054,6 @@ GuiDocumentViewerInstanceLoader const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) { - auto type = values[0].type; - auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -4046,7 +4103,7 @@ GuiDocumentLabelInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::CollectionWithParent(TypeInfoRetriver>::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -4060,8 +4117,6 @@ GuiDocumentLabelInstanceLoader const auto& values = arguments.GetByIndex(index); if (prop == GlobalStringKey::Empty) { - auto type = values[0].type; - auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -4180,7 +4235,7 @@ GuiSelectableListControlInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); return info; } return IGuiInstanceLoader::GetPropertyType(propertyInfo); @@ -4239,7 +4294,7 @@ GuiVirtualTreeViewInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); return info; } return IGuiInstanceLoader::GetPropertyType(propertyInfo); @@ -4299,7 +4354,7 @@ GuiComboBoxInstanceLoader if (typeInfo.typeName == GetTypeName()) { propertyNames.Add(_ListControl); - propertyNames.Add(GlobalStringKey::_ItemTemplate); + propertyNames.Add(GlobalStringKey::_ItemTemplate); } BASE_TYPE::GetConstructorParameters(typeInfo, propertyNames); } @@ -4308,14 +4363,14 @@ GuiComboBoxInstanceLoader { if (propertyInfo.propertyName == _ListControl) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; info->required = true; return info; } else if (propertyInfo.propertyName == GlobalStringKey::_ItemTemplate) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); return info; } return BASE_TYPE::GetPropertyType(propertyInfo); @@ -4502,13 +4557,13 @@ GuiListViewInstanceLoader { if (propertyInfo.propertyName == _View) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; return info; } else if (propertyInfo.propertyName == _IconSize) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; return info; } @@ -4606,12 +4661,12 @@ GuiTreeViewInstanceLoader { if (!bindable) { - return GuiInstancePropertyInfo::Collection(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Collection(TypeInfoRetriver>::CreateTypeInfo()); } } else if (propertyInfo.propertyName == _IconSize) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; return info; } @@ -4732,11 +4787,11 @@ GuiBindableDataColumnInstanceLoader { if (propertyInfo.propertyName == _VisualizerTemplates) { - return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); } else if (propertyInfo.propertyName == _EditorTemplate) { - return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); } return IGuiInstanceLoader::GetPropertyType(propertyInfo); } @@ -4914,11 +4969,11 @@ GuiBindableDataGridInstanceLoader { if (propertyInfo.propertyName == _Columns) { - return GuiInstancePropertyInfo::Collection(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Collection(TypeInfoRetriver>::CreateTypeInfo()); } else if (propertyInfo.propertyName == _ViewModelContext) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; info->bindable = true; return info; @@ -4996,19 +5051,19 @@ GuiTreeNodeInstanceLoader { if (propertyInfo.propertyName == _Text) { - return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); } else if (propertyInfo.propertyName == _Image) { - return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Assign(TypeInfoRetriver>::CreateTypeInfo()); } else if (propertyInfo.propertyName == _Tag) { - return GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); } else if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::Collection(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Collection(TypeInfoRetriver>::CreateTypeInfo()); } return IGuiInstanceLoader::GetPropertyType(propertyInfo); } @@ -5216,12 +5271,12 @@ GuiControlInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - auto info = GuiInstancePropertyInfo::Collection(); - info->acceptableTypes.Add(description::GetTypeDescriptor()); - info->acceptableTypes.Add(description::GetTypeDescriptor()); - if (propertyInfo.typeInfo.typeDescriptor->CanConvertTo(description::GetTypeDescriptor())) + auto info = GuiInstancePropertyInfo::Collection(nullptr); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); + if (propertyInfo.typeInfo.typeInfo->GetTypeDescriptor()->CanConvertTo(description::GetTypeDescriptor())) { - info->acceptableTypes.Add(description::GetTypeDescriptor()); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); } return info; } @@ -5238,10 +5293,10 @@ GuiControlInstanceLoader if (prop == GlobalStringKey::Empty) { auto value = values[0].expression; - auto type = values[0].type; + auto td = values[0].typeInfo->GetTypeDescriptor(); Ptr expr; - if (type->CanConvertTo(description::GetTypeDescriptor())) + if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -5256,7 +5311,7 @@ GuiControlInstanceLoader expr = call; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -5271,7 +5326,7 @@ GuiControlInstanceLoader expr = call; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -5286,7 +5341,7 @@ GuiControlInstanceLoader expr = call; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -5535,7 +5590,7 @@ GuiTabInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::CollectionWithParent(TypeInfoRetriver::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -5550,10 +5605,10 @@ GuiTabInstanceLoader if (prop == GlobalStringKey::Empty) { auto value = values[0].expression; - auto type = values[0].type; + auto td = values[0].typeInfo->GetTypeDescriptor(); Ptr expr; - if (type->CanConvertTo(description::GetTypeDescriptor())) + if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -5620,9 +5675,9 @@ GuiTabPageInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - auto info = GuiInstancePropertyInfo::Collection(); - info->acceptableTypes.Add(description::GetTypeDescriptor()); - info->acceptableTypes.Add(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Collection(nullptr); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); + info->acceptableTypes.Add(TypeInfoRetriver::CreateTypeInfo()); return info; } return IGuiInstanceLoader::GetPropertyType(propertyInfo); @@ -5638,10 +5693,10 @@ GuiTabPageInstanceLoader if (prop == GlobalStringKey::Empty) { auto value = values[0].expression; - auto type = values[0].type; + auto td = values[0].typeInfo->GetTypeDescriptor(); Ptr expr; - if (type->CanConvertTo(description::GetTypeDescriptor())) + if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refBoundsComposition = MakePtr(); refBoundsComposition->parent = value; @@ -5649,7 +5704,7 @@ GuiTabPageInstanceLoader expr = refBoundsComposition; } - else if (type->CanConvertTo(description::GetTypeDescriptor())) + else if (td->CanConvertTo(description::GetTypeDescriptor())) { expr = value; } @@ -5737,7 +5792,7 @@ GuiTemplateInstanceLoader void GetConstructorParameters(const TypeInfo& typeInfo, collections::List& propertyNames)override { List tds; - tds.Add(typeInfo.typeDescriptor); + tds.Add(typeInfo.typeInfo->GetTypeDescriptor()); for (vint i = 0; i < tds.Count(); i++) { @@ -5766,11 +5821,11 @@ GuiTemplateInstanceLoader Ptr GetPropertyType(const PropertyInfo& propertyInfo)override { - if (auto prop = propertyInfo.typeInfo.typeDescriptor->GetPropertyByName(propertyInfo.propertyName.ToString(), true)) + if (auto prop = propertyInfo.typeInfo.typeInfo->GetTypeDescriptor()->GetPropertyByName(propertyInfo.propertyName.ToString(), true)) { if (prop->IsWritable() && prop->GetReturn()->GetTypeDescriptor() == description::GetTypeDescriptor()) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; info->bindable = false; @@ -5786,9 +5841,9 @@ GuiTemplateInstanceLoader bool CanCreate(const TypeInfo& typeInfo)override { - if (typeInfo.typeDescriptor->CanConvertTo(description::GetTypeDescriptor())) + if (typeInfo.typeInfo->GetTypeDescriptor()->CanConvertTo(description::GetTypeDescriptor())) { - auto group = typeInfo.typeDescriptor->GetConstructorGroup(); + auto group = typeInfo.typeInfo->GetTypeDescriptor()->GetConstructorGroup(); if (group && group->GetMethodCount() == 1) { auto ctor = group->GetMethod(0); @@ -5811,7 +5866,7 @@ GuiTemplateInstanceLoader auto block = MakePtr(); { auto createExpr = MakePtr(); - createExpr->type = GetTypeFromTypeInfo(MakePtr(typeInfo.typeDescriptor, TypeInfoHint::Normal).Obj()); + createExpr->type = GetTypeFromTypeInfo(MakePtr(typeInfo.typeInfo->GetTypeDescriptor(), TypeInfoHint::Normal).Obj()); auto refVariable = MakePtr(); refVariable->name.value = variableName.ToString(); @@ -5908,10 +5963,10 @@ namespace vl if (prop == GlobalStringKey::Empty) { auto value = values[0].expression; - auto type = values[0].type; + auto td = values[0].typeInfo->GetTypeDescriptor(); Ptr expr; - if (type->CanConvertTo(description::GetTypeDescriptor())) + if (td->CanConvertTo(description::GetTypeDescriptor())) { auto refControl = MakePtr(); refControl->name.value = variableName.ToString(); @@ -5977,7 +6032,7 @@ GuiToolstripMenuInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::CollectionWithParent(TypeInfoRetriver::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -6019,7 +6074,7 @@ GuiToolstripMenuBarInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::CollectionWithParent(TypeInfoRetriver::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -6061,7 +6116,7 @@ GuiToolstripToolBarInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::Empty) { - return GuiInstancePropertyInfo::CollectionWithParent(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::CollectionWithParent(TypeInfoRetriver::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -6107,7 +6162,7 @@ GuiToolstripButtonInstanceLoader { if (propertyInfo.propertyName == _SubMenu) { - return GuiInstancePropertyInfo::Set(description::GetTypeDescriptor()); + return GuiInstancePropertyInfo::Set(TypeInfoRetriver::CreateTypeInfo()); } return BASE_TYPE::GetPropertyType(propertyInfo); } @@ -7045,7 +7100,7 @@ WorkflowEventNamesVisitor GlobalStringKey propertyName ) { - if (auto eventInfo = resolvedTypeInfo.typeDescriptor->GetEventByName(propertyName.ToString(), true)) + if (auto eventInfo = resolvedTypeInfo.typeInfo->GetTypeDescriptor()->GetEventByName(propertyName.ToString(), true)) { auto decl = Workflow_GenerateEventHandler(precompileContext, eventInfo); decl->anonymity = WfFunctionAnonymity::Named; @@ -7119,9 +7174,9 @@ WorkflowEventNamesVisitor List infos; WorkflowEventNamesVisitor visitor(precompileContext, resolvingResult, infos, instanceClass, errors); - auto td = possibleInfos[0].info->acceptableTypes[0]; - visitor.resolvedTypeInfo.typeDescriptor = td; - visitor.resolvedTypeInfo.typeName = GlobalStringKey::Get(td->GetTypeName()); + auto typeInfo = possibleInfos[0].info->acceptableTypes[0]; + visitor.resolvedTypeInfo.typeName = GlobalStringKey::Get(typeInfo->GetTypeDescriptor()->GetTypeName()); + visitor.resolvedTypeInfo.typeInfo = typeInfo; setTarget->Accept(&visitor); } else @@ -7168,9 +7223,9 @@ WorkflowEventNamesVisitor auto info = candidatePropertyTypeInfos[0].info; if (info->acceptableTypes.Count() == 1) { - auto td = info->acceptableTypes[0]; - resolvedTypeInfo.typeDescriptor = td; - resolvedTypeInfo.typeName = GlobalStringKey::Get(td->GetTypeName()); + auto typeInfo = info->acceptableTypes[0]; + resolvedTypeInfo.typeName = GlobalStringKey::Get(typeInfo->GetTypeDescriptor()->GetTypeName()); + resolvedTypeInfo.typeInfo = typeInfo; } else if (info->acceptableTypes.Count() == 0) { @@ -7187,21 +7242,21 @@ WorkflowEventNamesVisitor if (repr == context->instance.Obj()) { auto fullName = GlobalStringKey::Get(context->className); - if (auto reprTd = GetInstanceLoaderManager()->GetTypeDescriptorForType(fullName)) + if (auto reprType = GetInstanceLoaderManager()->GetTypeInfoForType(fullName)) { resolvedTypeInfo.typeName = fullName; - resolvedTypeInfo.typeDescriptor = reprTd; + resolvedTypeInfo.typeInfo = reprType; } } - if (!resolvedTypeInfo.typeDescriptor) + if (!resolvedTypeInfo.typeInfo) { auto source = FindInstanceLoadingSource(context, repr); resolvedTypeInfo.typeName = source.typeName; - resolvedTypeInfo.typeDescriptor = GetInstanceLoaderManager()->GetTypeDescriptorForType(source.typeName); + resolvedTypeInfo.typeInfo = GetInstanceLoaderManager()->GetTypeInfoForType(source.typeName); } } - if (resolvedTypeInfo.typeDescriptor) + if (resolvedTypeInfo.typeInfo) { if (repr->setters.Count() == 1 && repr->setters.Keys()[0] == GlobalStringKey::Empty) { @@ -7308,8 +7363,8 @@ Workflow_GenerateInstanceClass auto context = resolvingResult.context; auto source = FindInstanceLoadingSource(context, context->instance.Obj()); - auto baseTd = GetInstanceLoaderManager()->GetTypeDescriptorForType(source.typeName); - if (!baseTd) + auto baseType = GetInstanceLoaderManager()->GetTypeInfoForType(source.typeName); + if (!baseType) { errors.Add(GuiResourceError({ resolvingResult.resource }, context->instance->tagPosition, L"Precompile: Failed to find type \"" + @@ -7328,7 +7383,7 @@ Workflow_GenerateInstanceClass auto module = Workflow_CreateModuleWithUsings(context); auto instanceClass = Workflow_InstallClass(context->className, module); { - auto typeInfo = MakePtr(baseTd, TypeInfoHint::Normal); + auto typeInfo = MakePtr(baseType->GetTypeDescriptor(), TypeInfoHint::Normal); auto baseType = GetTypeFromTypeInfo(typeInfo.Obj()); instanceClass->baseTypes.Add(baseType); @@ -7436,7 +7491,7 @@ Workflow_GenerateInstanceClass auto ctorBlock = (beforePrecompile ? notImplemented() : MakePtr()); ctor->statement = ctorBlock; - if (auto group = baseTd->GetConstructorGroup()) + if (auto group = baseType->GetTypeDescriptor()->GetConstructorGroup()) { vint count = group->GetMethod(0)->GetParameterCount(); if (count > 0) @@ -7936,7 +7991,18 @@ WorkflowReferenceNamesVisitor auto candidate = candidatePropertyTypeInfos[selectedPropertyTypeInfo]; auto propertyInfo = candidate.propertyInfo; - auto td = candidate.info->acceptableTypes[0]; + ITypeDescriptor* td = nullptr; + { + auto typeInfo = candidate.info->acceptableTypes[0]; + if (auto deserializer = GetInstanceLoaderManager()->GetInstanceDeserializer(typeInfo.Obj())) + { + td = deserializer->DeserializeAs(typeInfo.Obj())->GetTypeDescriptor(); + } + else + { + td = typeInfo->GetTypeDescriptor(); + } + } if (auto st = td->GetSerializableType()) { @@ -7999,7 +8065,7 @@ WorkflowReferenceNamesVisitor resolvingResult.propertyResolvings.Add(repr, candidatePropertyTypeInfos[selectedPropertyTypeInfo]); } - bool isReferenceType = (resolvedTypeInfo.typeDescriptor->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined; + bool isReferenceType = (resolvedTypeInfo.typeInfo->GetTypeDescriptor()->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined; if (repr->instanceName == GlobalStringKey::Empty) { if (isReferenceType) @@ -8058,49 +8124,11 @@ WorkflowReferenceNamesVisitor auto setTarget = dynamic_cast(setter->values[0].Obj()); WorkflowReferenceNamesVisitor visitor(precompileContext, resolvingResult, possibleInfos, generatedNameCount, errors); - auto td = possibleInfos[0].info->acceptableTypes[0]; + auto typeInfo = possibleInfos[0].info->acceptableTypes[0]; visitor.selectedPropertyTypeInfo = 0; - visitor.resolvedTypeInfo.typeDescriptor = td; - visitor.resolvedTypeInfo.typeName = GlobalStringKey::Get(td->GetTypeName()); + visitor.resolvedTypeInfo.typeName = GlobalStringKey::Get(typeInfo->GetTypeDescriptor()->GetTypeName()); + visitor.resolvedTypeInfo.typeInfo = typeInfo; setTarget->Accept(&visitor); - - if (auto propInfo = resolvedTypeInfo.typeDescriptor->GetPropertyByName(prop.ToString(), true)) - { - auto propType = propInfo->GetReturn(); - if (propType->GetTypeDescriptor() == td) - { - resolvingResult.typeOverrides.Add(setTarget->instanceName, CopyTypeInfo(propInfo->GetReturn())); - } - else - { - switch (propType->GetDecorator()) - { - case ITypeInfo::Nullable: - { - auto elementType = MakePtr(td, TypeInfoHint::Normal); - auto decoratedType = MakePtr(elementType); - resolvingResult.typeOverrides.Add(setTarget->instanceName, decoratedType); - } - break; - case ITypeInfo::RawPtr: - { - auto elementType = MakePtr(td, TypeInfoHint::Normal); - auto decoratedType = MakePtr(elementType); - resolvingResult.typeOverrides.Add(setTarget->instanceName, decoratedType); - } - break; - case ITypeInfo::SharedPtr: - { - auto elementType = MakePtr(td, TypeInfoHint::Normal); - auto decoratedType = MakePtr(elementType); - resolvingResult.typeOverrides.Add(setTarget->instanceName, decoratedType); - } - break; - default: - resolvingResult.typeOverrides.Add(setTarget->instanceName, CopyTypeInfo(propInfo->GetReturn())); - } - } - } } else { @@ -8264,7 +8292,7 @@ WorkflowReferenceNamesVisitor { bool found = false; - bool inferType = repr->typeNamespace == GlobalStringKey::Empty&&repr->typeName == GlobalStringKey::_InferType; + bool inferType = repr->typeNamespace == GlobalStringKey::Empty && repr->typeName == GlobalStringKey::_InferType; if (inferType) { if (candidatePropertyTypeInfos.Count() == 1) @@ -8272,9 +8300,9 @@ WorkflowReferenceNamesVisitor auto info = candidatePropertyTypeInfos[0].info; if (info->acceptableTypes.Count() == 1) { - auto td = info->acceptableTypes[0]; - resolvedTypeInfo.typeDescriptor = td; - resolvedTypeInfo.typeName = GlobalStringKey::Get(td->GetTypeName()); + auto typeInfo = info->acceptableTypes[0]; + resolvedTypeInfo.typeName = GlobalStringKey::Get(typeInfo->GetTypeDescriptor()->GetTypeName()); + resolvedTypeInfo.typeInfo = typeInfo; } } } @@ -8283,12 +8311,11 @@ WorkflowReferenceNamesVisitor if (repr == resolvingResult.context->instance.Obj()) { auto fullName = GlobalStringKey::Get(resolvingResult.context->className); - auto td = GetInstanceLoaderManager()->GetTypeDescriptorForType(fullName); - if (td) + if (auto typeInfo = GetInstanceLoaderManager()->GetTypeInfoForType(fullName)) { - found = true; resolvedTypeInfo.typeName = fullName; - resolvedTypeInfo.typeDescriptor = td; + resolvedTypeInfo.typeInfo = typeInfo; + found = true; } } @@ -8296,18 +8323,18 @@ WorkflowReferenceNamesVisitor { auto source = FindInstanceLoadingSource(resolvingResult.context, repr); resolvedTypeInfo.typeName = source.typeName; - resolvedTypeInfo.typeDescriptor = GetInstanceLoaderManager()->GetTypeDescriptorForType(source.typeName); + resolvedTypeInfo.typeInfo = GetInstanceLoaderManager()->GetTypeInfoForType(source.typeName); } } - if (resolvedTypeInfo.typeDescriptor) + if (resolvedTypeInfo.typeInfo) { for (vint i = 0; i < candidatePropertyTypeInfos.Count(); i++) { - const auto& tds = candidatePropertyTypeInfos[i].info->acceptableTypes; - for (vint j = 0; j < tds.Count(); j++) + const auto& typeInfos = candidatePropertyTypeInfos[i].info->acceptableTypes; + for (vint j = 0; j < typeInfos.Count(); j++) { - if (resolvedTypeInfo.typeDescriptor->CanConvertTo(tds[j])) + if (resolvedTypeInfo.typeInfo->GetTypeDescriptor()->CanConvertTo(typeInfos[j]->GetTypeDescriptor())) { selectedPropertyTypeInfo = i; goto FINISH_MATCHING; @@ -8330,14 +8357,14 @@ WorkflowReferenceNamesVisitor for (vint i = 0; i < candidatePropertyTypeInfos.Count(); i++) { - const auto& tds = candidatePropertyTypeInfos[i].info->acceptableTypes; - for (vint j = 0; j < tds.Count(); j++) + const auto& typeInfos = candidatePropertyTypeInfos[i].info->acceptableTypes; + for (vint j = 0; j < typeInfos.Count(); j++) { if (i != 0 || j != 0) { error += L", "; } - error += L"\"" + tds[j]->GetTypeName() + L"\""; + error += L"\"" + typeInfos[j]->GetTypeFriendlyName() + L"\""; } } @@ -8436,7 +8463,7 @@ WorkflowReferenceNamesVisitor } }; - ITypeDescriptor* Workflow_CollectReferences(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors) + IGuiInstanceLoader::TypeInfo Workflow_CollectReferences(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors) { FOREACH(Ptr, parameter, resolvingResult.context->parameters) { @@ -8457,18 +8484,9 @@ WorkflowReferenceNamesVisitor } else { - { - IGuiInstanceLoader::TypeInfo typeInfo; - typeInfo.typeDescriptor = type; - typeInfo.typeName = GlobalStringKey::Get(type->GetTypeName()); - resolvingResult.typeInfos.Add(parameter->name, typeInfo); - } - { - auto elementType = MakePtr(type, TypeInfoHint::Normal); - auto pointerType = MakePtr(elementType); - - resolvingResult.typeOverrides.Add(parameter->name, pointerType); - } + auto elementType = MakePtr(type, TypeInfoHint::Normal); + auto pointerType = MakePtr(elementType); + resolvingResult.typeInfos.Add(parameter->name, { GlobalStringKey::Get(type->GetTypeName()),pointerType }); } } @@ -8476,7 +8494,7 @@ WorkflowReferenceNamesVisitor vint generatedNameCount = 0; WorkflowReferenceNamesVisitor visitor(precompileContext, resolvingResult, infos, generatedNameCount, errors); resolvingResult.context->instance->Accept(&visitor); - return visitor.resolvedTypeInfo.typeDescriptor; + return visitor.resolvedTypeInfo; } } } @@ -8528,7 +8546,7 @@ WorkflowGenerateBindingVisitor if (propertyResolving.info->scope == GuiInstancePropertyInfo::Property) { WString expressionCode = setter->values[0].Cast()->text; - auto instancePropertyInfo = reprTypeInfo.typeDescriptor->GetPropertyByName(propertyName.ToString(), true); + auto instancePropertyInfo = reprTypeInfo.typeInfo->GetTypeDescriptor()->GetPropertyByName(propertyName.ToString(), true); if (instancePropertyInfo || !binder->RequirePropertyExist()) { @@ -8579,7 +8597,7 @@ WorkflowGenerateBindingVisitor GlobalStringKey propertyName ) { - auto td = reprTypeInfo.typeDescriptor; + auto td = reprTypeInfo.typeInfo->GetTypeDescriptor(); auto eventInfo = td->GetEventByName(propertyName.ToString(), true); if (!eventInfo) @@ -8630,7 +8648,7 @@ WorkflowGenerateBindingVisitor reprTypeInfo = resolvingResult.typeInfos[repr->instanceName]; } - if (reprTypeInfo.typeDescriptor && (reprTypeInfo.typeDescriptor->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined) + if (reprTypeInfo.typeInfo && (reprTypeInfo.typeInfo->GetTypeDescriptor()->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined) { WORKFLOW_ENVIRONMENT_VARIABLE_ADD @@ -8656,7 +8674,7 @@ WorkflowGenerateBindingVisitor FOREACH_INDEXER(Ptr, handler, index, repr->eventHandlers.Values()) { - if (reprTypeInfo.typeDescriptor) + if (reprTypeInfo.typeInfo) { GlobalStringKey propertyName = repr->eventHandlers.Keys()[index]; if (auto statement = ProcessEventBinding(repr, reprTypeInfo, handler, propertyName)) @@ -8723,7 +8741,7 @@ WorkflowGenerateCreatingVisitor IGuiInstanceLoader::ArgumentInfo GetArgumentInfo(GuiResourceTextPos attPosition, GuiValueRepr* repr) { - ITypeDescriptor* td = nullptr; + Ptr typeInfo = nullptr; bool serializable = false; WString textValue; GuiResourceTextPos textValuePosition; @@ -8731,7 +8749,7 @@ WorkflowGenerateCreatingVisitor if (auto text = dynamic_cast(repr)) { - td = resolvingResult.propertyResolvings[repr].info->acceptableTypes[0]; + typeInfo = resolvingResult.propertyResolvings[repr].info->acceptableTypes[0]; serializable = true; textValue = text->text; textValuePosition = text->tagPosition; @@ -8740,13 +8758,14 @@ WorkflowGenerateCreatingVisitor { if (ctor->instanceName == GlobalStringKey::Empty) { - td = resolvingResult.propertyResolvings[repr].info->acceptableTypes[0]; + typeInfo = resolvingResult.propertyResolvings[repr].info->acceptableTypes[0]; } else { - td = resolvingResult.typeInfos[ctor->instanceName].typeDescriptor; + typeInfo = resolvingResult.typeInfos[ctor->instanceName].typeInfo; } - if ((td->GetTypeDescriptorFlags() & TypeDescriptorFlags::StructType) != TypeDescriptorFlags::Undefined) + + if ((typeInfo->GetTypeDescriptor()->GetTypeDescriptorFlags() & TypeDescriptorFlags::StructType) != TypeDescriptorFlags::Undefined) { serializable = true; auto value = ctor->setters.Values()[0]->values[0].Cast(); @@ -8756,12 +8775,23 @@ WorkflowGenerateCreatingVisitor } IGuiInstanceLoader::ArgumentInfo argumentInfo; - argumentInfo.type = td; + argumentInfo.typeInfo = typeInfo; argumentInfo.attPosition = attPosition; if (serializable) { - argumentInfo.expression = Workflow_ParseTextValue(precompileContext, td, { resolvingResult.resource }, textValue, textValuePosition, errors); + if (auto deserializer = GetInstanceLoaderManager()->GetInstanceDeserializer(typeInfo.Obj())) + { + auto typeInfoAs = deserializer->DeserializeAs(typeInfo.Obj()); + if (auto expression = Workflow_ParseTextValue(precompileContext, typeInfoAs->GetTypeDescriptor(), { resolvingResult.resource }, textValue, textValuePosition, errors)) + { + argumentInfo.expression = deserializer->Deserialize(precompileContext, resolvingResult, typeInfo.Obj(), expression, textValuePosition, errors); + } + } + else + { + argumentInfo.expression = Workflow_ParseTextValue(precompileContext, typeInfo->GetTypeDescriptor(), { resolvingResult.resource }, textValue, textValuePosition, errors); + } argumentInfo.valuePosition = textValuePosition; } else @@ -8871,6 +8901,7 @@ WorkflowGenerateCreatingVisitor pairedProps.Add(propInfo.propertyName); } + vint errorCount = errors.Count(); IGuiInstanceLoader::ArgumentMap arguments; FOREACH(GlobalStringKey, pairedProp, pairedProps) { @@ -8886,7 +8917,6 @@ WorkflowGenerateCreatingVisitor } } - vint errorCount = errors.Count(); if (auto stat = info.loader->AssignParameters(precompileContext, resolvingResult, propInfo.typeInfo, repr->instanceName, arguments, setter->attPosition, errors)) { return stat; @@ -8919,7 +8949,7 @@ WorkflowGenerateCreatingVisitor { auto reprTypeInfo = resolvingResult.typeInfos[repr->instanceName]; - if (reprTypeInfo.typeDescriptor && (reprTypeInfo.typeDescriptor->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined) + if (reprTypeInfo.typeInfo && (reprTypeInfo.typeInfo->GetTypeDescriptor()->GetTypeDescriptorFlags() & TypeDescriptorFlags::ReferenceType) != TypeDescriptorFlags::Undefined) { WORKFLOW_ENVIRONMENT_VARIABLE_ADD @@ -8988,7 +9018,7 @@ WorkflowGenerateCreatingVisitor FOREACH(Ptr, value, setter->values) { auto argument = GetArgumentInfo(setter->attPosition, value.Obj()); - if (argument.type && argument.expression) + if (argument.typeInfo && argument.expression) { arguments.Add(prop, argument); } @@ -9005,7 +9035,7 @@ WorkflowGenerateCreatingVisitor IGuiInstanceLoader::ArgumentInfo argument; argument.expression = expression; - argument.type = resolvedPropInfo->acceptableTypes[0]; + argument.typeInfo = resolvedPropInfo->acceptableTypes[0]; argument.attPosition = setter->attPosition; arguments.Add(prop, argument); } @@ -9030,7 +9060,9 @@ WorkflowGenerateCreatingVisitor { auto source = FindInstanceLoadingSource(resolvingResult.context, repr); ctorTypeInfo.typeName = source.typeName; - ctorTypeInfo.typeDescriptor = GetInstanceLoaderManager()->GetTypeDescriptorForType(source.typeName); + + auto typeInfo = GetInstanceLoaderManager()->GetTypeInfoForType(source.typeName); + ctorTypeInfo.typeInfo = typeInfo; } else { @@ -9050,7 +9082,6 @@ WorkflowGenerateCreatingVisitor if (resolvingResult.context->instance.Obj() == repr) { resolvingResult.rootLoader = ctorLoader; - resolvingResult.rootTypeInfo = ctorTypeInfo; FillCtorArguments(repr, ctorLoader, ctorTypeInfo, resolvingResult.rootCtorArguments); { @@ -9208,7 +9239,7 @@ Workflow_InstallBindProperty subBlock->statements.Add(ifStat); } - auto td = propInfo->acceptableTypes[0]; + auto td = propInfo->acceptableTypes[0]->GetTypeDescriptor(); Ptr convertedType; if (td->GetSerializableType()) { @@ -9251,7 +9282,7 @@ Workflow_InstallBindProperty isNull->test = WfTypeTesting::IsNull; auto valueException = MakePtr(); - valueException->value.value = L"Resource \"" + protocol + L"://" + path + L"\" cannot be read as type \"" + convertedType->GetTypeDescriptor()->GetTypeName() + L"\"."; + valueException->value.value = L"Resource \"" + protocol + L"://" + path + L"\" cannot be read as type \"" + convertedType->GetTypeFriendlyName() + L"\"."; auto raiseStat = MakePtr(); raiseStat->expression = valueException; @@ -9307,7 +9338,7 @@ Workflow_InstallBindProperty IGuiInstanceLoader::ArgumentMap arguments; { IGuiInstanceLoader::ArgumentInfo argumentInfo; - argumentInfo.type = td; + argumentInfo.typeInfo = propInfo->acceptableTypes[0]; argumentInfo.expression = evalExpression; argumentInfo.attPosition = attPosition; arguments.Add(prop.propertyName, argumentInfo); @@ -9488,7 +9519,7 @@ Workflow_InstallEvalProperty IGuiInstanceLoader::ArgumentMap arguments; { IGuiInstanceLoader::ArgumentInfo argumentInfo; - argumentInfo.type = propInfo->acceptableTypes[0]; + argumentInfo.typeInfo = propInfo->acceptableTypes[0]; argumentInfo.expression = evalExpression; argumentInfo.attPosition = attPosition; arguments.Add(prop.propertyName, argumentInfo); @@ -9808,12 +9839,7 @@ Workflow_InstallCtorClass auto thisParam = MakePtr(); thisParam->name.value = L""; - { - auto elementType = MakePtr(resolvingResult.rootTypeDescriptor, TypeInfoHint::Normal); - auto pointerType = MakePtr(elementType); - - thisParam->type = GetTypeFromTypeInfo(pointerType.Obj()); - } + thisParam->type = GetTypeFromTypeInfo(resolvingResult.rootTypeInfo.typeInfo.Obj()); auto resolverParam = MakePtr(); resolverParam->name.value = L""; @@ -9852,10 +9878,11 @@ Workflow_InstallCtorClass Variable ***********************************************************************/ - void Workflow_CreatePointerVariable(Ptr ctorClass, GlobalStringKey name, description::ITypeDescriptor* type, description::ITypeInfo* typeOverride) + void Workflow_CreatePointerVariable(Ptr ctorClass, GlobalStringKey name, description::ITypeInfo* typeInfo) { auto var = MakePtr(); var->name.value = name.ToString(); + var->type = GetTypeFromTypeInfo(typeInfo); { auto att = MakePtr(); @@ -9864,14 +9891,9 @@ Variable var->attributes.Add(att); } - if (typeOverride) - { - var->type = GetTypeFromTypeInfo(typeOverride); - } - if (!var->type) { - if (auto ctors = type->GetConstructorGroup()) + if (auto ctors = typeInfo->GetTypeDescriptor()->GetConstructorGroup()) { if (ctors->GetMethodCount() > 0) { @@ -9881,14 +9903,6 @@ Variable } } - if (!var->type) - { - auto elementType = MakePtr(type, TypeInfoHint::Normal); - auto pointerType = MakePtr(elementType); - - var->type = GetTypeFromTypeInfo(pointerType.Obj()); - } - auto literal = MakePtr(); literal->value = WfLiteralValue::Null; var->expression = literal; @@ -9904,15 +9918,8 @@ Variable for (vint i = 0; i < typeInfos.Count(); i++) { auto key = typeInfos.Keys()[i]; - auto value = typeInfos.Values()[i].typeDescriptor; - - ITypeInfo* typeOverride = nullptr; - vint index = resolvingResult.typeOverrides.Keys().IndexOf(key); - if (index != -1) - { - typeOverride = resolvingResult.typeOverrides.Values()[index].Obj(); - } - Workflow_CreatePointerVariable(ctorClass, key, value, typeOverride); + auto value = typeInfos.Values()[i].typeInfo.Obj(); + Workflow_CreatePointerVariable(ctorClass, key, value); } } } diff --git a/Import/GacUICompiler.h b/Import/GacUICompiler.h index 4b30e56c..a2a73c6e 100644 --- a/Import/GacUICompiler.h +++ b/Import/GacUICompiler.h @@ -472,7 +472,7 @@ Instance Loader class GuiInstancePropertyInfo : public IDescriptable, public Description { - typedef collections::List TypeDescriptorList; + typedef collections::List> TypeInfoList; public: enum Support { @@ -495,15 +495,15 @@ Instance Loader bool required = false; // only apply to constructor bool bindable = false; // only apply to constructor PropertyScope scope = Property; - TypeDescriptorList acceptableTypes; + TypeInfoList acceptableTypes; static Ptr Unsupported(); - static Ptr Assign(description::ITypeDescriptor* typeDescriptor = 0); - static Ptr AssignWithParent(description::ITypeDescriptor* typeDescriptor = 0); - static Ptr Collection(description::ITypeDescriptor* typeDescriptor = 0); - static Ptr CollectionWithParent(description::ITypeDescriptor* typeDescriptor = 0); - static Ptr Set(description::ITypeDescriptor* typeDescriptor = 0); - static Ptr Array(description::ITypeDescriptor* typeDescriptor = 0); + static Ptr Assign(Ptr typeInfo); + static Ptr AssignWithParent(Ptr typeInfo); + static Ptr Collection(Ptr typeInfo); + static Ptr CollectionWithParent(Ptr typeInfo); + static Ptr Set(Ptr typeInfo); + static Ptr Array(Ptr typeInfo); }; class IGuiInstanceLoader : public IDescriptable, public Description @@ -512,12 +512,15 @@ Instance Loader struct TypeInfo { GlobalStringKey typeName; - description::ITypeDescriptor* typeDescriptor; + Ptr typeInfo = nullptr; - TypeInfo() :typeDescriptor(0){} - TypeInfo(GlobalStringKey _typeName, description::ITypeDescriptor* _typeDescriptor) + TypeInfo() + { + } + + TypeInfo(GlobalStringKey _typeName, Ptr _typeInfo) :typeName(_typeName) - , typeDescriptor(_typeDescriptor) + , typeInfo(_typeInfo) { } }; @@ -552,7 +555,7 @@ Instance Loader struct ArgumentInfo { Ptr expression; - description::ITypeDescriptor* type; + Ptr typeInfo; GuiResourceTextPos attPosition; GuiResourceTextPos valuePosition; // only apply to text value }; @@ -596,6 +599,14 @@ Instance Binder virtual Ptr GenerateInstallStatement(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GlobalStringKey variableName, description::IEventInfo* eventInfo, const WString& code, GuiResourceTextPos position, GuiResourceError::List& errors) = 0; }; + class IGuiInstanceDeserializer : public IDescriptable, public Description + { + public: + virtual bool CanDeserialize(description::ITypeInfo* typeInfo) = 0; + virtual description::ITypeInfo* DeserializeAs(description::ITypeInfo* typeInfo) = 0; + virtual Ptr Deserialize(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, description::ITypeInfo* typeInfo, Ptr valueExpression, GuiResourceTextPos tagPosition, GuiResourceError::List& errors) = 0; + }; + /*********************************************************************** Instance Loader Manager ***********************************************************************/ @@ -607,11 +618,14 @@ Instance Loader Manager virtual IGuiInstanceBinder* GetInstanceBinder(GlobalStringKey bindingName) = 0; virtual bool AddInstanceEventBinder(Ptr binder) = 0; virtual IGuiInstanceEventBinder* GetInstanceEventBinder(GlobalStringKey bindingName) = 0; + virtual bool AddInstanceDeserializer(Ptr deserializer) = 0; + virtual IGuiInstanceDeserializer* GetInstanceDeserializer(description::ITypeInfo* typeInfo) = 0; + virtual bool CreateVirtualType(GlobalStringKey parentType, Ptr loader) = 0; virtual bool SetLoader(Ptr loader) = 0; virtual IGuiInstanceLoader* GetLoader(GlobalStringKey typeName) = 0; virtual IGuiInstanceLoader* GetParentLoader(IGuiInstanceLoader* loader) = 0; - virtual description::ITypeDescriptor* GetTypeDescriptorForType(GlobalStringKey typeName) = 0; + virtual Ptr GetTypeInfoForType(GlobalStringKey typeName) = 0; virtual void GetVirtualTypes(collections::List& typeNames) = 0; virtual GlobalStringKey GetParentTypeForVirtualType(GlobalStringKey virtualType) = 0; virtual void ClearReflectionCache() = 0; @@ -744,16 +758,14 @@ namespace vl { Ptr resource; // compiling resource Ptr context; // compiling context - reflection::description::ITypeDescriptor* rootTypeDescriptor = nullptr; // type of the context + IGuiInstanceLoader::TypeInfo rootTypeInfo; // type of the context EnvironmentVariableGroup envVars; // current environment variable value stacks collections::List referenceNames; // all reference names IGuiInstanceLoader::ArgumentMap rootCtorArguments; IGuiInstanceLoader* rootLoader = nullptr; - IGuiInstanceLoader::TypeInfo rootTypeInfo; VariableTypeInfoMap typeInfos; // type of references - TypeOverrideMap typeOverrides; // extra type information of references PropertyResolvingMap propertyResolvings; // information of property values which are calling constructors }; } @@ -793,7 +805,7 @@ WorkflowCompiler (Compile) extern Ptr Workflow_InstallClass(const WString& className, Ptr module); extern Ptr Workflow_InstallCtorClass(types::ResolvingResult& resolvingResult, Ptr module); - extern void Workflow_CreatePointerVariable(Ptr ctorClass, GlobalStringKey name, description::ITypeDescriptor* type, description::ITypeInfo* typeOverride); + extern void Workflow_CreatePointerVariable(Ptr ctorClass, GlobalStringKey name, description::ITypeInfo* typeInfo); extern void Workflow_CreateVariablesForReferenceValues(Ptr ctorClass, types::ResolvingResult& resolvingResult); struct InstanceLoadingSource @@ -828,7 +840,7 @@ WorkflowCompiler (Compile) }; extern bool Workflow_GetPropertyTypes(WString& errorPrefix, types::ResolvingResult& resolvingResult, IGuiInstanceLoader* loader, IGuiInstanceLoader::TypeInfo resolvedTypeInfo, GlobalStringKey prop, Ptr setter, collections::List& possibleInfos, GuiResourceError::List& errors); - extern description::ITypeDescriptor* Workflow_CollectReferences(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors); + extern IGuiInstanceLoader::TypeInfo Workflow_CollectReferences(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, GuiResourceError::List& errors); extern void Workflow_GenerateCreating(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, Ptr statements, GuiResourceError::List& errors); extern void Workflow_GenerateBindings(GuiResourcePrecompileContext& precompileContext, types::ResolvingResult& resolvingResult, Ptr statements, GuiResourceError::List& errors); @@ -1342,7 +1354,7 @@ GuiVrtualTypeInstanceLoader { if (propertyInfo.propertyName == GlobalStringKey::_ControlTemplate) { - auto info = GuiInstancePropertyInfo::Assign(description::GetTypeDescriptor()); + auto info = GuiInstancePropertyInfo::Assign(TypeInfoRetriver::CreateTypeInfo()); info->scope = GuiInstancePropertyInfo::Constructor; return info; } diff --git a/Import/GacUIReflection.cpp b/Import/GacUIReflection.cpp index 0603e5b9..65a9abcd 100644 --- a/Import/GacUIReflection.cpp +++ b/Import/GacUIReflection.cpp @@ -1812,27 +1812,14 @@ Type Declaration CLASS_MEMBER_METHOD(OnTotalSizeChanged, NO_PARAMETER) END_INTERFACE_MEMBER(GuiListControl::IItemArrangerCallback) - BEGIN_INTERFACE_MEMBER(GuiListControl::IItemPrimaryTextView) - CLASS_MEMBER_BASE(IDescriptable) - INTERFACE_IDENTIFIER(GuiListControl::IItemPrimaryTextView) - - CLASS_MEMBER_METHOD(GetPrimaryTextViewText, {L"itemIndex"}) - CLASS_MEMBER_METHOD(ContainsPrimaryText, {L"itemIndex"}) - END_INTERFACE_MEMBER(GuiListControl::IItemPrimaryTextView) - - BEGIN_INTERFACE_MEMBER(GuiListControl::IItemBindingView) - CLASS_MEMBER_BASE(IDescriptable) - INTERFACE_IDENTIFIER(GuiListControl::IItemBindingView) - - CLASS_MEMBER_METHOD(GetBindingValue, {L"itemIndex"}) - END_INTERFACE_MEMBER(GuiListControl::IItemBindingView) - BEGIN_INTERFACE_MEMBER(GuiListControl::IItemProvider) CLASS_MEMBER_BASE(IDescriptable) CLASS_MEMBER_METHOD(AttachCallback, {L"value"}) CLASS_MEMBER_METHOD(DetachCallback, {L"value"}) CLASS_MEMBER_METHOD(Count, NO_PARAMETER) + CLASS_MEMBER_METHOD(GetTextValue, { L"itemIndex" }) + CLASS_MEMBER_METHOD(GetBindingValue, { L"itemIndex" }) CLASS_MEMBER_METHOD(RequestView, {L"identifier"}) CLASS_MEMBER_METHOD(ReleaseView, {L"view"}) END_INTERFACE_MEMBER(GuiListControl::IItemProvider) @@ -1855,8 +1842,7 @@ Type Declaration CLASS_MEMBER_METHOD(AttachListControl, {L"value"}) CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER) - CLASS_MEMBER_METHOD(GetItemStyleId, {L"itemIndex"}) - CLASS_MEMBER_METHOD(CreateItemStyle, {L"styleId"}) + CLASS_MEMBER_METHOD(CreateItemStyle, NO_PARAMETER) CLASS_MEMBER_METHOD(DestroyItemStyle, {L"style"}) CLASS_MEMBER_METHOD(Install, {L"style" _ L"itemIndex"}) END_INTERFACE_MEMBER(GuiListControl::IItemStyleProvider) @@ -1934,10 +1920,8 @@ Type Declaration END_INTERFACE_MEMBER(TextItemStyleProvider::IBulletFactory) BEGIN_INTERFACE_MEMBER(TextItemStyleProvider::ITextItemView) - CLASS_MEMBER_BASE(GuiListControl::IItemPrimaryTextView) INTERFACE_IDENTIFIER(TextItemStyleProvider::ITextItemView) - CLASS_MEMBER_METHOD(GetText, {L"itemIndex"}) CLASS_MEMBER_METHOD(GetChecked, {L"itemIndex"}) CLASS_MEMBER_METHOD(SetCheckedSilently, {L"itemIndex" _ L"value"}) END_INTERFACE_MEMBER(TextItemStyleProvider::ITextItemView) @@ -2041,7 +2025,6 @@ Type Declaration END_CLASS_MEMBER(ListViewItemStyleProvider) BEGIN_INTERFACE_MEMBER(ListViewItemStyleProvider::IListViewItemView) - CLASS_MEMBER_BASE(GuiListControl::IItemPrimaryTextView) INTERFACE_IDENTIFIER(ListViewItemStyleProvider::IListViewItemView) CLASS_MEMBER_METHOD(GetSmallImage, {L"itemIndex"}) @@ -2273,12 +2256,13 @@ Type Declaration CLASS_MEMBER_METHOD(GetNodeByVisibleIndex, {L"index"}) CLASS_MEMBER_METHOD(AttachCallback, {L"value"}) CLASS_MEMBER_METHOD(DetachCallback, {L"value"}) + CLASS_MEMBER_METHOD(GetTextValue, { L"node" }) + CLASS_MEMBER_METHOD(GetBindingValue, { L"node" }) CLASS_MEMBER_METHOD(RequestView, {L"identifier"}) CLASS_MEMBER_METHOD(ReleaseView, {L"value"}) END_INTERFACE_MEMBER(INodeRootProvider) BEGIN_INTERFACE_MEMBER(INodeItemView) - CLASS_MEMBER_BASE(GuiListControl::IItemPrimaryTextView) INTERFACE_IDENTIFIER(INodeItemView) CLASS_MEMBER_METHOD(RequestNode, {L"index"}) @@ -2286,20 +2270,6 @@ Type Declaration CLASS_MEMBER_METHOD(CalculateNodeVisibilityIndex, {L"node"}) END_INTERFACE_MEMBER(INodeItemView) - BEGIN_INTERFACE_MEMBER(INodeItemPrimaryTextView) - CLASS_MEMBER_BASE(IDescriptable) - INTERFACE_IDENTIFIER(INodeItemPrimaryTextView) - - CLASS_MEMBER_METHOD(GetPrimaryTextViewText, {L"node"}) - END_INTERFACE_MEMBER(INodeItemPrimaryTextView) - - BEGIN_INTERFACE_MEMBER(INodeItemBindingView) - CLASS_MEMBER_BASE(IDescriptable) - INTERFACE_IDENTIFIER(INodeItemBindingView) - - CLASS_MEMBER_METHOD(GetBindingValue, {L"node"}) - END_INTERFACE_MEMBER(INodeItemBindingView) - BEGIN_INTERFACE_MEMBER(INodeItemStyleController) CLASS_MEMBER_BASE(GuiListControl::IItemStyleController) @@ -2314,8 +2284,7 @@ Type Declaration CLASS_MEMBER_METHOD(BindItemStyleProvider, {L"styleProvider"}) CLASS_MEMBER_METHOD(AttachListControl, {L"value"}) CLASS_MEMBER_METHOD(DetachListControl, NO_PARAMETER) - CLASS_MEMBER_METHOD(GetItemStyleId, {L"node"}) - CLASS_MEMBER_METHOD(CreateItemStyle, {L"styleId"}) + CLASS_MEMBER_METHOD(CreateItemStyle, NO_PARAMETER) CLASS_MEMBER_METHOD(DestroyItemStyle, {L"style"}) CLASS_MEMBER_METHOD(Install, {L"style" _ L"node" _ L"index"}) CLASS_MEMBER_METHOD(SetStyleIndex, {L"style" _ L"value"}) @@ -2350,7 +2319,6 @@ Type Declaration BEGIN_CLASS_MEMBER(MemoryNodeRootProvider) CLASS_MEMBER_BASE(MemoryNodeProvider) CLASS_MEMBER_BASE(NodeRootProviderBase) - CLASS_MEMBER_CONSTRUCTOR(Ptr(), NO_PARAMETER) CLASS_MEMBER_PROPERTY_READONLY_FAST(RootNode) @@ -2382,7 +2350,6 @@ Type Declaration END_CLASS_MEMBER(GuiVirtualTreeListControl) BEGIN_INTERFACE_MEMBER(ITreeViewItemView) - CLASS_MEMBER_BASE(INodeItemPrimaryTextView) INTERFACE_IDENTIFIER(ITreeViewItemView) CLASS_MEMBER_METHOD(GetNodeImage, {L"node"}) diff --git a/Import/GacUIReflection.h b/Import/GacUIReflection.h index 351b62ff..f0904516 100644 --- a/Import/GacUIReflection.h +++ b/Import/GacUIReflection.h @@ -474,8 +474,6 @@ Type List F(presentation::controls::GuiListControl)\ F(presentation::controls::GuiListControl::IItemProviderCallback)\ F(presentation::controls::GuiListControl::IItemArrangerCallback)\ - F(presentation::controls::GuiListControl::IItemPrimaryTextView)\ - F(presentation::controls::GuiListControl::IItemBindingView)\ F(presentation::controls::GuiListControl::IItemProvider)\ F(presentation::controls::GuiListControl::IItemStyleController)\ F(presentation::controls::GuiListControl::IItemStyleProvider)\ @@ -529,8 +527,6 @@ Type List F(presentation::controls::tree::INodeProvider)\ F(presentation::controls::tree::INodeRootProvider)\ F(presentation::controls::tree::INodeItemView)\ - F(presentation::controls::tree::INodeItemPrimaryTextView)\ - F(presentation::controls::tree::INodeItemBindingView)\ F(presentation::controls::tree::INodeItemStyleController)\ F(presentation::controls::tree::INodeItemStyleProvider)\ F(presentation::controls::tree::NodeItemStyleProvider)\ @@ -862,29 +858,6 @@ Interface Proxy } END_INTERFACE_PROXY(presentation::controls::GuiListControl::IItemProviderCallback) - BEGIN_INTERFACE_PROXY_SHAREDPTR(presentation::controls::GuiListControl::IItemPrimaryTextView, - presentation::controls::GuiListControl::IItemProviderCallback - ) - - WString GetPrimaryTextViewText(vint itemIndex)override - { - INVOKEGET_INTERFACE_PROXY(GetPrimaryTextViewText, itemIndex); - } - - bool ContainsPrimaryText(vint itemIndex)override - { - INVOKEGET_INTERFACE_PROXY(ContainsPrimaryText, itemIndex); - } - END_INTERFACE_PROXY(presentation::controls::GuiListControl::IItemPrimaryTextView) - - BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::GuiListControl::IItemBindingView) - - description::Value GetBindingValue(vint itemIndex)override - { - INVOKEGET_INTERFACE_PROXY(GetBindingValue, itemIndex); - } - END_INTERFACE_PROXY(presentation::controls::GuiListControl::IItemBindingView) - BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::GuiListControl::IItemProvider) bool AttachCallback(presentation::controls::GuiListControl::IItemProviderCallback* value)override @@ -902,6 +875,16 @@ Interface Proxy INVOKEGET_INTERFACE_PROXY_NOPARAMS(Count); } + WString GetTextValue(vint itemIndex)override + { + INVOKEGET_INTERFACE_PROXY(GetTextValue, itemIndex); + } + + description::Value GetBindingValue(vint itemIndex)override + { + INVOKEGET_INTERFACE_PROXY(GetBindingValue, itemIndex); + } + IDescriptable* RequestView(const WString& identifier)override { INVOKEGET_INTERFACE_PROXY(RequestView, identifier); @@ -963,14 +946,9 @@ Interface Proxy INVOKE_INTERFACE_PROXY_NOPARAMS(DetachListControl); } - vint GetItemStyleId(vint itemIndex)override + presentation::controls::GuiListControl::IItemStyleController* CreateItemStyle()override { - INVOKEGET_INTERFACE_PROXY(GetItemStyleId, itemIndex); - } - - presentation::controls::GuiListControl::IItemStyleController* CreateItemStyle(vint styleId)override - { - INVOKEGET_INTERFACE_PROXY(CreateItemStyle, styleId); + INVOKEGET_INTERFACE_PROXY_NOPARAMS(CreateItemStyle); } void DestroyItemStyle(presentation::controls::GuiListControl::IItemStyleController* style)override @@ -1067,14 +1045,7 @@ Interface Proxy } END_INTERFACE_PROXY(presentation::controls::list::TextItemStyleProvider::IBulletFactory) - BEGIN_INTERFACE_PROXY_SHAREDPTR(presentation::controls::list::TextItemStyleProvider::ITextItemView, - presentation::controls::GuiListControl::IItemPrimaryTextView - ) - - WString GetText(vint itemIndex)override - { - INVOKEGET_INTERFACE_PROXY(GetText, itemIndex); - } + BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::list::TextItemStyleProvider::ITextItemView) bool GetChecked(vint itemIndex)override { @@ -1132,9 +1103,7 @@ Interface Proxy } END_INTERFACE_PROXY(presentation::controls::GuiListViewBase::IStyleProvider) - BEGIN_INTERFACE_PROXY_SHAREDPTR(presentation::controls::list::ListViewItemStyleProvider::IListViewItemView, - presentation::controls::GuiListControl::IItemPrimaryTextView - ) + BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::list::ListViewItemStyleProvider::IListViewItemView) Ptr GetSmallImage(vint itemIndex)override { @@ -1386,6 +1355,16 @@ Interface Proxy INVOKEGET_INTERFACE_PROXY(DetachCallback, value); } + WString GetTextValue(presentation::controls::tree::INodeProvider* node)override + { + INVOKEGET_INTERFACE_PROXY(GetTextValue, node); + } + + description::Value GetBindingValue(presentation::controls::tree::INodeProvider* node)override + { + INVOKEGET_INTERFACE_PROXY(GetBindingValue, node); + } + IDescriptable* RequestView(const WString& identifier)override { INVOKEGET_INTERFACE_PROXY(RequestView, identifier); @@ -1397,9 +1376,7 @@ Interface Proxy } END_INTERFACE_PROXY(presentation::controls::tree::INodeRootProvider) - BEGIN_INTERFACE_PROXY_SHAREDPTR(presentation::controls::tree::INodeItemView, - presentation::controls::GuiListControl::IItemPrimaryTextView - ) + BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::tree::INodeItemView) presentation::controls::tree::INodeProvider* RequestNode(vint index)override { @@ -1417,22 +1394,6 @@ Interface Proxy } END_INTERFACE_PROXY(presentation::controls::tree::INodeItemView) - BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::tree::INodeItemPrimaryTextView) - - WString GetPrimaryTextViewText(presentation::controls::tree::INodeProvider* node)override - { - INVOKEGET_INTERFACE_PROXY(GetPrimaryTextViewText, node); - } - END_INTERFACE_PROXY(presentation::controls::tree::INodeItemPrimaryTextView) - - BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::tree::INodeItemBindingView) - - description::Value GetBindingValue(presentation::controls::tree::INodeProvider* node)override - { - INVOKEGET_INTERFACE_PROXY(GetBindingValue, node); - } - END_INTERFACE_PROXY(presentation::controls::tree::INodeItemBindingView) - BEGIN_INTERFACE_PROXY_RAWPTR(presentation::controls::tree::INodeItemStyleController, presentation::controls::GuiListControl::IItemStyleController ) @@ -1465,14 +1426,9 @@ Interface Proxy INVOKE_INTERFACE_PROXY_NOPARAMS(DetachListControl); } - vint GetItemStyleId(presentation::controls::tree::INodeProvider* node)override + presentation::controls::tree::INodeItemStyleController* CreateItemStyle()override { - INVOKEGET_INTERFACE_PROXY(GetItemStyleId, node); - } - - presentation::controls::tree::INodeItemStyleController* CreateItemStyle(vint styleId)override - { - INVOKEGET_INTERFACE_PROXY(CreateItemStyle, styleId); + INVOKEGET_INTERFACE_PROXY_NOPARAMS(CreateItemStyle); } void DestroyItemStyle(presentation::controls::tree::INodeItemStyleController* style)override @@ -1499,9 +1455,7 @@ Interface Proxy BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::tree::IMemoryNodeData) END_INTERFACE_PROXY(presentation::controls::tree::IMemoryNodeData) - BEGIN_INTERFACE_PROXY_SHAREDPTR(presentation::controls::tree::ITreeViewItemView, - presentation::controls::tree::INodeItemPrimaryTextView - ) + BEGIN_INTERFACE_PROXY_NOPARENT_SHAREDPTR(presentation::controls::tree::ITreeViewItemView) Ptr GetNodeImage(presentation::controls::tree::INodeProvider* node)override { diff --git a/Tools/GacGen.exe b/Tools/GacGen.exe index 863568d5..13a50e4e 100644 Binary files a/Tools/GacGen.exe and b/Tools/GacGen.exe differ diff --git a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/Source/DemoPartialClasses.cpp index 2c51d72c..a64f1bd0 100644 --- a/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_ControlTemplate/BlackSkin/UI/Source/DemoPartialClasses.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml @@ -19120,7 +19120,7 @@ Class (::darkskin::DocumentLabelTemplateConstructor) auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://DarkSkin/BaselineDocument\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://DarkSkin/BaselineDocument\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->self)->SetBaselineDocument(__vwsn_resource_value_); @@ -19207,7 +19207,7 @@ Class (::darkskin::DocumentViewerTemplateConstructor) auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://DarkSkin/BaselineDocument\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://DarkSkin/BaselineDocument\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->self)->SetBaselineDocument(__vwsn_resource_value_); @@ -25659,7 +25659,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_New.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_New.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileNew)->SetImage(__vwsn_resource_value_); @@ -25674,7 +25674,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_New.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_New.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileNewText)->SetImage(__vwsn_resource_value_); @@ -25689,7 +25689,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_New.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_New.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileNewRtf)->SetImage(__vwsn_resource_value_); @@ -25704,7 +25704,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Open.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Open.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileOpen)->SetImage(__vwsn_resource_value_); @@ -25719,7 +25719,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Open.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Open.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileOpenText)->SetImage(__vwsn_resource_value_); @@ -25734,7 +25734,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Open.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Open.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileOpenRtf)->SetImage(__vwsn_resource_value_); @@ -25749,7 +25749,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Save.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Save.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileSave)->SetImage(__vwsn_resource_value_); @@ -25764,7 +25764,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_SaveAs.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_SaveAs.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileSaveAs)->SetImage(__vwsn_resource_value_); @@ -25779,7 +25779,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Print.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Print.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFilePrint)->SetImage(__vwsn_resource_value_); @@ -25794,7 +25794,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Undo.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Undo.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditUndo)->SetImage(__vwsn_resource_value_); @@ -25809,7 +25809,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Redo.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Redo.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditRedo)->SetImage(__vwsn_resource_value_); @@ -25824,7 +25824,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Cut.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Cut.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditCut)->SetImage(__vwsn_resource_value_); @@ -25839,7 +25839,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Copy.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Copy.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditCopy)->SetImage(__vwsn_resource_value_); @@ -25854,7 +25854,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Paste.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Paste.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditPaste)->SetImage(__vwsn_resource_value_); @@ -25869,7 +25869,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Delete.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/_Delete.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditDelete)->SetImage(__vwsn_resource_value_); @@ -25923,7 +25923,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Documents/Simple\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Documents/Simple\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_75)->SetDocument(__vwsn_resource_value_); @@ -25941,7 +25941,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeWord.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeWord.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_175.Obj())->SetSmallImage(__vwsn_resource_value_); @@ -25956,7 +25956,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeExcel.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeExcel.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_176.Obj())->SetSmallImage(__vwsn_resource_value_); @@ -25971,7 +25971,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficePowerPoint.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficePowerPoint.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_177.Obj())->SetSmallImage(__vwsn_resource_value_); @@ -25986,7 +25986,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOutlook.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOutlook.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_178.Obj())->SetSmallImage(__vwsn_resource_value_); @@ -26001,7 +26001,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOneNote.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOneNote.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_179.Obj())->SetSmallImage(__vwsn_resource_value_); @@ -26016,7 +26016,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeWord.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeWord.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { (::vl::__vwsn::This(::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::controls::tree::TreeViewItem>(::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_186.Obj())->GetData().Obj())).Obj())->image = __vwsn_resource_value_); @@ -26032,7 +26032,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeExcel.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeExcel.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { (::vl::__vwsn::This(::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::controls::tree::TreeViewItem>(::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_187.Obj())->GetData().Obj())).Obj())->image = __vwsn_resource_value_); @@ -26048,7 +26048,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficePowerPoint.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficePowerPoint.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { (::vl::__vwsn::This(::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::controls::tree::TreeViewItem>(::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_188.Obj())->GetData().Obj())).Obj())->image = __vwsn_resource_value_); @@ -26064,7 +26064,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOutlook.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOutlook.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { (::vl::__vwsn::This(::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::controls::tree::TreeViewItem>(::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_189.Obj())->GetData().Obj())).Obj())->image = __vwsn_resource_value_); @@ -26080,7 +26080,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOneNote.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeOneNote.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { (::vl::__vwsn::This(::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::controls::tree::TreeViewItem>(::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_190.Obj())->GetData().Obj())).Obj())->image = __vwsn_resource_value_); @@ -26096,7 +26096,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeWord.ico\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/OfficeWord.ico\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { (::vl::__vwsn::This(::vl::__vwsn::Ensure(::vl::__vwsn::SharedPtrCast<::vl::presentation::controls::tree::TreeViewItem>(::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_185.Obj())->GetData().Obj())).Obj())->image = __vwsn_resource_value_); @@ -26112,7 +26112,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Documents/XmlDocDemo.xml\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Documents/XmlDocDemo.xml\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_209)->SetDocument(__vwsn_resource_value_); diff --git a/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp index 90edb7b5..0e7f2999 100644 --- a/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Controls/AddressBook/UI/Source/DemoPartialClasses.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml @@ -2348,7 +2348,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewFolder\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewFolder\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandNewFolder)->SetImage(__vwsn_resource_value_); @@ -2372,7 +2372,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Delete\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Delete\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandDeleteFolder)->SetImage(__vwsn_resource_value_); @@ -2396,7 +2396,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewContact\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewContact\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandNewContact)->SetImage(__vwsn_resource_value_); @@ -2420,7 +2420,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Edit\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Edit\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditContact)->SetImage(__vwsn_resource_value_); @@ -2444,7 +2444,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Delete\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Delete\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandDeleteContact)->SetImage(__vwsn_resource_value_); @@ -2468,7 +2468,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/BigIcon\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/BigIcon\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandBigIcon)->SetImage(__vwsn_resource_value_); @@ -2486,7 +2486,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/SmallIcon\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/SmallIcon\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandSmallIcon)->SetImage(__vwsn_resource_value_); @@ -2504,7 +2504,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/List\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/List\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandList)->SetImage(__vwsn_resource_value_); @@ -2522,7 +2522,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Detail\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Detail\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandDetail)->SetImage(__vwsn_resource_value_); @@ -2540,7 +2540,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Tile\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Tile\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandTile)->SetImage(__vwsn_resource_value_); @@ -2558,7 +2558,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Information\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Information\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandInformation)->SetImage(__vwsn_resource_value_); diff --git a/Tutorial/GacUI_Controls/ContainersAndButtons/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Controls/ContainersAndButtons/UI/Source/DemoPartialClasses.cpp index e3a22151..e575b0f0 100644 --- a/Tutorial/GacUI_Controls/ContainersAndButtons/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Controls/ContainersAndButtons/UI/Source/DemoPartialClasses.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml diff --git a/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp index 5aacfd1a..d92d0b2d 100644 --- a/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Controls/TextEditor/UI/Source/DemoPartialClasses.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml @@ -1812,7 +1812,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewText.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewText.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileNewText)->SetImage(__vwsn_resource_value_); @@ -1830,7 +1830,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewXml.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewXml.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileNewXml)->SetImage(__vwsn_resource_value_); @@ -1848,7 +1848,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Open.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Open.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileOpen)->SetImage(__vwsn_resource_value_); @@ -1866,7 +1866,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewText.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewText.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileOpenText)->SetImage(__vwsn_resource_value_); @@ -1884,7 +1884,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewXml.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/NewXml.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileOpenXml)->SetImage(__vwsn_resource_value_); @@ -1902,7 +1902,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Save.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/Save.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileSave)->SetImage(__vwsn_resource_value_); @@ -1920,7 +1920,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/SaveAs.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/SaveAs.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandFileSaveAs)->SetImage(__vwsn_resource_value_); @@ -1941,7 +1941,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditUndo.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditUndo.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditUndo)->SetImage(__vwsn_resource_value_); @@ -1964,7 +1964,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditRedo.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditRedo.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditRedo)->SetImage(__vwsn_resource_value_); @@ -1987,7 +1987,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditCut.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditCut.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditCut)->SetImage(__vwsn_resource_value_); @@ -2010,7 +2010,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditCopy.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditCopy.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditCopy)->SetImage(__vwsn_resource_value_); @@ -2033,7 +2033,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditPaste.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditPaste.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditPaste)->SetImage(__vwsn_resource_value_); @@ -2056,7 +2056,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditDelete.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditDelete.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditDelete)->SetImage(__vwsn_resource_value_); @@ -2082,7 +2082,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditFind.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/EditFind.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->commandEditFind)->SetImage(__vwsn_resource_value_); @@ -2124,7 +2124,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/New.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/New.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_5)->SetImage(__vwsn_resource_value_); @@ -2184,7 +2184,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/New.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Images/New.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_33)->SetImage(__vwsn_resource_value_); @@ -2344,7 +2344,7 @@ Class (::demo::AboutWindowConstructor) auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://AboutWindow/Gaclib.png\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://AboutWindow/Gaclib.png\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_2.Obj())->SetImage(::vl::__vwsn::This(__vwsn_resource_value_.Obj())->GetImage()); @@ -2359,7 +2359,7 @@ Class (::demo::AboutWindowConstructor) auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://AboutWindow/Description\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://AboutWindow/Description\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->documentLabel)->SetDocument(__vwsn_resource_value_); diff --git a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin index fc396a43..c9efff96 100644 Binary files a/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin and b/Tutorial/GacUI_HelloWorlds/UIRes/Xml.bin differ diff --git a/Tutorial/GacUI_Layout/RichTextEmbedding/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Layout/RichTextEmbedding/UI/Source/DemoPartialClasses.cpp index d352a5d2..daa15cf7 100644 --- a/Tutorial/GacUI_Layout/RichTextEmbedding/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Layout/RichTextEmbedding/UI/Source/DemoPartialClasses.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml @@ -558,7 +558,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://EmbeddedDocument/Document\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://EmbeddedDocument/Document\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->documentViewer)->SetDocument(__vwsn_resource_value_); diff --git a/Tutorial/GacUI_Xml/Binding_Uri/UI/Source/DemoPartialClasses.cpp b/Tutorial/GacUI_Xml/Binding_Uri/UI/Source/DemoPartialClasses.cpp index a909b1e7..ff4469a6 100644 --- a/Tutorial/GacUI_Xml/Binding_Uri/UI/Source/DemoPartialClasses.cpp +++ b/Tutorial/GacUI_Xml/Binding_Uri/UI/Source/DemoPartialClasses.cpp @@ -1,4 +1,4 @@ -/*********************************************************************** +/*********************************************************************** !!!!!! DO NOT MODIFY !!!!!! GacGen.exe Resource.xml @@ -136,7 +136,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiImageData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Data/Logo\" cannot be read as type \"presentation::GuiImageData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Data/Logo\" cannot be read as type \"presentation::GuiImageData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_4.Obj())->SetImage(::vl::__vwsn::This(__vwsn_resource_value_.Obj())->GetImage()); @@ -151,7 +151,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::DocumentModel>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Data/Document\" cannot be read as type \"presentation::DocumentModel\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Data/Document\" cannot be read as type \"presentation::DocumentModel^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->documentLabel)->SetDocument(__vwsn_resource_value_); @@ -169,7 +169,7 @@ namespace demo auto __vwsn_resource_value_ = ::vl::__vwsn::SharedPtrCast<::vl::presentation::GuiTextData>(__vwsn_resource_item_.Obj()); if ((! static_cast(__vwsn_resource_value_))) { - throw ::vl::Exception(::vl::WString(L"Resource \"res://Data/Title\" cannot be read as type \"presentation::GuiTextData\".", false)); + throw ::vl::Exception(::vl::WString(L"Resource \"res://Data/Title\" cannot be read as type \"presentation::GuiTextData^\".", false)); } { ::vl::__vwsn::This(::vl::__vwsn::This(this)->__vwsn_precompile_0)->SetText(::vl::__vwsn::This(__vwsn_resource_value_.Obj())->GetText());