Inheritance: Eto.Forms.Layout
Beispiel #1
0
		public MyForm()
		{
			ClientSize = new Size(600, 400);
			Title = "Table Layout";


			Content = new TableLayout(
				new TableRow(new Label { Text = "DataContext Binding" }, DataContextBinding()),
				new TableRow(new Label { Text = "Object Binding" }, ObjectBinding()),
				new TableRow(new Label { Text = "Direct Binding" }, DirectBinding()),
				null // same as creating a row with ScaleHeight = true
			) { Spacing = new Size(5, 5), Padding = new Padding(10) };

			// Set data context so it propegates to all child controls
			DataContext = new MyObject { TextProperty = "Initial value 1" };

			Menu = new MenuBar
			{
				QuitItem = new Command((sender, e) => Application.Instance.Quit())
				{ 
					MenuText = "Quit",
					Shortcut = Application.Instance.CommonModifier | Keys.Q
				}
			};
		}
Beispiel #2
0
		public GridViewSection()
		{
			var gridView = CreateGrid();
			var selectionGridView = CreateGrid();

			// hook up selection of main grid to the selection grid
			gridView.SelectionChanged += (s, e) => selectionGridView.DataStore = gridView.SelectedItems.ToList();

			var filteredCollection = new SelectableFilterCollection<MyGridItem>(gridView, CreateItems().ToList());
			gridView.DataStore = filteredCollection;

			if (Platform.Supports<ContextMenu>())
				gridView.ContextMenu = CreateContextMenu(gridView, filteredCollection);

			Content = new TableLayout
			{
				Padding = new Padding(10),
				Spacing = new Size(5, 5),
				Rows =
				{
					new TableRow(
						"Grid", 
						new TableLayout(
							CreateOptions(gridView, filteredCollection),
							gridView
						)
					) { ScaleHeight = true },
					new TableRow("Selected Items", selectionGridView)
				}
			};
		}
        public RpcServerSettingsManager(string title, string rpcUrlHost, ushort rpcUrlPort, bool isProcessHostedLocally)
        {
            Text = title;

            TextBoxRpcUrlHost = new TextBox { Text = rpcUrlHost };
            CheckBoxIsProcessHostedLocally = new CheckBox {
                Text = Desktop.Properties.Resources.OptionsNetworkIsProcessHostedLocally,
                Checked = isProcessHostedLocally
            };

            RpcUrlPort = rpcUrlPort;

            Content = new TableLayout(
                new TableLayout(
                    new TableRow(
                        new Label { Text = Desktop.Properties.Resources.TextHost },
                        new TableCell(TextBoxRpcUrlHost, true),

                        new Separator(SeparatorOrientation.Vertical),

                        new Label { Text = Desktop.Properties.Resources.TextPort },
                        Utilities.CreateNumericUpDown(this, o => o.RpcUrlPort, 0, 1, ushort.MaxValue)
                    )
                ) { Spacing = Utilities.Spacing3 },

                new TableRow(CheckBoxIsProcessHostedLocally)
            ) { Padding = new Padding(Utilities.Padding2), Spacing = Utilities.Spacing3 };
        }
Beispiel #4
0
        public CSyclesForm(string path)
        {
            ClientSize = new Eto.Drawing.Size(500, 500);
            Title      = "CSycles Tester";
            Path       = path;

            Image = new ef.ImageView();
            var layout = new ef.TableLayout();

            layout.Rows.Add(
                new ef.TableRow(
                    Image
                    )
                );

            var scenes = Directory.EnumerateFiles(path, "scene*.xml");

            Menu = new ef.MenuBar();
            var scenesmenu = Menu.Items.GetSubmenu("scenes");

            foreach (var sf in scenes)
            {
                scenesmenu.Items.Add(new RenderModalCommand(this, sf));
            }

            Content = layout;

            var m = new RendererModel();

            DataContext = m;
        }
