protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_visibility);

            mFlowLayout = (FlowLayout)FindViewById(Resource.Id.flow);
        }
Ejemplo n.º 2
0
 internal override void Initialize()
 {
     base.Initialize();
     base.Padding = this.DefaultPadding;
     FlowLayout.CreateSettings(this).FlowDirection = FlowDirection.TopDown;
     this.state[stateShowImageMargin] = true;
 }
Ejemplo n.º 3
0
        private static JPanel createButtonPanel()
        {
            JPanel     jpanel     = new JPanel();
            FlowLayout flowLayout = new FlowLayout();

            flowLayout.setAlignment(0);
            jpanel.setLayout(flowLayout);
            AudioTool.playButton = new JButton("Play");
            AudioTool.playButton.setEnabled(true);
            AudioTool.playButton.addActionListener(new AudioTool_12());
            AudioTool.recordButton = new JButton("Record");
            AudioTool.recordButton.setEnabled(true);
            AudioTool.recordButton.addActionListener(AudioTool.recordListener);
            AudioTool.zoomInButton = new JButton("Zoom In");
            AudioTool.zoomInButton.setEnabled(true);
            AudioTool.zoomInButton.addActionListener(new AudioTool_13());
            AudioTool.zoomOutButton = new JButton("Zoom Out");
            AudioTool.zoomOutButton.setEnabled(true);
            AudioTool.zoomOutButton.addActionListener(new AudioTool_14());
            AudioTool.zoomResetButton = new JButton("Reset Size");
            AudioTool.zoomResetButton.setEnabled(true);
            AudioTool.zoomResetButton.addActionListener(new AudioTool_15());
            JButton jbutton = new JButton("Exit");

            jbutton.addActionListener(new AudioTool_16());
            jpanel.add(AudioTool.recordButton);
            jpanel.add(AudioTool.playButton);
            jpanel.add(AudioTool.zoomInButton);
            jpanel.add(AudioTool.zoomOutButton);
            jpanel.add(AudioTool.zoomResetButton);
            jpanel.add(jbutton);
            return(jpanel);
        }
Ejemplo n.º 4
0
        public ListBoxTest(ControlBase parent) : base(parent)
        {
            FlowLayout l = new FlowLayout(parent);

            l.Dock = Dock.Fill;
            ListBox lb = new ListBox(l)
            {
                AutoSizeToContents = true,
                Margin             = Margin.Two,
                AlternateColors    = true,
            };

            lb.AddRow("Listbox");
            lb.AddRow("This one is autosized");
            lb.AddRow("Yep.");
            lb.AddRow("Also, alternate colors");
            ListBox manual = new ListBox(l);

            manual.Margin = Margin.Two;
            manual.Width  = 200;
            manual.Height = 200;
            manual.AddRow("Listbox.");
            manual.AddRow("This is manually sized and has an item too big for it.");
            manual.AddRow("so scrollbars are nice.");
            manual.AddRow("Also gonna pad down.");
            manual.AddRow("Pad.");
            manual.AddRow("Pad.");
            manual.AddRow("Pad.");
            manual.AddRow("Pad.");
            manual.AddRow("Pad.");
            manual.AddRow("Pad.");
        }
 protected override void OnLayout(LayoutEventArgs e)
 {
     if (ParentToolStrip != null && ParentToolStrip.IsInDesignMode)
     {
         if (FlowLayout.GetFlowDirection(this) != FlowDirection.TopDown)
         {
             FlowLayout.SetFlowDirection(this, FlowDirection.TopDown);
         }
         if (FlowLayout.GetWrapContents(this))
         {
             FlowLayout.SetWrapContents(this, false);
         }
     }
     else
     {
         if (FlowLayout.GetFlowDirection(this) != FlowDirection.LeftToRight)
         {
             FlowLayout.SetFlowDirection(this, FlowDirection.LeftToRight);
         }
         if (!FlowLayout.GetWrapContents(this))
         {
             FlowLayout.SetWrapContents(this, true);
         }
     }
     base.OnLayout(e);
 }
        public bool OnTagClick(View view, int position, FlowLayout parent)
        {
            Toast.MakeText(Activity, mVals[position], ToastLength.Short).Show();

            return(true);
            // throw new NotImplementedException();
        }
