示例#1
0
        public void Init(HashTableSettings gSettings, Ribbon mainRibbon)
        {
            ribbon = mainRibbon;

            devSettings = (bool)gSettings["DeveloperMode"];

            appDir = Application.StartupPath + "\\";
            globalSettings = gSettings;

            // load recent files
            if (File.Exists(appDir + "recentFiles.xml"))
            {
                recentFiles = RecentFiles.LoadFromFile(appDir + "recentFiles.xml");
                recentFiles.ClearDeadEntires();
            }
            else
                recentFiles = new RecentFiles();

            RebuildRecentFilesMenu();

            baseDir = /*(string)gSettings["Base.Path"];*/Path.GetFullPath(ConfigurationManager.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"].Replace("%STARTUP%", Application.StartupPath));
            if (!Directory.Exists(baseDir))
                throw new ApplicationException("Base directory does not exist! : " + baseDir);

            cdi = ICommonDeviceInterface.NewInterface((byte)globalSettings["CDI.Adapter"], baseDir);
            cdi.ResourceLoader.RegisterContentLoader(new LayerContentLoader());
            cdi.ResourceLoader.RegisterContentLoader(new BooScriptContentLoader());

            ShowHideGroups(false);
        }
 internal RibbonDropDown(
     RibbonItem parentItem,
     IEnumerable<RibbonItem> items,
     Ribbon ownerRibbon)
     : this(parentItem, items, ownerRibbon, RibbonElementSizeMode.DropDown)
 {
 }
 public RibbonTabGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon)
    : base(new RibbonTabGlyphBehavior(designer, ribbon))
 {
    _behaviorService = behaviorService;
    _componentDesigner = designer;
    _ribbon = ribbon;
 }
 /// <summary>
 /// Creates a new Sensor for specified objects
 /// </summary>
 /// <param name="control">Control to listen mouse events</param>
 /// <param name="ribbon">Ribbon that will be affected</param>
 /// <param name="tabs">Tabs that will be sensed</param>
 /// <param name="panels">Panels that will be sensed</param>
 /// <param name="items">Items that will be sensed</param>
 public RibbonMouseSensor(Control control, Ribbon ribbon, IEnumerable<RibbonTab> tabs, IEnumerable<RibbonPanel> panels, IEnumerable<RibbonItem> items)
     : this(control, ribbon)
 {
     if (tabs != null) Tabs.AddRange(tabs);
     if (panels != null) Panels.AddRange(panels);
     if (items != null) Items.AddRange(items);
 }
		internal RibbonOrbDropDown(Ribbon ribbon)
			: base()
		{
			DoubleBuffered = true;
			_ribbon = ribbon;
			_menuItems = new RibbonItemCollection();
			_recentItems = new RibbonItemCollection();
			_optionItems = new RibbonItemCollection();

			_menuItems.SetOwner(Ribbon);
			_recentItems.SetOwner(Ribbon);
			_optionItems.SetOwner(Ribbon);

			_optionsPadding = 6;
			Size = new System.Drawing.Size(527, 447);
			BorderRoundness = 8;

         AutoSizeContentButtons = DefaultAutoSizeContentButtons;
         ContentButtonsMinWidth = DefaultContentButtonsMinWidth;
         ContentRecentItemsMinWidth = DefaultContentRecentItemsMinWidth;

			//if (!(Site != null && Site.DesignMode))
			//{
			//   _keyboardHook = new GlobalHook(GlobalHook.HookTypes.Keyboard);
			//   _keyboardHook.KeyUp += new KeyEventHandler(_keyboardHook_KeyUp);
			//}
		}
 public RibbonQuickAccessToolbarGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon)
     : base(new RibbonQuickAccessGlyphBehavior(designer, ribbon))
 {
     _behaviorService = behaviorService;
     _componentDesigner = designer;
     _ribbon = ribbon;
 }
