public static bool ParseToolbarButtonLine(string source, out string command, ref ToolStripItemDisplayStyle displayStyle, out IconLocation imageLocation)
 {
     command = null;
     imageLocation = null;
     if (string.IsNullOrEmpty(source))
     {
         return false;
     }
     int startIndex = 0;
     command = StringHelper.ReadValue(source, ref startIndex, new char[] { ',' }).Trim();
     if (startIndex > 0)
     {
         string str = StringHelper.ReadValue(source, ref startIndex, new char[] { ',' }).Trim();
         try
         {
             displayStyle = (ToolStripItemDisplayStyle) Enum.Parse(typeof(ToolStripItemDisplayStyle), str);
         }
         catch (ArgumentException)
         {
         }
     }
     if (startIndex > 0)
     {
         string iconLocation = source.Substring(startIndex).Trim();
         imageLocation = IconLocation.TryParse(iconLocation);
         if (!(((imageLocation == null) || (imageLocation.IconIndex != 0)) || iconLocation.EndsWith(",0", StringComparison.Ordinal)))
         {
             imageLocation = new IconLocation(imageLocation.IconFileName, -1);
         }
     }
     return true;
 }
예제 #2
0
        protected ControlControl(IServiceProvider serviceProvider, NiCommandBarControl control, ToolStripItem item, ToolStripItemDisplayStyle defaultDisplayStyle)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            NiCommand = control;

            Item = item;
            DefaultDisplayStyle = defaultDisplayStyle;
            Item.Tag            = this;

            UpdateItem();

            NiCommand.AppearanceChanged += Control_AppearanceChanged;
        }
 public static string CreateToolbarButtonLine(string command, ToolStripItemDisplayStyle displayStyle, IconLocation imageLocation)
 {
     if (command == null)
     {
         throw new ArgumentNullException();
     }
     if (command == string.Empty)
     {
         throw new ArgumentException();
     }
     StringBuilder builder = new StringBuilder();
     builder.Append(command);
     if (displayStyle != ToolStripItemDisplayStyle.Image)
     {
         builder.Append(',');
         builder.Append(displayStyle);
     }
     if (imageLocation != null)
     {
         if (displayStyle == ToolStripItemDisplayStyle.Image)
         {
             builder.Append(',');
         }
         builder.Append(',');
         builder.Append(imageLocation.IconFileName);
         if (imageLocation.IconIndex >= 0)
         {
             builder.Append(',');
             builder.Append(imageLocation.IconIndex);
         }
     }
     return builder.ToString();
 }
예제 #4
0
        public IWordButton CreateButton(IWordCommandBar parent, string commandId, ToolStripItemDisplayStyle style, string caption, string toolTip,
             Image image, bool beginGroup)
        {
            CommandBarButtonWrapper wrapper = new CommandBarButtonWrapper(
                parent, style, caption, toolTip, commandId, image, beginGroup);

            return wrapper;
        }
        private void RefreshDisplayStyle()
        {
            ToolStripItemDisplayStyle property = (ToolStripItemDisplayStyle)this.GetProperty("DisplayStyle");

            this.noneStyleToolStripMenuItem.Checked      = property == ToolStripItemDisplayStyle.None;
            this.textStyleToolStripMenuItem.Checked      = property == ToolStripItemDisplayStyle.Text;
            this.imageStyleToolStripMenuItem.Checked     = property == ToolStripItemDisplayStyle.Image;
            this.imageTextStyleToolStripMenuItem.Checked = property == ToolStripItemDisplayStyle.ImageAndText;
        }
 public CommandBarButtonWrapper(IWordCommandBar parent, ToolStripItemDisplayStyle style, string caption, string toolTip,
     string commandId, Image image, bool beginGroup)
 {
     _parent = parent;
     _imageDisplayStyle = style;
     _caption = caption;
     _commandId = commandId;
     _glyph = image;
     _beginsGroup = beginGroup;
     _toolTip = toolTip;
 }
        //private void toolStrip2_LayoutCompleted(object sender, EventArgs e)
        //{
        //    // Check if the overflow menu is in use.
        //    if (toolStrip2.OverflowButton.HasDropDownItems)
        //    {
        //        if (shrinkAmount == ShrinkLevel.ImageOnly)
        //        {
        //            // No more shrinking is possible. You may
        //            // as well fix up the overflow menu to show
        //            // full text and image.
        //            foreach (ToolStripItem item in toolStrip2.Items)
        //            {
        //                if (item.Placement == ToolStripItemPlacement.Overflow)
        //                {
        //                    item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
        //                }
        //                else
        //                {
        //                    item.DisplayStyle = ToolStripItemDisplayStyle.Image;
        //                }
        //            }
        //            return;
        //        }

        //        // Will TextOnly fit?
        //        if (toolStrip2.DisplayRectangle.Width > textOnlySize)
        //        {
        //            shrinkAmount = ShrinkLevel.TextOnly;
        //            ChangeButtonSize(ToolStripItemDisplayStyle.Text);
        //        }
        //        // We need to go with ImageOnly.
        //        else
        //        {
        //            shrinkAmount = ShrinkLevel.ImageOnly;
        //            ChangeButtonSize(ToolStripItemDisplayStyle.Image);
        //        }
        //    }
        //}
        private void ChangeButtonSize(ToolStripItemDisplayStyle displayStyle)
        {
            toolStrip2.SuspendLayout();
            foreach (ToolStripItem item in toolStrip2.Items)
            {
                if (!(item is ToolStripSeparator))
                {
                    item.DisplayStyle = displayStyle;
                }
            }
            toolStrip2.ResumeLayout();
        }
