Exemple #1
0
        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);
        }
Exemple #2
0
 public ContainerLayout(ContentView view, LayoutChoice_Set subLayout, bool fillAvailableSpace)
 {
     this.Initialize();
     this.View      = view;
     this.SubLayout = subLayout;
     this.ChildFillsAvailableSpace = fillAvailableSpace;
 }
Exemple #3
0
 public MustBorderLayout(ContentView view, LayoutChoice_Set subLayout, Thickness borderThickness)
 {
     this.Initialize();
     this.View            = view;
     this.SubLayout       = subLayout;
     this.BorderThickness = borderThickness;
 }
Exemple #4
0
 public MustBorderLayout(ContentView view, LayoutChoice_Set subLayout, Thickness borderThickness, bool fillAvailableSpace)
 {
     this.Initialize();
     this.View                     = view;
     this.SubLayout                = subLayout;
     this.BorderThickness          = borderThickness;
     this.ChildFillsAvailableSpace = fillAvailableSpace;
 }
Exemple #5
0
        // Returns a ContainerLayout that wraps a ScrollView whose content size will always match the ScrollView's size.
        // The reason someone might want this is if something may later temporarily show overtop of this view (like a keyboard) then
        // the ScrollView might scroll its content to still be visible.
        public static ContainerLayout SameSize_Scroller(ScrollView view, LayoutChoice_Set subLayout)
        {
            ContainerLayout containerLayout = new ContainerLayout();

            containerLayout.view      = view;
            containerLayout.SubLayout = subLayout;
            return(containerLayout);
        }
Exemple #6
0
 public MustScroll_Layout(LayoutChoice_Set subLayout, ScrollView view, double pixelSize, bool treatNegativeScoresAsZero)
 {
     this.requiredChildScore = LayoutScore.Zero;
     this.resultingScore     = LayoutScore.Get_UsedSpace_LayoutScore(1);
     this.subLayout          = subLayout;
     this.subLayout.AddParent(this);
     this.view = view;
 }
Exemple #7
0
        // for convenience
        public LayoutUnion(LayoutChoice_Set layoutOption1, LayoutChoice_Set layoutOption2)
        {
            List <LayoutChoice_Set> options = new List <LayoutChoice_Set>();

            options.Add(layoutOption1);
            options.Add(layoutOption2);
            this.Set_LayoutChoices(options);
        }
Exemple #8
0
        // A ViewManager queries its child LayoutChoice_Set and puts the result into its parent View as needed.
        // That is, the ViewManager is what triggers the querying of layouts in the first place.
        public ViewManager(ContentView parentView, LayoutChoice_Set childLayout)
        {
            this.callerHolder.AddParent(this);
            this.SetLayout(childLayout);

            this.mainView = new ManageableView(this);
            this.SetParent(parentView);
        }
Exemple #9
0
        // A ViewManager queries its child LayoutChoice_Set and puts the result into its parent View as needed.
        // That is, the ViewManager is what triggers the querying of layouts in the first place.
        public ViewManager(ContentView parentView, LayoutChoice_Set childLayout, VisualDefaults layoutDefaults)
        {
            this.visualDefaults = layoutDefaults;
            this.callerHolder.AddParent(this);
            this.SetLayout(childLayout);

            this.mainView = new ManageableView(this);
            this.SetParent(parentView);
        }
 public LayoutChoice_Set Build()
 {
     List<LayoutChoice_Set> fontChoices = new List<LayoutChoice_Set>();
     LayoutChoice_Set large = this.MakeSublayout(20);
     fontChoices.Add(ScrollLayout.New(large));
     LayoutChoice_Set small = this.MakeSublayout(16);
     fontChoices.Add(small);
     return new LayoutUnion(fontChoices);
 }
Exemple #11
0
 public StackEntry(LayoutChoice_Set layout, string name, OnBack_Listener listener, int backPriority = 1)
 {
     this.Layout = layout;
     if (listener != null)
     {
         this.Listeners.Add(listener);
     }
     this.Name         = name;
     this.BackPriority = backPriority;
 }
Exemple #12
0
        public static LayoutCache For(LayoutChoice_Set layout)
        {
            LayoutCache result = layout as LayoutCache;

            if (result != null)
            {
                return(result);
            }
            return(new LayoutCache(layout));
        }
Exemple #13
0
        public LayoutChoice_Set Build()
        {
            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            foreach (string name in this.layoutNames)
            {
                LayoutChoice_Set subLayout = this.Get_ButtonLayout_By_Name(name);
                gridBuilder.AddLayout(subLayout);
            }
            return(gridBuilder.BuildAnyLayout());
        }