示例#7
0
        /// <summary>
        /// Find Ribbon Item
        /// </summary>
        /// <param name="ribbon">express Ribbon</param>
        /// <param name="ribbonTabText">express Ribbon Tab Text</param>
        /// <param name="ribbonItemName">express Ribbon Item Name</param>
        /// <returns>RibbonItem</returns>
        public static RibbonItem FindRibbonItem(Ribbon ribbon, string ribbonTabText, string ribbonItemName)
        {
            if (ribbon == null ||
                ribbon.Tabs == null ||
                ribbon.Tabs.Count.Equals(0) ||
                string.IsNullOrEmpty(ribbonTabText) ||
                string.IsNullOrEmpty(ribbonItemName))
            {
                return null;
            }

            foreach (RibbonTab tab in ribbon.Tabs)
            {
                if (ribbonTabText.Trim().Equals(tab.Text.Trim()))
                {
                    foreach (RibbonPanel panel in tab.Panels)
                    {
                        foreach (RibbonItem item in panel.Items)
                        {
                            if (ribbonItemName.Equals(item.Name))
                            {
                                return item;
                            }
                        }
                    }
                }
            }

            return null;
        }
 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, 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, Color color, FontStyle style,  StringFormat format)
     : base(owner, g, clip, item, bounds)
 {
     Text = text;
     Style = style;
     Format = format;
     Color = color;
 }
		public RibbonToolTipRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, string Text, Image tipImage, Color color, FontStyle style, StringFormat format, Font font)
			: base(owner, g, clip)
		{
			_text = Text;
			_color = Color;
			_style = style;
			_format = format;
			_image = tipImage;
			_font = font;
		}
 public RibbonCanvasEventArgs(
     Ribbon owner, Graphics g, Rectangle bounds, Control canvas, object relatedObject
     )
 {
     Owner = owner;
     Graphics = g;
     Bounds = bounds;
     Canvas = canvas;
     RelatedObject = relatedObject;
 }
