MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CreateChildPanel

Method CreateChildPanel

Source/Editor/GUI/Docking/DockPanel.cs:388–451  ·  view source on GitHub ↗

Create child dock panel Dock panel state Initial splitter value Child panel

(DockState state, float splitterValue)

Source from the content-addressed store, hash-verified

386 /// <param name="splitterValue">Initial splitter value</param>
387 /// <returns>Child panel</returns>
388 public DockPanel CreateChildPanel(DockState state, float splitterValue)
389 {
390 CreateTabsProxy();
391
392 // Create child dock panel
393 var dockPanel = new DockPanel(this);
394
395 // Switch dock mode
396 Control c1;
397 Control c2;
398 Orientation o;
399 switch (state)
400 {
401 case DockState.DockTop:
402 {
403 o = Orientation.Vertical;
404 c1 = dockPanel;
405 c2 = _tabsProxy;
406 break;
407 }
408 case DockState.DockBottom:
409 {
410 splitterValue = 1 - splitterValue;
411 o = Orientation.Vertical;
412 c1 = _tabsProxy;
413 c2 = dockPanel;
414 break;
415 }
416 case DockState.DockLeft:
417 {
418 o = Orientation.Horizontal;
419 c1 = dockPanel;
420 c2 = _tabsProxy;
421 break;
422 }
423 case DockState.DockRight:
424 {
425 splitterValue = 1 - splitterValue;
426 o = Orientation.Horizontal;
427 c1 = _tabsProxy;
428 c2 = dockPanel;
429 break;
430 }
431 default: throw new ArgumentOutOfRangeException();
432 }
433
434 // Create splitter and link controls
435 var parent = _tabsProxy.Parent;
436 var splitter = new SplitPanel(o, ScrollBars.None, ScrollBars.None)
437 {
438 AnchorPreset = AnchorPresets.StretchAll,
439 Offsets = Margin.Zero,
440 SplitterValue = splitterValue,
441 };
442 splitter.Panel1.AddChild(c1);
443 splitter.Panel2.AddChild(c2);
444 parent.AddChild(splitter);
445

Callers 1

LoadPanelMethod · 0.80

Calls 3

AddChildMethod · 0.45
PerformLayoutMethod · 0.45

Tested by

no test coverage detected