Ejemplo n.º 7
0
        public LayoutContainerTest(ControlBase parent) : base(parent)
        {
            GroupBox gb = new GroupBox(parent);

            gb.Text   = "Flow layout";
            gb.Width  = 120;
            gb.Height = 120;


            FlowLayout sp = new FlowLayout(gb);

            // sp.DrawDebugOutlines = true;
            sp.AutoSizeToContents = true;
            sp.Dock = Dock.Top;
            CreateButton(sp, "Test 1");
            CreateButton(sp, "Test 2");
            CreateButton(sp, "Test 3");
            CreateButton(sp, "Test 4");
            gb        = new GroupBox(parent);
            gb.Y     += 130;
            gb.Text   = "Table layout";
            gb.Width  = 200;
            gb.Height = 200;
            CreateTable(gb);
        }
Ejemplo n.º 8
0
 public SponsorsFragmentBinding(LayoutInflater inflater, ViewGroup root, bool attachToRoot)
 {
     Root = inflater.Inflate(Resource.Layout.fragment_sponsors, root, attachToRoot);
     platinumContainer = Root.FindViewById <FlowLayout>(Resource.Id.platinum_container);
     videoContainer    = Root.FindViewById <FlowLayout>(Resource.Id.video_container);
     foodsContainer    = Root.FindViewById <FlowLayout>(Resource.Id.foods_container);
     normalContainer   = Root.FindViewById <FlowLayout>(Resource.Id.normal_container);
 }
 public SponsorsFragmentBinding(LayoutInflater inflater, ViewGroup root, bool attachToRoot)
 {
     Root = inflater.Inflate(Resource.Layout.fragment_sponsors, root, attachToRoot);
     platinumContainer = Root.FindViewById<FlowLayout>(Resource.Id.platinum_container);
     videoContainer = Root.FindViewById<FlowLayout>(Resource.Id.video_container);
     foodsContainer = Root.FindViewById<FlowLayout>(Resource.Id.foods_container);
     normalContainer = Root.FindViewById<FlowLayout>(Resource.Id.normal_container);
 }
Ejemplo n.º 10
0
        public override void Load()
        {
            base.Load();

            WidgetManager.Root.StyleName = "panel";

            WidgetManager.Root.Add(flowLayout1 = new FlowLayout(WidgetManager)
            {
                AnchorTarget = WidgetManager.Root,
                AnchorFrom   = BoxAlignment.TopLeft,
                AnchorTo     = BoxAlignment.TopLeft,
                Padding      = new FourSide(16),
                Spacing      = 10,
                //FitChildren = true,
                //Fill = true,
            });
            foreach (var word in @"Sanae from class 3-B was an ordinary girl, one you might find anywhere. But one day, her pets ran away from her when she was at the lake.".Split(' '))
            {
                flowLayout1.Add(new Label(WidgetManager)
                {
                    Text = word,
                });
            }

            WidgetManager.Root.Add(flowLayout2 = new FlowLayout(WidgetManager)
            {
                AnchorTarget = WidgetManager.Root,
                AnchorFrom   = BoxAlignment.TopRight,
                AnchorTo     = BoxAlignment.TopRight,
                Padding      = new FourSide(16),
                //FitChildren = true,
                //Fill = true,
            });
            foreach (var letter in @"Sanae from class 3-B was an ordinary girl, one you might find anywhere. But one day, her pets ran away from her when she was at the lake.")
            {
                flowLayout2.Add(new Label(WidgetManager)
                {
                    Text = letter.ToString()
                });
            }

            WidgetManager.Root.Add(flowLayout3 = new FlowLayout(WidgetManager)
            {
                AnchorTarget = WidgetManager.Root,
                AnchorFrom   = BoxAlignment.Bottom,
                AnchorTo     = BoxAlignment.Bottom,
                Padding      = new FourSide(16),
                //FitChildren = true,
                //Fill = true,
            });
            foreach (var letter in @"三年B組のサナエさんは、どこにでもいる普通の女の子でした。ところがある日、彼女の飼っていたペットが湖で逃げてしまいました。")
            {
                flowLayout3.Add(new Label(WidgetManager)
                {
                    Text = letter.ToString(),
                });
            }
        }
