Пример #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;
            }
        }
        protected virtual void toolstripsDownList_SelectedValueChanged(object sender, EventArgs e)
        {
            if (stripsDropDownList.SelectedItem == null)
            {
                return;
            }

            CommandBarStripElement stripElement = (stripsDropDownList.SelectedItem.Value as CommandBarStripElement);

            if (stripElement == null)
            {
                return;
            }

            List <RadCommandBarBaseItem> items = new List <RadCommandBarBaseItem>();

            foreach (RadCommandBarBaseItem item in stripElement.Items)
            {
                items.Add(item);
            }
            foreach (RadCommandBarBaseItem item in stripElement.OverflowButton.OverflowPanel.Layout.Children)
            {
                items.Add(item);
            }

            stripItemsListControl.DataSource = items;
        }
Пример #3
0
        public RadCommandBarOverflowButton(CommandBarStripElement owner)
        {
            this.dialogProvider = new CommandBarCustomizeDialogProvider();

            this.owner = owner;
            this.dropDownMenuElement             = new RadDropDownMenu();
            this.dropDownMenuElement.MinimumSize = this.owner.OverflowMenuMinSize;
            this.dropDownMenuElement.MaximumSize = this.owner.OverflowMenuMaxSize;
            this.dropDownMenuElement.RightToLeft = this.RightToLeft ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No;

            panel = new RadCommandBarOverflowPanelElement();
            RadMenuSeparatorItem separator = new RadMenuSeparatorItem();

            panel.Visibility     = ElementVisibility.Collapsed;
            separator.Visibility = ElementVisibility.Collapsed;
            this.dropDownMenuElement.Items.Add(panel);
            this.dropDownMenuElement.Items.Add(separator);

            addRemoveButtonsMenuItem = new RadMenuItem(CommandBarLocalizationProvider.CurrentProvider.GetLocalizedString(CommandBarStringId.OverflowMenuAddOrRemoveButtonsText));

            this.dropDownMenuElement.Items.Add(addRemoveButtonsMenuItem);

            this.dropDownMenuElement.Items.Add(new RadMenuSeparatorItem());

            this.customizeButtonMenuItem = new RadMenuItem(CommandBarLocalizationProvider.CurrentProvider.GetLocalizedString(CommandBarStringId.OverflowMenuCustomizeText));


            this.dropDownMenuElement.Items.Add(customizeButtonMenuItem);

            this.layout         = panel.Layout;
            this.layout.MaxSize = this.owner.OverflowMenuMaxSize;

            WireEvents();
        }
Пример #4
0
        public RadCommandBarOverflowButton(CommandBarStripElement owner)
        {
            this.dialogProvider      = new CommandBarCustomizeDialogProvider();
            this.owner               = owner;
            this.dropDownMenuElement = new RadDropDownMenu((RadElement)this);
            this.dropDownMenuElement.HorizontalAlignmentCorrectionMode = AlignmentCorrectionMode.SnapToEdges;
            this.dropDownMenuElement.MinimumSize = this.owner.OverflowMenuMinSize;
            this.dropDownMenuElement.MaximumSize = this.owner.OverflowMenuMaxSize;
            this.dropDownMenuElement.RightToLeft = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
            this.panel = new RadCommandBarOverflowPanelElement();
            RadMenuSeparatorItem menuSeparatorItem = new RadMenuSeparatorItem();

            this.panel.Visibility        = ElementVisibility.Collapsed;
            menuSeparatorItem.Visibility = ElementVisibility.Collapsed;
            this.dropDownMenuElement.Items.Add((RadItem)this.panel);
            this.dropDownMenuElement.Items.Add((RadItem)menuSeparatorItem);
            this.addRemoveButtonsMenuItem = new RadMenuItem(LocalizationProvider <CommandBarLocalizationProvider> .CurrentProvider.GetLocalizedString("OverflowMenuAddOrRemoveButtonsText"));
            this.dropDownMenuElement.Items.Add((RadItem)this.addRemoveButtonsMenuItem);
            this.dropDownMenuElement.Items.Add((RadItem) new RadMenuSeparatorItem());
            this.customizeButtonMenuItem = new RadMenuItem(LocalizationProvider <CommandBarLocalizationProvider> .CurrentProvider.GetLocalizedString("OverflowMenuCustomizeText"));
            this.dropDownMenuElement.Items.Add((RadItem)this.customizeButtonMenuItem);
            this.layout         = this.panel.Layout;
            this.layout.MaxSize = this.owner.OverflowMenuMaxSize;
            this.WireEvents();
        }