Beispiel #5
0
        public CSyclesForm(string path)
        {
            ClientSize = new Eto.Drawing.Size(500, 500);
            Title = "CSycles Tester";
            Path = path;

            Image = new ef.ImageView();
            var layout = new ef.TableLayout();
            layout.Rows.Add(
                new ef.TableRow(
                    Image
                    )
                );

            var scenes = Directory.EnumerateFiles(path, "scene*.xml");
            Menu = new ef.MenuBar();
            var scenesmenu = Menu.Items.GetSubmenu("scenes");
            foreach(var sf in scenes)
            {
                scenesmenu.Items.Add(new RenderModalCommand(this, sf));
            }

            Content = layout;

            var m = new RendererModel();
            DataContext = m;
        }
		public ScrollableSection()
		{
			var layout = new TableLayout(4, 2);
			layout.Spacing = new Size(5, 5);
			layout.Padding = new Padding(10);

			layout.SetColumnScale(1);
			layout.SetColumnScale(3);
			layout.SetRowScale(0);
			layout.SetRowScale(1);

			layout.Add(new Label { Text = "Default" }, 0, 0);
			layout.Add(DefaultScrollable(), 1, 0);

			layout.Add(new Label { Text = "No Border" }, 2, 0);
			layout.Add(NoBorderScrollable(), 3, 0);

			layout.Add(new Label { Text = "Bezeled" }, 0, 1);
			layout.Add(BezelScrollable(), 1, 1);

			layout.Add(new Label { Text = "Line" }, 2, 1);
			layout.Add(LineScrollable(), 3, 1);

			Content = layout;
		}
Beispiel #7
0
		public CursorSection()
		{
			var layout = new TableLayout();
			layout.Spacing = new Size(20, 20);

			TableRow row;

			layout.Rows.Add(row = new TableRow());

			foreach (var type in Enum.GetValues(typeof(CursorType)).OfType<CursorType?>())
			{
				var label = new Label
				{ 
					Size = new Size(100, 50), 
					Text = type.ToString(),
					VerticalAlignment = VerticalAlignment.Center,
					TextAlignment = TextAlignment.Center,
					BackgroundColor = Colors.Silver
				};
				if (type == null)
					label.Cursor = null;
				else
					label.Cursor = new Cursor(type.Value);
				row.Cells.Add(label);

				if (row.Cells.Count > 3)
					layout.Rows.Add(row = new TableRow());
			}

			Content = TableLayout.AutoSized(layout, centered: true);

		}
		public TablePaddingAndSpacingSection()
		{
			var layout = new TableLayout
			{
				Padding = 10,
				Spacing = new Size(10, 10)
			};

			layout.Rows.Add(new Panel
			{
				Content = "You should be able to see a green label at the bottom"
			});

			for (int i = 0; i < 20; i++)
			{
				layout.Rows.Add(CreateChild());
			}

			layout.Rows.Add(new Panel
			{
				BackgroundColor = Colors.LightGreen,
				Content = "End control. Should be 10px padding below."
			});

			Content = layout;
		}
Beispiel #9
0
		public SpacingSection ()
		{
			var layout = new TableLayout (this, 3, 1);

			layout.Add (NoSpacing (), 0, 0, true, true);
			layout.Add (NoPadding (), 1, 0, true, true);
			layout.Add (DifferentSizes (), 2, 0, true, true);
		}
        public ProgressBarWithText()
        {
            TableLayoutProgressBar = new TableLayout(new TableRow(new TableCell(ProgressBar, true) { ScaleWidth = true }));

            Add(TableLayoutProgressBar, 0, 0);
            Add(Label, 0, 0);

            SizeChanged += OnControlSizeChanged;
        }