예제 #8
0
 private CommandContainer(
     IWin32Window window,
     ToolStripItemCollection menuItems,
     ToolStripItemDisplayStyle displayStyle,
     Func <IExceptionDialog> getExceptionDialogFunc,
     CommandContainer <TContext> parent)
 {
     this.window                 = window;
     this.menuItems              = menuItems;
     this.displayStyle           = displayStyle;
     this.getExceptionDialogFunc = getExceptionDialogFunc;
     this.parent                 = parent;
 }
예제 #9
0
 public CommandContainer(
     IWin32Window parent,
     ToolStripItemCollection menuItems,
     ToolStripItemDisplayStyle displayStyle,
     IServiceProvider serviceProvider)
     : this(
         parent,
         menuItems,
         displayStyle,
         serviceProvider.GetService <IExceptionDialog>,
         null)
 {
 }
예제 #10
0
        private void SetToolbarText()
        {
            ToolStripItemDisplayStyle style = Runtime.Instance.Settings.HideToolbarText
                ? ToolStripItemDisplayStyle.Image
                : ToolStripItemDisplayStyle.ImageAndText;

            this.showWindow.DisplayStyle   = style;
            this.hideWindow.DisplayStyle   = style;
            this.unlockWindow.DisplayStyle = style;
            this.lockWindow.DisplayStyle   = style;
            this.pinWindow.DisplayStyle    = style;
            this.renameWindow.DisplayStyle = style;
        }
예제 #11
0
 public CommandContainer(
     IWin32Window parent,
     ToolStripItemCollection menuItems,
     ToolStripItemDisplayStyle displayStyle,
     Func <IExceptionDialog> getExceptionDialogFunc)
     : this(
         parent,
         menuItems,
         displayStyle,
         getExceptionDialogFunc,
         null)
 {
 }
예제 #12
0
        /// <summary>
        /// A simple constructor.
        /// </summary>
        /// <remarks>
        /// This constructor wires the appropriate event <paramref name="p_ctlButton"/> to the
        /// <see cref="Selected"/> event.
        /// </remarks>
        /// <param name="p_ctlButton">The actual control that is to be added to the <see cref="PanelToolStrip"/>.</param>
        /// <param name="p_strEvent">The name of the event on the button control to which to bind the <see cref="Selected"/> event.</param>
        /// <param name="p_intIndex">The index of this item in the panel.</param>
        /// <param name="p_tdsDisplayStyle">The <see cref="ToolStripItemDisplayStyle"/> indicating how text and
        /// images are displayed on this item.</param>
        public PanelToolStripItem(Control p_ctlButton, string p_strEvent, Int32 p_intIndex, ToolStripItemDisplayStyle p_tdsDisplayStyle)
        {
            m_ctlButton       = p_ctlButton;
            m_tdsDisplayStyle = p_tdsDisplayStyle;

            Type tpeButtonType = m_ctlButton.GetType();

            m_ctlButton.Tag = this;
            m_intIndex      = p_intIndex;
            m_ttpToolTip.SetToolTip(m_ctlButton, m_ctlButton.Text);

            tpeButtonType.GetEvent(p_strEvent).AddEventHandler(p_ctlButton, Delegate.CreateDelegate(typeof(EventHandler), this, "OnSelected"));
        }
