<?xml version="1.0" encoding="utf-8"?>
<Resource>
  <Folder name="GacGenConfig">
    <Folder name="Cpp">
      <Text name="SourceFolder">Source</Text>
      <Text name="Resource">..\..\UIRes\Stack.bin</Text>
      <Text name="NormalInclude">GacUI.h</Text>
      <Text name="Name">Demo</Text>
    </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 = 
                  radioButton.Text == "Horizontal" ? Horizontal :
                  radioButton.Text == "Vertical" ? Vertical :
                  radioButton.Text == "ReversedHorizontal" ? ReversedHorizontal :
                  ReversedVertical;
              }
            }
          ]]>
          </ev.SelectedChanged-eval>
        </Style>
        <Style ref.Path="//StackItem/Button">
          <ev.Clicked-eval>
            <![CDATA[
            {
              for (stackItem in stackLayout.StackItems)
              {
                stackItem.ExtraMargin = {};
              }
            
              var selectedItem = cast (StackItem*) sender.Parent;
              selectedItem.ExtraMargin = {left:10 top:10 right:10 bottom:10};
              stackLayout.MoveChild(selectedItem, stackLayout.StackItems.Count - 1);
            }
          ]]>
          </ev.Clicked-eval>
        </Style>
      </Styles>
    </InstanceStyle>
    <Instance name="MainWindowResource">
      <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>
  </Folder>
</Resource>