Update tutorial

This commit is contained in:
vczh
2015-10-04 21:45:04 -07:00
parent ee954f7ff0
commit 64638b30cf
13 changed files with 364 additions and 166 deletions
@@ -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>
+85 -1
View File
@@ -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.