示例#1
17
		public TreeViewSection()
		{
			var layout = new DynamicLayout();
			
			layout.BeginHorizontal();
			layout.Add(new Label());
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.Add(null);
			layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true });
			layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true });
			layout.Add(RefreshButton());
			layout.Add(null);
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();

			treeView = ImagesAndMenu();

			layout.AddRow(new Label{ Text = "Simple" }, Default());
			layout.BeginHorizontal();
			layout.Add(new Panel());
			layout.BeginVertical();
			layout.AddSeparateRow(InsertButton(), AddChildButton(), RemoveButton(), ExpandButton(), CollapseButton(), null);
			layout.AddSeparateRow(LabelEditCheck(), EnabledCheck(), null);
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, treeView);
			layout.AddRow(new Panel(), HoverNodeLabel());

			layout.Add(null, false, true);

			Content = layout;
		}
示例#2
0
		Control TestProperties()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) };
			DateTimePicker min, max, current, setValue;
			Button setButton;

			layout.AddRow("Min Value", min = new DateTimePicker());
			layout.AddRow("Max Value", max = new DateTimePicker());
			layout.BeginHorizontal();
			layout.Add("Set to value");
			layout.BeginVertical(Padding.Empty);
			layout.BeginHorizontal();
			layout.AddAutoSized(setValue = new DateTimePicker());
			layout.Add(setButton = new Button { Text = "Set" });
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow("Value", current = new DateTimePicker());

			min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue;
			max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue;
			setButton.Click += (sender, e) => current.Value = setValue.Value;
			LogEvents(current);

			return layout;
		}
示例#3
0
		Control VerticalSection ()
		{
			var layout = new DynamicLayout (new Panel { BackgroundColor = Color.Blue });
			layout.Add (new Panel { Size = new Size (50, 60), BackgroundColor = Color.Green });
			layout.Add (new Panel { Size = new Size (50, 60), BackgroundColor = Color.Green });
			return layout.Container;
		}
示例#4
0
		public GridViewSection()
		{
			var layout = new DynamicLayout();

			layout.AddRow(new Label { Text = "Default" }, Default());
			layout.AddRow(new Label { Text = "No Header,\nNon-Editable" }, NoHeader());
#if DESKTOP
			layout.BeginHorizontal();
			layout.Add(new Label { Text = "Context Menu\n&& Multi-Select\n&& Filter" });
			layout.BeginVertical();
			layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" });
			var withContextMenuAndFilter = WithContextMenuAndFilter();
			layout.Add(withContextMenuAndFilter);
			layout.EndVertical();
			layout.EndHorizontal();

			var selectionGridView = Default(addItems: false);
			layout.AddRow(new Label { Text = "Selected Items" }, selectionGridView);

			// hook up selection of main grid to the selection grid
			withContextMenuAndFilter.SelectionChanged += (s, e) =>
			{
				var items = new DataStoreCollection();
				items.AddRange(withContextMenuAndFilter.SelectedItems);
				selectionGridView.DataStore = items;
			};
#endif

			Content = layout;
		}
示例#5
0
		public PrintDialogSection()
		{
			this.DataContext = settings;

			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.Add(null);
			layout.BeginVertical(Padding.Empty);
			layout.AddSeparateRow(null, ShowPrintDialog(), null);
			layout.AddSeparateRow(null, PrintFromGraphicsWithDialog(), null);
			layout.AddSeparateRow(null, PrintFromGraphics(), null);
			layout.EndBeginVertical();
			layout.Add(PrintDialogOptions());
			layout.Add(null);
			layout.EndVertical();
			layout.Add(null);
			layout.EndHorizontal();
			layout.EndVertical();
			layout.AddSeparateRow(null, PageRange(), Settings(), null);

			layout.Add(null);
			Content = layout;
		}
