/// <summary> /// Initialize the item form. /// </summary> /// <param name="gui">The GUI that this form will be a part of.</param> /// <param name="position">The position of this form.</param> /// <param name="height">The height of this form.</param> /// <param name="width">The width of this form.</param> protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height) { //The inherited method. base.Initialize(gui, position, width, height); //Intialize some variables. _Item = null; //Create the tab controller. _TabControl = new TabControl(gui, position, width, height); //Create the general tab. _FrmGeneral = new Form(gui, position + new Vector2(0, 25), width, height); _PtbThumbnail = new Picturebox(gui, position, width - 10, 150); _ExpBase = new Expander(gui, position, width - 10, 15); _FldWidth = new Field(gui, width - 10, 15); _FldHeight = new Field(gui, width - 10, 15); _ExpWorld = new Expander(gui, position, width - 10, 15); _FldPosX = new Field(gui, width - 10, 15); _FldPosY = new Field(gui, width - 10, 15); _FldRotation = new Field(gui, width - 10, 15); _ExpLocal = new Expander(gui, position, width - 10, 15); _FldScaleX = new Field(gui, width - 10, 15); _FldScaleY = new Field(gui, width - 10, 15); _FldOriginX = new Field(gui, width - 10, 15); _FldOriginY = new Field(gui, width - 10, 15); //Create the physics tab. _FrmPhysics = new Form(gui, position + new Vector2(0, 25), width, height); _FldMass = new Field(gui, width - 10, 15); _FldFriction = new Field(gui, width - 10, 15); _FldRestitution = new Field(gui, width - 10, 15); _CkbIsStatic = new Checkbox(gui, position, width - 10, 15); _CkbIgnoreGravity = new Checkbox(gui, position, width - 10, 15); //Set up the components. SetUpComponents(); //Add controls to the expanders. _ExpBase.AddItem(_FldWidth); _ExpBase.AddItem(_FldHeight); _ExpWorld.AddItem(_FldPosX); _ExpWorld.AddItem(_FldPosY); _ExpWorld.AddItem(_FldRotation); _ExpLocal.AddItem(_FldScaleX); _ExpLocal.AddItem(_FldScaleY); _ExpLocal.AddItem(_FldOriginX); _ExpLocal.AddItem(_FldOriginY); //Add the controls to the forms. _FrmGeneral.AddItem(_PtbThumbnail); _FrmGeneral.AddItem(_ExpBase); _FrmGeneral.AddItem(_ExpWorld); _FrmGeneral.AddItem(_ExpLocal); _FrmPhysics.AddItem(_FldMass); _FrmPhysics.AddItem(_FldFriction); _FrmPhysics.AddItem(_FldRestitution); _FrmPhysics.AddItem(_CkbIsStatic); _FrmPhysics.AddItem(_CkbIgnoreGravity); //Add the controls to their respective tabs. _TabControl.AddTab(_FrmGeneral, "General"); _TabControl.AddTab(_FrmPhysics, "Physics"); //Add the tab control to this modifier. Add(_TabControl); //Subscribe to the component's events. _FldPosX.Textbox.FocusChange += OnUserModify; _FldPosY.Textbox.FocusChange += OnUserModify; _FldRotation.Textbox.FocusChange += OnUserModify; _FldScaleX.Textbox.FocusChange += OnUserModify; _FldScaleY.Textbox.FocusChange += OnUserModify; _FldOriginX.Textbox.FocusChange += OnUserModify; _FldOriginY.Textbox.FocusChange += OnUserModify; _FldMass.Textbox.FocusChange += OnUserModify; _FldFriction.Textbox.FocusChange += OnUserModify; _FldRestitution.Textbox.FocusChange += OnUserModify; _CkbIsStatic.CheckboxTick += OnUserModify; _CkbIgnoreGravity.CheckboxTick += OnUserModify; }
/// <summary> /// Initialize the list item. /// </summary> /// <param name="gui">The GUI that this list item will be a part of.</param> /// <param name="position">The position of this list item.</param> /// <param name="height">The height of this list item.</param> /// <param name="width">The width of this list item.</param> protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height) { //The inherited method. base.Initialize(gui, position, width, height); //Intialize some variables. _Checkbox = new Checkbox(gui, Position, Width, Height); }
/// <summary> /// Initialize the treeview node. /// </summary> /// <param name="gui">The GUI that this node will be a part of.</param> /// <param name="position">The position of this trenodeeview.</param> /// <param name="height">The height of this treenodeview.</param> /// <param name="width">The width of this treevnodeiew.</param> protected override void Initialize(GraphicalUserInterface gui, Vector2 position, float width, float height) { //The inherited method. base.Initialize(gui, position, width, height); //Intialize some variables. _Nodes = new List<TreeNode>(); _Button = new Button(gui, new Vector2(Position.X, Position.Y + (Height / 3))); _Checkbox = new Checkbox(gui, new Vector2(Position.X + _Button.Width + 2, Position.Y), width, height); _NodeState = TreeNodeState.None; //Add the items to the list. Add(_Button); Add(_Checkbox); //Hook up some events. _Checkbox.CheckboxTick += OnCheckboxTicked; _Button.MouseClick += OnButtonMouseClick; }