Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TreeNode"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public TreeNode(ControlBase parent)
            : base(parent)
        {
            // Make sure that the tree control has only one root node.
            if (m_TreeControl == null && parent is TreeControl)
            {
                m_TreeControl = parent as TreeControl;
                m_Root        = true;
            }
            else
            {
                m_ToggleButton          = new TreeToggleButton(this);
                m_ToggleButton.Toggled += OnToggleButtonPress;

                m_Title = new TreeNodeLabel(this);
                m_Title.DoubleClicked += OnDoubleClickName;
                m_Title.Clicked       += OnClickName;
            }

            m_InnerPanel = new Layout.VerticalLayout(this);
            m_InnerPanel.Collapse(!m_Root, false); // Root node is always expanded

            m_Selected   = false;
            m_Selectable = true;
        }
Beispiel #2
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            TreeControl element = new TreeControl(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "TreeNode")
                    {
                        parser.ParseElement <TreeNode>(element);
                    }
                }
            }
            return(element);
        }