示例#6
0
文件: About.cs 项目: majorsilence/Eto
		public About ()
		{
			this.Title = "About Eto Test";
#if DESKTOP
			this.Resizable = true;
#endif

			var layout = new DynamicLayout (this, new Padding (20, 5), new Size(10, 10));

			layout.AddCentered(new ImageView{
				Image = Icon.FromResource ("Eto.Test.TestIcon.ico")
			}, true, true);
			
			layout.Add (new Label{
				Text = "Test Application",
				Font = new Font(SystemFont.Bold, 16),
				HorizontalAlign = HorizontalAlign.Center
			});

			var version = Assembly.GetEntryAssembly ().GetName ().Version;
			layout.Add (new Label {
				Text = string.Format("Version {0}", version),
				Font = new Font(SystemFont.Default, 8),
				HorizontalAlign = HorizontalAlign.Center
			});
			
			
			layout.Add (new Label{
				Text = "Copyright 2011 by Curtis Wensley aka Eto",
				Font = new Font(SystemFont.Default, 8),
				HorizontalAlign = HorizontalAlign.Center
			});

			layout.AddCentered (CloseButton ());
		}
示例#7
0
文件: About.cs 项目: hultqvist/Eto
		public About ()
		{
			this.Title = "About Eto Test";
#if DESKTOP
			this.Resizable = true;
#endif

			var layout = new DynamicLayout (this);

			layout.AddCentered(new ImageView{
				Image = Icon.FromResource ("Eto.Test.TestIcon.ico"),
				Size = new Size(128, 128)
			}, true, true);
			
			layout.Add (new Label{
				Text = "Test Application",
				Font = new Font(FontFamily.Sans, 16, FontStyle.Bold),
				HorizontalAlign = HorizontalAlign.Center
			});

			var version = Assembly.GetEntryAssembly ().GetName ().Version;
			layout.Add (new Label {
				Text = string.Format("Version {0}", version),
				HorizontalAlign = HorizontalAlign.Center
			});
			
			
			layout.Add (new Label{
				Text = "Copyright 2011 by Curtis Wensley aka Eto",
				HorizontalAlign = HorizontalAlign.Center
			});

			layout.AddCentered (CloseButton ());
		}
 protected virtual Control CreateLayout()
 {
     var layout = new DynamicLayout(Padding.Empty, Size.Empty);
     layout.Add(History, yscale: true);
     layout.Add(new Panel { Content = TextEntry, Padding = new Padding(10) });
     return layout;
 }
		Control TestProperties()
		{
			var layout = new DynamicLayout();
			DateTimePicker min, max, current, setValue;
			Button setButton;

			layout.AddRow(new Label { Text = "Min Value" }, min = new DateTimePicker());
			layout.AddRow(new Label { Text = "Max Value" }, max = new DateTimePicker());
			layout.BeginHorizontal();
			layout.Add(new Label { Text = "Set to value" });
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.AddAutoSized(setValue = new DateTimePicker());
			layout.Add(setButton = new Button { Text = "Set" });
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow(new Label { Text = "Value" }, current = new DateTimePicker());

			min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue;
			max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue;
			setButton.Click += (sender, e) => current.Value = setValue.Value;
			LogEvents(current);

			return layout;
		}
示例#10
0
		static void AddHeaders(DynamicLayout layout)
		{
			layout.BeginHorizontal();
			layout.Add(null, xscale: false);
			layout.Add(new Label { Text = "Bitmap", HorizontalAlign = HorizontalAlign.Center }, xscale: true);
			layout.Add(new Label { Text = "Icon", HorizontalAlign = HorizontalAlign.Center }, xscale: true);
			layout.EndHorizontal();
		}