예제 #13
0
 public ToolbarCommand(Command command, int position, bool viewImage, bool viewText)
 {
     this.command  = command;
     this.Position = position;
     if (viewImage == viewText)
     {
         displayStyle = viewImage ? ToolStripItemDisplayStyle.ImageAndText : ToolStripItemDisplayStyle.None;
     }
     else
     {
         displayStyle = viewImage ? ToolStripItemDisplayStyle.Image : ToolStripItemDisplayStyle.Text;
     }
 }
예제 #14
0
        /// <summary>
        /// A simple constructor.
        /// </summary>
        /// <remarks>
        /// This constructor wires the appropriate event <paramref name="p_ctlButton"/> to the
        /// <see cref="Select"/> event.
        /// </remarks>
        /// <param name="p_ctlButton">The actual control that is to be added to the <see cref="PanelToolStrip"/>.</param>
        /// <param name="p_strEvent">The name of the event on the button control to which to bind the <see cref="Selected"/> event.</param>
        /// <param name="p_intIndex">The index of this item in the panel.</param>
        /// <param name="p_tdsDisplayStyle">The <see cref="ToolStripItemDisplayStyle"/> indicating how text and
        /// images are displayed on this item.</param>
        public PanelToolStripItem(Control p_ctlButton, string p_strEvent, Int32 p_intIndex, ToolStripItemDisplayStyle p_tdsDisplayStyle)
        {
            m_ctlButton = p_ctlButton;
            m_tdsDisplayStyle = p_tdsDisplayStyle;

            Type tpeButtonType = m_ctlButton.GetType();

            m_ctlButton.Tag = this;
            m_intIndex = p_intIndex;
            m_ttpToolTip.SetToolTip(m_ctlButton, m_ctlButton.Text);

            tpeButtonType.GetEvent(p_strEvent).AddEventHandler(p_ctlButton, Delegate.CreateDelegate(typeof(EventHandler), this, "OnSelected"));
        }
        /// <summary>
        /// Performs custom actions on toolstrip SizeChanged events</summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args</param>
        void toolStrip_SizeChanged(object sender, EventArgs e)
        {
            if (m_showToolStripLabels)
            {
                m_showToolStripLabelThreshold = m_toolStrip.Items.Cast <ToolStripItem>().Sum(item => item.Width);
            }
            m_showToolStripLabels = m_toolStrip.Width > m_showToolStripLabelThreshold;

            ToolStripItemDisplayStyle style = m_showToolStripLabels
                ? ToolStripItemDisplayStyle.ImageAndText
                : ToolStripItemDisplayStyle.Image;

            m_addButton.DisplayStyle    = style;
            m_deleteButton.DisplayStyle = style;
        }
예제 #16
0
        protected ControlControl(IServiceProvider serviceProvider, NiCommandBarControl control, ToolStripItem item, ToolStripItemDisplayStyle defaultDisplayStyle)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");
            if (control == null)
                throw new ArgumentNullException("control");
            if (item == null)
                throw new ArgumentNullException("item");

            NiCommand = control;

            Item = item;
            DefaultDisplayStyle = defaultDisplayStyle;
            Item.Tag = this;

            UpdateItem();

            NiCommand.AppearanceChanged += Control_AppearanceChanged;
        }
