private void CreateUi() { //textarea1 = new RichTextArea() { Width=this.Width/2, Height=this.Height, Text="何かしらの文字列。" }; textarea1 = new RichTextArea() { Width = 1, Height = 1, Text = "何かしらの文字列。" }; textarea1.Focus(); textarea1.KeyDown += Textarea1_KeyDown; webView1 = new WebView() { Width = 1, Height = 1, Url = new Uri("https://www.google.co.jp") }; //webView1 = new WebView() { Width=this.Width/2, Height=this.Height, Url=new Uri("https://www.google.co.jp") } ; var splitter = new Eto.Forms.Splitter(); splitter.Panel1 = textarea1; splitter.Panel2 = webView1; //splitter.Panel1.Width = this.Width / 2; fontDialog1 = new FontDialog(); fontDialog1.FontChanged += Dialog_FontChanged; Content = new TableLayout() { Padding = 0, Spacing = new Size(0, 0), Rows = { new TableRow(splitter), } }; }
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; }
private void CreateUi() { //textarea1 = new RichTextArea() { Width=this.Width/2, Height=this.Height, Text="何かしらの文字列。" }; textarea1 = new RichTextArea() { Width = 1, Height = 1, Text = "何かしらの文字列。" }; textarea1.Focus(); textarea1.KeyDown += Textarea1_KeyDown; webView1 = new WebView() { Width = 1, Height = 1, Url = new Uri("https://www.google.co.jp") }; //webView1 = new WebView() { Width=this.Width/2, Height=this.Height, Url=new Uri("https://www.google.co.jp") } ; var splitter = new Eto.Forms.Splitter(); splitter.Panel1 = textarea1; splitter.Panel2 = webView1; //splitter.Panel1.Width = this.Width / 2; fontDialog1 = new FontDialog(); fontDialog1.FontChanged += Dialog_FontChanged; textareaContextMenu1 = new ContextMenu(); Command showFontDialog = new Command(); showFontDialog.MenuText = "フォント"; showFontDialog.Executed += Command_Executed; textareaContextMenu1.Items.Add(showFontDialog); // デフォルトMouseDownイベントを消せない…… //textarea1.MouseDown -= textarea1.MouseDown; //textarea1.MouseDown += null; //foreach (Delegate d in (textarea1.MouseDown as Eto.Widget.Hander).GetInvocationList()) { //EventHandler.RemoveAll(); //foreach (EventHandler<Eto.Forms.MouseEventArgs> d in (textarea1.MouseDown as Eto.Widget.Hander).GetInvocationList()) { //foreach (EventHandler<Eto.Forms.MouseEventArgs> d in (textarea1.MouseDown as EventHandler<Eto.Forms.MouseEventArgs>).GetInvocationList()) { // textarea1.MouseDown -= d; //}; //textarea1.MouseDown as EventHandler //EventHandler a = new EventHandler((object sender, EventArgs e)=>{}); //a.GetInvocationList(); //Delegate.RemoveAll(textarea1.MouseDown); //textarea1.MouseDown.GetInvocationList() //textarea1.GetType().GetRuntimeFields() //textarea1.GetType().GetRuntimeProperties() //foreach (EventInfo info in textarea1.GetType().GetRuntimeEvents()) { //} textarea1.MouseDown += Textarea1_MouseDown; Content = new TableLayout() { Padding = 0, Spacing = new Size(0, 0), Rows = { new TableRow(splitter), } }; }
void GenerateContent() { var splitter = new Splitter(); splitter.Panel1 = Notes.ListBox; splitter.Panel2 = Notes.TextArea; splitter.Position = 200; Content = splitter; splitter.Panel1.Focus(); }
private void GenerateContent() { var splitter = new Splitter(); splitter.Panel1 = Notes.ListBox; splitter.Panel2 = Notes.TextArea; splitter.Position = 200; this.AddDockedControl(splitter); this.Shown += delegate { splitter.Panel1.Focus(); }; }
public TopSection(Configuration config) { this.Config = config; Channels = new Channels(config); Channels.ChannelChanged += HandleChannelChanged; splitter = new Splitter{ Panel1 = Channels , Position = 160 }; Content = splitter; SetView(); }
public TopSection(Configuration config) { this.Config = config; Channels = new Channels(config); Channels.ChannelChanged += HandleChannelChanged; splitter = new Splitter{ Panel1 = Channels , Position = 160 }; this.AddDockedControl(splitter); SetView(); }
public MainForm () { nav = new Navigation (); if (Splitter.Supported) { // ipad and tablets usually support this splitter = new Splitter(); splitter.Panel1 = nav; splitter.Panel2 = new Panel(); Content = splitter; } else { // show list directly for smartphones Content = nav; } SetContent(); }
Control MainContent () { var splitter = new Splitter { Position = 200, FixedPanel = SplitterFixedPanel.Panel1 }; var sectionList = new SectionList (this.ContentContainer); // set focus when the form is shown this.Shown += delegate { sectionList.Focus (); }; splitter.Panel1 = sectionList; splitter.Panel2 = RightPane (); return splitter; }
void Init() { _textAreaInput = new TextArea(); _textAreaInput.Font = new Font(FontFamilies.Monospace, 10); _dropDownServices = new DropDown {Width = 200}; _dropDownServices.SelectedIndexChanged += DropDownServicesSelectedIndexChanged; _radioButtonEncode = new RadioButton {Text = "Encode"}; _radioButtonEncode.CheckedChanged += _radioButtonEncode_CheckedChanged; _radioButtonDecode = new RadioButton(_radioButtonEncode) {Text = "Decode"}; _buttonRun = new Button { Text = "Run" }; _buttonRun.Click += _buttonRun_Click; _textAreaOutput = new TextArea(); _textAreaOutput.Font = new Font(FontFamilies.Monospace, 10); var inputLayout = new DynamicLayout {Padding = new Padding(5, 5, 5, 0), Spacing = new Size(5, 5)}; inputLayout.AddSeparateRow(_textAreaInput); var outputLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)}; outputLayout.BeginVertical(); outputLayout.BeginHorizontal(); outputLayout.AddCentered(_radioButtonEncode, horizontalCenter: false); outputLayout.AddCentered(_radioButtonDecode, horizontalCenter: false); outputLayout.Add(null); outputLayout.AddCentered(_dropDownServices, horizontalCenter: false); outputLayout.AddCentered(_buttonRun, horizontalCenter: false); outputLayout.EndHorizontal(); outputLayout.EndVertical(); outputLayout.AddSeparateRow(_textAreaOutput); var layout = new Splitter { Panel1 = inputLayout, Panel2 = outputLayout, Orientation = SplitterOrientation.Vertical, Position = 130 }; Content = layout; }
Button TestHiding() { var control = new Button { Text = "Test Hiding" }; control.Click += (sender, e) => { var form = new Form(); using (Context) { var splitter = new Splitter { Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.None, RelativePosition = 0.5, Panel1 = new Panel { Padding = 20, BackgroundColor = Colors.Red, Content = new Panel { BackgroundColor = Colors.White, Size = new Size(200, 400) } }, Panel2 = new Panel { Padding = 20, BackgroundColor = Colors.Blue, Content = new Panel { BackgroundColor = Colors.White, Size = new Size(200, 400) } } }; var showPanel1 = new CheckBox { Text = "Panel1.Visible" }; showPanel1.CheckedBinding.Bind(splitter.Panel1, r => r.Visible); var showPanel2 = new CheckBox { Text = "Panel2.Visible" }; showPanel2.CheckedBinding.Bind(splitter.Panel2, r => r.Visible); var fixedPanel = new EnumDropDown<SplitterFixedPanel>(); fixedPanel.SelectedValueBinding.Bind(splitter, r => r.FixedPanel); var orientation = new EnumDropDown<Orientation>(); orientation.SelectedValueBinding.Bind(splitter, r => r.Orientation); var splitPanel = new Panel { Content = splitter }; var showSplitter = new CheckBox { Text = "Show Splitter", Checked = true }; showSplitter.CheckedChanged += (sender2, e2) => { if (showSplitter.Checked == true) splitPanel.Content = splitter; else splitPanel.Content = null; }; var buttons = new StackLayout { Orientation = Orientation.Horizontal, Items = { showSplitter, showPanel1, showPanel2, fixedPanel, orientation } }; form.Content = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { buttons, new StackLayoutItem(splitPanel, true) } }; } form.Show(); }; return control; }
static Control TestInitResize() { var app = Application.Instance; var control = new Button { Text = "Show splitter test of initial resize" }; Func<Splitter, Control> makebox = split => { var area = new TextArea(); area.SizeChanged += (s, e) => { var size = area.VisualParent.Size; if (split.Orientation == Orientation.Horizontal) size.Width -= split.SplitterWidth; else size.Height -= split.SplitterWidth; if (size.Width <= 0 || size.Height <= 0) return; app.AsyncInvoke(() => { area.Text = string.Format( "W:{0} ({1}%)\r\nH:{2} ({3}%)", area.Width, (area.Width * 200 + size.Width) / (size.Width + size.Width), area.Height, (area.Height * 200 + size.Height) / (size.Height + size.Height)); }); }; return area; }; Func<int, Form> makeform = i => { var wa = new Rectangle(Screen.PrimaryScreen.WorkingArea); var form = new Form { Title = "Test Form #" + (i + 1), Bounds = i == 0 ? new Rectangle(wa.X + 20, wa.Y + 20, wa.Width / 3, wa.Height / 3) : i == 1 ? new Rectangle(wa.X + 20, wa.Y + 40 + wa.Height / 3, wa.Width / 3, wa.Height * 2 / 3 - 60) : new Rectangle(wa.X + wa.Width / 3 + 40, wa.Y + 20, wa.Width * 2 / 3 - 60, wa.Height - 40) }; using (Context) { var main = new Splitter { Position = 80 }; var middle = new Splitter { FixedPanel = SplitterFixedPanel.Panel2, Width = 200, Position = 120 - main.SplitterWidth }; var ltop = new Splitter { Orientation = Orientation.Vertical, Position = 80 }; var lbottom = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.Panel2, RelativePosition = 80 }; var right = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.None, Height = 300 + main.SplitterWidth, Position = 100 // ~33% }; var center = new Splitter { FixedPanel = SplitterFixedPanel.None, RelativePosition = .4 }; main.Panel1 = ltop; main.Panel2 = middle; ltop.Panel1 = makebox(ltop); ltop.Panel2 = lbottom; lbottom.Panel1 = makebox(lbottom); lbottom.Panel2 = makebox(lbottom); middle.Panel1 = center; middle.Panel2 = right; right.Panel1 = makebox(right); right.Panel2 = makebox(right); center.Panel1 = makebox(center); center.Panel2 = makebox(center); form.Content = main; } form.Show(); return form; }; control.Click += (sender, e) => { var forms = new Form[3]; for (int i = 0; i < 3; i++) { forms[i] = makeform(i); forms[i].Closed += (fs, fe) => { var all = forms; forms = null; if (all != null) for (int j = 0; j < 3; j++) if (all[j] != fs) all[j].Close(); }; } }; return control; }
public Control Layout(Func<int, Control> getContent) { // Add splitters like this: // |--------------------------- // | | | | // | P0 | P2 | P4 | // | -------| |----------| <== These are on MainPanel // | P1 |------| P5 | // | | P3 | | // |--------------------------- // | status0..5, | <== These are on StatusPanel // ---------------------------- for (var i = 0; i < Panels.Length; ++i) Panels[i].Content = getContent(i); using (Context) { // basic test (compatible mode) var p0_1 = new Splitter { Panel1 = Panels[0], Panel2 = Panels[1], Orientation = Orientation.Vertical, Position = 200 }; // absolute position with height and second panel fixed (issue #309) var p2_3 = new Splitter { Panel1 = Panels[2], Panel2 = Panels[3], Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.Panel2, //Position = 0, Height = 205 // ~ RelativePosition=200 }; // ratio mode (60%) var p4_5 = new Splitter { Panel1 = Panels[4], Panel2 = Panels[5], Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.None, RelativePosition = .6 }; // auto-size test var p01_23 = new Splitter { Panel1 = p0_1, Panel2 = p2_3, Orientation = Orientation.Horizontal, }; // relative position with second panel fixed var p0123_45 = new Splitter { Panel1 = p01_23, Panel2 = p4_5, Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel2, RelativePosition = 150 }; return Root = p0123_45; } }
protected override Control CreateLayout() { var split = new Splitter { FixedPanel = SplitterFixedPanel.Panel2 }; split.Panel1 = base.CreateLayout(); split.Panel2 = UserList = new UserList(Channel); return split; }
/// <summary> /// Raises the position changed event. /// </summary> public void OnPositionChanged(Splitter widget, EventArgs e) { widget.Platform.Invoke(() => widget.OnPositionChanged(e)); }
public void SplitterShouldRegisterChangeNotifications() { bool success = false; string message = "#1"; Form(form => { var posLabel = new Label(); var label = new Label { Text = "Drag the splitter right", TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; int stage = 0; var splitter = new Splitter { Panel1 = new Panel { BackgroundColor = SystemColors.ControlBackground, Size = new Size(100, 100) }, Panel2 = new Panel { BackgroundColor = SystemColors.ControlBackground } }; int? startingPosition = null; form.Shown += (sender, e) => { startingPosition = splitter.Position; posLabel.Text = startingPosition?.ToString(); if (startingPosition == 0) { message = "#2 - Initial splitter position not set properly before Shown event"; form.Close(); } }; splitter.PositionChanged += (sender, e) => { posLabel.Text = splitter.Position.ToString(); if (success || startingPosition == null) return; switch (stage) { case 0: if (splitter.Position > startingPosition.Value) { label.Text = "Now, slide to the left"; startingPosition = splitter.Position; stage++; } break; case 1: if (splitter.Position < startingPosition.Value) { success = true; form.Close(); } break; } }; form.Size = new Size(300, 300); form.Content = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Items = { new StackLayout { Orientation = Orientation.Horizontal, Padding = 10, Items = { new StackLayoutItem(label, true), posLabel } }, new StackLayoutItem(splitter, true) } }; }, -1); Assert.IsTrue(success, message); }
static Form Test2(bool setSize) { var leftPane = new DynamicLayout { Padding = Padding.Empty, DefaultPadding = Padding.Empty }; leftPane.AddColumn(new TreeGridView()); var rightTop = new DynamicLayout(); rightTop.AddColumn(ComboWithItems(), new Panel()); var rightBottom = new DynamicLayout(); rightBottom.AddRow(new ComboBox(), ComboWithItems(), new Button(), new CheckBox(), null); var rightPane = new Splitter { Orientation = SplitterOrientation.Vertical, FixedPanel = SplitterFixedPanel.Panel2, Panel1 = rightTop, Panel2 = rightBottom, Position = 200, }; var form = new Form { Padding = new Padding(5), Content = new Splitter { Orientation = SplitterOrientation.Horizontal, FixedPanel = SplitterFixedPanel.Panel1, BackgroundColor = Colors.Gray, Position = 200, Panel1 = leftPane, Panel2 = rightPane } }; if (setSize) form.Size = new Size(600, 400); return form; }
void Init() { //_buttonConnect _buttonConnect = new Button { Text = StrRes.GetString("StrConnect","Connect"), Image = Icons.ConnectIcon }; _buttonConnect.Click += ButtonConnect_Click; //_buttonDisconnect _buttonDisconnect = new Button { Text = StrRes.GetString("StrDisconnect","Disconnect"), Image = Icons.DisconnectIcon }; _buttonDisconnect.Click += _buttonDisconnect_Click; //_dropDownDbs _dropDownDbs = new DropDown {Width = 200}; //_buttonRunScript _buttonRunScript = new Button {Text = StrRes.GetString("StrExecute","Execute"), Image = Icons.RunScripIcon}; _buttonRunScript.Click += _buttonRunScript_Click; //_itemSaveAsCsv _itemSaveAsCsv = new ButtonMenuItem { Text = StrRes.GetString("StrSaveAsCsv","SaveAs .Csv") }; _itemSaveAsCsv.Click += _itemSaveAsCsv_Click; //_itemViewTable _itemViewTable = new ButtonMenuItem { Text = StrRes.GetString("StrViewTable","ViewTable") }; _itemViewTable.Click += _itemViewTable_Click; _itemViewTable.Enabled = false; //_itemCopyName _itemCopyName = new ButtonMenuItem { Text = StrRes.GetString("StrCopyName","CopyName") }; _itemCopyName.Click += _itemCopyName_Click; //_menuDbView _menuDbView = new ContextMenu(); _menuDbView.Items.Add(_itemCopyName); _menuDbView.Items.Add(_itemViewTable); //_menuResultView _menuResultView = new ContextMenu(); _menuResultView.Items.Add(_itemSaveAsCsv); //_treeViewDbs _treeViewDbs = new TreeView(); _treeViewDbs.ContextMenu = _menuDbView; _treeViewDbs.SelectionChanged += _treeViewDbs_SelectionChanged; _treeViewDbs.Activated += _treeViewDbs_Activated; _treeViewDbs.MouseUp += (sender, e) => { if (e.Buttons == MouseButtons.Alternate) { _treeViewDbs.ContextMenu.Show(_treeViewDbs); } }; //_textAreaSql _textAreaSql = new TextArea {Font = new Font(FontFamilies.Sans, 12, FontStyle.Bold | FontStyle.Italic)}; //_gridViewResult _gridViewResult = new GridView(); _gridViewResult.ContextMenu = _menuResultView; _gridViewResult.Style = "GridViewResult"; _gridViewResult.MouseUp += (sender, e) => { if (e.Buttons == MouseButtons.Alternate) { _gridViewResult.ContextMenu.Show(_treeViewDbs); } }; //topLayout var topLayout = new DynamicLayout(); topLayout.BeginHorizontal(); topLayout.AddCentered(_buttonConnect, horizontalCenter: false); topLayout.AddCentered(_buttonDisconnect, horizontalCenter: false); topLayout.AddCentered(_dropDownDbs, horizontalCenter: false); topLayout.AddCentered(_buttonRunScript, horizontalCenter: false); topLayout.Add(null); topLayout.EndVertical(); //rightPanel var rightPanel = new Splitter { Panel1 = _textAreaSql, Panel2 = _gridViewResult, Orientation = SplitterOrientation.Vertical, Position = 100 }; //mainLayout var mainLayout = new Splitter { Panel1 = _treeViewDbs, Panel2 = rightPanel, Orientation = SplitterOrientation.Horizontal, Position = 200 }; //layout var layout = new DynamicLayout { Padding = new Padding(0, 0), Spacing = new Size(5, 5) }; layout.AddRow(topLayout); layout.AddRow(mainLayout); Content = layout; }
protected override void CreateLayout(Container container) { var split = new Splitter{ Size = new Size(200, 200), Position = 50, FixedPanel = SplitterFixedPanel.Panel2 }; split.Panel1 = new Panel(); split.Panel2 = UserList = new UserList(this.Channel); base.CreateLayout(split.Panel1 as Panel); container.AddDockedControl(split); }
/// <summary> /// Raises the position change completed event. /// </summary> public void OnPositionChangeCompleted(Splitter widget, EventArgs e) { using (widget.Platform.Context) widget.OnPositionChangeCompleted(e); }
/// <summary> /// Raises the position changing event. /// </summary> public void OnPositionChanging(Splitter widget, SplitterPositionChangingEventArgs e) { using (widget.Platform.Context) widget.OnPositionChanging(e); }
Control RightPane() { var splitter = new Splitter { Orientation = SplitterOrientation.Vertical, Position = 500, FixedPanel = SplitterFixedPanel.Panel2 }; splitter.Panel1 = contentContainer; splitter.Panel2 = this.EventLogSection(); return splitter; }
public void NoPositionShouldAutoSizeComplexTest2(Orientation orient, SplitterFixedPanel fix) { TestUtils.Shown( form => { // +====test 2====+ // | | // |-----+--------| Tested splitter is placed inside two other splitters // | | | to overcome minimal window/form size problems // | | tested | ...or non-desktop plaforms // | | | // +-----+--------+ var it = new Splitter { Orientation = orient, FixedPanel = fix, Panel1 = new Panel { Size = new Size(40, 40), BackgroundColor = Colors.White }, Panel2 = new Panel { Size = new Size(60, 60), BackgroundColor = Colors.Black } }; form.Content = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.Panel2, Panel1 = new Panel(), Panel2 = new Splitter { FixedPanel = SplitterFixedPanel.Panel2, Panel1 = new Panel(), Panel2 = it } }; return it; }, it => { Assert.AreEqual(40, it.Position, "{0}; {1}", fix, orient); Assert.AreEqual(fix == SplitterFixedPanel.Panel1 ? 40 : fix == SplitterFixedPanel.Panel2 ? 60 : 0.4, it.RelativePosition, "{0}; {1}", fix, orient); var sz = orient == Orientation.Horizontal ? new Size(100 + it.SplitterWidth, 60) : new Size(60, 100 + it.SplitterWidth); Assert.AreEqual(sz, it.Size, "{0}; {1}", fix, orient); }, replay: ReplayTests); }
public Control Layout(Func<int, Control>getContent) { // Add splitters like this: // |--------------------------- // | | | | // | P0 | P2 | P4 | // | -------| | | <== These are on MainPanel // | P1 |------| | // | | P3 | | // |--------------------------- // | status0..4, | <== These are on StatusPanel // ---------------------------- for (var i = 0; i < Panels.Length; ++i) Panels[i].Content = getContent(i); var p0_1 = new Splitter { Panel1 = Panels[0], Panel2 = Panels[1], Orientation = SplitterOrientation.Vertical, Position = 200 }; var p2_3 = new Splitter { Panel1 = Panels[2], Panel2 = Panels[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 = Panels[4], Orientation = SplitterOrientation.Horizontal, Position = 400 }; return this.Root = p0123_4; }
// Issue #309 public void PositionShouldTrackInitialResize(Orientation orient, SplitterFixedPanel fix) { bool replay = false; TestUtils.Shown( form => { var it = new Splitter() { Orientation = orient, FixedPanel = fix, Position = 50, Panel1 = new Panel { BackgroundColor = Colors.White }, Panel2 = new Panel { BackgroundColor = Colors.Black } }; it.Size = new Size(100, 100) + it.SplitterWidth; form.ClientSize = new Size(150, 150) + it.SplitterWidth; return it; }, it => { double pos = fix == SplitterFixedPanel.None ? 0.5 : 50.0; Assert.AreEqual(pos, it.RelativePosition, 1e-2, "Fix: {0}; {1} [replay={2}]", fix, orient, replay); if (ReplayTests) replay = !replay; }, replay: ReplayTests); }
Control MainContent() { contentContainer = new Panel(); // set focus when the form is shown Shown += delegate { SectionList.Focus(); }; SectionList.SelectedItemChanged += (sender, e) => { try { var item = SectionList.SelectedItem; Control content = item != null ? item.CreateContent() : null; if (navigation != null) { if (content != null) navigation.Push(content, item != null ? item.Text : null); } else { contentContainer.Content = content; } } catch (Exception ex) { Log.Write(this, "Error loading section: {0}", ex.GetBaseException()); contentContainer.Content = null; } #if DEBUG GC.Collect(); GC.WaitForPendingFinalizers(); #endif }; if (Splitter.IsSupported) { var splitter = new Splitter { Position = 200, FixedPanel = SplitterFixedPanel.Panel1, Panel1 = SectionList.Control, // for now, don't show log in mobile Panel2 = Platform.IsMobile ? contentContainer : RightPane() }; return splitter; } if (Navigation.IsSupported) { navigation = new Navigation(SectionList.Control, "Eto.Test"); return navigation; } throw new EtoException("Platform must support splitter or navigation"); }
Control RightPane() { var splitter = new Splitter { Orientation = SplitterOrientation.Vertical, Position = 500, FixedPanel = SplitterFixedPanel.Panel2 }; splitter.Panel1 = this.ContentContainer; splitter.Panel2 = DockLayout.CreatePanel (this.EventLog, new Padding (5)); return splitter; }