This commit is contained in:
vczh
2016-07-31 15:55:41 -07:00
parent 3172b55c61
commit f8a677700e
7 changed files with 46 additions and 24 deletions

View File

@@ -11277,7 +11277,6 @@ ListViewInformationContentProvider
GuiTableComposition* table=new GuiTableComposition;
contentComposition->AddChild(table);
table->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
table->SetRowsAndColumns(3, 3);
table->SetRowOption(0, GuiCellOption::PercentageOption(0.5));
table->SetRowOption(1, GuiCellOption::MinSizeOption());
@@ -11285,6 +11284,7 @@ ListViewInformationContentProvider
table->SetColumnOption(0, GuiCellOption::MinSizeOption());
table->SetColumnOption(1, GuiCellOption::PercentageOption(1.0));
table->SetColumnOption(2, GuiCellOption::MinSizeOption());
table->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
table->SetAlignmentToParent(Margin(0, 0, 0, 0));
table->SetCellPadding(4);
{
@@ -11321,8 +11321,8 @@ ListViewInformationContentProvider
cell->SetPreferredMinSize(Size(224, 0));
textTable=new GuiTableComposition;
textTable->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
textTable->SetCellPadding(4);
textTable->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
textTable->SetAlignmentToParent(Margin(0, 0, 0, 0));
cell->AddChild(textTable);
}
@@ -11344,8 +11344,8 @@ ListViewInformationContentProvider
void ListViewInformationContentProvider::ItemContent::Install(GuiListViewBase::IStyleProvider* styleProvider, ListViewItemStyleProvider::IListViewItemView* view, vint itemIndex)
{
Ptr<GuiImageData> imageData=view->GetLargeImage(itemIndex);
if(imageData)
Ptr<GuiImageData> imageData = view->GetLargeImage(itemIndex);
if (imageData)
{
image->SetImage(imageData->GetImage(), imageData->GetFrameIndex());
}
@@ -11357,53 +11357,55 @@ ListViewInformationContentProvider
text->SetColor(styleProvider->GetPrimaryTextColor());
bottomLine->SetColor(styleProvider->GetItemSeparatorColor());
for(vint i=0;i<dataTexts.Count();i++)
for (vint i = 0; i < dataTexts.Count(); i++)
{
GuiCellComposition* cell=textTable->GetSitedCell(i, 0);
GuiCellComposition* cell = textTable->GetSitedCell(i, 0);
textTable->RemoveChild(cell);
delete cell;
}
vint dataColumnCount=view->GetDataColumnCount();
vint dataColumnCount = view->GetDataColumnCount();
dataTexts.Resize(dataColumnCount);
textTable->SetRowsAndColumns(dataColumnCount+1, 1);
textTable->SetRowOption(dataColumnCount, GuiCellOption::PercentageOption(1.0));
textTable->SetColumnOption(0, GuiCellOption::PercentageOption(1.0));
for(vint i=0;i<dataColumnCount;i++)
textTable->SetRowsAndColumns(dataColumnCount + 2, 1);
textTable->SetRowOption(0, GuiCellOption::PercentageOption(0.5));
for (vint i = 0; i < dataColumnCount; i++)
{
textTable->SetRowOption(i, GuiCellOption::MinSizeOption());
textTable->SetRowOption(i + 1, GuiCellOption::MinSizeOption());
}
textTable->SetRowOption(dataColumnCount + 1, GuiCellOption::PercentageOption(0.5));
textTable->SetColumnOption(0, GuiCellOption::PercentageOption(1.0));
for(vint i=0;i<dataColumnCount;i++)
for (vint i = 0; i < dataColumnCount; i++)
{
GuiCellComposition* cell=new GuiCellComposition;
GuiCellComposition* cell = new GuiCellComposition;
textTable->AddChild(cell);
cell->SetSite(i, 0, 1, 1);
cell->SetSite(i + 1, 0, 1, 1);
GuiTableComposition* dataTable=new GuiTableComposition;
GuiTableComposition* dataTable = new GuiTableComposition;
dataTable->SetRowsAndColumns(1, 2);
dataTable->SetRowOption(0, GuiCellOption::MinSizeOption());
dataTable->SetColumnOption(0, GuiCellOption::MinSizeOption());
dataTable->SetColumnOption(1, GuiCellOption::PercentageOption(1.0));
dataTable->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
dataTable->SetAlignmentToParent(Margin(0, 0, 0, 0));
cell->AddChild(dataTable);
{
GuiCellComposition* cell=new GuiCellComposition;
GuiCellComposition* cell = new GuiCellComposition;
dataTable->AddChild(cell);
cell->SetSite(0, 0, 1, 1);
GuiSolidLabelElement* textColumn=GuiSolidLabelElement::Create();
GuiSolidLabelElement* textColumn = GuiSolidLabelElement::Create();
textColumn->SetFont(baselineFont);
textColumn->SetText(view->GetColumnText(view->GetDataColumn(i)+1)+L": ");
textColumn->SetText(view->GetColumnText(view->GetDataColumn(i) + 1) + L": ");
textColumn->SetColor(styleProvider->GetSecondaryTextColor());
cell->SetOwnedElement(textColumn);
}
{
GuiCellComposition* cell=new GuiCellComposition;
GuiCellComposition* cell = new GuiCellComposition;
dataTable->AddChild(cell);
cell->SetSite(0, 1, 1, 1);
GuiSolidLabelElement* textData=GuiSolidLabelElement::Create();
GuiSolidLabelElement* textData = GuiSolidLabelElement::Create();
textData->SetFont(baselineFont);
textData->SetEllipse(true);
textData->SetText(view->GetSubItem(itemIndex, view->GetDataColumn(i)));
@@ -35687,7 +35689,8 @@ GuiTableComposition
Size GuiTableComposition::GetMinPreferredClientSize()
{
return tableContentMinSize;
vint offset = (borderVisible ? 2 * cellPadding : 0);
return Size(tableContentMinSize.x + offset, tableContentMinSize.y + offset);
}
Rect GuiTableComposition::GetBounds()

View File

@@ -90,7 +90,9 @@
<ClCompile Include="UI\Source\MainWindow.cpp" />
</ItemGroup>
<ItemGroup>
<Xml Include="UI\Resource.xml" />
<Xml Include="UI\Resource.xml">
<SubType>Designer</SubType>
</Xml>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UI\Source\Demo.h" />

View File

@@ -98,6 +98,17 @@ public:
return birthday;
}
WString GetBirthdayText()override
{
List<WString> formats;
Locale::UserDefault().GetShortDateFormats(formats);
if (formats.Count() > 0)
{
return Locale::UserDefault().FormatDate(formats[0], birthday);
}
return L"";
}
WString GetPhone()override
{
return phone;

View File

@@ -36,6 +36,9 @@
func GetBirthday() : DateTime;
prop Birthday : DateTime {GetBirthday}
func GetBirthdayText() : string;
prop BirthdayText : string {GetBirthdayText}
func GetPhone() : string;
prop Phone : string {GetPhone}
@@ -279,7 +282,7 @@
<att.Columns>
<ListViewColumn Text="Name" TextProperty="Name" Size="120"/>
<ListViewColumn Text="Birthday" TextProperty="Birthday" Size="120"/>
<ListViewColumn Text="Birthday" TextProperty="BirthdayText" Size="120"/>
<ListViewColumn Text="Phone" TextProperty="Phone" Size="120"/>
<ListViewColumn Text="Address" TextProperty="Address" Size="120"/>
</att.Columns>

View File

@@ -100,6 +100,7 @@ namespace vl
CLASS_MEMBER_METHOD(GetBigImage, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetSmallImage, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetBirthday, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetBirthdayText, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetPhone, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetAddress, NO_PARAMETER);
CLASS_MEMBER_METHOD(Update, { L"name" _ L"birthday" _ L"phone" _ L"address" });
@@ -107,6 +108,7 @@ namespace vl
CLASS_MEMBER_PROPERTY_READONLY(BigImage, GetBigImage)
CLASS_MEMBER_PROPERTY_READONLY(SmallImage, GetSmallImage)
CLASS_MEMBER_PROPERTY_READONLY(Birthday, GetBirthday)
CLASS_MEMBER_PROPERTY_READONLY(BirthdayText, GetBirthdayText)
CLASS_MEMBER_PROPERTY_READONLY(Phone, GetPhone)
CLASS_MEMBER_PROPERTY_READONLY(Address, GetAddress)
END_CLASS_MEMBER(demo::IContact)

View File

@@ -29,6 +29,7 @@ namespace demo
virtual vl::Ptr<vl::presentation::GuiImageData> GetBigImage() = 0;
virtual vl::Ptr<vl::presentation::GuiImageData> GetSmallImage() = 0;
virtual vl::DateTime GetBirthday() = 0;
virtual vl::WString GetBirthdayText() = 0;
virtual vl::WString GetPhone() = 0;
virtual vl::WString GetAddress() = 0;
virtual void Update(vl::WString name, vl::DateTime birthday, vl::WString phone, vl::WString address) = 0;