예제 #17
0
        public ServerTreeComponentControl(ServerTreeComponent component)
        {
            Platform.CheckForNullReference(component, "component");
            InitializeComponent();

            _component = component;

            this.DataBindings.Add("Enabled", _component, "IsEnabled");

            _titleBar.Visible    = _component.ShowTitlebar;
            _serverTools.Visible = _component.ShowTools;

            _aeTreeView.AllowDrop    = !_component.IsReadOnly;
            _aeTreeView.ItemDrag    += TreeViewItemDrag;
            _aeTreeView.DragEnter   += TreeViewDragEnter;
            _aeTreeView.DragOver    += TreeViewDragOver;
            _aeTreeView.DragDrop    += TreeViewDragDrop;
            _aeTreeView.MouseDown   += AETreeViewClick;
            _aeTreeView.AfterSelect += AETreeViewAfterSelect;

            _component.SelectedServerChanged        += new EventHandler(OnSelectedServerChanged);
            _component.ServerTree.ServerTreeUpdated += OnServerTreeUpdated;
            if (_component.ShowTools)
            {
                _toolStripItemDisplayStyle = ToolStripItemDisplayStyle.Image;
                ToolbarModel = _component.ToolbarModel;
                MenuModel    = _component.ContextMenuModel;
            }

            if (_component.ShowLocalServerNode)
            {
                // A bit cheap, but by doing this we can force a refresh of the tooltip text.
                _aeTreeView.MouseEnter += OnMouseEnter;
            }

            BuildServerTreeView(_aeTreeView, _component.ServerTree);
            SetInitialSelection();
        }
예제 #18
0
		public ServerTreeComponentControl(ServerTreeComponent component)
		{
            Platform.CheckForNullReference(component, "component");
            InitializeComponent();

            _component = component;

			this.DataBindings.Add("Enabled", _component, "IsEnabled");

			_titleBar.Visible = _component.ShowTitlebar;
			_serverTools.Visible = _component.ShowTools;

			_aeTreeView.AllowDrop = !_component.IsReadOnly;
            _aeTreeView.ItemDrag += TreeViewItemDrag;
            _aeTreeView.DragEnter += TreeViewDragEnter;
            _aeTreeView.DragOver += TreeViewDragOver;
            _aeTreeView.DragDrop += TreeViewDragDrop;
			_aeTreeView.MouseDown += AETreeViewClick;
			_aeTreeView.AfterSelect += AETreeViewAfterSelect;

			_component.SelectedServerChanged += new EventHandler(OnSelectedServerChanged);
			_component.ServerTree.ServerTreeUpdated += OnServerTreeUpdated;
			if (_component.ShowTools)
			{
				_toolStripItemDisplayStyle = ToolStripItemDisplayStyle.Image;
				ToolbarModel = _component.ToolbarModel;
				MenuModel = _component.ContextMenuModel;
			}

			if (_component.ShowLocalServerNode)
			{
				// A bit cheap, but by doing this we can force a refresh of the tooltip text.
                _aeTreeView.MouseEnter += OnMouseEnter;
			}

			BuildServerTreeView(_aeTreeView, _component.ServerTree);
			SetInitialSelection();
		}
예제 #19
0
        public static ToolStripItemDisplayStyle GetDisplayStyle(string displayStyle)
        {
            ToolStripItemDisplayStyle style = ToolStripItemDisplayStyle.ImageAndText;

            switch (displayStyle)
            {
            case "Text":
                style = ToolStripItemDisplayStyle.Text;
                break;

            case "Image":
                style = ToolStripItemDisplayStyle.Image;
                break;

            case "ImageAndText":
                style = ToolStripItemDisplayStyle.ImageAndText;
                break;

            default:
                throw new Exception("参数输入不正确!");
            }
            return(style);
        }
예제 #20
0
        public StandardToolbar(IWorkingEnvironment environment)
        {
            Verify.Argument.IsNotNull(environment, "environment");

            _environment = environment;

            Text = Resources.StrStandard;

            const TextImageRelation         tir = TextImageRelation.ImageAboveText;
            const ToolStripItemDisplayStyle ds  = ToolStripItemDisplayStyle.ImageAndText;

            Items.AddRange(new ToolStripItem[]
            {
                _initRepositoryButton = new ToolStripButton(Resources.StrInit, CachedResources.Bitmaps["ImgRepositoryInitSmall"], OnInitRepositoryClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipInit
                },
                _cloneRepositoryButton = new ToolStripButton(Resources.StrClone, CachedResources.Bitmaps["ImgRepositoryCloneSmall"], OnCloneRepositoryClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipClone
                },
            });
        }