Пример #5
0
 protected virtual void CreateSecondBottomStripElementChildElements()
 {
     if (this.Navigator.Site == null)
     {
         this.secondBottomStripElement = new CommandBarStripElement();
         this.commandBarRowElement.Strips.Add(this.secondBottomStripElement);
         this.addNewButton = new CommandBarButton();
         this.secondBottomStripElement.Items.Add((RadCommandBarBaseItem)this.addNewButton);
         this.secondBottomStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
         this.deleteButton = new CommandBarButton();
         this.secondBottomStripElement.Items.Add((RadCommandBarBaseItem)this.deleteButton);
     }
     else
     {
         this.secondBottomStripElement = (CommandBarStripElement)this.designerHost.CreateComponent(typeof(CommandBarStripElement), this.Navigator.Name + "SecondStrip");
         this.addNewButton             = (CommandBarButton)this.designerHost.CreateComponent(typeof(CommandBarButton), this.Navigator.Name + "AddNewItem");
         this.deleteButton             = (CommandBarButton)this.designerHost.CreateComponent(typeof(CommandBarButton), this.Navigator.Name + "DeleteItem");
         this.commandBarRowElement.Strips.Add(this.secondBottomStripElement);
         this.secondBottomStripElement.Items.Add((RadCommandBarBaseItem)this.addNewButton);
         this.secondBottomStripElement.Items.Add((RadCommandBarBaseItem)this.designerHost.CreateComponent(typeof(CommandBarSeparator)));
         this.secondBottomStripElement.Items.Add((RadCommandBarBaseItem)this.deleteButton);
     }
     this.secondBottomStripElement.MinSize         = Size.Empty;
     this.secondBottomStripElement.EnableDragging  = false;
     this.secondBottomStripElement.EnableFloating  = false;
     this.secondBottomStripElement.DesiredLocation = new PointF(10000f, 0.0f);
     this.addNewButton.Margin = new Padding(3, 0, 0, 0);
     this.secondBottomStripElement.Grip.Visibility           = ElementVisibility.Collapsed;
     this.secondBottomStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed;
 }
Пример #6
0
        private void strips_ItemsChanged(CommandBarStripElementCollection changed, CommandBarStripElement target, ItemsChangeOperation operation)
        {
            if (operation == ItemsChangeOperation.Inserted || operation == ItemsChangeOperation.Set)
            {
                target.Orientation = this.orientation;
                if (this.owner != null)
                {
                    this.owner.StripInfoHolder.AddStripInfo(target);
                }
            }

            if (operation == ItemsChangeOperation.Removed || operation == ItemsChangeOperation.Setting)
            {
                if (this.owner != null)
                {
                    this.owner.StripInfoHolder.RemoveStripInfo(target);
                }
            }

            if (operation == ItemsChangeOperation.Clearing && this.owner != null)
            {
                foreach (CommandBarStripElement strip in this.strips)
                {
                    this.owner.StripInfoHolder.RemoveStripInfo(strip);
                }
            }
        }
Пример #7
0
        public virtual void MoveToUpperLine(CommandBarStripElement element, CommandBarRowElement currentHolder)
        {
            Debug.Assert(currentHolder.Children.Contains(element), "Current holder must contains element");
            int index = this.lines.IndexOf(currentHolder);

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

            int prevLineIndex = index - 1;

            if (prevLineIndex < 0)
            {
                //this.lines.Insert(0,RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this));
                prevLineIndex = 0;
            }

            currentHolder.Children.Remove(element);
            if (currentHolder.Children.Count == 0)
            {
                this.lines.Remove(currentHolder);
            }

            lines[prevLineIndex].Children.Add(element);

            SyncStackLayoutWithLines();
        }