示例#11
0
		protected override Forms.Window GetWindow()
		{
			// Add splitters like this:
			// |---------------------------
			// |        |      |          |
			// |  P0    |  P2  |   P4     |
			// | -------|      |          |  <== These are on MainPanel
			// |  P1    |------|          |
			// |        |  P3  |          |
			// |---------------------------
			// |         status0..4,      |  <== These are on StatusPanel
			// ----------------------------

			Label[] status = new Label[] { new Label(), new Label(), new Label(), new Label(), new Label() };

			// Status bar
			var statusPanel = new Panel { };
			var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty);
			statusLayout.BeginHorizontal();
			for (var i = 0; i < status.Length; ++i)
				statusLayout.Add(status[i], xscale: true);
			statusLayout.EndHorizontal();
			statusPanel.Content = statusLayout;

			// Splitter windows
			Panel[] p = new Panel[] { new Panel(), new Panel(), new Panel(), new Panel(), new Panel() };
			var colors = new Color[] { Colors.PaleTurquoise, Colors.Olive, Colors.NavajoWhite, Colors.Purple, Colors.Orange };
			var count = 0;
			for (var i = 0; i < p.Length; ++i)
			{
				var temp = i;
				//p[i].BackgroundColor = colors[i];
				var button = new Button { Text = "Click to update status " + i.ToString(), BackgroundColor = colors[i] };
				button.Click += (s, e) => status[temp].Text = "New count: " + (count++).ToString();
				p[i].Content = button;
			}

			var p0_1 = new Splitter { Panel1 = p[0], Panel2 = p[1], Orientation = SplitterOrientation.Vertical, Position = 200 };
			var p2_3 = new Splitter { Panel1 = p[2], Panel2 = p[3], Orientation = SplitterOrientation.Vertical, Position = 200 };
			var p01_23 = new Splitter { Panel1 = p0_1, Panel2 = p2_3, Orientation = SplitterOrientation.Horizontal, Position = 200};
			var p0123_4 = new Splitter { Panel1 = p01_23, Panel2 = p[4], Orientation = SplitterOrientation.Horizontal, Position = 400 };

			// Main panel
			var mainPanel = new Panel();
			mainPanel.Content = p0123_4;

			// Form's content
			var layout = new DynamicLayout();
			layout.Add(mainPanel, yscale: true);
			layout.Add(statusPanel);
			layout.Generate();
			var form = new Form 
			{ 
				Size = new Size(800, 600),
				Content = layout
			};
			return form;
		}
示例#12
0
		public ContextMenuSection ()
		{
			var layout = new DynamicLayout(this);
			
			layout.Add (null, null, true);
			
			layout.AddRow (null, ContextMenuPanel(), null);
			
			layout.Add (null, null, true);
		}
示例#13
0
		public UnitTestSection()
		{
			var layout = new DynamicLayout();
			var button = new Button { Text = "Start Tests" };
			layout.Add(null);
			layout.Add(button);
			layout.Add(null);

			Content = layout;

			button.Click += (s, e) =>
			{
				button.Enabled = false;
				var thread = new Thread(() =>
				{
					using (Generator.ThreadStart())
					{
						var oldOut = Console.Out;
						var oldErr = Console.Error;
						var output = new EventStringWriter();
						output.Flushed += val => Application.Instance.Invoke(() =>
						{
							foreach (var line in val.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries))
								Log.Write(null, line);
							output.Clear();
						});
						Console.SetOut(output);
						Console.SetError(output);
						try
						{
							var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
							#if DESKTOP
							var consoleRunner = NUnit.ConsoleRunner.Runner.Main(new[]
							{
								"-noshadow",
								"-nothread",
								"-nologo",
								"-nodots",
								"-domain=None",
								"-work=" + dir,
								typeof(Eto.Test.UnitTests.Startup).Assembly.Location
							});
							#endif
						}
						finally
						{
							Console.SetOut(oldOut);
							Console.SetError(oldErr);
							Application.Instance.Invoke(() => button.Enabled = true);
						}
					}
				});
				thread.Start();
			};
		}
示例#14
0
		Control LoginSection ()
		{
			var layout = new DynamicLayout (loginSection = new GroupBox{ Text = "Login"});
			
			layout.Add (null);
			layout.AddRow (new Label { Text = "UserName" }, EditUserName ());
			layout.AddRow (new Label { Text = "Password" }, EditPassword ());
			layout.Add (null);

			return layout.Container;
		}
示例#15
0
		public DockLayoutExpansion()
		{
			var layout = new DynamicLayout();

			defaultScrollable = new Scrollable();
			layout.AddSeparateRow(null, ExpandContentWidth(), ExpandContentHeight(), null);
			layout.Add(Default(), yscale: true);
			layout.Add(ExpandedWidth(), yscale: true);
			layout.Add(ExpandedHeight(), yscale: true);
			Content = layout;
		}
示例#16
0
		public TableLayoutExpansion()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			defaultScrollable = new Scrollable();
			layout.AddSeparateRow(null, ExpandContentWidth(), ExpandContentHeight(), null);
			layout.Add(Default(), yscale: true);
			layout.Add(ExpandedWidth(), yscale: true);
			layout.Add(ExpandedHeight(), yscale: true);

			Content = layout;
		}