예제 #21
0
        private void ChangeStyle(object sender, EventArgs e)
        {
            if (this.manualChangeStyle)
            {
                return;
            }

            if (this.listCurrentActions.SelectedItem != null)
            {
                Command cmd = ((KryptonListItem)this.listCurrentActions.SelectedItem).Tag as Command;
                if (cmd != null)
                {
                    ToolStripItemDisplayStyle style = ToolStripItemDisplayStyle.None;
                    if (this.checkImage.Checked)
                    {
                        style |= ToolStripItemDisplayStyle.Image;
                    }

                    if (this.checkText.Checked)
                    {
                        style |= ToolStripItemDisplayStyle.Text;
                    }

                    if (this.styles.ContainsKey(cmd))
                    {
                        this.styles[cmd] = style;
                    }
                    else
                    {
                        this.styles.Add(cmd, style);
                    }

                    this.Changed = true;
                }
            }
        }
 public ToolStripDropDownItemCodonAbstract(string pathPoint, string text, Image image, ToolStripItemDisplayStyle displayStyle, OnToolStripItemCodonActionHandler action)
     : base(pathPoint, text, image, displayStyle, action)
 {
 }
예제 #23
0
 public NToolStripButton(string text, ICommand command, string imageFile, ToolStripItemDisplayStyle style)
 {
     this.Text = text;
     this.command = command;
     this.DisplayStyle = style;
 }
예제 #24
0
 public ToolStripBuilderStyle(ToolStripItemDisplayStyle toolStripItemDisplayStyle, ToolStripItemAlignment toolStripItemAlignment, TextImageRelation textImageRelation)
 {
     _toolStripItemAlignment = toolStripItemAlignment;
     _toolStripItemDisplayStyle = toolStripItemDisplayStyle;
     _textImageRelation = textImageRelation;
 }
예제 #25
0
        /// <summary>
        /// Create a new instance of ToolStripButton class with the specified name that displays the specified text and image and that raises the Click event.
        /// </summary>
        /// <param name="name">The name of the ToolStripButton.</param>
        /// <param name="text">The text to display on the ToolStripButton.</param>
        /// <param name="toolTipText">Specify the text that appears as a ToolTip for a control.</param>
        /// <param name="image">The image to display on the ToolStripButton.</param>
        /// <param name="onClick">An event handler that raises the Click event.</param>
        /// <param name="displayStyle">Specify whether text and images are displayed on a ToolStripItem.</param>
        /// <returns></returns>
        protected virtual ToolStripItem CreateButton(string name, string text, string toolTipText, Image image, EventHandler onClick, ToolStripItemDisplayStyle displayStyle = ToolStripItemDisplayStyle.ImageAndText)
        {
            ToolStripButton btn = new ToolStripButton(text, image, onClick, name);

            btn.Padding           = new Padding(7, 2, 7, 2);
            btn.ToolTipText       = toolTipText;
            btn.ImageScaling      = ToolStripItemImageScaling.None;
            btn.TextImageRelation = TextImageRelation.ImageAboveText;
            btn.DisplayStyle      = displayStyle;
            return(btn);
        }
예제 #26
0
 public ToolStripItemCodonAbstract(string pathPoint, string text, Image image, ToolStripItemDisplayStyle displayStyle, OnToolStripItemCodonActionHandler action)
 {
     PathPoint = pathPoint;
     if (text != null)
     {
         this._text = text;
     }
     if (image != null)
     {
         this.Image = image;
     }
     this.DisplayStyle = displayStyle;
     if (action != null)
     {
         Action = action;
     }
 }
예제 #27
0
 public ToolStripItemCodonAbstract(string pathPoint, string text, ToolStripItemDisplayStyle displayStyle)
     : this(pathPoint, text, null, displayStyle, null)
 {
 }
예제 #28
0
        public PopupControl(IServiceProvider serviceProvider, NiCommandBarPopup control, ToolStripItemDisplayStyle defaultDisplayStyle)
            : base(serviceProvider, control, defaultDisplayStyle)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            _serviceProvider = serviceProvider;
            _groupManager    = new GroupManager(NiCommand, serviceProvider, Item);
            _menuManager     = (NiMenuManager)serviceProvider.GetService(typeof(INiMenuManager));

            var objectWithSite = Item as INiObjectWithSite;

            if (objectWithSite != null)
            {
                ErrorUtil.ThrowOnFailure(objectWithSite.SetSite(serviceProvider));
            }

            Item.QueryStatus += (s, e) => _menuManager.QueryStatus(NiCommand);
        }