Пример #8
0
 protected virtual void CreateButtonsStripElementChildElements()
 {
     this.buttonsStripElement                           = new CommandBarStripElement();
     this.buttonsStripElement.MinSize                   = Size.Empty;
     this.buttonsStripElement.EnableDragging            = false;
     this.buttonsStripElement.EnableFloating            = false;
     this.buttonsStripElement.StretchHorizontally       = true;
     this.buttonsStripElement.Grip.Visibility           = ElementVisibility.Collapsed;
     this.buttonsStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed;
     this.commandBarRowElement.Strips.Add(this.buttonsStripElement);
     this.firstButton = new CommandBarButton();
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem)this.firstButton);
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
     this.previousButton = new CommandBarButton();
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem)this.previousButton);
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
     this.fastBackButton          = new CommandBarButton();
     this.fastBackButton.Text     = "...";
     this.fastBackButton.Image    = (Image)null;
     this.fastBackButton.DrawText = true;
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem)this.fastBackButton);
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
     this.fastForwardButton          = new CommandBarButton();
     this.fastForwardButton.Text     = "...";
     this.fastForwardButton.Image    = (Image)null;
     this.fastForwardButton.DrawText = true;
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem)this.fastForwardButton);
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
     this.nextButton = new CommandBarButton();
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem)this.nextButton);
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
     this.lastButton = new CommandBarButton();
     this.buttonsStripElement.Items.Add((RadCommandBarBaseItem)this.lastButton);
 }
        protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
        {
            if (this.ElementTree == null || this.ElementTree.Control == null || !(this.ElementTree.Control.FindForm() is CommandBarFloatingForm))
            {
                return;
            }
            CommandBarStripElement stripElement = ((CommandBarFloatingForm)this.ElementTree.Control.FindForm()).StripElement;

            if (stripElement == null)
            {
                return;
            }
            if (args.RoutedEvent == RadCommandBarBaseItem.ClickEvent)
            {
                stripElement.OnItemClicked((object)sender, args.OriginalEventArgs);
            }
            if (args.RoutedEvent == RadCommandBarBaseItem.VisibleInStripChangedEvent)
            {
                stripElement.OnItemVisibleInStripChanged((object)sender, args.OriginalEventArgs);
            }
            if (args.RoutedEvent == RadCommandBarBaseItem.VisibleInStripChangingEvent)
            {
                stripElement.OnItemVisibleInStripChanging((object)sender, args.OriginalEventArgs as CancelEventArgs);
            }
            base.OnBubbleEvent(sender, args);
        }
Пример #10
0
 /// <summary>
 /// Adds information about a specific strip to the <c ref="StripInfoHolder"/>
 /// </summary>
 /// <param name="strip">The <c ref="CommandBarStripElement"/> object to add info about.</param>
 public void AddStripInfo(CommandBarStripElement strip)
 {
     if (!stripInfoList.Contains(strip))
     {
         stripInfoList.Add(strip);
     }
 }
Пример #11
0
        protected virtual void moveDownButton_Click(object sender, EventArgs e)
        {
            int currentIndex = this.stripItemsListControl.SelectedIndex;
            int nextIndex    = currentIndex + 1;

            if (nextIndex >= this.stripItemsListControl.Items.Count)
            {
                return;
            }

            RadCommandBarBaseItem currentItem = this.stripItemsListControl.Items[currentIndex].Value as RadCommandBarBaseItem;
            RadCommandBarBaseItem nextItem    = this.stripItemsListControl.Items[nextIndex].Value as RadCommandBarBaseItem;

            if (currentItem == null || nextItem == null)
            {
                return;
            }

            CommandBarStripElement stripElement        = (stripsDropDownList.SelectedItem.Value as CommandBarStripElement);
            LayoutPanel            overflowPanelLayout = stripElement.OverflowButton.OverflowPanel.Layout;

            int currentItemIndex = stripElement.Items.IndexOf(currentItem);
            int nextItemIndex    = stripElement.Items.IndexOf(nextItem);

            if (currentItemIndex != -1 && nextItemIndex != -1)
            {
                RadCommandBarBaseItem temp = stripElement.Items[currentItemIndex];
                stripElement.Items.RemoveAt(currentItemIndex);
                stripElement.Items.Insert(nextItemIndex, temp);
            }
            else if (currentItemIndex != -1 && nextItemIndex == -1)
            {
                nextItemIndex = overflowPanelLayout.Children.IndexOf(nextItem);
                if (nextItemIndex != -1)
                {
                    RadCommandBarBaseItem temp = overflowPanelLayout.Children[nextItemIndex] as RadCommandBarBaseItem;
                    if (temp != null)
                    {
                        overflowPanelLayout.Children.RemoveAt(nextItemIndex);
                        stripElement.Items.Insert(currentItemIndex, temp);
                    }
                }
            }
            else
            {
                currentItemIndex = overflowPanelLayout.Children.IndexOf(currentItem);
                nextItemIndex    = overflowPanelLayout.Children.IndexOf(nextItem);

                if (currentItemIndex != -1 && nextItemIndex != -1)
                {
                    RadElement temp = overflowPanelLayout.Children[nextItemIndex];
                    overflowPanelLayout.Children.RemoveAt(nextItemIndex);
                    overflowPanelLayout.Children.Insert(currentItemIndex, temp);
                }
            }

            toolstripsDownList_SelectedValueChanged(this, EventArgs.Empty);
            this.stripItemsListControl.SelectedIndex = nextIndex;
        }
