コード例 #1
0
ファイル: LayoutStack.cs プロジェクト: emmauss/VisiPlacer
        private LayoutChoice_Set JumpBack_ButtonLayout(StackEntry stackEntry)
        {
            int toIndex = -1;

            for (int i = 0; i < this.layoutEntries.Count; i++)
            {
                if (this.layoutEntries[i] == stackEntry)
                {
                    toIndex = i;
                    break;
                }
            }

            if (toIndex >= this.backButton_layouts.Count)
            {
                Button newButton = new Button();
                newButton.Clicked += Button_Clicked;
                this.backButtons.Add(newButton);
                this.backButton_layouts.Add(LayoutCache.For(new ButtonLayout(newButton)));
            }
            Button button = this.backButtons[toIndex];

            button.Text = stackEntry.Name;
            return(this.backButton_layouts[toIndex]);
        }
コード例 #2
0
ファイル: LayoutUnion.cs プロジェクト: mathjeff/VisiPlacer
        public void Set_LayoutChoices(IEnumerable <LayoutChoice_Set> layoutOptions)
        {
            // remove any existing options
            if (this.layoutOptions != null)
            {
                foreach (LayoutChoice_Set layout in this.layoutOptions)
                {
                    layout.RemoveParent(this);
                }
            }

            // put the new layout options
            this.layoutOptions = new List <LayoutChoice_Set>();
            if (layoutOptions != null)
            {
                foreach (LayoutChoice_Set layout in layoutOptions)
                {
                    LayoutChoice_Set layoutToAdd = layout;
                    if (layoutOptions.Count() > 1)
                    {
                        layoutToAdd = LayoutCache.For(layout);
                    }
                    this.layoutOptions.Add(layoutToAdd);
                    layoutToAdd.AddParent(this);
                }
            }

            // announce having changed
            this.AnnounceChange(true);
        }
コード例 #3
0
        private ScrollLayout(LayoutChoice_Set subLayout, ScrollView scrollView, bool treatNegativeScoresAsZero)
        {
            List <LayoutChoice_Set> subLayouts     = new List <LayoutChoice_Set>();
            LayoutCache             sublayoutCache = LayoutCache.For(subLayout);
            double pixelSize = 1;

            subLayouts.Add(
                new PixelatedLayout(
                    new MustScroll_Layout(sublayoutCache, scrollView, pixelSize, treatNegativeScoresAsZero),
                    pixelSize
                    )
                );

            subLayouts.Add(sublayoutCache);
            this.Set_LayoutChoices(subLayouts);
        }
コード例 #4
0
        private LayoutChoice_Set build()
        {
            GridLayout_Builder mainBuilder = new Vertical_GridLayout_Builder().Uniform();

            this.buttons            = new List <Button>();
            this.subtitles          = new List <TextblockLayout>();
            this.buttonDestinations = new Dictionary <Button, ValueProvider <StackEntry> >();
            for (int i = 0; i < this.buttonNameProviders.Count; i++)
            {
                Button button = new Button();
                button.Clicked += Button_Clicked;
                this.buttons.Add(button);

                ButtonLayout    buttonLayout   = new ButtonLayout(button);
                TextblockLayout subtitleLayout = new TextblockLayout();
                subtitleLayout.AlignHorizontally(TextAlignment.Center);
                subtitleLayout.AlignVertically(TextAlignment.Center);
                subtitleLayout.ScoreIfEmpty = false;
                this.subtitles.Add(subtitleLayout);

                BoundProperty_List columnWidths = new BoundProperty_List(2);
                columnWidths.SetPropertyScale(0, 2);
                columnWidths.SetPropertyScale(1, 1);
                columnWidths.BindIndices(0, 1);
                GridLayout entryGrid = GridLayout.New(new BoundProperty_List(1), columnWidths, LayoutScore.Get_UnCentered_LayoutScore(1));
                entryGrid.AddLayout(buttonLayout);
                entryGrid.AddLayout(subtitleLayout);

                LayoutUnion content = new LayoutUnion(entryGrid, buttonLayout);
                mainBuilder.AddLayout(content);

                ValueProvider <StackEntry> destinationProvider = destinationProviders[i];
                this.buttonDestinations[button] = destinationProvider;
            }
            return(LayoutCache.For(mainBuilder.BuildAnyLayout()));
        }
コード例 #5
0
 public MenuLayoutBuilder AddLayout(ValueProvider <MenuItem> nameProvider, StackEntry entry)
 {
     entry.Layout = LayoutCache.For(entry.Layout);
     return(this.AddLayout(nameProvider, new ConstantValueProvider <StackEntry>(entry)));
 }
コード例 #6
0
 public MenuLayoutBuilder AddLayout(string name, LayoutChoice_Set layout)
 {
     layout = LayoutCache.For(layout);
     return(this.AddLayout(new StackEntry(layout, name, null)));
 }