示例#13
0
        /// <summary>
        /// Find Ribbon Item
        /// </summary>
        /// <param name="ribbon">Ribbon</param>
        /// <param name="ribbonItemName">Ribbon Item Name</param>
        /// <returns>RibbonItem</returns>
        public static RibbonItem FindRibbonItem(Ribbon ribbon, string ribbonItemName)
        {
            if (ribbon == null ||
               ((ribbon.Tabs == null ||
                 ribbon.Tabs.Count.Equals(0)) &&
                (ribbon.QuickAcessToolbar == null ||
                 ribbon.QuickAcessToolbar.Items.Count.Equals(0)) &&
                (ribbon.OrbDropDown == null ||
                 ribbon.OrbDropDown.MenuItems.Count.Equals(0))) ||
                string.IsNullOrEmpty(ribbonItemName))
            {
                return null;
            }

            if (ribbon.OrbDropDown != null &&
                ribbon.OrbDropDown.MenuItems != null)
            {
                foreach (RibbonItem item in ribbon.OrbDropDown.MenuItems)
                {
                    if (ribbonItemName.Equals(item.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return item;
                    }
                }
            }

            if (ribbon.QuickAcessToolbar != null &&
                ribbon.QuickAcessToolbar.Items != null)
            {
                foreach (RibbonItem item in ribbon.QuickAcessToolbar.Items)
                {
                    if (ribbonItemName.Equals(item.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return item;
                    }
                }
            }

            foreach (RibbonTab tab in ribbon.Tabs)
            {
                foreach (RibbonPanel panel in tab.Panels)
                {
                    foreach (RibbonItem item in panel.Items)
                    {
                        if (ribbonItemName.Equals(item.Name, StringComparison.InvariantCultureIgnoreCase))
                        {
                            return item;
                        }
                    }
                }
            }

            return null;
        }
示例#14
0
        public RibbonSensor(Control control, Ribbon ribbon, RibbonTab tabToSense)
        {
            _ribbon = ribbon;
            _control = control;
            _tab = tabToSense;

            _control.MouseMove += new MouseEventHandler(_control_MouseMove);
            _control.MouseDown += new MouseEventHandler(_control_MouseDown);
            _control.MouseUp += new MouseEventHandler(_control_MouseUp);
            _control.MouseLeave += new EventHandler(_control_MouseLeave);
        }
        /// <summary>
        /// Creates a new Sensor for the specified RibbonTab
        /// </summary>
        /// <param name="control">Control to listen to mouse events</param>
        /// <param name="ribbon">Ribbon that will be affected</param>
        /// <param name="tab">Tab that will be sensed, from which all panels and items will be extracted to sensing also.</param>
        public RibbonMouseSensor(Control control, Ribbon ribbon, RibbonTab tab)
            : this(control, ribbon)
        {
            Tabs.Add(tab);
            Panels.AddRange(tab.Panels);

            foreach (RibbonPanel panel in tab.Panels)
            {
                Items.AddRange(panel.Items);
            }
        }
        /// <summary>
        /// Creates a new Empty Sensor
        /// </summary>
        /// <param name="control">Control to listen mouse events</param>
        /// <param name="ribbon">Ribbon that will be affected</param>
        public RibbonMouseSensor(Control control, Ribbon ribbon)
            : this()
        {
            if (control == null) throw new ArgumentNullException("control");
            if (ribbon == null) throw new ArgumentNullException("ribbon");

            _control = control;
            _ribbon = ribbon;

            AddHandlers();
        }
示例#17
0
        public RibbonSensor(Control control, Ribbon ribbon, IEnumerable<RibbonItem> itemsToSense)
        {
            _ribbon = ribbon;
            _control = control;
            _itemsToSense = itemsToSense;
            SenseOnlyItems = true;

            _control.MouseMove += new MouseEventHandler(_control_MouseMove);
            _control.MouseDown += new MouseEventHandler(_control_MouseDown);
            _control.MouseUp += new MouseEventHandler(_control_MouseUp);
            _control.MouseLeave += new EventHandler(_control_MouseLeave);
        }
        internal RibbonQuickAccessToolbar(Ribbon ownerRibbon)
        {
            if (ownerRibbon == null) throw new ArgumentNullException("ownerRibbon");

             SetOwner(ownerRibbon);

             _dropDownButton = new RibbonButton();
             _dropDownButton.SetOwner(ownerRibbon);
             _dropDownButton.SmallImage = CreateDropDownButtonImage();

             _margin = new Padding(9);
             _padding = new Padding(3, 0, 0, 0);
             _items = new RibbonQuickAccessToolbarItemCollection(this);
             _sensor = new RibbonMouseSensor(ownerRibbon, ownerRibbon, Items);
             _DropDownButtonVisible = true;
        }
示例#19
0
        public static void AddRibbonButton(Ribbon ribbon, 
                                           string tabText, 
                                           string buttonName,
                                           string text, 
                                           Image image, 
                                           string tooltip, 
                                           bool enable, 
                                           bool isChecked,
                                           RibbonButtonAlignment alignment,
                                           EventHandler clickHandler)
        {
            if (ribbon == null)
            {
                return;
            }

            RibbonItem ribbonItem = null;

            if (RibbonModulePluginProvider.Ribbon_Separator.Equals(buttonName))
            {
                ribbonItem = new RibbonSeparator();
            }
            else
            {
                ribbonItem = new RibbonButton();
                ribbonItem.Text = text;
                ribbonItem.Image = image;
                ribbonItem.ToolTip = tooltip;
                ribbonItem.Enabled = enable;
                ribbonItem.Checked = isChecked;
                ribbonItem.Click += new EventHandler(clickHandler);
            }

            ribbonItem.Name = buttonName;

            RibbonTab ribbonTab = RibbonHelper.FindRibbonTab(ribbon, tabText);

            if (ribbonTab == null)
            {
                return;
            }

            int panelIndex = alignment == RibbonButtonAlignment.Right ? 1 : 0;

            ribbonTab.Panels[panelIndex].Items.Add(ribbonItem);
        }
示例#20
0
        internal RibbonOrbDropDown(Ribbon ribbon)
            : base()
        {
            DoubleBuffered = true;
            _ribbon = ribbon;
            _menuItems = new RibbonItemCollection();
            _recentItems = new RibbonItemCollection();
            _optionItems = new RibbonItemCollection();

            _menuItems.SetOwner(Ribbon);
            _recentItems.SetOwner(Ribbon);
            _optionItems.SetOwner(Ribbon);

            _optionsPadding = 6;
            Size = new System.Drawing.Size(527, 447);
            BorderRoundness = 8;
        }
示例#21
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();
        }
示例#22
0
		public MenuToolPanel(MainMDIForm parent)
		{
			mParent = parent;

			Text = "Menu";

			mRibbon = new Ribbon();
			mRibbon.Location = new Point(0, 0);
			mRibbon.Width = this.Width;
			mRibbon.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

			Controls.Add(mRibbon);

			InitRibbon();

			InitShortcuts();

			UpdateRecentPackFiles();

			Height = mRibbon.Height;
		}
        /// <summary>
        /// Creates an item of the specified type and adds it to the specified collection
        /// </summary>
        /// <param name="ribbon"></param>
        /// <param name="collection"></param>
        /// <param name="t"></param>
        protected virtual void CreateItem(Ribbon ribbon, RibbonItemCollection collection, Type t)
        {
            IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (host != null && collection != null && ribbon != null)
            {
                DesignerTransaction transaction = host.CreateTransaction("AddRibbonItem_" + Component.Site.Name);

                MemberDescriptor member = TypeDescriptor.GetProperties(Component)["Items"];
                base.RaiseComponentChanging(member);

                RibbonItem item = host.CreateComponent(t) as RibbonItem;

                if (!(item is RibbonSeparator)) item.Text = item.Site.Name;

                collection.Add(item);
                ribbon.OnRegionsChanged();

                base.RaiseComponentChanged(member, null, null);
                transaction.Commit();
            }
        }
示例#24
0
        public static void AddRibbonButton(Ribbon ribbon,
                                           RibbonModulePluginItem modulePluginItem,
                                           EventHandler clickHandler)
        {
            if (ribbon == null ||
                modulePluginItem == null)
            {
                return;
            }

            Image buttonImage = EAppRuntime.Instance.CurrentApp.ResourceManagers["Common"].GetImage(modulePluginItem.IconResourceName) ;

            AddRibbonButton(ribbon,
                            modulePluginItem.Navigation.Text,
                            modulePluginItem.Name,
                            modulePluginItem.Text,
                            buttonImage,
                            modulePluginItem.Tooltip,
                            modulePluginItem.Enabled,
                            modulePluginItem.Checked,
                            modulePluginItem.Alignment,
                            clickHandler);
        }
示例#25
0
 /// <summary>
 /// When an item is removed from the RibbonItemCollection remove all its references.
 /// </summary>
 internal virtual void ClearOwner()
 {
     _owner = null;
     OnOwnerChanged(EventArgs.Empty);
 }
示例#26
0
 public RibbonToolTipRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, string Text, Image tipImage)
     : base(owner, g, clip)
 {
     this.Text = Text;
     TipImage  = tipImage;
 }