Beispiel #11
0
		Control TestProperties()
		{
			var min = new DateTimePicker();
			var max = new DateTimePicker();
			var setValue = new DateTimePicker();
			var toValue = new DateTimePicker();
			var modeSelect = new EnumRadioButtonList<CalendarMode>();
			var current = new Calendar();
			var setButton = new Button { Text = "Set" };
			var toValueSection = new StackLayout
			{
				Orientation = Orientation.Horizontal,
				Visible = false,
				Spacing = 5,
				Items = { " to ", toValue }
			};

			var layout = new TableLayout
			{
				Spacing = new Size(5, 5),
				Padding = new Padding(10),
				Rows = 
				{
					new TableRow("Min Value", min),
					new TableRow("Max Value", max),
					new TableRow("Mode", modeSelect),
					new TableRow("Set to value",
						new StackLayout
						{
							Orientation = Orientation.Horizontal,
							Spacing = 5,
							Items = { setValue, toValueSection, setButton }
						}
					),
					new TableRow("Value", TableLayout.AutoSized(current), null),
					null
				}
			};

			modeSelect.SelectedValueBinding.Bind(() => current.Mode, v =>
			{
				toValueSection.Visible = v == CalendarMode.Range;
				current.Mode = v;
			});
			min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue;
			max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue;
			setButton.Click += (sender, e) =>
			{
				if (current.Mode == CalendarMode.Range)
					current.SelectedRange = (setValue.Value != null && toValue.Value != null) ? new Range<DateTime>(setValue.Value.Value, toValue.Value.Value) : current.SelectedRange;
				else
					current.SelectedDate = setValue.Value ?? current.SelectedDate;
			};
			LogEvents(current);

			return layout;
		}
Beispiel #12
0
		Control NoSpacing ()
		{
			var layout = new TableLayout (new Panel { BackgroundColor = Colors.Blue }, 3, 4);
			layout.Padding = new Padding (10);
			layout.Spacing = Size.Empty;
			layout.SetColumnScale (1); // scale middle column
			FillTable (layout);
			return layout.Container;
		}
Beispiel #13
0
		Control MiddleSection()
		{
			middleTable = new TableLayout(1, 3);

			middleTable.Add(new Label { Text = "Content", BackgroundColor = Colors.LightGrey, HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle }, 0, 1, true, true);
			middleTable.Add(topSection = new Panel(), 0, 0);

			return middleTable;
		}
Beispiel #14
0
		Control MainTable()
		{
			mainTable = new TableLayout(3, 1);

			mainTable.Add(MiddleSection(), 1, 0, true, true);
			mainTable.Add(rightSection = new Panel(), 2, 0);

			return mainTable;
		}
Beispiel #15
0
		public WebViewSection ()
		{
			var layout = new TableLayout (this, 1, 3);
			
			int row = 0;
			layout.Add (Buttons (), 0, row++);
			layout.Add (TitleLabel (), 0, row++);
			layout.Add (WebView (), 0, row++, true, true);
		}
Beispiel #16
0
		public MyForm()
		{
			ClientSize = new Size(600, 400);
			Title = "Table Layout";

			// The main layout mechanism for Eto.Forms is a TableLayout.
			// This is recommended to allow controls to keep their natural platform-specific size.
			// You can layout your controls declaratively using rows and columns as below, or add to the TableLayout.Rows and TableRow.Cell directly.

			Content = new TableLayout
			{
				Spacing = new Size(5, 5), // space between each cell
				Padding = new Padding(10, 10, 10, 10), // space around the table's sides
				Rows =
				{
					new TableRow(
						new TableCell(new Label { Text = "First Column" }, true), 
						new TableCell(new Label { Text = "Second Column" }, true),
						new Label { Text = "Third Column" }
					),
					new TableRow(
						new TextBox { Text = "Some text" },
						new DropDown { Items = { "Item 1", "Item 2", "Item 3" } },
						new CheckBox { Text = "A checkbox" }
					),
					// by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form.
					// otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height.
					new TableRow { ScaleHeight = true }
				}
			};

			// This creates the following layout:
			//  --------------------------------
			// |First     |Second    |Third     |
			//  --------------------------------
			// |<TextBox> |<ComboBox>|<CheckBox>|
			//  --------------------------------
			// |          |          |          |
			// |          |          |          |
			//  --------------------------------
			//
			// Some notes:
			//  1. When scaling the width of a cell, it applies to all cells in the same column.
			//  2. When scaling the height of a row, it applies to the entire row.
			//  3. Scaling a row/column makes it share all remaining space with other scaled rows/columns.
			//  4. If a row/column is not scaled, it will be the size of the largest control in that row/column.
			//  5. A Control can be implicitly converted to a TableCell or TableRow to make the layout more concise.

			Menu = new MenuBar
			{
				QuitItem = new Command((sender, e) => Application.Instance.Quit())
				{
					MenuText = "Quit",
					Shortcut = Application.Instance.CommonModifier | Keys.Q
				}
			};
		}