예제 #29
0
 private void SetToolStripItemDisplayStyle(ToolStripItemDisplayStyle style)
 {
     foreach (ToolStripItem toolStripItem in this.tsTempateEditor.Items)
     {
         if (toolStripItem.GetType() != typeof(ToolStripSeparator))
         {
             toolStripItem.DisplayStyle = style;
         }
     }
 }
예제 #30
0
		public virtual void ResetDisplayStyle () { this.display_style = this.DefaultDisplayStyle; }
예제 #31
0
 private static ToolStripButton CreateToolStripButton(string text, System.Drawing.Image image, EventHandler handler, string toolTip, ToolStripItemDisplayStyle toolStripDisplayStyle)
 {
     return(new ToolStripButton(text, image, handler)
     {
         DisplayStyle = toolStripDisplayStyle,
         ToolTipText = toolTip,
         DoubleClickEnabled = true,
         Text = text
     });
 }
예제 #32
0
 private void SetToolStripButtonDisplayStyle(ToolStripItemDisplayStyle style1, ToolStripItemDisplayStyle style2, ToolStripItemDisplayStyle style3)
 {
     Program.mw.toolStripButton1.DisplayStyle = style1;
     Program.mw.toolStripButton2.DisplayStyle = style2;
     Program.mw.toolStripButton3.DisplayStyle = style3;
 }
예제 #33
0
 /// <summary>
 /// Adds a <see cref="Control"/> to the toolstrip.
 /// </summary>
 /// <remarks>
 /// This method creates a <see cref="PanelToolStripItem"/> base on the given
 /// values and adds it to the toolstrip.
 /// </remarks>
 /// <param name="p_ctlButton">The <see cref="Control"/> to add.</param>
 /// <param name="p_strEventName">The name of the event on the control to which to bind the <see cref="PanelToolStripItem.Selected"/> event.</param>
 /// <param name="p_intIndex">The index at which to insert the added item.</param>
 /// <param name="p_tdsDisplayStyle">The <see cref="ToolStripItemDisplayStyle"/> indicating how text and
 /// images are displayed on the added item.</param>
 public void addToolStripItem(Control p_ctlButton, string p_strEventName, Int32 p_intIndex, ToolStripItemDisplayStyle p_tdsDisplayStyle)
 {
     addToolStripItem(new PanelToolStripItem(p_ctlButton, p_strEventName, p_intIndex, p_tdsDisplayStyle));
 }
 public ToolStripDropDownItemCodonAbstract(string pathPoint, string text, ToolStripItemDisplayStyle displayStyle)
     : base(pathPoint, text, displayStyle)
 {
 }
예제 #35
0
 public static void BuildToolbar(ToolStripItemCollection parentItemCollection, IEnumerable <ActionModelNode> nodes, ToolStripItemDisplayStyle toolStripItemDisplayStyle)
 {
     BuildToolbar(parentItemCollection, nodes, new ToolStripBuilderStyle(toolStripItemDisplayStyle));
 }