Ejemplo n.º 11
0
        protected override void OnConstruct()
        {
            base.OnConstruct();
            ClearChildren();
            var     parts = text.Split(new string[] { "#" }, StringSplitOptions.None);
            Control row   = new FlowLayout
            {
                Newline  = false,
                AutoSize = true,
            };

            foreach (var s in parts)
            {
                string str             = s;
                System.Drawing.Color c = font.Color;
                string sc;
                if (s.Length >= 6)
                {
                    sc = s.Substring(0, 6);
                    int h;
                    if (int.TryParse(sc, System.Globalization.NumberStyles.HexNumber, null, out h))
                    {
                        c   = System.Drawing.Color.FromArgb(h);
                        c   = System.Drawing.Color.FromArgb(255, c);
                        str = s.Substring(6);
                    }
                }

                var lines = str.Split('\n');
                for (int i = 0; i < lines.Length; i++)
                {
                    var line = lines[i];
                    row.AddChild(new Label
                    {
                        Text = line,
                        Font = new Font
                        {
                            SystemFont = font.SystemFont,
                            Color      = c,
                            Backdrop   = font.Backdrop
                        },
                        AutoSize   = AutoSizeMode.Full,
                        Background = null,
                        Clickable  = false
                    });
                    if (lines.Length > 1 && i < lines.Length - 1)
                    {
                        AddChild(row);
                        row = new FlowLayout
                        {
                            Newline  = false,
                            AutoSize = true
                        };
                    }
                }
            }
            AddChild(row);
        }
        public override View GetView(FlowLayout parent, int position, Java.Lang.Object s)
        {
            //throw new NotImplementedException();
            TextView tv = (TextView)_mInflater.Inflate(Resource.Layout.tag_item,
                                                       _view, false);

            tv.Text = s.ToString();// .setText(s);
            return(tv);
        }
Ejemplo n.º 13
0
 public SplitedLessonViewHolder(View view) : base(view)
 {
     _textViewLessonNum  = view.FindViewById <TextView>(Resource.Id.text_splited_lesson_number);
     _textViewSubject1   = view.FindViewById <TextView>(Resource.Id.text_splited_lesson_first);
     _textViewSubject2   = view.FindViewById <TextView>(Resource.Id.text_splited_lesson_second);
     _textViewClassroom1 = view.FindViewById <TextView>(Resource.Id.text_splited_classroom_first);
     _textViewClassroom2 = view.FindViewById <TextView>(Resource.Id.text_splited_classroom_second);
     _firstLes           = view.FindViewById <FlowLayout>(Resource.Id.splited_lesson_first_panel);
     _secondLes          = view.FindViewById <FlowLayout>(Resource.Id.splited_lesson_second_panel);
 }
Ejemplo n.º 14
0
        public Vector3Control(ControlBase parent) : base(parent)
        {
            var layout = new FlowLayout(this);

            layout.Dock        = Dock.Top;
            layout.MinimumSize = new Size(300, 30);

            _X = AddControl(layout, "X");
            _Y = AddControl(layout, "Y");
            _Z = AddControl(layout, "Z");
        }
 private void InitFlowLayout()
 {
     if (this.Orientation == System.Windows.Forms.Orientation.Horizontal)
     {
         FlowLayout.SetFlowDirection(this, FlowDirection.TopDown);
     }
     else
     {
         FlowLayout.SetFlowDirection(this, FlowDirection.LeftToRight);
     }
     FlowLayout.SetWrapContents(this, false);
 }
