internal RibbonDropDown(
     RibbonItem parentItem,
     IEnumerable<RibbonItem> items,
     Ribbon ownerRibbon)
     : this(parentItem, items, ownerRibbon, RibbonElementSizeMode.DropDown)
 {
 }
 public RibbonTextEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonItem item, Rectangle bounds, string text, StringFormat format)
     : base(owner, g, clip, item, bounds)
 {
     Text = text;
     Style = FontStyle.Regular;
     Format = format;
     Color = Color.Empty;
 }
 public RibbonTextEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonItem item, Rectangle bounds, string text, FontStyle style)
     : base(owner, g, clip, item, bounds)
 {
     Text = text;
     Style = style;
     Format = new StringFormat();
     Color = Color.Empty;
 }
 public RibbonTextEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonItem item, Rectangle bounds, 
     string text, Color color, FontStyle style,  StringFormat format)
     : base(owner, g, clip, item, bounds)
 {
     Text = text;
     Style = style;
     Format = format;
     Color = color;
 }
        /// <summary>
        /// Adds the specified item to the collection
        /// </summary>
        public override void Add(RibbonItem item)
        {
            CheckRestrictions(item as RibbonButton);

            item.SetOwner(Owner);
            item.SetOwnerPanel(OwnerPanel);
            item.SetOwnerTab(OwnerTab);
            item.SetOwnerItem(OwnerItem);

            item.Click += new EventHandler(_ownerList.item_Click);

            base.Add(item);
        }
Esempio n. 6
0
        internal RibbonDropDown(RibbonItem parentItem, IEnumerable<RibbonItem> items, Ribbon ownerRibbon, RibbonElementSizeMode measuringSize)
            : this()
        {
            _items = items;
            _ownerRibbon = ownerRibbon;
            _sizingGripHeight = 12;
            _parentItem = parentItem;
            _sensor = new RibbonMouseSensor(this, OwnerRibbon, items);
            _MeasuringSize = measuringSize;

            if (Items != null)
                foreach (RibbonItem item in Items)
                {
                    item.SetSizeMode(RibbonElementSizeMode.DropDown);
                    item.SetCanvas(this);
                }

            UpdateSize();
        }
      internal void item_Click(object sender, EventArgs e)
      {
         // Steve
         _selectedItem = (sender as RibbonItem);

         //Kevin Carbis
         RibbonItemEventArgs ev = new RibbonItemEventArgs(_selectedItem);
         if (DropDownItems.Contains(_selectedItem))
            OnDropDownItemClicked(ref ev);
         else
            OnButtonItemClicked(ref ev);
      }
        void DropDownItem_Click(object sender, EventArgs e)
        {
            // Steve
             _selectedItem = (sender as RibbonItem);

             TextBoxText = (sender as RibbonItem).Text;
             //Kevin Carbis
             RibbonItemEventArgs ev = new RibbonItemEventArgs(sender as RibbonItem);
             OnDropDownItemClicked(ref ev);
        }