예제 #36
0
        public GitToolbar(GuiProvider guiProvider)
        {
            Verify.Argument.IsNotNull(guiProvider, nameof(guiProvider));

            _guiProvider = guiProvider;

            Text = Resources.StrGit;

            const TextImageRelation         tir = TextImageRelation.ImageAboveText;
            const ToolStripItemDisplayStyle ds  = ToolStripItemDisplayStyle.ImageAndText;

            Items.AddRange(new ToolStripItem[]
            {
                _fetchButton = new ToolStripSplitButton(Resources.StrFetch, CachedResources.Bitmaps["ImgFetch"])
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipFetch
                },
                _pullButton = new ToolStripSplitButton(Resources.StrPull, CachedResources.Bitmaps["ImgPull"])
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipPull
                },
                _pushButton = new ToolStripButton(Resources.StrPush, CachedResources.Bitmaps["ImgPush"])
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipPush
                },
                new ToolStripSeparator(),
                _historyButton = new ToolStripButton(Resources.StrHistory, CachedResources.Bitmaps["ImgHistory"], OnHistoryClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipHistory
                },
                new ToolStripSeparator(),
                _commitButton = new ToolStripButton(Resources.StrCommit, CachedResources.Bitmaps["ImgCommit"], OnCommitClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipCommit
                },
                _applyPatchButton = new ToolStripButton(Resources.StrPatch, CachedResources.Bitmaps["ImgPatchApply"], OnApplyPatchClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipApplyPatches
                },
                _stashButton = new ToolStripSplitButton(Resources.StrStash, CachedResources.Bitmaps["ImgStash"])
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipStash
                },
                _cleanButton = new ToolStripButton(Resources.StrClean, CachedResources.Bitmaps["ImgClean"], OnCleanClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipClean
                },
                new ToolStripSeparator(),
                _checkoutButton = new ToolStripButton(Resources.StrCheckout, CachedResources.Bitmaps["ImgCheckout"], OnCheckoutClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipCheckoutBranch
                },
                _branchButton = new ToolStripButton(Resources.StrBranch, CachedResources.Bitmaps["ImgBranch"], OnBranchClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipCreateBranch
                },
                _mergeButton = new ToolStripSplitButton(Resources.StrMerge, CachedResources.Bitmaps["ImgMerge"])
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipMerge
                },
                new ToolStripSeparator(),
                _tagButton = new ToolStripButton(Resources.StrTag, CachedResources.Bitmaps["ImgTag"], OnTagClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, ToolTipText = Resources.TipCreateTag
                },
                _noteButton = new ToolStripButton(Resources.StrNote, CachedResources.Bitmaps["ImgNote"], OnNoteClick)
                {
                    TextImageRelation = tir, DisplayStyle = ds, Available = false                               /* GitFeatures.AdvancedNotesCommands.IsAvailable */
                },
            });

            _fetchButton.ButtonClick += OnFetchClick;
            _pullButton.ButtonClick  += OnPullClick;
            _pushButton.Click        += OnPushClick;

            _mergeButton.ButtonClick += OnMergeClick;

            _mergeButton.DropDown.Items.Add(
                _mergeMultipleItem = new ToolStripMenuItem(Resources.StrMergeMultipleBranches, null, OnMultipleMergeClick));

            _stashButton.ButtonClick += OnStashClick;
            _stashButton.DropDown.Items.Add(
                _stashPopItem = new ToolStripMenuItem(Resources.StrSave, CachedResources.Bitmaps["ImgStashSave"], OnStashSaveClick));
            _stashButton.DropDown.Items.Add(
                _stashPopItem = new ToolStripMenuItem(Resources.StrPop, CachedResources.Bitmaps["ImgStashPop"], OnStashPopClick));
            _stashButton.DropDown.Items.Add(
                _stashApplyItem = new ToolStripMenuItem(Resources.StrApply, CachedResources.Bitmaps["ImgStashApply"], OnStashApplyClick));

            if (guiProvider.Repository != null)
            {
                AttachToRepository(guiProvider.Repository);
            }
        }
예제 #37
0
 public ToolStripBuilderStyle(ToolStripItemDisplayStyle toolStripItemDisplayStyle, ToolStripItemAlignment toolStripItemAlignment, TextImageRelation textImageRelation)
 {
     _toolStripItemAlignment    = toolStripItemAlignment;
     _toolStripItemDisplayStyle = toolStripItemDisplayStyle;
     _textImageRelation         = textImageRelation;
 }
예제 #38
0
		public static void BuildToolbar(ToolStripItemCollection parentItemCollection, IEnumerable<ActionModelNode> nodes, ToolStripItemDisplayStyle toolStripItemDisplayStyle)
        {
			BuildToolbar(parentItemCollection, nodes, new ToolStripBuilderStyle(toolStripItemDisplayStyle));
        }
예제 #39
0
 public ToolStripBuilderStyle(ToolStripItemDisplayStyle toolStripItemDisplayStyle)
 {
     _toolStripItemDisplayStyle = toolStripItemDisplayStyle;
 }