示例#17
0
文件: MainActivity.cs 项目: Exe0/Eto
			public override void OnInitialized(EventArgs e)
			{
				base.OnInitialized(e);
				var layout = new DynamicLayout();
				layout.Add(new Label { Text = "Hello world", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center });
				layout.Add(new Label { Text = "Hello world2", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center });
				layout.Add(new Eto.Forms.Spinner { Enabled = true });
				layout.Add(null);

				MainForm = new Form { Content = layout };
				MainForm.Show();
			}
示例#18
0
		public SplitterSection()
		{
			var layout = new DynamicLayout();
			layout.Add(null);
			layout.AddCentered(Test1WithSize());
			layout.AddCentered(Test1AutoSize());
			layout.AddCentered(Test1WithFullScreenAndSize());
			layout.AddCentered(Test1FullScreenAndAutoSize());
			layout.AddCentered(Test2WithSize());
			layout.AddCentered(Test2AutoSize());
			layout.Add(null);
			Content = layout;
		}
示例#19
0
		public WebViewSection()
		{
			var layout = new DynamicLayout();

			var webContainer = WebView();
			layout.Add(Buttons());
			layout.AddSeparateRow(TitleLabel(), null, CancelLoad(), EnableContextMenu());
			layout.Add(webContainer, yscale: true);

			if (webView != null)
				LoadHtml();

			Content = layout;
		}
示例#20
0
		public LinkButtonSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.AddAutoSized(NormalButton(), centered: true);
			layout.AddAutoSized(LongerButton(), centered: true);
			layout.AddAutoSized(ColourButton(), centered: true);
			layout.AddAutoSized(DisabledButton(), centered: true);
			layout.AddAutoSized(DisabledButtonWithColor(), centered: true);
			layout.Add(StretchedButton());
			layout.Add(null);

			Content = layout;
		}
示例#21
0
        Control LoginSection()
        {
            var layout = new DynamicLayout(loginSection = new GroupBox{ Text = "Login"});
            
            layout.Add(null);
            layout.BeginVertical();
            layout.AddRow(new Label { Text = "User Name" }, EditUserName());
            layout.AddRow(new Label { Text = "Password" }, EditPassword());
            layout.EndVertical();
            layout.AddSeparateRow(null, CreateAccountButton(), null);
            layout.Add(null);

            return layout.Container;
        }
示例#22
0
		public LinkButtonSection()
		{
			var layout = new DynamicLayout();

			layout.AddAutoSized(NormalButton(), centered: true);
			layout.AddAutoSized(LongerButton(), centered: true);
			layout.AddAutoSized(ColourButton(), centered: true);
			layout.AddAutoSized(DisabledButton(), centered: true);
			layout.AddAutoSized(DisabledButtonWithColor(), centered: true);
			layout.Add(StretchedButton());
			layout.Add(null);

			Content = layout;
		}
示例#23
0
		Control SocialSection ()
		{
			var layout = new DynamicLayout (socialSection = new GroupBox{ Text = "Janrain"});

			layout.Add (null);
			layout.AddSeparateRow (new Label { Text = "App Name" }, JanrainAppName ());
			layout.Add (null);
			layout.BeginVertical ();
			layout.AddRow (null, StatusLabel (), null);
			layout.AddRow (null, AuthButton(), null);
			layout.EndVertical ();
			layout.Add (null);

			return layout.Container;
		}
示例#24
0
        void Init()
        {
	        _tbxShellData = new TextArea {Size = new Size(-1, 200)};
            _tbxMsg = new TextBox();
	        _btnShowMsgInStatus = new Button {Text = "Show Msg In Status", Width = 150};
            _btnShowMsgInStatus.Click+=btn_showMsgInStatus_Click;
			_btnShowMessageBox = new Button { Text = "Show Msg In Message", Width = 150 };
            _btnShowMessageBox.Click+=btn_showMessageBox_Click;
			_btnCreateNewTabPage = new Button { Text = "Create New TabPage", Width = 150 };
            _btnCreateNewTabPage.Click+=btn_createNewTabPage_Click;

			// Test
	        var btnTest = new Button {Text = "Test", Width = 150};
			btnTest.Click += btnTest_Click;

	        var layout = new DynamicLayout {Padding = new Padding(10, 10), Size = new Size(10, 10)};
            layout.AddRow(new Label() { Text = "ShellData"});
			layout.AddRow(_tbxShellData);
			layout.AddSeparateRow(new Label() { Text = "Msg", VerticalAlign = VerticalAlign.Middle }, _tbxMsg, null);
	        layout.AddAutoSized(_btnShowMsgInStatus);
	        layout.AddAutoSized(_btnShowMessageBox);
	        layout.AddAutoSized(_btnCreateNewTabPage);
			layout.AddAutoSized(btnTest);
			layout.Add(null);

            this.Content = layout;
        }
