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
+25 -22
View File
@@ -11277,7 +11277,6 @@ ListViewInformationContentProvider
GuiTableComposition* table=new GuiTableComposition; GuiTableComposition* table=new GuiTableComposition;
contentComposition->AddChild(table); contentComposition->AddChild(table);
table->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
table->SetRowsAndColumns(3, 3); table->SetRowsAndColumns(3, 3);
table->SetRowOption(0, GuiCellOption::PercentageOption(0.5)); table->SetRowOption(0, GuiCellOption::PercentageOption(0.5));
table->SetRowOption(1, GuiCellOption::MinSizeOption()); table->SetRowOption(1, GuiCellOption::MinSizeOption());
@@ -11285,6 +11284,7 @@ ListViewInformationContentProvider
table->SetColumnOption(0, GuiCellOption::MinSizeOption()); table->SetColumnOption(0, GuiCellOption::MinSizeOption());
table->SetColumnOption(1, GuiCellOption::PercentageOption(1.0)); table->SetColumnOption(1, GuiCellOption::PercentageOption(1.0));
table->SetColumnOption(2, GuiCellOption::MinSizeOption()); table->SetColumnOption(2, GuiCellOption::MinSizeOption());
table->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
table->SetAlignmentToParent(Margin(0, 0, 0, 0)); table->SetAlignmentToParent(Margin(0, 0, 0, 0));
table->SetCellPadding(4); table->SetCellPadding(4);
{ {
@@ -11321,8 +11321,8 @@ ListViewInformationContentProvider
cell->SetPreferredMinSize(Size(224, 0)); cell->SetPreferredMinSize(Size(224, 0));
textTable=new GuiTableComposition; textTable=new GuiTableComposition;
textTable->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
textTable->SetCellPadding(4); textTable->SetCellPadding(4);
textTable->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
textTable->SetAlignmentToParent(Margin(0, 0, 0, 0)); textTable->SetAlignmentToParent(Margin(0, 0, 0, 0));
cell->AddChild(textTable); cell->AddChild(textTable);
} }
@@ -11344,8 +11344,8 @@ ListViewInformationContentProvider
void ListViewInformationContentProvider::ItemContent::Install(GuiListViewBase::IStyleProvider* styleProvider, ListViewItemStyleProvider::IListViewItemView* view, vint itemIndex) void ListViewInformationContentProvider::ItemContent::Install(GuiListViewBase::IStyleProvider* styleProvider, ListViewItemStyleProvider::IListViewItemView* view, vint itemIndex)
{ {
Ptr<GuiImageData> imageData=view->GetLargeImage(itemIndex); Ptr<GuiImageData> imageData = view->GetLargeImage(itemIndex);
if(imageData) if (imageData)
{ {
image->SetImage(imageData->GetImage(), imageData->GetFrameIndex()); image->SetImage(imageData->GetImage(), imageData->GetFrameIndex());
} }
@@ -11357,53 +11357,55 @@ ListViewInformationContentProvider
text->SetColor(styleProvider->GetPrimaryTextColor()); text->SetColor(styleProvider->GetPrimaryTextColor());
bottomLine->SetColor(styleProvider->GetItemSeparatorColor()); 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); textTable->RemoveChild(cell);
delete cell; delete cell;
} }
vint dataColumnCount=view->GetDataColumnCount(); vint dataColumnCount = view->GetDataColumnCount();
dataTexts.Resize(dataColumnCount); dataTexts.Resize(dataColumnCount);
textTable->SetRowsAndColumns(dataColumnCount+1, 1); textTable->SetRowsAndColumns(dataColumnCount + 2, 1);
textTable->SetRowOption(dataColumnCount, GuiCellOption::PercentageOption(1.0)); textTable->SetRowOption(0, 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++)
{ {
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); 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->SetRowsAndColumns(1, 2);
dataTable->SetRowOption(0, GuiCellOption::MinSizeOption()); dataTable->SetRowOption(0, GuiCellOption::MinSizeOption());
dataTable->SetColumnOption(0, GuiCellOption::MinSizeOption()); dataTable->SetColumnOption(0, GuiCellOption::MinSizeOption());
dataTable->SetColumnOption(1, GuiCellOption::PercentageOption(1.0)); dataTable->SetColumnOption(1, GuiCellOption::PercentageOption(1.0));
dataTable->SetMinSizeLimitation(GuiGraphicsComposition::LimitToElementAndChildren);
dataTable->SetAlignmentToParent(Margin(0, 0, 0, 0)); dataTable->SetAlignmentToParent(Margin(0, 0, 0, 0));
cell->AddChild(dataTable); cell->AddChild(dataTable);
{ {
GuiCellComposition* cell=new GuiCellComposition; GuiCellComposition* cell = new GuiCellComposition;
dataTable->AddChild(cell); dataTable->AddChild(cell);
cell->SetSite(0, 0, 1, 1); cell->SetSite(0, 0, 1, 1);
GuiSolidLabelElement* textColumn=GuiSolidLabelElement::Create(); GuiSolidLabelElement* textColumn = GuiSolidLabelElement::Create();
textColumn->SetFont(baselineFont); 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()); textColumn->SetColor(styleProvider->GetSecondaryTextColor());
cell->SetOwnedElement(textColumn); cell->SetOwnedElement(textColumn);
} }
{ {
GuiCellComposition* cell=new GuiCellComposition; GuiCellComposition* cell = new GuiCellComposition;
dataTable->AddChild(cell); dataTable->AddChild(cell);
cell->SetSite(0, 1, 1, 1); cell->SetSite(0, 1, 1, 1);
GuiSolidLabelElement* textData=GuiSolidLabelElement::Create(); GuiSolidLabelElement* textData = GuiSolidLabelElement::Create();
textData->SetFont(baselineFont); textData->SetFont(baselineFont);
textData->SetEllipse(true); textData->SetEllipse(true);
textData->SetText(view->GetSubItem(itemIndex, view->GetDataColumn(i))); textData->SetText(view->GetSubItem(itemIndex, view->GetDataColumn(i)));
@@ -35687,7 +35689,8 @@ GuiTableComposition
Size GuiTableComposition::GetMinPreferredClientSize() Size GuiTableComposition::GetMinPreferredClientSize()
{ {
return tableContentMinSize; vint offset = (borderVisible ? 2 * cellPadding : 0);
return Size(tableContentMinSize.x + offset, tableContentMinSize.y + offset);
} }
Rect GuiTableComposition::GetBounds() Rect GuiTableComposition::GetBounds()
@@ -90,7 +90,9 @@
<ClCompile Include="UI\Source\MainWindow.cpp" /> <ClCompile Include="UI\Source\MainWindow.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Xml Include="UI\Resource.xml" /> <Xml Include="UI\Resource.xml">
<SubType>Designer</SubType>
</Xml>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="UI\Source\Demo.h" /> <ClInclude Include="UI\Source\Demo.h" />
@@ -98,6 +98,17 @@ public:
return birthday; 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 WString GetPhone()override
{ {
return phone; return phone;
@@ -36,6 +36,9 @@
func GetBirthday() : DateTime; func GetBirthday() : DateTime;
prop Birthday : DateTime {GetBirthday} prop Birthday : DateTime {GetBirthday}
func GetBirthdayText() : string;
prop BirthdayText : string {GetBirthdayText}
func GetPhone() : string; func GetPhone() : string;
prop Phone : string {GetPhone} prop Phone : string {GetPhone}
@@ -279,7 +282,7 @@
<att.Columns> <att.Columns>
<ListViewColumn Text="Name" TextProperty="Name" Size="120"/> <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="Phone" TextProperty="Phone" Size="120"/>
<ListViewColumn Text="Address" TextProperty="Address" Size="120"/> <ListViewColumn Text="Address" TextProperty="Address" Size="120"/>
</att.Columns> </att.Columns>
@@ -100,6 +100,7 @@ namespace vl
CLASS_MEMBER_METHOD(GetBigImage, NO_PARAMETER); CLASS_MEMBER_METHOD(GetBigImage, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetSmallImage, NO_PARAMETER); CLASS_MEMBER_METHOD(GetSmallImage, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetBirthday, NO_PARAMETER); CLASS_MEMBER_METHOD(GetBirthday, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetBirthdayText, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetPhone, NO_PARAMETER); CLASS_MEMBER_METHOD(GetPhone, NO_PARAMETER);
CLASS_MEMBER_METHOD(GetAddress, NO_PARAMETER); CLASS_MEMBER_METHOD(GetAddress, NO_PARAMETER);
CLASS_MEMBER_METHOD(Update, { L"name" _ L"birthday" _ L"phone" _ L"address" }); 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(BigImage, GetBigImage)
CLASS_MEMBER_PROPERTY_READONLY(SmallImage, GetSmallImage) CLASS_MEMBER_PROPERTY_READONLY(SmallImage, GetSmallImage)
CLASS_MEMBER_PROPERTY_READONLY(Birthday, GetBirthday) CLASS_MEMBER_PROPERTY_READONLY(Birthday, GetBirthday)
CLASS_MEMBER_PROPERTY_READONLY(BirthdayText, GetBirthdayText)
CLASS_MEMBER_PROPERTY_READONLY(Phone, GetPhone) CLASS_MEMBER_PROPERTY_READONLY(Phone, GetPhone)
CLASS_MEMBER_PROPERTY_READONLY(Address, GetAddress) CLASS_MEMBER_PROPERTY_READONLY(Address, GetAddress)
END_CLASS_MEMBER(demo::IContact) END_CLASS_MEMBER(demo::IContact)
@@ -29,6 +29,7 @@ namespace demo
virtual vl::Ptr<vl::presentation::GuiImageData> GetBigImage() = 0; virtual vl::Ptr<vl::presentation::GuiImageData> GetBigImage() = 0;
virtual vl::Ptr<vl::presentation::GuiImageData> GetSmallImage() = 0; virtual vl::Ptr<vl::presentation::GuiImageData> GetSmallImage() = 0;
virtual vl::DateTime GetBirthday() = 0; virtual vl::DateTime GetBirthday() = 0;
virtual vl::WString GetBirthdayText() = 0;
virtual vl::WString GetPhone() = 0; virtual vl::WString GetPhone() = 0;
virtual vl::WString GetAddress() = 0; virtual vl::WString GetAddress() = 0;
virtual void Update(vl::WString name, vl::DateTime birthday, vl::WString phone, vl::WString address) = 0; virtual void Update(vl::WString name, vl::DateTime birthday, vl::WString phone, vl::WString address) = 0;
Binary file not shown.