예제 #40
0
			public ToolStripBuilderStyle(ToolStripItemDisplayStyle toolStripItemDisplayStyle)
            {
                _toolStripItemDisplayStyle = toolStripItemDisplayStyle;
            }
 protected ToolStripItem()
 {
     this.bounds = Rectangle.Empty;
     this.overflow = ToolStripItemOverflow.AsNeeded;
     this.placement = ToolStripItemPlacement.None;
     this.imageAlign = ContentAlignment.MiddleCenter;
     this.textAlign = ContentAlignment.MiddleCenter;
     this.textImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     this.state = new BitVector32();
     this.imageTransparentColor = Color.Empty;
     this.imageScaling = ToolStripItemImageScaling.SizeToFit;
     this.cachedTextSize = System.Drawing.Size.Empty;
     this.displayStyle = ToolStripItemDisplayStyle.ImageAndText;
     this.state[((((((stateEnabled | stateAutoSize) | stateVisible) | stateContstructing) | stateSupportsItemClick) | stateInvalidMirroredImage) | stateMouseDownAndUpMustBeInSameItem) | stateUseAmbientMargin] = true;
     this.state[(((((((stateAllowDrop | stateMouseDownAndNoDrag) | stateSupportsRightClick) | statePressed) | stateSelected) | stateDisposed) | stateDoubleClickEnabled) | stateRightToLeftAutoMirrorImage) | stateSupportsSpaceKey] = false;
     this.SetAmbientMargin();
     this.Size = this.DefaultSize;
     this.DisplayStyle = this.DefaultDisplayStyle;
     CommonProperties.SetAutoSize(this, true);
     this.state[stateContstructing] = false;
     this.AutoToolTip = this.DefaultAutoToolTip;
 }
		protected ToolStripItem (string text, Image image, EventHandler onClick, string name)
		{
			this.alignment = ToolStripItemAlignment.Left;
			this.anchor = AnchorStyles.Left | AnchorStyles.Top;
			this.auto_size = true;
			this.auto_tool_tip = this.DefaultAutoToolTip;
			this.available = true;
			this.back_color = Color.Empty;
			this.background_image_layout = ImageLayout.Tile;
			this.can_select = true;
			this.display_style = this.DefaultDisplayStyle;
			this.dock = DockStyle.None;
			this.enabled = true;
			this.fore_color = Color.Empty;
			this.image = image;
			this.image_align = ContentAlignment.MiddleCenter;
			this.image_index = -1;
			this.image_key = string.Empty;
			this.image_scaling = ToolStripItemImageScaling.SizeToFit;
			this.image_transparent_color = Color.Empty;
			this.margin = this.DefaultMargin;
			this.merge_action = MergeAction.Append;
			this.merge_index = -1;
			this.name = name;
			this.overflow = ToolStripItemOverflow.AsNeeded;
			this.padding = this.DefaultPadding;
			this.placement = ToolStripItemPlacement.None;
			this.right_to_left = RightToLeft.Inherit;
			this.bounds.Size = this.DefaultSize;
			this.text = text;
			this.text_align = ContentAlignment.MiddleCenter;
			this.text_direction = DefaultTextDirection;
			this.text_image_relation = TextImageRelation.ImageBeforeText;
			this.visible = true;

			this.Click += onClick;
			OnLayout (new LayoutEventArgs (null, string.Empty));
		}
예제 #43
0
 internal void SetStyle(ToolStripItem tsItem, ToolStripItemDisplayStyle dstyle)
 {
     SetStyle(tsItem); tsItem.DisplayStyle = dstyle;
 }
예제 #44
0
 public ToolbarCommand(Command command, int position, ToolStripItemDisplayStyle style) : this(command, position)
 {
     displayStyle = style;
 }
예제 #45
0
 /// <summary>
 /// General function for syncrhonuze the toolbar with the action menu
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="type"></param>
 private void UpdateToolBarViewContextMenu(object sender, ToolStripItemDisplayStyle type)
 {
     foreach (ToolStripMenuItem menuItem in viewToolStripMenuItem.DropDownItems)
     {
         menuItem.Checked = false;
     }
     foreach (Object toolItem in mainToolBar.Items)
     {
         ToolStripButton toolButton = toolItem as ToolStripButton;
         if (toolButton != null)
         {
             toolButton.DisplayStyle = type;
         }
     }
     ToolStripMenuItem item = sender as ToolStripMenuItem;
     item.Checked = true;
 }