示例#25
0
		public BitmapSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.AddRow(
				"Load from Stream", LoadFromStream(), 
				"Custom 24-bit", CreateCustom24(),
				null
			);

			layout.AddRow(
				"Custom 32-bit", CreateCustom32(),
				"Custom 32-bit alpha", CreateCustom32Alpha(),
				null
			);

			layout.AddRow(
				"Clone", Cloning(),
				"Clone rectangle", TableLayout.AutoSized(CloneRectangle(), centered: true),
				null);

			layout.AddRow(
				"Draw to a rect", TableLayout.AutoSized(DrawImageToRect(), centered: true)
			);

			layout.Add(null);

			Content = layout;
		}
示例#26
0
		Control ExpandedHeight()
		{
			var layout = new DynamicLayout();

			layout.Add(new Label { BackgroundColor = Colors.Red, Text = "Expanded Height" });
			return new Scrollable { ExpandContentWidth = false, Content = layout };
		}
示例#27
0
		public TabControlSection ()
		{
			var layout = new DynamicLayout (this);
			
			layout.Add (DefaultTabs ());
			
		}
示例#28
0
		public BitmapSection()
		{
			var layout = new DynamicLayout();

			layout.AddRow(new Label { Text = "Load from Stream" }, LoadFromStream());

			layout.AddRow(
				new Label { Text = "Custom 32-bit" }, CreateCustom32(),
				new Label { Text = "Custom 32-bit alpha" }, CreateCustom32Alpha(),
				null
			);

			layout.AddRow(
				new Label { Text = "Clone" }, Cloning(),
				new Label { Text = "Clone rectangle" }, TableLayout.AutoSized(CloningRectangle(), centered: true),
				null);

			layout.AddRow(
				new Label { Text = "Clone using tiles" }, TableLayout.AutoSized(CloneTiles(), centered: true),
				new Label { Text = "Draw to a rect" }, TableLayout.AutoSized(DrawImageToRect(), centered: true),
				null);

			layout.Add(null);

			Content = layout;
		}
示例#29
0
		public MousePositionSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) };

			layout.Add(null);
			layout.AddSeparateRow(null, "Mouse Position (in screen co-ordinates)", MousePositionLabel(), null);
			layout.AddSeparateRow(null, "PointFromScreen", PointFromScreen(), null);
			layout.AddSeparateRow(null, "PointToScreen", PointToScreen(), null);
			layout.AddSeparateRow(null, "Mouse.Buttons", Buttons(), null);
			layout.AddSeparateRow(null, "Keyboard.ModifierKeys", Modifiers(), null);
			layout.Add(null);

			SetLabels();

			Content = layout;
		}
示例#30
0
		public TransformSection()
		{
			image = TestIcons.TestIcon;
			font = Fonts.Sans(10);

			var layout = new DynamicLayout();

			var drawable = new Drawable { Size = canvasSize };
			drawable.Paint += (sender, pe) => {
				pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
				MatrixTests(pe.Graphics);
			};
			layout.AddRow(new Label { Text = "Matrix" }, drawable);

			drawable = new Drawable { Size = canvasSize };
			drawable.Paint += (sender, pe) => {
				pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
				DirectTests(pe.Graphics);
			};
			layout.AddRow(new Label { Text = "Direct" }, drawable);
			layout.Add(null);

			var m = Matrix.Create();
			m.Scale(100, 100);
			var m2 = m.Clone();
			m2.Translate(10, 10);

			if (m == m2)
				throw new Exception("Grr!");

			Content = layout;
		}