Beispiel #17
0
		Control NoSpacing()
		{
			var layout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue };
			layout.Padding = new Padding(10);
			layout.Spacing = Size.Empty;
			layout.SetColumnScale(1); // scale middle column
			layout.SetRowScale(1); // scale middle row
			FillTable(layout);
			return layout;
		}
Beispiel #18
0
		public virtual void Generate (DynamicLayout layout, TableLayout parent, int x, int y)
		{
			var c = Generate (layout);
			if (c != null)
				parent.Add (c, x, y);
			if (XScale != null)
				parent.SetColumnScale (x, XScale.Value);
			if (YScale != null)
				parent.SetRowScale (y, YScale.Value);
		}
Beispiel #19
0
		Control NoPadding ()
		{
			var layout = new TableLayout (new Panel { BackgroundColor = Colors.Blue }, 3, 4);
			layout.Padding = Padding.Empty;
			layout.Spacing = new Size (20, 20);
			layout.SetColumnScale (0); // scale first and last column
			layout.SetColumnScale (2); // scale first and last column
			FillTable (layout);
			return layout.Container;
		}
Beispiel #20
0
		public DrawableSection()
		{
			Content = new TableLayout
			{
				Padding = new Padding(10),
				Spacing = new Size(10,10),
				Rows =
				{
					TableLayout.HorizontalScaled(
						10,
						new TableLayout(
							"Default",
							Default()
						),
						new TableLayout(
							"With Background",
							WithBackground()
						)
					),

					new TableLayout(
						"Large Canvas",
						// use a separate containing panel to test calculations in those cases
						new Panel { Content = LargeCanvas() }
					),

					new TableRow(TableLayout.Horizontal(
						10,
						new TableLayout(
							"Nested",
							Nested()
						),
						new TableLayout(
							"Transparent",
							Transparent()
						),
						new TableLayout(
							"Tools",
							TableLayout.Horizontal(
								Tools(1), Tools(2), Tools(0)
							),
							Tools(3),
							Tools(0)
						)
					)),

					(Platform.SupportedFeatures & PlatformFeatureFlags.DrawableWithTransparentContent) == 0 ?
					new TableRow(
						"(Transparent content on drawable not supported on this platform)"
					) : null,

					null
				}
			};
		}
        public HiSumDisplay()
        {
            // sets the client (inner) size of the window for your content
            ClientSize = new Eto.Drawing.Size(600, 400);

            Title = "HiSum";
            TreeGridView view = new TreeGridView(){Height = 500};

            view.Columns.Add(new GridColumn() { HeaderText = "Summary", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false });
            var textbox = new TextBox() {Width = 1000};
            var button = new Button(){Text = "Go", Width = 15};
            var label = new Label() {Width = 100};
            var tbResult = new TextArea() {Width = 1000};

            button.Click += (sender, e) =>
            {
                Reader reader = new Reader();
                List<int> top100 = reader.GetTop100();
                List<FullStory> fullStories = new List<FullStory>();
                foreach (int storyID in top100.Take(30))
                {
                    FullStory fullStory = reader.GetStoryFull(storyID);
                    fullStories.Add(fullStory);
                }
                TreeGridItemCollection data = GetTree(fullStories);
                view.DataStore = data;
            };
            Content = new TableLayout
            {
                Spacing = new Size(5, 5), // space between each cell
                Padding = new Padding(10, 10, 10, 10), // space around the table's sides
                Rows = {
                    new TableRow(
                        new Label{Text = "Input URL from Hacker News: ",Width=200},
                        textbox,
                        button,
                        label
                    ),
                    new TableRow(
                        null,
                        tbResult,
                        null,
                        null
                        ),
                    new TableRow(
                        new Label(),
                        view
                    ),

                    // by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form.
                    // otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height.
                    new TableRow { ScaleHeight = true }
                }
            };
        }
Beispiel #22
0
		void FillTable (TableLayout layout)
		{
			for (int y = 0; y < layout.Size.Height - 1; y++)
				for (int x = 0; x < layout.Size.Width; x++) {
					var panel = new Panel { 
						Size = SquareSize, 
						BackgroundColor = (x+y*layout.Size.Width) % 2 == 0 ? Colors.Lime : Colors.Red 
					};
					layout.Add (panel, x, y);
				}
		}
