Пример #1
0
        /// <summary>
        /// Selects the specified item as the currently selected sub-item
        /// </summary>
        /// <param name="item"></param>
        private void SetSelectedSubItem(RibbonItem item)
        {
            if (item == _lastSelectedSubItem)
            {
                return;
            }

            if (_lastSelectedSubItem != null)
            {
                _lastSelectedSubItem.SetSelected(false);
                RedrawItem(_lastSelectedSubItem, GetContentBounds(_lastSelectedSubItemParent));
            }

            if (item != null)
            {
                item.SetSelected(true);
                RedrawItem(item, GetContentBounds(_lastSelectedSubItemParent));
            }

            _lastSelectedSubItem = item;
        }
Пример #2
0
        /// <summary>
        /// Selects the specified item as the currently selected item
        /// </summary>
        /// <param name="item"></param>
        private void SetSelectedItem(RibbonItem item)
        {
            if (item == _lastSelectedItem)
            {
                return;
            }

            if (_lastSelectedItem != null)
            {
                _lastSelectedItem.SetSelected(false);
                RedrawItem(_lastSelectedItem);
            }

            if (item != null)
            {
                item.SetSelected(true);
                RedrawItem(item);
            }

            _lastSelectedItem = item;
        }
Пример #3
0
        private void _keyboardHook_KeyUp(object sender, KeyEventArgs e)
        {
            //base.OnKeyUp(e);
            if (e.KeyCode == Keys.Down)
            {
                RibbonItem NextItem     = null;
                RibbonItem SelectedItem = null;
                foreach (RibbonItem itm in MenuItems)
                {
                    if (itm.Selected)
                    {
                        SelectedItem = itm;
                        break;
                    }
                }
                if (SelectedItem != null)
                {
                    //get the next item in the chain
                    int Index = MenuItems.IndexOf(SelectedItem);
                    NextItem = GetNextSelectableMenuItem(Index + 1);
                }
                else
                {
                    //nothing found so lets search through the recent buttons
                    foreach (RibbonItem itm in RecentItems)
                    {
                        if (itm.Selected)
                        {
                            SelectedItem = itm;
                            itm.SetSelected(false);
                            itm.RedrawItem();
                            break;
                        }
                    }
                    if (SelectedItem != null)
                    {
                        //get the next item in the chain
                        int Index = RecentItems.IndexOf(SelectedItem);
                        NextItem = GetNextSelectableRecentItem(Index + 1);
                    }
                    else
                    {
                        //nothing found so lets search through the option buttons
                        foreach (RibbonItem itm in OptionItems)
                        {
                            if (itm.Selected)
                            {
                                SelectedItem = itm;
                                itm.SetSelected(false);
                                itm.RedrawItem();
                                break;
                            }
                        }
                        if (SelectedItem != null)
                        {
                            //get the next item in the chain
                            int Index = OptionItems.IndexOf(SelectedItem);
                            NextItem = GetNextSelectableOptionItem(Index + 1);
                        }
                    }
                }
                //last check to make sure we found a selected item
                if (SelectedItem == null)
                {
                    //we should have the right item by now so lets select it
                    NextItem = GetNextSelectableMenuItem(0);
                    if (NextItem != null)
                    {
                        NextItem.SetSelected(true);
                        NextItem.RedrawItem();
                    }
                }
                else
                {
                    SelectedItem.SetSelected(false);
                    SelectedItem.RedrawItem();

                    NextItem.SetSelected(true);
                    NextItem.RedrawItem();
                }
                //_sensor.SelectedItem = NextItem;
                //_sensor.HittedItem = NextItem;
            }
            else if (e.KeyCode == Keys.Up)
            {
            }
        }
Пример #4
0
        /// <summary>
        /// Selects the specified item as the currently selected sub-item
        /// </summary>
        /// <param name="item"></param>
        private void SetSelectedSubItem(RibbonItem item)
        {
            if (item == _lastSelectedSubItem) return;

            if (_lastSelectedSubItem != null)
            {
                _lastSelectedSubItem.SetSelected(false);
                RedrawItem(_lastSelectedSubItem, GetContentBounds(_lastSelectedSubItemParent));
            }

            if (item != null)
            {
                item.SetSelected(true);
                RedrawItem(item, GetContentBounds(_lastSelectedSubItemParent));
            }

            _lastSelectedSubItem = item;
        }
Пример #5
0
        /// <summary>
        /// Selects the specified item as the currently selected item
        /// </summary>
        /// <param name="item"></param>
        private void SetSelectedItem(RibbonItem item)
        {
            if (item == _lastSelectedItem) return;

            if (_lastSelectedItem != null)
            {
                _lastSelectedItem.SetSelected(false);
                RedrawItem(_lastSelectedItem);
            }

            if (item != null)
            {
                item.SetSelected(true);
                RedrawItem(item);
            }

            _lastSelectedItem = item;
        }