Ejemplo n.º 16
0
        public InGameMenu()
        {
            Size        = new Vector2(250, 400);
            LargeWindow = true;

            FlowLayout leftButtons = new FlowLayout
            {
                HorizontalFill = true,
                AutoSize       = true,
                Newline        = false,
                Anchor         = Graphics.Orientation.Left
            };

            bottomBar.AddChild(leftButtons);
            ButtonBase returnToMainMenu = new StoneButton
            {
                Text = Locale.Resource.GenQuit
            };

            returnToMainMenu.Click += new EventHandler(returnToMainMenu_Click);
            leftButtons.AddChild(returnToMainMenu);

            ButtonBase restart = new StoneButton
            {
                Text = Locale.Resource.GenRestart
            };

            restart.Click += new EventHandler(restart_Click);
            leftButtons.AddChild(restart);

            ButtonBase options = new StoneButton
            {
                Text = Locale.Resource.GenOptions
            };

            options.Click += new EventHandler(options_Click);
            leftButtons.AddChild(options);

            ButtonBase returnToGame = new LargeStoneButton
            {
                Text   = Locale.Resource.GenResume,
                Anchor = global::Graphics.Orientation.Right,
                Hotkey = new KeyCombination {
                    Key = System.Windows.Forms.Keys.Escape
                },
                Size = new Vector2(210, 62)
            };

            returnToGame.Click += new EventHandler(returnToGame_Click);
            bottomBar.AddChild(returnToGame);
            Result = InGameMenuResult.Resume;
        }
Ejemplo n.º 17
0
        public SaveTab(GameState gameState)
        {
            Icon = new Sprite(Ressources.TileIcons, new Point(3, 2));

            var container = new FlowLayout
            {
                Dock = Dock.Fill,
                Flow = FlowDirection.TopToBottom,
            };

            Content = new Container()
            {
                Childrens =
                {
                    new Label {
                        Text = "Save", Font = Ressources.FontAlagard, Dock = Dock.Top
                    },
                    container
                }
            };

            container.AddChild(new Button {
                Text = "Quick save", Padding = new Margins(4)
            })
            .RegisterMouseClickEvent((sender) =>
            {
                var job = Jobs.SaveWorld.Then((_, e) => { gameState.CurrentMenu = new MenuInGame(gameState); });
                job.SetArguments(new Jobs.WorldSaveInfo(gameState.GetSavePath(), gameState));

                gameState.CurrentMenu = new LoadingMenu(job, gameState);
            });

            container.AddChild(new Button {
                Text = "Save and Exit", Padding = new Margins(4)
            })
            .RegisterMouseClickEvent((sender) =>
            {
                var job = Jobs.SaveWorld;
                job.SetArguments(new Jobs.WorldSaveInfo(gameState.GetSavePath(), gameState));
                job.Then((_, e) => { Game.GoToMainMenu(); });

                gameState.CurrentMenu = new LoadingMenu(job, gameState);
            });

            container.AddChild(new Button
            {
                Text    = "Exit",
                Padding = new Margins(4)
            })
            .RegisterMouseClickEvent(sender => Game.GoToMainMenu());
        }
