Esempio n. 1
0
        public void MoveToDownerLine(CommandBarStripElement element, CommandBarRowElement currentHolder)
        {
            int index = this.Rows.IndexOf(currentHolder) + 1;

            if (index >= this.Rows.Count && currentHolder.Strips.Count == 1)
            {
                this.CreateFloatingStrip(element, currentHolder, Control.MousePosition);
            }
            else
            {
                if (index >= this.Rows.Count)
                {
                    this.Rows.Add(RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this));
                    index = this.Rows.Count - 1;
                }
                bool capture = element.Grip.Capture;
                currentHolder.Strips.Remove((RadItem)element);
                this.Rows[index].Strips.Add(element);
                if (currentHolder.Strips.Count == 0)
                {
                    this.Rows.Remove((RadItem)currentHolder);
                }
                element.Grip.Capture = capture;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Moves a specific <see cref="CommandBarStripElement"/> to the lower <see cref="CommandBarRowElement"/>.
        /// </summary>
        /// <param name="element">The element to move.</param>
        /// <param name="currentHolder">The <see cref="CommandBarRowElement"/> that contains the element to move.</param>
        public void MoveToDownerLine(CommandBarStripElement element, CommandBarRowElement currentHolder)
        {
            Debug.Assert(currentHolder.Strips.Contains(element), "Current holder must contains element");

            int index = this.Rows.IndexOf(currentHolder);

            Debug.Assert(index > -1, "Lines must contains currentHolder");

            int nextHolderPanelIndex = index + 1;

            if (nextHolderPanelIndex >= this.Rows.Count && currentHolder.Strips.Count == 1)
            {
                CreateFloatingStrip(element, currentHolder, Control.MousePosition);
                return;
            }

            if (nextHolderPanelIndex >= this.Rows.Count)
            {
                CommandBarRowElement newPanel = RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this);
                this.Rows.Add(newPanel);
                nextHolderPanelIndex = this.Rows.Count - 1;
            }


            bool capture = element.Grip.Capture;

            currentHolder.Strips.Remove(element);
            CommandBarRowElement panelToAdd = this.Rows[nextHolderPanelIndex];

            Debug.Assert(panelToAdd != null, "Panel to add cannot be null");
            panelToAdd.Strips.Add(element);

            if (currentHolder.Strips.Count == 0)
            {
                this.Rows.Remove(currentHolder);
            }



            element.Grip.Capture = capture;
        }
Esempio n. 3
0
        /// <summary>
        /// Moves a specific <see cref="CommandBarStripElement"/> to the upper <see cref="CommandBarRowElement"/>.
        /// </summary>
        /// <param name="element">The element to move.</param>
        /// <param name="currentHolder">The <see cref="CommandBarRowElement"/> that contains the element to move.</param>
        public void MoveToUpperLine(CommandBarStripElement element, CommandBarRowElement currentHolder)
        {
            Debug.Assert(currentHolder.Strips.Contains(element), "Current holder must contains element");

            int index = this.Rows.IndexOf(currentHolder);

            Debug.Assert(index > -1, "Rows must contain currentHolder");

            int prevHolderPanelIndex = index - 1;

            if (prevHolderPanelIndex < 0 && currentHolder.Strips.Count == 1)
            {
                CreateFloatingStrip(element, currentHolder, Control.MousePosition);
                return;
            }

            if (prevHolderPanelIndex < 0)
            {
                CommandBarRowElement newPanel = RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this);
                this.Rows.Insert(0, newPanel);
                prevHolderPanelIndex = 0;
            }

            bool capture = element.Grip.Capture;

            currentHolder.Strips.Remove(element);
            CommandBarRowElement panelToAdd = this.Rows[prevHolderPanelIndex];

            Debug.Assert(panelToAdd != null, "Panel to add cannot be null");
            panelToAdd.Strips.Add(element);
            if (currentHolder.Strips.Count == 0)
            {
                this.Rows.Remove(currentHolder);
            }
            // this.ElementTree.Control.FindForm();
            element.Grip.Capture = capture;
        }