Пример #12
0
 public void AddStripInfo(CommandBarStripElement strip)
 {
     if (this.stripInfoList.Contains(strip))
     {
         return;
     }
     this.stripInfoList.Add(strip);
 }
Пример #13
0
        /// <summary>
        /// Tries to dock the floating strip in a specified <c ref="RadCommandBar"/>.
        /// </summary>
        /// <param name="commandBar">The <c ref="RadCommandBar"/> control into which the strip should be docked.</param>
        public void TryDocking(RadCommandBar commandBar)
        {
            if (commandBar == null || commandBar.CommandBarElement.CallOnFloatingStripDocking(this.stripElement))
            {
                return;
            }

            this.Capture        = false;
            this.isWindowMoving = false;
            this.stripElement.EnableDragging = true;
            this.stripElement.Capture        = false;
            this.stripElement.ForceEndDrag();
            this.stripElement.Items.Owner = this.stripElement.ItemsLayout;

            bool enableFloatingOldValue = this.stripElement.EnableFloating;

            this.stripElement.EnableFloating = false;

            while (this.hostControl.Element.Layout.Children.Count > 0)
            {
                RadElement item = this.hostControl.Element.Layout.Children[0];
                if (item is RadCommandBarBaseItem || !this.stripElement.Items.Contains(item as RadCommandBarBaseItem))
                {
                    this.hostControl.Element.Layout.Children.Remove(item);
                    this.stripElement.Items.Add(item as RadCommandBarBaseItem);
                }
            }

            this.stripElement.FloatingForm = null;
            this.stripInfoHolder.RemoveStripInfo(this.stripElement);

            if (commandBar.Rows.Count == 0)
            {
                commandBar.Rows.Add(new CommandBarRowElement());
            }

            commandBar.Rows[0].Strips.Add(this.stripElement);
            this.stripElement.OverflowButton.HostControlThemeName = commandBar.ThemeName;

            this.stripElement.Capture = false;
            this.stripElement.ForceEndDrag();
            this.stripElement.ElementTree.Control.Capture = false;
            this.stripElement.CallDoMouseUp(new MouseEventArgs(System.Windows.Forms.MouseButtons.Left, 1, 0, 0, 0));

            Point location = this.parentControl.PointToClient(this.Location);

            if (stripElement.RightToLeft)
            {
                location.X = this.parentControl.Size.Width - location.X - this.Size.Width;
            }

            this.stripElement.DesiredLocation = location;

            this.stripElement.EnableFloating = enableFloatingOldValue;
            commandBar.CommandBarElement.CallOnFloatingStripDocked(this.stripElement);
            this.StripElement = null;
            this.Close();
        }
Пример #14
0
        /// <summary>
        /// Creates a floating form of a specified <c ref="CommandBarStripElement"/>.
        /// </summary>
        /// <param name="stripElement">The strip element of which the floating form should be created.</param>
        /// <param name="currentRow">The <c ref="CommandBarRowElement"/> that contains the strip element.</param>
        /// <param name="initialLocation">The initial location of the floating form.</param>
        public void CreateFloatingStrip(CommandBarStripElement stripElement, CommandBarRowElement currentRow, Point initialLocation)
        {
            if (!stripElement.EnableFloating || this.OnFloatingStripCreating(stripElement))
            {
                return;
            }

            CommandBarFloatingForm floatingForm = new CommandBarFloatingForm();

            floatingForm.ParentControl = this.ElementTree.Control.Parent;
            Point initialDragOffset = Point.Empty;

            if (!this.RightToLeft)
            {
                floatingForm.RightToLeft = System.Windows.Forms.RightToLeft.No;
                floatingForm.Location    = Point.Add(initialLocation, new Size(-5, -5));
                initialDragOffset        = new Point(5, 5);
            }
            else
            {
                floatingForm.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
                floatingForm.Location    = Point.Add(Point.Add(initialLocation, new Size(-stripElement.Size.Width, 0)), new Size(5, -5));
                initialDragOffset        = new Point(stripElement.Size.Width - 5, 5);
            }

            floatingForm.Text           = stripElement.Name;
            stripElement.EnableDragging = false;
            stripElement.Capture        = false;
            stripElement.ForceEndDrag();

            Size screenSize = Screen.GetWorkingArea(this.ElementTree.Control).Size;

            stripElement.Orientation = System.Windows.Forms.Orientation.Horizontal;
            floatingForm.ClientSize  = (stripElement.GetExpectedSize(screenSize).ToSize());

            stripElement.FloatingForm = floatingForm;
            floatingForm.StripElement = stripElement;

            if (currentRow != null)
            {
                currentRow.Strips.Remove(stripElement);
            }

            floatingForm.StripInfoHolder.AddStripInfo(stripElement);
            floatingForm.Show();

            this.OnFloatingStripCreated(stripElement);

            floatingForm.InitializeMove(initialDragOffset);
            Cursor.Current = Cursors.SizeAll;

            if (currentRow != null && currentRow.Strips.Count == 0)
            {
                this.Rows.Remove(currentRow);
            }
        }