Esempio n. 9
0
        private void LoadThumbnails()
        {
            RemoveThumbnails();

            innerPanel.Width = thumbNails.Count * (step + space) + 20;

            int i = 0;
            int count = 0;

            //for( int k = firstIndex; k < thumbNails.Count; k++)
            for (int k = 0; k < thumbNails.Count; k++)
            {
                Image t = thumbNails[k];

                RibbonItem newPicBox = new RibbonItem();
                newPicBox.Width = picBoxClone.Width;
                newPicBox.Height = picBoxClone.Height;
                newPicBox.BackColor = picBoxClone.BackColor;
                newPicBox.Image = t;

                this.innerPanel.Controls.Add(newPicBox);
                newPicBox.Location = new Point(5 + i, 4);

                string ext = Path.GetExtension((string)files[k]).ToUpper();

                this.toolTip1.SetToolTip(newPicBox, (string)toolTips[k]);
                
                newPicBox.Click += new EventHandler(newPicBox_Click);
                
                newPicBox.Cursor = Cursors.Hand;
                newPicBox.Tag = k;
                selectedIndex = k;

                i += (step + space);
                count++;

                //int temp = (count + 1) * ( step + space ) + 60;
                //if (temp > this.mainRibbonGroup.Height)
                //{
                //    lastIndex = count + firstIndex;
                //    break;                     
                //}                
            }

            ResizeInnerPanel();
        }
 /// <summary>
 /// Inserts the specified item at the desired index
 /// </summary>
 /// <param name="index">Desired index of the item</param>
 /// <param name="item">Item to insert</param>
 public override void Insert(int index, RibbonItem item)
 {
     item.MaxSizeMode = RibbonElementSizeMode.Compact;
     item.SetOwnerGroup(OwnerGroup);
     base.Insert(index, item);
 }
        public override void OnRenderDropDownDropDownImageSeparator(RibbonItem item, RibbonCanvasEventArgs e)
        {
            RibbonDropDown dd = e.Canvas as RibbonDropDown;

            if (dd != null && dd.DrawIconsBar)
            {
                Rectangle imgsR = new Rectangle(item.Bounds.Left, item.Bounds.Top, 26, item.Bounds.Height);

                using (Pen p = new Pen(ColorTable.DropDownImageBg))
                {
                    using (SolidBrush b = new SolidBrush(ColorTable.DropDownImageBg))
                    {
                            SmoothingMode sm = e.Graphics.SmoothingMode;
                            e.Graphics.SmoothingMode = SmoothingMode.None;
                            e.Graphics.FillRectangle(b, imgsR);
                            e.Graphics.SmoothingMode = sm;
                    }
                }

                using (Pen p = new Pen(ColorTable.DropDownImageSeparator))
                {
                    SmoothingMode sm = e.Graphics.SmoothingMode;
                    e.Graphics.SmoothingMode = SmoothingMode.None;
                    e.Graphics.DrawLine(p,
                         new Point(imgsR.Right, imgsR.Top),
                         new Point(imgsR.Right, imgsR.Bottom - 1));
                    e.Graphics.SmoothingMode = sm;

                }
            }
        }
        void newPicBox_Click(object sender, EventArgs e)
        {
            try
            {                
                RibbonItem source = (RibbonItem)sender;

                selectedIndex = (int)source.Tag;

                if (SelectedIndexChanged != null && source != null)
                    SelectedIndexChanged(this, EventArgs.Empty);

                
                if (lastSelected != null)
                {
                    lastSelected.IsPressed = false;
                }

                lastSelected = source;
                lastSelected.IsPressed = true;
            }
            catch (Exception ex) 
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 13
0
		internal void HandleDesignerItemRemoved(RibbonItem item)
		{
			if (MenuItems.Contains(item))
			{
				MenuItems.Remove(item);
			}
			else if (RecentItems.Contains(item))
			{
				RecentItems.Remove(item);
			}
			else if (OptionItems.Contains(item))
			{
				OptionItems.Remove(item);
			}

			OnRegionsChanged();
		}
Esempio n. 14
0
        void item_Click(object sender, EventArgs e)
        {
            //Console.WriteLine("item_Click: " + this.ToString());

             RibbonItemEventArgs ev = new RibbonItemEventArgs(sender as RibbonItem);
             OnDropDownItemClicked(ref ev);
             // Steve
             _selectedItem = (sender as RibbonItem);
             //Kevin Carbis - For some reason this event never gets fired even though the above
             //function assigns a handler for it
             TextBoxText = (sender as RibbonItem).Text;
        }
		/// <summary>
		/// Handles the MouseDown on the control
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void Control_MouseDown(object sender, MouseEventArgs e)
		{
			if (IsSupsended || Disposed) return;

			HitTest(e.Location);
			_lastMouseDown = HittedItem;

			#region Tab Scrolls
			if (HittedTab != null)
			{
				if (HittedTabScrollLeft)
				{
					HittedTab.SetScrollLeftPressed(true);
					Control.Invalidate(HittedTab.ScrollLeftBounds);
				}

				if (HittedTabScrollRight)
				{
					HittedTab.SetScrollRightPressed(true);
					Control.Invalidate(HittedTab.ScrollRightBounds);
				}
			}
			#endregion

			#region Panel
			if (HittedPanel != null)
			{
				HittedPanel.SetPressed(true);
				HittedPanel.OnMouseDown(e);
				Control.Invalidate(HittedPanel.Bounds);
			}
			#endregion

			#region Item

			if (HittedItem != null)
			{
				HittedItem.SetPressed(true);
				HittedItem.OnMouseDown(e);
				Control.Invalidate(HittedItem.Bounds);
			}

			#endregion

			#region SubItem

			if (HittedSubItem != null)
			{
				HittedSubItem.SetPressed(true);
				HittedSubItem.OnMouseDown(e);
				Control.Invalidate(Rectangle.Intersect(HittedItem.Bounds, HittedSubItem.Bounds));
			}

			#endregion
		}
        private void DoSelect()
        {
            foreach (RibbonItem picBoxCtrl in this.innerPanel.Controls)
            {
                if ((int)picBoxCtrl.Tag == selectedIndex)
                {
                    if (lastSelected != null)
                    {
                        lastSelected.IsPressed = false;
                    }

                    lastSelected = picBoxCtrl;
                    lastSelected.IsPressed = true;                    
                }
            }

            if (selectedIndex < firstShowingIdx)
            {
                for (int i = 0; i < (lastShowingIdx - firstShowingIdx + 1); i++)
                {
                    ScrollUpSingle();
                }
            }

            if (selectedIndex > lastShowingIdx)
            {
                for (int i = 0; i < (lastShowingIdx - firstShowingIdx + 1); i++)
                {
                    ScrollDownSingle();
                }
            }           
        }
        private void DoSelectFast()
        {
            foreach (RibbonItem picBoxCtrl in this.innerPanel.Controls)
            {
                if ((int)picBoxCtrl.Tag == selectedIndex)
                {
                    if (lastSelected != null)
                    {
                        lastSelected.IsPressed = false;
                    }

                    lastSelected = picBoxCtrl;
                    lastSelected.IsPressed = true;
                }
            }

            if (selectedIndex < firstShowingIdx)
            {
                while (selectedIndex < firstShowingIdx)
                {
                    ScrollUpLength();
                }
            }
            

            if (selectedIndex > lastShowingIdx)
            {
                while(selectedIndex > lastShowingIdx)
                {
                    ScrollDownLength();
                }
            }
            
        }
Esempio n. 18
0
		/// <summary>
		/// Selects the specified item on the designer
		/// </summary>
		/// <param name="item"></param>
		internal void SelectOnDesigner(RibbonItem item)
		{
			if (RibbonDesigner.Current != null)
			{
				RibbonDesigner.Current.SelectedElement = item;
				UpdateDesignerSelectedBounds();
				Invalidate();
			}
		}
 /// <summary>
 /// Adds the specified item to the collection
 /// </summary>
 public override void Add(RibbonItem item)
 {
     item.MaxSizeMode = RibbonElementSizeMode.Compact;
     base.Add(item);
 }
 public RibbonItemBoundsEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonItem item, Rectangle bounds)
     : base(owner, g, clip, item)
 {
     Bounds = bounds;
 }
 /// <summary>
 /// Adds the specified item to the collection
 /// </summary>
 public override void Add(RibbonItem item)
 {
     item.MaxSizeMode = RibbonElementSizeMode.Compact;
     item.SetOwnerGroup(OwnerGroup);
     base.Add(item);
 }