示例#27
0
 public RibbonTab(Ribbon owner, string text)
     : this(text)
 {
 }
 public RibbonRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip)
 {
     Ribbon = owner;
     Graphics = g;
     ClipRectangle = clip;
 }
        /// <summary>
        /// Sets the value of the Owner Property
        /// </summary>
        internal void SetOwner(Ribbon owner)
        {
            _owner = owner;

             Items.SetOwner(owner);
        }
 public RibbonTabRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonTab tab)
     : base(owner, g, clip)
 {
     Tab = tab;
 }
示例#31
0
 public RibbonToolTipRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, string text)
     : base(owner, g, clip)
 {
     Text = text;
 }
示例#32
0
        /// <summary>
        /// Processes the WndProc for a form with a Ribbbon. Returns true if message has been handled
        /// </summary>
        /// <param name="m">Message to process</param>
        /// <returns><c>true</c> if message has been handled. <c>false</c> otherwise</returns>
        public virtual bool WndProc(ref Message m)
        {
            if (DesignMode)
            {
                return(false);
            }

            bool handled = false;

            if (WinApi.IsVista)
            {
                #region Checks if DWM processes the message
                IntPtr result;
                int    dwmHandled = WinApi.DwmDefWindowProc(m.HWnd, m.Msg, m.WParam, m.LParam, out result);

                if (dwmHandled == 1)
                {
                    m.Result = result;
                    handled  = true;
                }
                #endregion
            }

            //if (m.Msg == WinApi.WM_NCLBUTTONUP)
            //{
            //    UpdateRibbonConditions();
            //}

            if (!handled)
            {
                if (m.Msg == WinApi.WM_NCCALCSIZE && (int)m.WParam == 1)                 //0x83
                {
                    #region Catch the margins of what the client area would be
                    WinApi.NCCALCSIZE_PARAMS nccsp = (WinApi.NCCALCSIZE_PARAMS)Marshal.PtrToStructure(m.LParam, typeof(WinApi.NCCALCSIZE_PARAMS));

                    if (!MarginsChecked)
                    {
                        //Set what client area would be for passing to DwmExtendIntoClientArea
                        SetMargins(new Padding(
                                       nccsp.rect2.Left - nccsp.rect1.Left,
                                       nccsp.rect2.Top - nccsp.rect1.Top,
                                       nccsp.rect1.Right - nccsp.rect2.Right,
                                       nccsp.rect1.Bottom - nccsp.rect2.Bottom));

                        MarginsChecked = true;
                    }

                    Marshal.StructureToPtr(nccsp, m.LParam, false);

                    m.Result = IntPtr.Zero;
                    handled  = true;
                    #endregion
                }
                else if (m.Msg == WinApi.WM_NCACTIVATE && Ribbon != null && Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn)
                {
                    Ribbon.Invalidate(); handled = true;
                    if (m.WParam == IntPtr.Zero)                      // if could be removed because result is ignored if WParam is TRUE
                    {
                        m.Result = (IntPtr)1;
                    }
                }
                else if ((m.Msg == WinApi.WM_ACTIVATE || m.Msg == WinApi.WM_PAINT) && WinApi.IsVista)                 //0x06 - 0x000F
                {
                    m.Result = (IntPtr)1; handled = false;
                }
                else if (m.Msg == WinApi.WM_NCHITTEST && (int)m.Result == 0)                 //0x84
                {
                    #region Check the Non-client area hit test

                    m.Result = new IntPtr(Convert.ToInt32(NonClientHitTest(new Point(WinApi.LoWord((int)m.LParam), WinApi.HiWord((int)m.LParam)))));
                    handled  = true;

                    if (Ribbon != null && Ribbon.ActualBorderMode == RibbonWindowMode.NonClientAreaCustomDrawn)
                    {
                        //Kevin Carbis - this refresh call caused severe cpu usage while moving the mouse over the
                        //caption bar.  I have been trying to find a way to make a less demanding call to paint.
                        //Form.Refresh();
                        //WinApi.InvalidateWindow(Form.Handle);
                        //Form.Invalidate();
                        //Ribbon.Invalidate();
                        Ribbon.RedrawArea(Ribbon.ClientRectangle);
                    }
                    //Console.WriteLine("Msg " + m.Msg.ToString() + " " + m.Msg.ToString("X"));
                    #endregion
                }
                else if (
                    (Ribbon != null && Ribbon.ActualBorderMode != RibbonWindowMode.NonClientAreaCustomDrawn) &&
                    (m.Msg == WinApi.WM_SYSCOMMAND || m.Msg == WinApi.WM_WINDOWPOSCHANGING || m.Msg == WinApi.WM_WINDOWPOSCHANGED))
                {
                    Ribbon.Invalidate();
                }
                else if (m.Msg == WinApi.WM_NCMOUSELEAVE)
                {
                }
            }
            return(handled);
        }
        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;
            ScrollBarSize    = 16;

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

                    //If item is a RibbonHost, the MouseSensor will not detect the mouse move event, so manually hook into the event.
                    if (item is RibbonHost)
                    {
                        ((RibbonHost)item).ClientMouseMove += OnRibbonHostMouseMove;
                    }
                }
            }

            UpdateSize();
        }