Пример #15
0
        private void ToggleStateChanged(object sender, StateChangedEventArgs args)
        {
            CommandBarStripElement dataBoundItem = this.Data.DataBoundItem as CommandBarStripElement;

            if (dataBoundItem == null)
            {
                return;
            }
            dataBoundItem.VisibleInCommandBar = this.checkBox.Checked;
        }
Пример #16
0
 public RadCommandBarStripPanelLayoutInfo(CommandBarStripElement commandBarStripElement)
 {
     this.commandBarStripElement   = commandBarStripElement;
     this.ControlBoundingRectangle = commandBarStripElement.ControlBoundingRectangle;
     this.DesiredLocation          = commandBarStripElement.DesiredLocation;
     this.ArrangeRectangle         = RectangleF.Empty;
     this.DesiredSpaceToEnd        = 0;
     this.IntersectionSpaceToEnd   = 0;
     this.MinSpaceToEnd            = 0;
 }
Пример #17
0
        protected virtual void moveDownButton_Click(object sender, EventArgs e)
        {
            int selectedIndex = this.stripItemsListControl.SelectedIndex;
            int index1        = selectedIndex + 1;

            if (index1 >= this.stripItemsListControl.Items.Count)
            {
                return;
            }
            RadCommandBarBaseItem commandBarBaseItem1 = this.stripItemsListControl.Items[selectedIndex].Value as RadCommandBarBaseItem;
            RadCommandBarBaseItem commandBarBaseItem2 = this.stripItemsListControl.Items[index1].Value as RadCommandBarBaseItem;

            if (commandBarBaseItem1 == null || commandBarBaseItem2 == null)
            {
                return;
            }
            CommandBarStripElement commandBarStripElement = this.stripsDropDownList.SelectedItem.Value as CommandBarStripElement;
            LayoutPanel            layout = commandBarStripElement.OverflowButton.OverflowPanel.Layout;
            int index2 = commandBarStripElement.Items.IndexOf(commandBarBaseItem1);
            int index3 = commandBarStripElement.Items.IndexOf(commandBarBaseItem2);

            if (index2 != -1 && index3 != -1)
            {
                RadCommandBarBaseItem commandBarBaseItem3 = commandBarStripElement.Items[index2];
                commandBarStripElement.Items.RemoveAt(index2);
                commandBarStripElement.Items.Insert(index3, commandBarBaseItem3);
            }
            else if (index2 != -1 && index3 == -1)
            {
                int index4 = layout.Children.IndexOf((RadElement)commandBarBaseItem2);
                if (index4 != -1)
                {
                    RadCommandBarBaseItem child = layout.Children[index4] as RadCommandBarBaseItem;
                    if (child != null)
                    {
                        layout.Children.RemoveAt(index4);
                        commandBarStripElement.Items.Insert(index2, child);
                    }
                }
            }
            else
            {
                int index4 = layout.Children.IndexOf((RadElement)commandBarBaseItem1);
                int index5 = layout.Children.IndexOf((RadElement)commandBarBaseItem2);
                if (index4 != -1 && index5 != -1)
                {
                    RadElement child = layout.Children[index5];
                    layout.Children.RemoveAt(index5);
                    layout.Children.Insert(index4, child);
                }
            }
            this.toolstripsDownList_SelectedValueChanged((object)this, EventArgs.Empty);
            this.stripItemsListControl.SelectedIndex = index1;
        }
