1 /** DGui project file. 2 3 Copyright: Trogu Antonio Davide 2011-2013 4 5 License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0). 6 7 Authors: Trogu Antonio Davide 8 */ 9 module splitter; 10 11 import std..string; 12 import dgui.all; 13 import dgui.layout.splitpanel; 14 15 class MainForm: Form 16 { 17 private SplitPanel _spVPanel; 18 private SplitPanel _spHPanel; 19 private RichTextBox _rtbText; 20 private RichTextBox _rtbText2; 21 private TreeView _tvwTree; 22 23 public this() 24 { 25 this.text = "DGui SplitPanel Example"; 26 this.size = Size(500, 500); 27 this.startPosition = FormStartPosition.centerScreen; 28 29 this._spVPanel = new SplitPanel(); 30 this._spVPanel.dock = DockStyle.fill; 31 this._spVPanel.splitPosition = 200; 32 this._spVPanel.splitOrientation = SplitOrientation.vertical; // Split Window vertically (this is the default option) 33 this._spVPanel.parent = this; 34 35 // Add another Splitter Panel in Panel1 of the Vertical Splitter Panel (aka. Right Panel) 36 this._spHPanel = new SplitPanel(); 37 this._spHPanel.dock = DockStyle.fill; 38 this._spHPanel.splitPosition = 300; 39 this._spHPanel.splitOrientation = SplitOrientation.horizontal; // Split Window horizontally (this is the default option) 40 this._spHPanel.parent = this._spVPanel.panel2; // The parent of the Horizontal Splitter Panel is the left panel of the Vertical Splitter Panel 41 42 // Add a TreeView in Panel1 of the Vertical Splitter Panel (aka. Left Panel) 43 this._tvwTree = new TreeView(); 44 this._tvwTree.dock = DockStyle.fill; 45 this._tvwTree.parent = this._spVPanel.panel1; 46 47 for(int i = 0; i < 4; i++) 48 { 49 TreeNode node1 = this._tvwTree.addNode(format("Node %d", i)); 50 51 for(int j = 0; j < 5; j++) 52 { 53 node1.addNode(format("Node %d -> %d", i, j)); 54 } 55 } 56 57 // Add a RichTextBox in Panel1 of the Horizontal Splitter Panel (aka. Top Panel) 58 this._rtbText = new RichTextBox(); 59 this._rtbText.dock = DockStyle.fill; 60 this._rtbText.readOnly = true; 61 this._rtbText.text = "This is a RichTextBox inside a Horizontal Splitter Panel (Top Panel)!"; 62 this._rtbText.parent = this._spHPanel.panel1; // The parent of the RichTextBox is the Top Panel of the Horizontal Splitter Panel 63 64 // Add a RichTextBox in Panel2 of the Horizontal (aka. Bottom Panel) 65 this._rtbText = new RichTextBox(); 66 this._rtbText.dock = DockStyle.fill; 67 this._rtbText.readOnly = true; 68 this._rtbText.text = "This is a RichTextBox inside a Horizontal Splitter Panel (Bottom Panel)!"; 69 this._rtbText.parent = this._spHPanel.panel2; // The parent of the RichTextBox is the Bottom Panel of the Horizontal Splitter Panel 70 71 } 72 } 73 74 int main(string[] args) 75 { 76 return Application.run(new MainForm()); 77 }