Пример #1
0
        private void ramMain_DropDown(object sender, EventArgs e)
        {
            for (int i = ramMain.RightPaneItems.Count - 1; i > 1; i--)
            {
                RibbonItem ri = ramMain.RightPaneItems[i];
                ramMain.RightPaneItems.RemoveAt(i);
                ri.Dispose();
            }

            for (int i = 0; i < ppMain.VisitedDocuments.Count; i++)
            {
                RibbonListItem rli = new RibbonListItem();
                rli.Click += RecentFileClick;
                rli.Tag    = i;
                RibbonButton rb = new RibbonButton();
                if (i < 9)
                {
                    rb.Text = string.Format("&{0}  {1}", i + 1, ppMain.VisitedDocuments[i].DocumentCaption);
                }
                else
                {
                    rb.Text = string.Format("   {0}", ppMain.VisitedDocuments[i].DocumentCaption);
                }
                rli.Items.Add(rb);
                ramMain.RightPaneItems.Add(rli);
            }
        }
Пример #2
0
        void RibbonListItem_Click(object sender, EventArgs e)
        {
            RibbonListItem rli      = (RibbonListItem)sender;
            C1JumpPath     jumpPath = (C1JumpPath)rli.Tag;

            OpenFile(jumpPath.Path);
        }
Пример #3
0
            public RecentDocumentList(
                RibbonItemCollection rightPaneItems,
                StringCollection files,
                LoadDocumentDelegate loadDocument)
            {
                this.rightPaneItems = rightPaneItems;
                this.files          = files;
                this.loadDocument   = loadDocument;

                // first create a header and make sure it's not selectable
                RibbonListItem listItem = new RibbonListItem(new RibbonLabel("Recent Documents"));

                listItem.AllowSelection = false;
                rightPaneItems.Add(listItem);
                rightPaneItems.Add(new RibbonListItem(new RibbonSeparator()));

                this.listTopIndex = rightPaneItems.Count;

                // create the recently used document list
                foreach (string document in this.files)
                {
                    RecentDocumentItem item = new RecentDocumentItem(document, false, loadDocument);
                    rightPaneItems.Add(item);

                    string d = document;
                }
            }
Пример #4
0
        // Creates a RibbonListItem and initializes it using a unique ID string.
        internal static RibbonListItem CreateHeader(string id)
        {
            string         text   = (string)Resources.ResourceManager.GetObject(id + "_hdr", Resources.Culture);
            RibbonLabel    label  = new RibbonLabel(text);
            RibbonListItem header = new RibbonListItem(label);

            header.AllowSelection = false;
            return(header);
        }
Пример #5
0
        void DelButton_Click(object sender, EventArgs e)
        {
            RibbonListItem rli = ((RibbonButton)sender).Parent as RibbonListItem;

            if (rli != null)
            {
                atb.JumpList.RemoveFromKnownCategories((C1JumpPath)rli.Tag);
                rpc.Ribbon.ApplicationMenu.RightPaneItems.Remove(rli);
                rli.Dispose();
            }
        }
Пример #6
0
        private void recentLocation_Click(object sender, EventArgs e)
        {
            // One of the recent locations was clicked
            // (item belongs to c1Ribbon.ApplicationMenu.RightPaneItems)
            RibbonListItem item = sender as RibbonListItem;

            if (item != null)
            {
                // label is the first child of item
                RibbonLabel label = item.Items[0] as RibbonLabel;

                // Find the corresponding location
                if (label != null)
                {
                    FindLocation(label.Text);
                }
            }
        }
Пример #7
0
        void DelButton_Click(object sender, EventArgs e)
        {
            RibbonListItem rli = ((RibbonButton)sender).Parent as RibbonListItem;

            if (rli != null)
            {
                string s = (string)rli.Tag;
                for (int i = 0; i < _recentItems.Count; i++)
                {
                    if (_recentItems[i] == s)
                    {
                        _recentItems.RemoveAt(i);
                        break;
                    }
                }
                fv.Ribbon.ApplicationMenu.RightPaneItems.Remove(rli);
                rli.Dispose();
            }
        }
Пример #8
0
        /// <summary>
        /// Builds the recent documents menu items (buttons) on the ribbon application menu.
        /// Should be called from the ribbon application menu's DropDown event.
        /// </summary>
        protected void AddRecentDocumentsMenuItems()
        {
            // Clear any old items:
            while (ramMain.RightPaneItems.Count > NFIXED)
            {
                ramMain.RightPaneItems.RemoveAt(NFIXED);
            }

            // add all recent docs to the menu:
            foreach (Pair <string, string> pair in RecentDocuments)
            {
                // button for the new item:
                var rbtn = new RibbonButton();
                if (!string.IsNullOrEmpty(pair.Second))
                {
                    rbtn.Text    = pair.Second;
                    rbtn.ToolTip = string.Format(
                        "<table><tr><td>Report:</td><td><b>{1}</b></td></tr><tr><td>File:</td><td><b>{0}</b></td></tr></table>",
                        pair.First, pair.Second);
                }
                else
                {
                    rbtn.Text    = System.IO.Path.GetFileName(pair.First);
                    rbtn.ToolTip = string.Format(
                        "<table><tr><td>File:</td><td><b>{0}</b></td></tr></table>",
                        pair.First);
                }
                // the list item:
                var rli = new RibbonListItem(rbtn);
                rli.Tag    = pair;
                rli.Click += (s, e) =>
                {
                    cmdFileOpen.UserData = ((RibbonListItem)s).Tag;
                    cmdFileOpen.PerformClick();
                    cmdFileOpen.UserData = null; // cleanup
                };
                // done, add the new item:
                ramMain.RightPaneItems.Add(rli);
            }
        }
Пример #9
0
        private void UpdateRecentLocations(string address)
        {
            // Get the collection of recent locations (right pane)
            RibbonItemCollection mru = c1Ribbon.ApplicationMenu.RightPaneItems;

            // Add the specified address if not already present
            if (address.Length > 0 && !mru.Contains(address))
            {
                // Create a list item containing a label
                RibbonLabel    label = new RibbonLabel(address);
                RibbonListItem item  = new RibbonListItem(label);

                // Add a handler for the Click event
                item.Click += new EventHandler(recentLocation_Click);

                // Must set the ID for subsequent calls to mru.Contains(address)
                item.ID = address;

                // Add the new item to the collection
                mru.Add(item);
            }
        }
Пример #10
0
        void RibbonListItem_Click(object sender, EventArgs e)
        {
            RibbonListItem rli = (RibbonListItem)sender;

            OpenFile((string)rli.Tag, false);
        }