Пример #18
0
 protected virtual void CreateFirstTopStripElementChildElements()
 {
     if (this.Navigator.Site == null)
     {
         this.firstTopStripElement = new CommandBarStripElement();
         this.commandBarRowElement.Strips.Add(this.firstTopStripElement);
         this.firstButton = new CommandBarButton();
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.firstButton);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
         this.previousButton = new CommandBarButton();
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.previousButton);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
         this.currentNumberTextBox = new CommandBarTextBox();
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.currentNumberTextBox);
         this.pageLabel = new CommandBarLabel();
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.pageLabel);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
         this.nextButton = new CommandBarButton();
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.nextButton);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem) new CommandBarSeparator());
         this.lastButton = new CommandBarButton();
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.lastButton);
     }
     else
     {
         this.firstTopStripElement = (CommandBarStripElement)this.designerHost.CreateComponent(typeof(CommandBarStripElement), this.Navigator.Name + "FirstStrip");
         this.firstButton          = (CommandBarButton)this.designerHost.CreateComponent(typeof(CommandBarButton), this.Navigator.Name + "MoveFirstItem");
         this.previousButton       = (CommandBarButton)this.designerHost.CreateComponent(typeof(CommandBarButton), this.Navigator.Name + "MovePreviousItem");
         this.currentNumberTextBox = (CommandBarTextBox)this.designerHost.CreateComponent(typeof(CommandBarTextBox), this.Navigator.Name + "PositionItem");
         this.pageLabel            = (CommandBarLabel)this.designerHost.CreateComponent(typeof(CommandBarLabel), this.Navigator.Name + "CountItem");
         this.nextButton           = (CommandBarButton)this.designerHost.CreateComponent(typeof(CommandBarButton), this.Navigator.Name + "MoveNextItem");
         this.lastButton           = (CommandBarButton)this.designerHost.CreateComponent(typeof(CommandBarButton), this.Navigator.Name + "MoveLastItem");
         this.changeService.OnComponentChanging((object)this.Navigator.Site.Component, (MemberDescriptor)null);
         this.commandBarRowElement.Strips.Add(this.firstTopStripElement);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.firstButton);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.designerHost.CreateComponent(typeof(CommandBarSeparator)));
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.previousButton);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.designerHost.CreateComponent(typeof(CommandBarSeparator)));
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.currentNumberTextBox);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.pageLabel);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.designerHost.CreateComponent(typeof(CommandBarSeparator)));
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.nextButton);
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.designerHost.CreateComponent(typeof(CommandBarSeparator)));
         this.firstTopStripElement.Items.Add((RadCommandBarBaseItem)this.lastButton);
         this.changeService.OnComponentChanged((object)this.Navigator.Site.Component, (MemberDescriptor)null, (object)null, (object)null);
     }
     this.firstTopStripElement.MinSize                   = Size.Empty;
     this.firstTopStripElement.EnableDragging            = false;
     this.firstTopStripElement.EnableFloating            = false;
     this.firstTopStripElement.Grip.Visibility           = ElementVisibility.Collapsed;
     this.firstTopStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed;
     this.firstButton.Margin = new Padding(3, 0, 0, 0);
     this.pageLabel.Text     = "of {0}";
 }
        protected internal override void SetDataBoundItem(bool dataBinding, object value)
        {
            base.SetDataBoundItem(dataBinding, value);
            CommandBarStripElement stripElement = value as CommandBarStripElement;

            if (value == null)
            {
                return;
            }

            this.Name    = stripElement.DisplayName;
            this.Visible = stripElement.VisibleInCommandBar;

            stripElement.RadPropertyChanged += new RadPropertyChangedEventHandler(stripElement_RadPropertyChanged);
        }
Пример #20
0
        public void CreateFloatingStrip(
            CommandBarStripElement stripElement,
            CommandBarRowElement currentRow,
            Point initialLocation)
        {
            if (!stripElement.EnableFloating || this.OnFloatingStripCreating((object)stripElement))
            {
                return;
            }
            CommandBarFloatingForm commandBarFloatingForm = new CommandBarFloatingForm();

            commandBarFloatingForm.ParentControl = this.ElementTree.Control.Parent;
            Point offset = Point.Empty;

            if (!this.RightToLeft)
            {
                commandBarFloatingForm.RightToLeft = RightToLeft.No;
                commandBarFloatingForm.Location    = Point.Add(initialLocation, new Size(-5, -5));
                offset = new Point(5, 5);
            }
            else
            {
                commandBarFloatingForm.RightToLeft = RightToLeft.Yes;
                commandBarFloatingForm.Location    = Point.Add(Point.Add(initialLocation, new Size(-stripElement.Size.Width, 0)), new Size(5, -5));
                offset = new Point(stripElement.Size.Width - 5, 5);
            }
            commandBarFloatingForm.Text = stripElement.DisplayName;
            stripElement.EnableDragging = false;
            stripElement.Capture        = false;
            stripElement.ForceEndDrag();
            Size size = Screen.GetWorkingArea(this.ElementTree.Control).Size;

            stripElement.Orientation            = Orientation.Horizontal;
            commandBarFloatingForm.ClientSize   = stripElement.GetExpectedSize((SizeF)size).ToSize();
            stripElement.FloatingForm           = commandBarFloatingForm;
            commandBarFloatingForm.StripElement = stripElement;
            currentRow?.Strips.Remove((RadItem)stripElement);
            commandBarFloatingForm.StripInfoHolder.AddStripInfo(stripElement);
            commandBarFloatingForm.Show();
            this.OnFloatingStripCreated((object)stripElement);
            commandBarFloatingForm.InitializeMove(offset);
            Cursor.Current = Cursors.SizeAll;
            if (currentRow == null || currentRow.Strips.Count != 0)
            {
                return;
            }
            this.Rows.Remove((RadItem)currentRow);
        }