示例#34
0
        internal override void SetOwner(Ribbon owner)
        {
            base.SetOwner(owner);

            DropDownItems.SetOwner(owner);
        }
示例#35
0
 public RibbonPanelRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonPanel panel, Control canvas)
     : base(owner, g, clip)
 {
     Panel  = panel;
     Canvas = canvas;
 }
 /// <summary>
 /// Call to draw the scrollbar on the Control
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderScrollbar(Graphics g, Control item, Ribbon ribbon)
 {
 }
示例#37
0
 /// <summary>
 /// Sets the value of the Owner Property
 /// </summary>
 internal void SetOwner(Ribbon owner)
 {
     _owner = owner;
     _tabs.SetOwner(owner);
 }
示例#38
0
 /// <summary>
 /// Sets the Ribbon that owns this item
 /// </summary>
 /// <param name="owner">Ribbon that owns this item</param>
 internal virtual void SetOwner(Ribbon owner)
 {
     _owner = owner;
     OnOwnerChanged(EventArgs.Empty);
 }
示例#39
0
 /// <summary>
 /// Sets the value of the Owner Property
 /// </summary>
 internal void SetOwner(Ribbon owner)
 {
     _owner = owner;
 }
示例#40
0
 public RibbonRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip)
 {
     Ribbon        = owner;
     Graphics      = g;
     ClipRectangle = clip;
 }