Beispiel #23
0
		Control MainTable()
		{
			mainTable = new TableLayout(3, 1);
			mainTable.Padding = new Padding(10);
			mainTable.Spacing = new Size(5, 5);

			mainTable.Add(MiddleSection(), 1, 0, true, true);
			mainTable.Add(rightSection = new Panel(), 2, 0);

			return mainTable;
		}
Beispiel #24
0
		Control MiddleSection()
		{
			middleTable = new TableLayout(1, 3);
			middleTable.Padding = new Padding(10);
			middleTable.Spacing = new Size(5, 5);

			middleTable.Add(new Label { Text = "Content", BackgroundColor = Colors.LightGrey, TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center }, 0, 1, true, true);
			middleTable.Add(topSection = new Panel(), 0, 0);

			return middleTable;
		}
Beispiel #25
0
		public SpacingSection()
		{
			var layout = new TableLayout(3, 1);
			layout.Spacing = new Size(5, 5);
			layout.Padding = new Padding(10);

			layout.Add(NoSpacing(), 0, 0, true, true);
			layout.Add(NoPadding(), 1, 0, true, true);
			layout.Add(DifferentSizes(), 2, 0, true, true);

			Content = layout;
		}
Beispiel #26
0
		public DynamicMenuBar()
		{
			var count = 0;
			var menu = Application.Instance.MainForm.Menu;
			ISubmenu editMenu = menu.Items.GetSubmenu("Edit");

			// selection of which menu to add/remove
			var menuToEdit = new DropDown
			{
				DataStore = menu.Items.OfType<ISubmenu>().Union(new ISubmenu[] { menu }).ToList(),
				TextBinding = Binding.Delegate((MenuItem item) => item.Text, defaultGetValue: "Main Menu")
			};
			menuToEdit.SelectedValueBinding.Bind(() => editMenu, v => editMenu = v as ISubmenu);

			// tag to identify items that we've added
			var dynamicTag = new object();

			// button to add a new item
			var addToEditMenu = new Button { Text = "Add MenuItem" };
			addToEditMenu.Click += (sender, e) =>
			{
				var itemNumber = ++count;
				var item = new ButtonMenuItem { Text = "Dynamic Menu Item " + itemNumber, Tag = dynamicTag };
				item.Click += (s, ee) => Log.Write(item, "Clicked " + itemNumber);
				editMenu.Items.Add(item);
			};

			// button to remove the item
			var removeFromEditMenu = new Button { Text = "Remove MenuItem" };
			removeFromEditMenu.Click += (sender, e) =>
			{
				var item = editMenu.Items.LastOrDefault(r => Equals(r.Tag, dynamicTag));
				if (item != null)
				{
					editMenu.Items.Remove(item);
				}
			};

			// layout of the form
			Content = new TableLayout
			{
				Rows =
				{
					null,
					TableLayout.Horizontal(null, new Label { Text = "Submenu to add to", VerticalAlign = VerticalAlign.Middle }, menuToEdit, null),
					TableLayout.Horizontal(null, addToEditMenu, removeFromEditMenu, null),
					null
				}
			};
		}
Beispiel #27
0
		Control NoPadding()
		{
			var layout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue };
			layout.Padding = Padding.Empty;
			layout.Spacing = new Size(20, 20);
			// scale first and last column
			layout.SetColumnScale(0);
			layout.SetColumnScale(2);
			// scale first and last row
			layout.SetRowScale(0);
			layout.SetRowScale(2);
			FillTable(layout);
			return new Panel { Content = layout, BackgroundColor = Colors.Blue };
		}
Beispiel #28
0
		public MyEtoPanel()
		{
			Content = new TableLayout
			{
				Spacing = new Size(5, 5),
				Rows =
				{
					new TableRow(new Label { Text = "An Eto.Forms control" }),
					new TableRow(new TextBox()),
					new TableRow(new ComboBox { Items = { "Item 1", "Item 2", "Item 3" } }),
					null
				}
			};
		}