Пример #21
0
        public virtual void MoveToUpperLine(
            CommandBarStripElement element,
            CommandBarRowElement currentHolder)
        {
            int index = this.lines.IndexOf(currentHolder) - 1;

            if (index < 0)
            {
                index = 0;
            }
            currentHolder.Children.Remove((RadElement)element);
            if (currentHolder.Children.Count == 0)
            {
                this.lines.Remove(currentHolder);
            }
            this.lines[index].Children.Add((RadElement)element);
            this.SyncStackLayoutWithLines();
        }
Пример #22
0
 protected internal void MoveCommandStripInOtherLine(CommandBarStripElement currentElement)
 {
     if (this.owner == null)
     {
         return;
     }
     if (this.Orientation == Orientation.Horizontal)
     {
         if ((double)currentElement.DesiredLocation.Y < (double)(currentElement.ControlBoundingRectangle.Top - SystemInformation.DragSize.Height))
         {
             this.ResetDesiredLocation(currentElement);
             this.owner.MoveToUpperLine(currentElement, this);
             this.Invalidate();
             return;
         }
         if ((double)currentElement.DesiredLocation.Y > (double)(currentElement.ControlBoundingRectangle.Bottom + SystemInformation.DragSize.Height))
         {
             this.ResetDesiredLocation(currentElement);
             this.owner.MoveToDownerLine(currentElement, this);
             this.Invalidate();
             return;
         }
     }
     if (this.Orientation != Orientation.Vertical)
     {
         return;
     }
     if ((double)currentElement.DesiredLocation.X < (double)(currentElement.ControlBoundingRectangle.Left - SystemInformation.DragSize.Height))
     {
         this.ResetDesiredLocation(currentElement);
         this.owner.MoveToUpperLine(currentElement, this);
         this.Invalidate();
     }
     else
     {
         if ((double)currentElement.DesiredLocation.X <= (double)(currentElement.ControlBoundingRectangle.Right + SystemInformation.DragSize.Height))
         {
             return;
         }
         this.ResetDesiredLocation(currentElement);
         this.owner.MoveToDownerLine(currentElement, this);
         this.Invalidate();
     }
 }
Пример #23
0
 private void SetStripElementCore(CommandBarStripElement value)
 {
     if (this.stripElement != null)
     {
         this.stripElement.RadPropertyChanged -= new RadPropertyChangedEventHandler(this.stripElement_RadPropertyChanged);
     }
     this.stripElement = value;
     if (this.stripElement == null)
     {
         return;
     }
     this.stripElement.RadPropertyChanged += new RadPropertyChangedEventHandler(this.stripElement_RadPropertyChanged);
     this.stripElement.Items.Owner         = (RadElement)this.hostControl.Element.Layout;
     while (this.stripElement.OverflowButton.ItemsLayout.Children.Count > 0)
     {
         RadElement child = this.stripElement.OverflowButton.ItemsLayout.Children[0];
         this.stripElement.OverflowButton.ItemsLayout.Children.Remove(child);
         this.hostControl.Element.Layout.Children.Add(child);
     }
 }
        void stripElement_RadPropertyChanged(object sender, RadPropertyChangedEventArgs e)
        {
            if (e.Property == CommandBarStripElement.VisibleInCommandBarProperty)
            {
                CommandBarStripElement strip = (this.DataBoundItem as CommandBarStripElement);
                if (strip != null)
                {
                    this.Visible = strip.VisibleInCommandBar;
                }
            }

            if (e.Property == RadElement.NameProperty)
            {
                CommandBarStripElement strip = (this.DataBoundItem as CommandBarStripElement);
                if (strip != null)
                {
                    this.Name = strip.DisplayName;
                }
            }
        }
Пример #25
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;
        }
Пример #26
0
 protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
 {
     if (e.Property == StackLayoutPanel.OrientationProperty)
     {
         CommandBarStripElement parent = (this.Parent as CommandBarStripElement);
         foreach (RadCommandBarBaseItem item in parent.Items)
         {
             if (item.InheritsParentOrientation)
             {
                 item.Orientation = this.Orientation;
             }
         }
         foreach (RadCommandBarBaseItem item in parent.OverflowButton.ItemsLayout.Children)
         {
             if (item.InheritsParentOrientation)
             {
                 item.Orientation = this.Orientation;
             }
         }
     }
     base.OnPropertyChanged(e);
 }
