mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-19 02:25:04 +08:00
Update tutorial
This commit is contained in:
+167
-157
@@ -33496,116 +33496,85 @@ GuiStackComposition
|
||||
|
||||
void GuiStackComposition::UpdateStackItemBounds()
|
||||
{
|
||||
if(stackItemBounds.Count()!=stackItems.Count())
|
||||
if (stackItemBounds.Count() != stackItems.Count())
|
||||
{
|
||||
stackItemBounds.Resize(stackItems.Count());
|
||||
}
|
||||
|
||||
stackItemTotalSize=Size(0, 0);
|
||||
vint x=extraMargin.left?extraMargin.left:0;
|
||||
vint y=extraMargin.top?extraMargin.top:0;
|
||||
switch(direction)
|
||||
stackItemTotalSize = Size(0, 0);
|
||||
Point offset;
|
||||
for (vint i = 0; i < stackItems.Count(); i++)
|
||||
{
|
||||
case GuiStackComposition::Horizontal:
|
||||
{
|
||||
for(vint i=0;i<stackItems.Count();i++)
|
||||
{
|
||||
Size itemSize=stackItems[i]->GetMinSize();
|
||||
if(i>0) stackItemTotalSize.x+=padding;
|
||||
if(stackItemTotalSize.y<itemSize.y) stackItemTotalSize.y=itemSize.y;
|
||||
stackItemBounds[i]=Rect(Point(stackItemTotalSize.x+x, y), Size(itemSize.x, 0));
|
||||
stackItemTotalSize.x+=itemSize.x;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GuiStackComposition::Vertical:
|
||||
{
|
||||
for(vint i=0;i<stackItems.Count();i++)
|
||||
{
|
||||
Size itemSize=stackItems[i]->GetMinSize();
|
||||
if(i>0) stackItemTotalSize.y+=padding;
|
||||
if(stackItemTotalSize.x<itemSize.x) stackItemTotalSize.x=itemSize.x;
|
||||
stackItemBounds[i]=Rect(Point(x, stackItemTotalSize.y+y), Size(0, itemSize.y));
|
||||
stackItemTotalSize.y+=itemSize.y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
vint offsetX = 0;
|
||||
vint offsetY = 0;
|
||||
Size itemSize = stackItems[i]->GetMinSize();
|
||||
stackItemBounds[i] = Rect(offset, itemSize);
|
||||
|
||||
FixStackItemSizes();
|
||||
#define ACCUMULATE(U, V) \
|
||||
{ \
|
||||
if (stackItemTotalSize.V < itemSize.V) \
|
||||
{ \
|
||||
stackItemTotalSize.V = itemSize.V; \
|
||||
} \
|
||||
if (i > 0) \
|
||||
{ \
|
||||
stackItemTotalSize.U += padding; \
|
||||
} \
|
||||
stackItemTotalSize.U += itemSize.U; \
|
||||
} \
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case GuiStackComposition::Horizontal:
|
||||
case GuiStackComposition::ReversedHorizontal:
|
||||
ACCUMULATE(x, y)
|
||||
break;
|
||||
case GuiStackComposition::Vertical:
|
||||
case GuiStackComposition::ReversedVertical:
|
||||
ACCUMULATE(y, x)
|
||||
break;
|
||||
}
|
||||
|
||||
#undef ACCUMULATE
|
||||
offset.x += itemSize.x + padding;
|
||||
offset.y += itemSize.y + padding;
|
||||
}
|
||||
EnsureStackItemVisible();
|
||||
}
|
||||
|
||||
void GuiStackComposition::FixStackItemSizes()
|
||||
void GuiStackComposition::EnsureStackItemVisible()
|
||||
{
|
||||
switch(direction)
|
||||
#define ADJUSTMENT(U, V) \
|
||||
if (itemBounds.U() <= 0) \
|
||||
{ \
|
||||
adjustment -= itemBounds.U(); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
vint overflow = itemBounds.V() - previousBounds.V(); \
|
||||
if (overflow > 0) \
|
||||
{ \
|
||||
adjustment -= overflow; \
|
||||
} \
|
||||
} \
|
||||
|
||||
if (ensuringVisibleStackItem)
|
||||
{
|
||||
case Horizontal:
|
||||
{
|
||||
vint y=0;
|
||||
if(extraMargin.top>0) y+=extraMargin.top;
|
||||
if(extraMargin.bottom>0) y+=extraMargin.bottom;
|
||||
|
||||
for(vint i=0;i<stackItemBounds.Count();i++)
|
||||
{
|
||||
stackItemBounds[i].y2=stackItemBounds[i].y1+previousBounds.Height()-y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Vertical:
|
||||
{
|
||||
vint x=0;
|
||||
if(extraMargin.left>0) x+=extraMargin.left;
|
||||
if(extraMargin.right>0) x+=extraMargin.right;
|
||||
|
||||
for(vint i=0;i<stackItemBounds.Count();i++)
|
||||
{
|
||||
stackItemBounds[i].x2=stackItemBounds[i].x1+previousBounds.Width()-x;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
vint index=stackItems.IndexOf(ensuringVisibleStackItem);
|
||||
if(index!=-1)
|
||||
{
|
||||
Rect itemBounds=stackItemBounds[index];
|
||||
Size size=previousBounds.GetSize();
|
||||
Size offset;
|
||||
switch(direction)
|
||||
Rect itemBounds = ensuringVisibleStackItem->GetBounds();
|
||||
switch (direction)
|
||||
{
|
||||
case Horizontal:
|
||||
{
|
||||
if(itemBounds.Left()<=0)
|
||||
{
|
||||
offset.x=-itemBounds.Left();
|
||||
}
|
||||
else if(itemBounds.Right()>=size.x)
|
||||
{
|
||||
offset.x=size.x-itemBounds.Right();
|
||||
}
|
||||
}
|
||||
case ReversedHorizontal:
|
||||
ADJUSTMENT(Left, Right)
|
||||
break;
|
||||
case Vertical:
|
||||
{
|
||||
if(itemBounds.Top()<=0)
|
||||
{
|
||||
offset.y=-itemBounds.Top();
|
||||
}
|
||||
else if(itemBounds.Bottom()>=size.y)
|
||||
{
|
||||
offset.y=size.y-itemBounds.Bottom();
|
||||
}
|
||||
}
|
||||
case ReversedVertical:
|
||||
ADJUSTMENT(Top, Bottom)
|
||||
break;
|
||||
}
|
||||
for(vint i=0;i<stackItemBounds.Count();i++)
|
||||
{
|
||||
stackItemBounds[i].x1+=offset.x;
|
||||
stackItemBounds[i].y1+=offset.y;
|
||||
stackItemBounds[i].x2+=offset.x;
|
||||
stackItemBounds[i].y2+=offset.y;
|
||||
}
|
||||
}
|
||||
|
||||
#undef ADJUSTMENT
|
||||
}
|
||||
|
||||
void GuiStackComposition::OnBoundsChanged(GuiGraphicsComposition* sender, GuiEventArgs& arguments)
|
||||
@@ -33616,10 +33585,11 @@ GuiStackComposition
|
||||
void GuiStackComposition::OnChildInserted(GuiGraphicsComposition* child)
|
||||
{
|
||||
GuiBoundsComposition::OnChildInserted(child);
|
||||
GuiStackItemComposition* item=dynamic_cast<GuiStackItemComposition*>(child);
|
||||
if(item && !stackItems.Contains(item))
|
||||
GuiStackItemComposition* item = dynamic_cast<GuiStackItemComposition*>(child);
|
||||
if (item && !stackItems.Contains(item))
|
||||
{
|
||||
stackItems.Add(item);
|
||||
UpdateStackItemBounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33630,18 +33600,15 @@ GuiStackComposition
|
||||
if(item)
|
||||
{
|
||||
stackItems.Remove(item);
|
||||
if(item==ensuringVisibleStackItem)
|
||||
if (item == ensuringVisibleStackItem)
|
||||
{
|
||||
ensuringVisibleStackItem=0;
|
||||
UpdateStackItemBounds();
|
||||
ensuringVisibleStackItem = 0;
|
||||
}
|
||||
UpdateStackItemBounds();
|
||||
}
|
||||
}
|
||||
|
||||
GuiStackComposition::GuiStackComposition()
|
||||
:direction(Horizontal)
|
||||
,padding(0)
|
||||
,ensuringVisibleStackItem(0)
|
||||
{
|
||||
BoundsChanged.AttachMethod(this, &GuiStackComposition::OnBoundsChanged);
|
||||
}
|
||||
@@ -33676,7 +33643,8 @@ GuiStackComposition
|
||||
|
||||
void GuiStackComposition::SetDirection(Direction value)
|
||||
{
|
||||
direction=value;
|
||||
direction = value;
|
||||
EnsureStackItemVisible();
|
||||
}
|
||||
|
||||
vint GuiStackComposition::GetPadding()
|
||||
@@ -33686,38 +33654,45 @@ GuiStackComposition
|
||||
|
||||
void GuiStackComposition::SetPadding(vint value)
|
||||
{
|
||||
padding=value;
|
||||
padding = value;
|
||||
}
|
||||
|
||||
Size GuiStackComposition::GetMinPreferredClientSize()
|
||||
{
|
||||
Size minSize=GuiBoundsComposition::GetMinPreferredClientSize();
|
||||
Size minSize = GuiBoundsComposition::GetMinPreferredClientSize();
|
||||
UpdateStackItemBounds();
|
||||
if(GetMinSizeLimitation()==GuiGraphicsComposition::LimitToElementAndChildren)
|
||||
if (GetMinSizeLimitation() == GuiGraphicsComposition::LimitToElementAndChildren)
|
||||
{
|
||||
if (!ensuringVisibleStackItem || direction == Vertical)
|
||||
if (!ensuringVisibleStackItem || direction == Vertical || direction == ReversedVertical)
|
||||
{
|
||||
if(minSize.x<stackItemTotalSize.x) minSize.x=stackItemTotalSize.x;
|
||||
if (minSize.x < stackItemTotalSize.x)
|
||||
{
|
||||
minSize.x = stackItemTotalSize.x;
|
||||
}
|
||||
}
|
||||
if (!ensuringVisibleStackItem || direction == Horizontal)
|
||||
{
|
||||
if(minSize.y<stackItemTotalSize.y) minSize.y=stackItemTotalSize.y;
|
||||
if (!ensuringVisibleStackItem || direction == Horizontal || direction == ReversedHorizontal)
|
||||
{
|
||||
if (minSize.y < stackItemTotalSize.y)
|
||||
{
|
||||
minSize.y = stackItemTotalSize.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
vint x=0;
|
||||
vint y=0;
|
||||
if(extraMargin.left>0) x+=extraMargin.left;
|
||||
if(extraMargin.right>0) x+=extraMargin.right;
|
||||
if(extraMargin.top>0) y+=extraMargin.top;
|
||||
if(extraMargin.bottom>0) y+=extraMargin.bottom;
|
||||
return minSize+Size(x, y);
|
||||
|
||||
vint x = 0;
|
||||
vint y = 0;
|
||||
if (extraMargin.left > 0) x += extraMargin.left;
|
||||
if (extraMargin.right > 0) x += extraMargin.right;
|
||||
if (extraMargin.top > 0) y += extraMargin.top;
|
||||
if (extraMargin.bottom > 0) y += extraMargin.bottom;
|
||||
return minSize + Size(x, y);
|
||||
}
|
||||
|
||||
Rect GuiStackComposition::GetBounds()
|
||||
{
|
||||
Rect bounds=GuiBoundsComposition::GetBounds();
|
||||
previousBounds=bounds;
|
||||
FixStackItemSizes();
|
||||
Rect bounds = GuiBoundsComposition::GetBounds();
|
||||
previousBounds = bounds;
|
||||
EnsureStackItemVisible();
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@@ -33733,36 +33708,36 @@ GuiStackComposition
|
||||
|
||||
bool GuiStackComposition::IsStackItemClipped()
|
||||
{
|
||||
Rect clientArea=GetClientArea();
|
||||
for(vint i=0;i<stackItems.Count();i++)
|
||||
Rect clientArea = GetClientArea();
|
||||
switch(direction)
|
||||
{
|
||||
Rect stackItemBounds=stackItems[i]->GetBounds();
|
||||
switch(direction)
|
||||
case Horizontal:
|
||||
case ReversedHorizontal:
|
||||
{
|
||||
case Horizontal:
|
||||
{
|
||||
if(stackItemBounds.Left()<0 || stackItemBounds.Right()>=clientArea.Width())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Vertical:
|
||||
{
|
||||
if(stackItemBounds.Top()<0 || stackItemBounds.Bottom()>=clientArea.Height())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
vint width = stackItemTotalSize.x
|
||||
+ (extraMargin.left > 0 ? extraMargin.left : 0)
|
||||
+ (extraMargin.right > 0 ? extraMargin.right : 0)
|
||||
;
|
||||
return width > clientArea.Width();
|
||||
}
|
||||
break;
|
||||
case Vertical:
|
||||
case ReversedVertical:
|
||||
{
|
||||
vint height = stackItemTotalSize.y
|
||||
+ (extraMargin.top > 0 ? extraMargin.top : 0)
|
||||
+ (extraMargin.bottom > 0 ? extraMargin.bottom : 0)
|
||||
;
|
||||
return height > clientArea.Height();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GuiStackComposition::EnsureVisible(vint index)
|
||||
{
|
||||
if(0<=index && index<stackItems.Count())
|
||||
if (0 <= index && index < stackItems.Count())
|
||||
{
|
||||
ensuringVisibleStackItem = stackItems[index];
|
||||
}
|
||||
@@ -33770,7 +33745,7 @@ GuiStackComposition
|
||||
{
|
||||
ensuringVisibleStackItem = 0;
|
||||
}
|
||||
UpdateStackItemBounds();
|
||||
EnsureStackItemVisible();
|
||||
return ensuringVisibleStackItem != 0;
|
||||
}
|
||||
|
||||
@@ -33781,7 +33756,7 @@ GuiStackItemComposition
|
||||
void GuiStackItemComposition::OnParentChanged(GuiGraphicsComposition* oldParent, GuiGraphicsComposition* newParent)
|
||||
{
|
||||
GuiGraphicsSite::OnParentChanged(oldParent, newParent);
|
||||
stackParent=newParent==0?0:dynamic_cast<GuiStackComposition*>(newParent);
|
||||
stackParent = newParent == 0 ? 0 : dynamic_cast<GuiStackComposition*>(newParent);
|
||||
}
|
||||
|
||||
Size GuiStackItemComposition::GetMinSize()
|
||||
@@ -33806,30 +33781,65 @@ GuiStackItemComposition
|
||||
|
||||
Rect GuiStackItemComposition::GetBounds()
|
||||
{
|
||||
Rect result=bounds;
|
||||
Rect result = bounds;
|
||||
if(stackParent)
|
||||
{
|
||||
vint index=stackParent->stackItems.IndexOf(this);
|
||||
if(index!=-1)
|
||||
vint index = stackParent->stackItems.IndexOf(this);
|
||||
if (index != -1)
|
||||
{
|
||||
if(stackParent->stackItemBounds.Count()!=stackParent->stackItems.Count())
|
||||
{
|
||||
stackParent->UpdateStackItemBounds();
|
||||
}
|
||||
result=stackParent->stackItemBounds[index];
|
||||
result = stackParent->stackItemBounds[index];
|
||||
}
|
||||
|
||||
Rect parentBounds = stackParent->previousBounds;
|
||||
Margin margin = stackParent->extraMargin;
|
||||
if (margin.left <= 0) margin.left = 0;
|
||||
if (margin.top <= 0) margin.top = 0;
|
||||
if (margin.right <= 0) margin.right = 0;
|
||||
if (margin.bottom <= 0) margin.bottom = 0;
|
||||
|
||||
auto x = result.Left();
|
||||
auto y = result.Top();
|
||||
auto w = result.Width();
|
||||
auto h = result.Height();
|
||||
|
||||
switch (stackParent->direction)
|
||||
{
|
||||
case GuiStackComposition::Horizontal:
|
||||
x += margin.left + stackParent->adjustment;
|
||||
y = margin.top;
|
||||
h = parentBounds.Height() - margin.top - margin.bottom;
|
||||
break;
|
||||
case GuiStackComposition::ReversedHorizontal:
|
||||
x = parentBounds.Width() - margin.right - x - w + stackParent->adjustment;
|
||||
y = margin.top;
|
||||
h = parentBounds.Height() - margin.top - margin.bottom;
|
||||
break;
|
||||
case GuiStackComposition::Vertical:
|
||||
x = margin.left;
|
||||
y += margin.top + stackParent->adjustment;
|
||||
w = parentBounds.Width() - margin.left - margin.right;
|
||||
break;
|
||||
case GuiStackComposition::ReversedVertical:
|
||||
x = margin.left;
|
||||
y = parentBounds.Height() - margin.bottom - y - h + stackParent->adjustment;
|
||||
w = parentBounds.Width() - margin.left - margin.right;
|
||||
break;
|
||||
}
|
||||
|
||||
result = Rect(
|
||||
x - extraMargin.left,
|
||||
y - extraMargin.top,
|
||||
x + w + extraMargin.right,
|
||||
y + h + extraMargin.bottom
|
||||
);
|
||||
}
|
||||
result.x1-=extraMargin.left;
|
||||
result.y1-=extraMargin.top;
|
||||
result.x2+=extraMargin.right;
|
||||
result.y2+=extraMargin.bottom;
|
||||
UpdatePreviousBounds(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void GuiStackItemComposition::SetBounds(Rect value)
|
||||
{
|
||||
bounds=value;
|
||||
bounds = value;
|
||||
}
|
||||
|
||||
Margin GuiStackItemComposition::GetExtraMargin()
|
||||
@@ -33839,7 +33849,7 @@ GuiStackItemComposition
|
||||
|
||||
void GuiStackItemComposition::SetExtraMargin(Margin value)
|
||||
{
|
||||
extraMargin=value;
|
||||
extraMargin = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-7
@@ -6693,23 +6693,30 @@ Stack Compositions
|
||||
/// <summary>Stack item layout direction.</summary>
|
||||
enum Direction
|
||||
{
|
||||
/// <summary>Stack items is layouted horizontally.</summary>
|
||||
/// <summary>Stack items is layouted from left to right.</summary>
|
||||
Horizontal,
|
||||
/// <summary>Stack items is layouted vertically.</summary>
|
||||
/// <summary>Stack items is layouted from top to bottom.</summary>
|
||||
Vertical,
|
||||
/// <summary>Stack items is layouted from right to left.</summary>
|
||||
ReversedHorizontal,
|
||||
/// <summary>Stack items is layouted from bottom to top.</summary>
|
||||
ReversedVertical,
|
||||
};
|
||||
protected:
|
||||
Direction direction;
|
||||
Direction direction = Horizontal;
|
||||
ItemCompositionList stackItems;
|
||||
GuiStackItemComposition* ensuringVisibleStackItem = nullptr;
|
||||
|
||||
vint padding = 0;
|
||||
vint adjustment = 0;
|
||||
Margin extraMargin;
|
||||
|
||||
collections::Array<Rect> stackItemBounds;
|
||||
Size stackItemTotalSize;
|
||||
vint padding;
|
||||
Rect previousBounds;
|
||||
Margin extraMargin;
|
||||
GuiStackItemComposition* ensuringVisibleStackItem;
|
||||
|
||||
void UpdateStackItemBounds();
|
||||
void FixStackItemSizes();
|
||||
void EnsureStackItemVisible();
|
||||
void OnBoundsChanged(GuiGraphicsComposition* sender, GuiEventArgs& arguments);
|
||||
void OnChildInserted(GuiGraphicsComposition* child)override;
|
||||
void OnChildRemoved(GuiGraphicsComposition* child)override;
|
||||
|
||||
@@ -6065,7 +6065,7 @@ Module
|
||||
{
|
||||
auto fragment = MakePtr<WfModuleUsingNameFragment>();
|
||||
item->fragments.Add(fragment);
|
||||
fragment->name.value = WString(wildcard, vint(end - wildcard - 1));
|
||||
fragment->name.value = WString(wildcard + 1, vint(end - wildcard - 1));
|
||||
}
|
||||
}
|
||||
else if (begin < end)
|
||||
@@ -6963,6 +6963,8 @@ Workflow_GetSharedManager
|
||||
context->instance->Accept(&visitor);
|
||||
rootTypeDescriptor = visitor.rootTypeDescriptor;
|
||||
}
|
||||
|
||||
if (errors.Count() == 0)
|
||||
{
|
||||
WorkflowCompileVisitor visitor(context, typeInfos, errors);
|
||||
context->instance->Accept(&visitor);
|
||||
@@ -10278,6 +10280,8 @@ Type Declaration
|
||||
ENUM_ITEM_NAMESPACE(GuiStackComposition)
|
||||
ENUM_NAMESPACE_ITEM(Horizontal)
|
||||
ENUM_NAMESPACE_ITEM(Vertical)
|
||||
ENUM_NAMESPACE_ITEM(ReversedHorizontal)
|
||||
ENUM_NAMESPACE_ITEM(ReversedVertical)
|
||||
END_ENUM_ITEM(GuiStackComposition::Direction)
|
||||
|
||||
BEGIN_CLASS_MEMBER(GuiStackItemComposition)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -17,6 +17,16 @@
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
|
||||
<Window Text="Alignment" ClientSize="x:480 y:320">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
|
||||
<att.ContainerComposition-set InternalMargin="left:5 top:5 right:5 bottom:5"/>
|
||||
<Button Text="Button">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:-1 bottom:-1" PreferredMinSize="x:100 y:30"/>
|
||||
</Button>
|
||||
<Button Text="Button">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:-1 top:0 right:0 bottom:-1" PreferredMinSize="x:100 y:30"/>
|
||||
</Button>
|
||||
<Button Text="Button">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:-1 right:0 bottom:0" PreferredMinSize="x:100 y:30"/>
|
||||
</Button>
|
||||
</Window>
|
||||
</Instance>
|
||||
</Instance>
|
||||
|
||||
@@ -13,10 +13,94 @@
|
||||
</Folder>
|
||||
</Folder>
|
||||
<Folder name="MainWindow">
|
||||
<InstanceStyle name="MainWindowStyle">
|
||||
<Styles>
|
||||
<Style ref.Path="//RadioButton">
|
||||
<ev.SelectedChanged-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
var radioButton = cast (SelectableButton*) sender.RelatedControl;
|
||||
if (radioButton.Selected)
|
||||
{
|
||||
stackLayout.Direction = cast (Stack::Direction) radioButton.Text;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</ev.SelectedChanged-eval>
|
||||
</Style>
|
||||
<Style ref.Path="//StackItem/Button">
|
||||
<ev.Clicked-eval>
|
||||
<![CDATA[
|
||||
{
|
||||
for (item in stackLayout.StackItems)
|
||||
{
|
||||
item.ExtraMargin = cast Margin "";
|
||||
}
|
||||
|
||||
var item = cast (StackItem*) sender.Parent;
|
||||
item.ExtraMargin = cast Margin "left:10 top:10 right:10 bottom:10";
|
||||
stackLayout.MoveChild(item, stackLayout.StackItems.Count - 1);
|
||||
}
|
||||
]]>
|
||||
</ev.Clicked-eval>
|
||||
</Style>
|
||||
</Styles>
|
||||
</InstanceStyle>
|
||||
<Instance name="MainWindowResource">
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow" xmlns:x="presentation::controls::GuiSelectableButton::*" ref.Styles="res://MainWindow/MainWindowStyle">
|
||||
<Window Text="Stack" ClientSize="x:480 y:320">
|
||||
<x:MutexGroupController ref.Name="groupStackDirection"/>
|
||||
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
|
||||
<Table AlignmentToParent="left:5 top:5 right:5 bottom:5" CellPadding="5">
|
||||
<att.Rows>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
</att.Rows>
|
||||
<att.Columns>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
</att.Columns>
|
||||
|
||||
<Cell Site="row:0 column:0">
|
||||
<RadioButton Text="Horizontal" GroupController-ref="groupStackDirection" Selected="true"/>
|
||||
</Cell>
|
||||
<Cell Site="row:1 column:0">
|
||||
<RadioButton Text="Vertical" GroupController-ref="groupStackDirection"/>
|
||||
</Cell>
|
||||
<Cell Site="row:2 column:0">
|
||||
<RadioButton Text="ReversedHorizontal" GroupController-ref="groupStackDirection"/>
|
||||
</Cell>
|
||||
<Cell Site="row:3 column:0">
|
||||
<RadioButton Text="ReversedVertical" GroupController-ref="groupStackDirection"/>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:4 column:0">
|
||||
<Label Text="Click any button in stack items to enlarge it."/>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:5 column:0">
|
||||
<Stack ref.Name="stackLayout" AlignmentToParent="left:0 top:0 right:0 bottom:0" Padding="5" ExtraMargin="left:10 top:10 right:10 bottom:10">
|
||||
<StackItem>
|
||||
<Button Text="Large">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="x:100 y:100"/>
|
||||
</Button>
|
||||
</StackItem>
|
||||
<StackItem>
|
||||
<Button Text="Medium">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="x:75 y:75"/>
|
||||
</Button>
|
||||
</StackItem>
|
||||
<StackItem>
|
||||
<Button Text="Small">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0" PreferredMinSize="x:50 y:50"/>
|
||||
</Button>
|
||||
</StackItem>
|
||||
</Stack>
|
||||
</Cell>
|
||||
</Table>
|
||||
</Window>
|
||||
</Instance>
|
||||
</Instance>
|
||||
|
||||
@@ -23,11 +23,15 @@ namespace demo
|
||||
friend struct vl::reflection::description::CustomTypeDescriptorSelector<TImpl>;
|
||||
private:
|
||||
protected:
|
||||
vl::presentation::controls::GuiSelectableButton::MutexGroupController* groupStackDirection;
|
||||
vl::presentation::compositions::GuiStackComposition* stackLayout;
|
||||
|
||||
void InitializeComponents()
|
||||
{
|
||||
if (InitializeFromResource())
|
||||
{
|
||||
GUI_INSTANCE_REFERENCE(groupStackDirection);
|
||||
GUI_INSTANCE_REFERENCE(stackLayout);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -37,6 +41,8 @@ namespace demo
|
||||
MainWindow_()
|
||||
:vl::presentation::GuiInstancePartialClass<vl::presentation::controls::GuiWindow>(L"demo::MainWindow")
|
||||
,vl::presentation::controls::GuiWindow(vl::presentation::theme::GetCurrentTheme()->CreateWindowStyle())
|
||||
,groupStackDirection(0)
|
||||
,stackLayout(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,6 +17,83 @@
|
||||
<Instance ref.CodeBehind="false" ref.Class="demo::MainWindow">
|
||||
<Window Text="Table" ClientSize="x:480 y:320">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:480 y:320"/>
|
||||
<Table AlignmentToParent="left:5 top:5 right:5 bottom:5" CellPadding="5" MinSizeLimitation="LimitToElementAndChildren">
|
||||
<att.Rows>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Absolute absolute:20</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
</att.Rows>
|
||||
<att.Columns>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
</att.Columns>
|
||||
|
||||
<Cell Site="row:0 column:0 columnSpan:3">
|
||||
<SolidLabel Font="fontFamily:{Lucida Calligraphy} size:96" HorizontalAlignment="Center" VerticalAlignment="Center" Text="GacUI"/>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:2 column:0">
|
||||
<Label Text="User Name:"/>
|
||||
</Cell>
|
||||
<Cell Site="row:2 column:1">
|
||||
<SinglelineTextBox>
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
</SinglelineTextBox>
|
||||
</Cell>
|
||||
<Cell Site="row:2 column:2">
|
||||
<Button Text="Forget User Name ...">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
</Button>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:3 column:0">
|
||||
<Label Text="Password:"/>
|
||||
</Cell>
|
||||
<Cell Site="row:3 column:1">
|
||||
<SinglelineTextBox PasswordChar="*">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
</SinglelineTextBox>
|
||||
</Cell>
|
||||
<Cell Site="row:3 column:2">
|
||||
<Button Text="Forget Password ...">
|
||||
<att.BoundsComposition-set AlignmentToParent="left:0 top:0 right:0 bottom:0"/>
|
||||
</Button>
|
||||
</Cell>
|
||||
|
||||
<Cell Site="row:5 column:0 columnSpan:3">
|
||||
<Table AlignmentToParent="left:0 top:0 right:0 bottom:0" MinSizeLimitation="LimitToElementAndChildren">
|
||||
<att.Rows>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
</att.Rows>
|
||||
<att.Columns>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
<CellOption>composeType:Percentage percentage:1.0</CellOption>
|
||||
<CellOption>composeType:MinSize</CellOption>
|
||||
</att.Columns>
|
||||
|
||||
<Cell Site="row:0 column:0" InternalMargin="right:10">
|
||||
<Button Text="Sign Up ...">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
|
||||
</Button>
|
||||
</Cell>
|
||||
<Cell Site="row:0 column:1">
|
||||
<Button Text="Log In">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
|
||||
</Button>
|
||||
</Cell>
|
||||
<Cell Site="row:0 column:3">
|
||||
<Button Text="Close">
|
||||
<att.BoundsComposition-set PreferredMinSize="x:100 y:30"/>
|
||||
</Button>
|
||||
</Cell>
|
||||
</Table>
|
||||
</Cell>
|
||||
</Table>
|
||||
</Window>
|
||||
</Instance>
|
||||
</Instance>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user