Exemple #14
0
 public bool Contains(LayoutChoice_Set layout)
 {
     foreach (StackEntry entry in this.layoutEntries)
     {
         if (entry.Layout == layout)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #15
0
 public LayoutCache(LayoutChoice_Set layoutToManage)
 {
     if (layoutToManage == null)
     {
         ErrorReporter.ReportParadox("Warning: creating a LayoutCache with nothing in it");
     }
     if (layoutToManage is LayoutCache)
     {
         ErrorReporter.ReportParadox("Warning: creating a LayoutCache that simply manages another LayoutCache");
     }
     this.LayoutToManage = layoutToManage;
 }
Exemple #16
0
 public void OnAnswered(LayoutChoice_Set layout)
 {
     this.Cost = LayoutQuery.nextID - this.debugID;
     if (this.Cost >= ExpensiveThreshold)
     {
         if (System.Diagnostics.Debugger.IsAttached)
         {
             System.Diagnostics.Debug.WriteLine("Expensive layout query: " + this + " in " + layout + " required " + this.Cost + " queries");
         }
         ExpensiveThreshold *= 2;
     }
 }
Exemple #17
0
        private void initialize(string message, LayoutChoice_Set detailLayout, LayoutStack layoutStack, double fontSize)
        {
            this.message = message;
            Button       button       = new Button();
            ButtonLayout buttonLayout = new ButtonLayout(button, message, fontSize);

            this.detailLayout = detailLayout;
            this.layoutStack  = layoutStack;


            button.Clicked     += Button_Clicked;
            this.LayoutToManage = buttonLayout;
        }
Exemple #18
0
 private void setSublayout(LayoutChoice_Set layout)
 {
     if (this.showBackButtons && this.layoutEntries.Count > 1)
     {
         this.mainGrid.PutLayout(layout, 0, 0);
         this.mainGrid.PutLayout(this.makeBackButtons(this.layoutEntries), 0, 2);
         this.SubLayout = this.mainGrid;
     }
     else
     {
         this.SubLayout = layout;
     }
 }
        public LayoutChoice_Set Build()
        {
            List <LayoutChoice_Set> fontChoices = new List <LayoutChoice_Set>();

            for (int i = 28; i >= 20; i -= 2)
            {
                LayoutChoice_Set large = this.MakeSublayout(i);
                fontChoices.Add(large);
            }
            LayoutChoice_Set small = this.MakeSublayout(16);

            fontChoices.Add(small);
            return(new LayoutUnion(fontChoices));
        }
 public virtual void CopyFrom(LayoutChoice_Set original)
 {
     this.changedSinceLatestQuery = original.changedSinceLatestQuery;
     this.changedSinceLastRender  = original.changedSinceLastRender;
     this.parents = new List <LayoutChoice_Set>();
     foreach (LayoutChoice_Set parent in original.parents)
     {
         this.AddParent(parent);
     }
     this.children = new List <LayoutChoice_Set>();
     foreach (LayoutChoice_Set child in original.children)
     {
         child.AddParent(this);
     }
 }
Exemple #21
0
        private void button_Click(object sender, System.EventArgs e)
        {
            // find the sender's name
            Button button = sender as Button;

            if (button != null)
            {
                button = (Button)sender;
                // find where the sender wants to go
                LayoutChoice_Set sourceLayout = this.buttonLayouts_by_button[button];
                StackEntry       destination  = this.buttonDestinations[sourceLayout].Get();
                // update the view
                this.layoutStack.AddLayout(destination);
            }
        }
Exemple #22
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);
        }
Exemple #23
0
        public ReorderableList(IEnumerable <T> items, LayoutProvider <T> layoutProvider)
        {
            // get the items and layouts
            this.Items       = new List <T>(items);
            this.itemLayouts = new List <LayoutChoice_Set>();

            foreach (T item in items)
            {
                LayoutChoice_Set itemLayout = layoutProvider.GetLayout(item);
                this.itemLayouts.Add(itemLayout);
            }

            this.makeArrows();
            BoundProperty_List columnWidths = new BoundProperty_List(2);

            columnWidths.BindIndices(0, 1);
            columnWidths.SetPropertyScale(0, 1);
            columnWidths.SetPropertyScale(1, 7);
            this.mainGrid  = GridLayout.New(BoundProperty_List.Uniform(this.itemLayouts.Count), columnWidths, LayoutScore.Zero);
            this.SubLayout = this.mainGrid;
            this.putLayouts();
        }
Exemple #24
0
        private void swapWithNext(int index)
        {
            // swap layouts
            LayoutChoice_Set layoutA = this.itemLayouts[index];
            LayoutChoice_Set layoutB = this.itemLayouts[index + 1];

            this.itemLayouts[index]     = layoutB;
            this.itemLayouts[index + 1] = layoutA;

            // swap items
            T itemA = this.Items[index];
            T itemB = this.Items[index + 1];

            this.Items[index]     = itemB;
            this.Items[index + 1] = itemA;

            // update positions in grid
            this.putLayouts();

            if (this.Reordered != null)
            {
                this.Reordered.Invoke(this.Items);
            }
        }
Exemple #25
0
 public void AddLayout(LayoutChoice_Set newLayout, String name, int backPriority = 1)
 {
     this.AddLayout(new StackEntry(newLayout, name, null, backPriority));
 }
 public HelpWindowBuilder AddLayout(LayoutChoice_Set layout)
 {
     this.components.Add(new HelpLayout(layout));
     return this;
 }
Exemple #27
0
 public void OnBack(LayoutChoice_Set other)
 {
     this.updateButtonText();
 }
 public HelpLayout(LayoutChoice_Set layout)
 {
     this.layout = layout;
 }
Exemple #29
0
 public void AddLayout(LayoutChoice_Set newLayout, String name, OnBack_Listener listener)
 {
     this.AddLayout(new StackEntry(newLayout, name, listener));
 }
Exemple #30
0
 public PixelatedLayout(LayoutChoice_Set layoutToManage, double pixelSize)
 {
     this.layoutToManage = layoutToManage;
     pixelWidth          = pixelHeight = pixelSize;
     layoutToManage.AddParent(this);
 }