Beispiel #29
0
		public ScalingSection()
		{
			TableLayout tableLayout;

			var layout = new DynamicLayout();
			var size = new Size(-1, 100);

			tableLayout = new TableLayout(1, 1) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.Add(new Label { Text = "1x1, should scale to fill entire region with 5px padding around border", BackgroundColor = Colors.Red }, 0, 0, false, false);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.Add(new Label { Text = "2x2, should scale with extra space on top & left", BackgroundColor = Colors.Red }, 1, 1, false, false);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.Add(new Label { Text = "2x2, should scale with extra space on bottom & right", BackgroundColor = Colors.Red }, 0, 0, true, true);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.Add(new Label { Text = "3x3, should scale with extra space all around (10px)", BackgroundColor = Colors.Red }, 1, 1, true, true);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.Add(new Label { Text = "2x2, should not scale and be top left", BackgroundColor = Colors.Red }, 0, 0, false, false);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(2, 2) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.SetColumnScale(0);
			tableLayout.SetRowScale(0);
			tableLayout.Add(new Label { Text = "2x2, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.SetColumnScale(0);
			tableLayout.SetRowScale(0);
			tableLayout.Add(new Label { Text = "3x3, should not scale and be bottom-right", BackgroundColor = Colors.Red }, 1, 1);
			layout.Add(tableLayout, yscale: true);

			tableLayout = new TableLayout(3, 3) { BackgroundColor = Colors.Blue, Size = size };
			tableLayout.SetColumnScale(0);
			tableLayout.SetColumnScale(2);
			tableLayout.SetRowScale(0);
			tableLayout.SetRowScale(2);
			tableLayout.Add(new Label { Text = "2x2, should not scale and be centered", BackgroundColor = Colors.Red }, 1, 1);
			layout.Add(tableLayout, yscale: true);

			Content = layout;
		}
Beispiel #30
0
        public SessionCreator()
        {
            _session = new Session();
            _session.Processes.Add(new PortManagerProcess());
            _session.Processes.Add(new RouterProcess());
            _session.Processes.Add(new HostProcess());
            _session.Processes.Add(new DeviceFinderProcess ());
            _session.Processes.Add(new NetworkDatabaseProcess());

            var left = new TableLayout(1, 3);

            _processesList = new ListBox();
            _processesList.Size = new Size(250, -1);
            _processesList.DataStore = _session.Processes;
            _processesList.SelectedValueChanged += _selectedProcessChanged;

            left.Add(_processesList, 0, 0);

            _portTypesCombo = new ComboBox();
            foreach (var portType in PortType.All())
            {
                _portTypesCombo.Items.Add(portType);
            }

            _addPortButton = new Button();
            _addPortButton.Text = Constants.AddPortButtonText;
            _addPortButton.Click += _addPortButtonClicked;

            var newPortLayout = new DynamicLayout();
            newPortLayout.Padding = Eto.Drawing.Padding.Empty;
            newPortLayout.AddRow(_portTypesCombo, _addPortButton);
            left.Add(newPortLayout, 0, 1);

            _contentPanel = new Panel();
            _contentPanel.Content = new SessionSettings(_session);

            _createSessionButton = new Button();
            _createSessionButton.Text = Constants.CreateSessionButtonText;
            _createSessionButton.Click += _createSessionButtonClicked;

            this.BeginVertical(padding:null, xscale: true, yscale: true);
            this.AddRow(left, _contentPanel);
            this.EndVertical();

            this.BeginVertical(padding:null, xscale: true, yscale: false);
            this.AddRow(null, _createSessionButton);
            this.EndVertical();
        }
Beispiel #31
0
        Control Buttons()
        {
            var layout = new TableLayout (new Panel (), 7, 1);

            int col = 0;
            layout.Add (BackButton (), col++, 0);
            layout.Add (ForwardButton (), col++, 0);
            layout.Add (LoadHtmlButton (), col++, 0);
            layout.Add (ReloadButton (), col++, 0);
            layout.Add (StopButton (), col++, 0);
            layout.Add (ExecuteScriptButton (), col++, 0);

            layout.SetColumnScale (col++);

            return layout.Container;
        }
Beispiel #32
0
 /// <summary>
 /// Creates a table layout with an auto sized control.
 /// </summary>
 /// <remarks>
 /// Since controls fill an entire cell, you can use this method to create a layout that will ensure that the
 /// specified <paramref name="control"/> gets its preferred size instead of stretching to fill the container.
 ///
 /// By default, extra space will be added to the right and bottom, unless <paramref name="centered"/> is <c>true</c>,
 /// which will add equal space to the top/bottom, and left/right.
 /// </remarks>
 /// <returns>The table layout with the auto sized control.</returns>
 /// <param name="control">Control to auto size.</param>
 /// <param name="padding">Padding around the control</param>
 /// <param name="centered">If set to <c>true</c> center the control, otherwise control is upper left of the container.</param>
 public static TableLayout AutoSized(Control control, Padding?padding = null, bool centered = false)
 {
     if (centered)
     {
         var layout = new TableLayout(3, 3);
         layout.Padding = padding ?? Padding.Empty;
         layout.Spacing = Size.Empty;
         layout.SetColumnScale(0);
         layout.SetColumnScale(2);
         layout.SetRowScale(0);
         layout.SetRowScale(2);
         layout.Add(control, 1, 1);
         return(layout);
     }
     else
     {
         var layout = new TableLayout(2, 2);
         layout.Padding = padding ?? Padding.Empty;
         layout.Spacing = Size.Empty;
         layout.Add(control, 0, 0);
         return(layout);
     }
 }
Beispiel #33
0
 public void Generate(DynamicLayout layout, TableLayout parent, int x, int y)
 {
     Create(layout, parent, x, y);
 }
Beispiel #34
0
 public TableRowCollection(TableLayout layout)
 {
     this.layout = layout;
 }
Beispiel #35
0
 internal void SetLayout(TableLayout layout)
 {
     ((TableCellCollection)Cells).SetLayout(layout);
 }
Beispiel #36
0
		void Create()
		{
			var table = new TableLayout { IsVisualControl = true };
			table.Spacing = new Size(Spacing, Spacing);

			bool filled = false;
			var expandItem = new StackLayoutItem { Expand = true };
			switch (Orientation)
			{
				case Orientation.Horizontal:
					var topRow = new TableRow();
					for (int i = 0; i < items.Count; i++)
					{
						var item = items[i] ?? expandItem;
						var align = GetVerticalAlign(item);
						var control = item.Control;
						filled |= item.Expand;
						var cell = new TableCell { ScaleWidth = item.Expand };
						switch (align)
						{
							case VerticalAlignment.Top:
								cell.Control = new TableLayout(control, null);
								break;
							case VerticalAlignment.Center:
								cell.Control = new TableLayout(null, control, null);
								break;
							case VerticalAlignment.Bottom:
								cell.Control = new TableLayout(null, control);
								break;
							case VerticalAlignment.Stretch:
								cell.Control = control;
								break;
							default:
								throw new ArgumentOutOfRangeException();
						}
						topRow.Cells.Add(cell);
					}
					if (!filled)
						topRow.Cells.Add(null);
					table.Rows.Add(topRow);
					break;
				case Orientation.Vertical:
					for (int i = 0; i < items.Count; i++)
					{
						var item = items[i] ?? expandItem;
						var align = GetHorizontalAlign(item);
						var control = item.Control;
						filled |= item.Expand;
						var vrow = new TableRow { ScaleHeight = item.Expand };
						switch (align)
						{
							case HorizontalAlignment.Left:
								vrow.Cells.Add(TableLayout.Horizontal(control, null));
								break;
							case HorizontalAlignment.Center:
								vrow.Cells.Add(TableLayout.Horizontal(null, control, null));
								break;
							case HorizontalAlignment.Right:
								vrow.Cells.Add(TableLayout.Horizontal(null, control));
								break;
							case HorizontalAlignment.Stretch:
								vrow.Cells.Add(control);
								break;
							default:
								throw new ArgumentOutOfRangeException();
						}
						table.Rows.Add(vrow);
					}
					if (!filled)
						table.Rows.Add(null);
					break;
				default:
					throw new ArgumentOutOfRangeException();
			}
			Content = table;
			isCreated = true;
		}