Ejemplo n.º 18
0
        protected override void OnLayout(LayoutEventArgs e)
        {
            if (ParentToolStrip is not null && ParentToolStrip.IsInDesignMode)
            {
                if (FlowLayout.GetFlowDirection(this) != FlowDirection.TopDown)
                {
                    FlowLayout.SetFlowDirection(this, FlowDirection.TopDown);
                }

                if (FlowLayout.GetWrapContents(this))
                {
                    FlowLayout.SetWrapContents(this, false);
                }
            }
Ejemplo n.º 19
0
        public void flow_layout_can_have_padding_between_rows()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(30, 30), new FlowLayoutStyle(paddingBetweenRows: 3),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(10, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 20
0
        public void flow_layout_supports_horizontal_alignment()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 30), new FlowLayoutStyle(alignment: Alignment.CenterRight),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(7, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 21
0
        public void flow_layout_can_be_vertical()
        {
            var layout = FlowLayout.VerticalFlowParent("root", LayoutSize.Pixels(25, 40), new FlowLayoutStyle(paddingBetweenItemsInEachRow: 4),
                                                       LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                       LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                       LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                       LayoutNode.Leaf("itemD", LayoutSize.Pixels(10, 10)),
                                                       LayoutNode.Leaf("itemE", LayoutSize.Pixels(13, 10)),
                                                       LayoutNode.Leaf("itemF", LayoutSize.Pixels(7, 10))
                                                       );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 22
0
        public void flow_layout_can_have_margin()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 40), new FlowLayoutStyle(margin: new Point(5)),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(10, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 23
0
        public void flow_layout_can_be_vertical_with_alignment()
        {
            var layout = FlowLayout.VerticalFlowParent("root", LayoutSize.Pixels(25, 40), new FlowLayoutStyle(alignment: Alignment.BottomRight),
                                                       LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                       LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                       LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                       LayoutNode.Leaf("itemD", LayoutSize.Pixels(10, 10)),
                                                       LayoutNode.Leaf("itemE", LayoutSize.Pixels(13, 10)),
                                                       LayoutNode.Leaf("itemF", LayoutSize.Pixels(7, 10))
                                                       );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 24
0
        public void can_create_flow_layout()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(30, 30), FlowLayoutStyle.Empty,
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(10, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 25
0
        public void flow_layout_halts_on_illegal_but_keep_last_overflow()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 20), new FlowLayoutStyle(overflowRule: OverflowRule.LastRowKeepsGoing),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(13, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("really-wide-item", LayoutSize.Pixels(21, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 26
0
        public void flow_layout_estimates_accurate_height()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 30), FlowLayoutStyle.Empty,
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 5)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(13, 7)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(12, 3)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(13, 12)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(8, 15)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(10, 5))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 27
0
        public void flow_layout_supports_padding_between_individual_items()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 30), new FlowLayoutStyle(paddingBetweenItemsInEachRow: 4),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(13, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(7, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 28
0
        public void flow_layout_halts_on_illegal_overflow()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 20), new FlowLayoutStyle(overflowRule: OverflowRule.EverythingMustBeInside),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(13, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(8, 12)),
                                                         LayoutNode.Leaf("itemG", LayoutSize.Pixels(9, 10))
                                                         );

            var result = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 29
0
        public void flow_layout_can_address_individual_rows()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(25, 40), new FlowLayoutStyle(alignment: Alignment.Center),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                         FlowLayoutInstruction.Linebreak,
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                         FlowLayoutInstruction.Linebreak,
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(10, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(13, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemG", LayoutSize.Pixels(7, 10))
                                                         );

            var result = layout.Bake();

            result.GetRow(0).ItemCount.Should().Be(2);
            result.GetRow(1).ItemCount.Should().Be(1);
            result.GetRow(2).ItemCount.Should().Be(2);
            result.GetRow(3).ItemCount.Should().Be(2);

            result.GetRow(2).GetItemNode(1).Size.Should().Be(new Point(13, 10));

            result.GetRow(0).Node.Rectangle.Should().Be(new Rectangle(new Point(0, 0), new Point(25, 10)));
            result.GetRow(1).Node.Rectangle.Should().Be(new Rectangle(new Point(0, 10), new Point(25, 10)));
            result.GetRow(2).Node.Rectangle.Should().Be(new Rectangle(new Point(0, 20), new Point(25, 10)));
            result.GetRow(3).Node.Rectangle.Should().Be(new Rectangle(new Point(0, 30), new Point(25, 10)));

            result.GetRow(0).UsedRectangle.Should().Be(new Rectangle(new Point(3, 0), new Point(19, 10)));
            result.GetRow(1).UsedRectangle.Should().Be(new Rectangle(new Point(8, 10), new Point(9, 10)));
            result.GetRow(2).UsedRectangle.Should().Be(new Rectangle(new Point(1, 20), new Point(23, 10)));
            result.GetRow(3).UsedRectangle.Should().Be(new Rectangle(new Point(5, 30), new Point(14, 10)));


            int totalItems = 0;

            foreach (var row in result.Rows)
            {
                foreach (var item in row)
                {
                    item.NestingLevel.Should().Be(3);
                    totalItems++;
                }
            }

            totalItems.Should().Be(7);
        }
Ejemplo n.º 30
0
        public void flow_layout_can_permit_overflow_extra_rows()
        {
            var layout = FlowLayout.HorizontalFlowParent("root", LayoutSize.Pixels(40, 20), new FlowLayoutStyle(overflowRule: OverflowRule.Free),
                                                         LayoutNode.Leaf("itemA", LayoutSize.Pixels(12, 10)),
                                                         LayoutNode.Leaf("itemB", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemC", LayoutSize.Pixels(9, 10)),
                                                         LayoutNode.Leaf("itemD", LayoutSize.Pixels(13, 10)),
                                                         LayoutNode.Leaf("itemE", LayoutSize.Pixels(7, 10)),
                                                         LayoutNode.Leaf("itemF", LayoutSize.Pixels(8, 10)),
                                                         LayoutNode.Leaf("itemG", LayoutSize.Pixels(9, 10)),
                                                         LayoutNode.Leaf("itemH", LayoutSize.Pixels(4, 4))
                                                         );

            var result = layout.Bake();

            Approvals.Verify("There are supposed to be a bunch of skipped pixels here: \n\n" + LayoutNodeUtils.DrawResult(result));
        }
Ejemplo n.º 31
0
        public CategoryTest(ControlBase parent) : base(parent)
        {
            FlowLayout container = new FlowLayout(parent);

            container.Dock = Dock.Fill;
            CollapsibleList list = new CollapsibleList(container);

            list.Width  = 200;
            list.Height = 200;
            var l = list.Add("Hell0 i am cat");

            l.Add("i have cats");
            l.Add("meaow");
            l = list.Add("Hi. I'm a kitten");
            l.Add("I am proffesional.");
            l.Add("Mow.");
        }
        private void AddView(Sponsor sponsor, FlowLayout container)
        {
            var imageView = new SponsorImageView(Activity);
            imageView.BindData(sponsor, (_, __) =>
                {
                    if (string.IsNullOrEmpty(sponsor.Url))
                    {
                        return;
                    }
                    AnalyticsTracker.SendEvent("sponsor", sponsor.Url);
                    AppUtil.ShowWebPage(Activity, sponsor.Url);
                });

            var lparams = new FlowLayout.LayoutParams(
                FlowLayout.LayoutParams.WrapContent, FlowLayout.LayoutParams.WrapContent);
            int margin = (int) Resources.GetDimension(Resource.Dimension.spacing_small);
            lparams.SetMargins(margin, margin, 0, 0);
            container.AddView(imageView, lparams);
        }
Ejemplo n.º 33
0
 private void initGUI()
 {
     try
     {
         setPreferredSize(new Dimension(400, 300));
         {
             generalPanel = new JPanel();
             FlowLayout generalPanelLayout = new FlowLayout();
             generalPanelLayout.setAlignment(FlowLayout.LEFT);
             generalPanel.setLayout(generalPanelLayout);
             this.addTab("General", null, generalPanel, null);
             {
                 resolutionPanel = new JPanel();
                 generalPanel.add(resolutionPanel);
                 FlowLayout resolutionPanelLayout = new FlowLayout();
                 resolutionPanel.setLayout(resolutionPanelLayout);
                 resolutionPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Resolution", TitledBorder.LEADING, TitledBorder.TOP));
                 {
                     resolutionCheckBox = new JCheckBox();
                     resolutionPanel.add(resolutionCheckBox);
                     resolutionCheckBox.setText("Override");
                 }
                 {
                     jLabel1 = new JLabel();
                     resolutionPanel.add(jLabel1);
                     jLabel1.setText("Image Width:");
                 }
                 {
                     resolutionXTextField = new JTextField();
                     resolutionPanel.add(resolutionXTextField);
                     resolutionXTextField.setText("640");
                     resolutionXTextField.setPreferredSize(new java.awt.Dimension(50, 20));
                 }
                 {
                     jLabel2 = new JLabel();
                     resolutionPanel.add(jLabel2);
                     jLabel2.setText("Image Height:");
                 }
                 {
                     resolutionYTextField = new JTextField();
                     resolutionPanel.add(resolutionYTextField);
                     resolutionYTextField.setText("480");
                     resolutionYTextField.setPreferredSize(new java.awt.Dimension(50, 20));
                 }
             }
             {
                 threadsPanel = new JPanel();
                 generalPanel.add(threadsPanel);
                 threadsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Threads", TitledBorder.LEADING, TitledBorder.TOP));
                 {
                     threadCheckBox = new JCheckBox();
                     threadsPanel.add(threadCheckBox);
                     threadCheckBox.setText("Use All Processors");
                 }
                 {
                     jLabel3 = new JLabel();
                     threadsPanel.add(jLabel3);
                     jLabel3.setText("Threads:");
                 }
                 {
                     threadTextField = new JTextField();
                     threadsPanel.add(threadTextField);
                     threadTextField.setText("1");
                     threadTextField.setPreferredSize(new java.awt.Dimension(50, 20));
                 }
             }
         }
         {
             rendererPanel = new JPanel();
             FlowLayout rendererPanelLayout = new FlowLayout();
             rendererPanelLayout.setAlignment(FlowLayout.LEFT);
             rendererPanel.setLayout(rendererPanelLayout);
             this.addTab("Renderer", null, rendererPanel, null);
             {
                 defaultRendererRadioButton = new JRadioButton();
                 rendererPanel.add(defaultRendererRadioButton);
                 defaultRendererRadioButton.setText("Default Renderer");
             }
             {
                 bucketRendererPanel = new JPanel();
                 BoxLayout bucketRendererPanelLayout = new BoxLayout(bucketRendererPanel, javax.swing.BoxLayout.Y_AXIS);
                 bucketRendererPanel.setLayout(bucketRendererPanelLayout);
                 rendererPanel.add(bucketRendererPanel);
                 bucketRendererPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED), "Bucket Renderer", TitledBorder.LEADING, TitledBorder.TOP));
                 {
                     bucketRendererRadioButton = new JRadioButton();
                     bucketRendererPanel.add(bucketRendererRadioButton);
                     bucketRendererRadioButton.setText("Enable");
                 }
                 {
                     samplingPanel = new JPanel();
                     GridLayout samplingPanelLayout = new GridLayout(2, 2);
                     samplingPanelLayout.setColumns(2);
                     samplingPanelLayout.setHgap(5);
                     samplingPanelLayout.setVgap(5);
                     samplingPanelLayout.setRows(2);
                     samplingPanel.setLayout(samplingPanelLayout);
                     bucketRendererPanel.add(samplingPanel);
                     {
                         jLabel5 = new JLabel();
                         samplingPanel.add(jLabel5);
                         jLabel5.setText("Min:");
                     }
                     {
                         ComboBoxModel minSamplingComboBoxModel = new DefaultComboBoxModel(new string[] {
                             "Item One", "Item Two" });
                         minSamplingComboBox = new JComboBox();
                         samplingPanel.add(minSamplingComboBox);
                         minSamplingComboBox.setModel(minSamplingComboBoxModel);
                     }
                     {
                         jLabel6 = new JLabel();
                         samplingPanel.add(jLabel6);
                         jLabel6.setText("Max:");
                     }
                     {
                         ComboBoxModel maxSamplingComboxBoxModel = new DefaultComboBoxModel(new string[] {
                             "Item One", "Item Two" });
                         maxSamplingComboxBox = new JComboBox();
                         samplingPanel.add(maxSamplingComboxBox);
                         maxSamplingComboxBox.setModel(maxSamplingComboxBoxModel);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         e.printStackTrace();
     }
 }