Esempio n. 22
0
 /// <summary>
 /// Sets the value of the OwnerList property
 /// </summary>
 /// <param name="ownerList"></param>
 internal virtual void SetOwnerGroup(RibbonItemGroup ownerGroup)
 {
     _ownerItem = ownerGroup;
 }
Esempio n. 23
0
        public void DoSelect(string Path)
        {
        	foreach(RibbonItem item in this.innerPanel.Controls)
        	{
        		int fileNum = (int)item.Tag;
                fileName = (string)files[fileNum];
                
        		if( fileName == Path )
        		{
	        		if (lastSelected != null)
	                {
	                    lastSelected.IsPressed = false;
	                }
	
	                lastSelected = item;
	                lastSelected.IsPressed = true;
        		}
        	}
        }
 /// <summary>
 /// When an item is removed from the RibbonItemCollection remove all its references.
 /// </summary>
 internal virtual void ClearOwner()
 {
     _ownerItem = null;
     _ownerPanel = null;
     _ownerTab = null;
     _owner = null;
     OnOwnerChanged(EventArgs.Empty);
 }
Esempio n. 25
0
        void newPicBox_Click(object sender, EventArgs e)
        {
            try
            {                
                RibbonItem source = (RibbonItem)sender;
                int fileNum = (int)source.Tag;
                fileName = (string)files[fileNum];

                if (SelectedIndexChanged != null && source != null)
                    SelectedIndexChanged(this, EventArgs.Empty);

                if (lastSelected != null)
                {
                    lastSelected.IsPressed = false;
                }

                lastSelected = source;
                lastSelected.IsPressed = true;

            }
            catch (Exception) {}
        }
 /// <summary>
 /// Sets the value of the OwnerItem property
 /// </summary>
 /// <param name="item">RibbonItem where this item is located</param>
 internal virtual void SetOwnerItem(RibbonItem item)
 {
     _ownerItem = item;
 }
		// Choose an action for the selected item
		void ParseItem(RibbonItem item)
		{
			//if (item is RibbonDropDown)
			//    (item as RibbonDropDown).Focus();
			//else 
			if (item is RibbonButton)
				(item as RibbonButton).PerformClick();
			else if (item is RibbonCheckBox)
				(item as RibbonCheckBox).Checked = !(item as RibbonCheckBox).Checked;
			else if (item is RibbonTextBox)
				(item as RibbonTextBox).SetSelected(true);
		}
Esempio n. 28
0
        void DropDownItem_Click(object sender, EventArgs e)
        {
            _selectedItem = (sender as RibbonItem);

            RibbonItemEventArgs ev = new RibbonItemEventArgs(sender as RibbonItem);
            OnDropDownItemClicked(ref ev);
        }
 internal override void SetOwnerItem(RibbonItem ownerItem)
 {
     base.SetOwnerItem(ownerItem);
 }
 public RibbonItemRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonItem item)
     : base(owner, g, clip)
 {
     Item = item;
 }