示例#41
0
        /// <summary>
        /// Sets the value of the Owner Property
        /// </summary>
        internal void SetOwner(Ribbon owner)
        {
            _owner = owner;

            Items.SetOwner(owner);
        }
 public RibbonQuickAccessGlyphBehavior(RibbonDesigner designer, Ribbon ribbon)
 {
     _designer = designer;
     _ribbon   = ribbon;
 }
示例#43
0
        private void HitOn(int x, int y)
        {
            if (Ribbon.Tabs.Count == 0 || Ribbon.ActiveTab == null)
            {
                SelectRibbon();
                return;
            }

            if (Ribbon != null)
            {
                if (Ribbon.TabHitTest(x, y))
                {
                    SelectedElement = Ribbon.ActiveTab;
                }
                else
                {
                    #region Tab ScrollTest

                    if (Ribbon.ActiveTab.TabContentBounds.Contains(x, y))
                    {
                        if (Ribbon.ActiveTab.ScrollLeftBounds.Contains(x, y) && Ribbon.ActiveTab.ScrollLeftVisible)
                        {
                            Ribbon.ActiveTab.ScrollLeft();
                            SelectedElement = Ribbon.ActiveTab;
                            return;
                        }

                        if (Ribbon.ActiveTab.ScrollRightBounds.Contains(x, y) && Ribbon.ActiveTab.ScrollRightVisible)
                        {
                            Ribbon.ActiveTab.ScrollRight();
                            SelectedElement = Ribbon.ActiveTab;
                            return;
                        }
                    }

                    #endregion

                    //Check Panel
                    if (Ribbon.ActiveTab.TabContentBounds.Contains(x, y))
                    {
                        RibbonPanel hittedPanel = null;

                        foreach (RibbonPanel panel in Ribbon.ActiveTab.Panels)
                        {
                            if (panel.Bounds.Contains(x, y))
                            {
                                hittedPanel = panel;
                                break;
                            }
                        }

                        if (hittedPanel != null)
                        {
                            //Check item
                            RibbonItem hittedItem = null;

                            foreach (RibbonItem item in hittedPanel.Items)
                            {
                                if (item.Bounds.Contains(x, y))
                                {
                                    hittedItem = item;
                                    break;
                                }
                            }

                            if (hittedItem != null && hittedItem is IContainsSelectableRibbonItems)
                            {
                                //Check subitem
                                RibbonItem hittedSubItem = null;

                                foreach (RibbonItem subItem in (hittedItem as IContainsSelectableRibbonItems).GetItems())
                                {
                                    if (subItem.Bounds.Contains(x, y))
                                    {
                                        hittedSubItem = subItem;
                                        break;
                                    }
                                }

                                if (hittedSubItem != null)
                                {
                                    SelectedElement = hittedSubItem;
                                }
                                else
                                {
                                    SelectedElement = hittedItem;
                                }
                            }
                            else if (hittedItem != null)
                            {
                                SelectedElement = hittedItem;
                            }
                            else
                            {
                                SelectedElement = hittedPanel;
                            }
                        }
                        else
                        {
                            SelectedElement = Ribbon.ActiveTab;
                        }
                    }
                    else if (Ribbon.QuickAcessToolbar.SuperBounds.Contains(x, y))
                    {
                        bool itemHitted = false;

                        foreach (RibbonItem item in Ribbon.QuickAcessToolbar.Items)
                        {
                            if (item.Bounds.Contains(x, y))
                            {
                                itemHitted      = true;
                                SelectedElement = item;
                                break;
                            }
                        }
                        if (!itemHitted)
                        {
                            SelectedElement = Ribbon.QuickAcessToolbar;
                        }
                    }
                    else if (Ribbon.OrbBounds.Contains(x, y))
                    {
                        Ribbon.OrbMouseDown();
                    }
                    else
                    {
                        SelectRibbon();

                        Ribbon.ForceOrbMenu = false;
                        if (Ribbon.OrbDropDown.Visible)
                        {
                            Ribbon.OrbDropDown.Close();
                        }
                    }
                }
            }
        }
 public RibbonQuickAccessToolbarGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon)
     : base(new RibbonQuickAccessGlyphBehavior(designer, ribbon))
 {
     _behaviorService   = behaviorService;
     _componentDesigner = designer;
     _ribbon            = ribbon;
 }
