コード例 #1
0
 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;
        }
コード例 #3
0
 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;
        }
コード例 #6
0
 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
ファイル: PanelToolStripItem.cs プロジェクト: BioBrainX/fomm
        /// <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"));
        }
コード例 #15
0
        /// <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
ファイル: ControlControl.cs プロジェクト: netide/netide
        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
ファイル: StandardToolbar.cs プロジェクト: oqewok/gitter
        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;
                }
            }
        }
コード例 #22
0
 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
ファイル: PopupControl.cs プロジェクト: vector-man/netide
        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));
 }
コード例 #34
0
 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;
            }
コード例 #41
0
 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;
 }
コード例 #42
0
		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
ファイル: MainGui.cs プロジェクト: artisticcheese/MSE
 /// <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;
 }