Пример #27
0
        /// <summary>
        /// Moves specified <see cref="CommandBarStripElement"/> in coresponding row
        /// if its <see cref="P:CommandBarStripElement.DesiredLocation"/> property points to a location in other row.
        /// </summary>
        /// <param name="currentElement">The <see cref="CommandBarStripElement"/> to move.</param>
        protected internal void MoveCommandStripInOtherLine(CommandBarStripElement currentElement)
        {
            if (this.owner == null)
            {
                return;
            }

            if (this.Orientation == System.Windows.Forms.Orientation.Horizontal)
            {
                if (currentElement.DesiredLocation.Y < currentElement.ControlBoundingRectangle.Top - SystemInformation.DragSize.Height)
                {
                    this.ResetDesiredLocation(currentElement);
                    this.owner.MoveToUpperLine(currentElement, this);
                    return;
                }
                else if (currentElement.DesiredLocation.Y > currentElement.ControlBoundingRectangle.Bottom + SystemInformation.DragSize.Height)
                {
                    this.ResetDesiredLocation(currentElement);
                    owner.MoveToDownerLine(currentElement, this);
                    return;
                }
            }
            if (this.Orientation == System.Windows.Forms.Orientation.Vertical)
            {
                if (currentElement.DesiredLocation.X < currentElement.ControlBoundingRectangle.Left - SystemInformation.DragSize.Height)
                {
                    this.ResetDesiredLocation(currentElement);
                    this.owner.MoveToUpperLine(currentElement, this);
                    return;
                }
                else if (currentElement.DesiredLocation.X > currentElement.ControlBoundingRectangle.Right + SystemInformation.DragSize.Height)
                {
                    this.ResetDesiredLocation(currentElement);
                    owner.MoveToDownerLine(currentElement, this);
                    return;
                }
            }
        }
Пример #28
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;
        }
Пример #29
0
        protected virtual void toolstripsDownList_SelectedValueChanged(object sender, EventArgs e)
        {
            if (this.stripsDropDownList.SelectedItem == null)
            {
                return;
            }
            CommandBarStripElement commandBarStripElement = this.stripsDropDownList.SelectedItem.Value as CommandBarStripElement;

            if (commandBarStripElement == null)
            {
                return;
            }
            List <RadCommandBarBaseItem> commandBarBaseItemList = new List <RadCommandBarBaseItem>();

            foreach (RadCommandBarBaseItem commandBarBaseItem in commandBarStripElement.Items)
            {
                commandBarBaseItemList.Add(commandBarBaseItem);
            }
            foreach (RadCommandBarBaseItem child in commandBarStripElement.OverflowButton.OverflowPanel.Layout.Children)
            {
                commandBarBaseItemList.Add(child);
            }
            this.stripItemsListControl.DataSource = (object)commandBarBaseItemList;
        }
Пример #30
0
        protected virtual void CreateTextBoxStripElementChildElements()
        {
            this.textBoxStripElement                           = new CommandBarStripElement();
            this.textBoxStripElement.MinSize                   = Size.Empty;
            this.textBoxStripElement.EnableDragging            = false;
            this.textBoxStripElement.EnableFloating            = false;
            this.textBoxStripElement.DesiredLocation           = new PointF(10000f, 0.0f);
            this.textBoxStripElement.Grip.Visibility           = ElementVisibility.Collapsed;
            this.textBoxStripElement.OverflowButton.Visibility = ElementVisibility.Collapsed;
            this.commandBarRowElement.Strips.Add(this.textBoxStripElement);
            this.pageLabel      = new CommandBarLabel();
            this.pageLabel.Text = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("PagingPanelPagesLabel");

            this.textBoxStripElement.Items.Add((RadCommandBarBaseItem)this.pageLabel);
            this.pageNumberTextBox = new CommandBarTextBox();
            this.pageNumberTextBox.TextBoxElement.MinSize = new Size(30, 20);
            this.textBoxStripElement.Items.Add((RadCommandBarBaseItem)this.pageNumberTextBox);
            this.ofPagesLabel      = new CommandBarLabel();
            this.ofPagesLabel.Text = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("PagingPanelOfPagesLabel");

            this.textBoxStripElement.Items.Add((RadCommandBarBaseItem)this.ofPagesLabel);
            this.numberOfPagesLabel = new CommandBarLabel();
            this.textBoxStripElement.Items.Add((RadCommandBarBaseItem)this.numberOfPagesLabel);
        }