示例#45
0
 public LayoutHelper(Ribbon ribbon)
 {
     _ribbon = ribbon;
 }
示例#46
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();
        }
示例#47
0
        internal override void SetOwner(Ribbon owner)
        {
            base.SetOwner(owner);

            if (_dropDownItems != null) _dropDownItems.SetOwner(owner);
        }
示例#48
0
 internal RibbonDropDown(RibbonItem parentItem, IEnumerable <RibbonItem> items, Ribbon ownerRibbon)
     : this(parentItem, items, ownerRibbon, RibbonElementSizeMode.DropDown)
 {
 }
示例#49
0
 /// <summary>
 /// Creates a new RibbonTabContext
 /// </summary>
 /// <param name="Ribbon">Ribbon that owns the context</param>
 public RibbonContext(Ribbon owner)
 {
     _tabs = new RibbonTabCollection(owner);
 }
示例#50
0
 /// <summary>
 /// Creates a new RibbonTab
 /// </summary>
 public RibbonTab(Ribbon owner, string text)
 {
     _panels = new RibbonPanelCollection(owner, this);
     _text   = text;
 }
      internal override void SetOwner(Ribbon owner)
      {
         base.SetOwner(owner);

         _buttons.SetOwner(owner);
         _dropDownItems.SetOwner(owner);
      }
 public RibbonItemRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonItem item)
     : base(owner, g, clip)
 {
     Item = item;
 }