protected override void Dispose(bool disposing)
        {
            if (disposing && _action != null)
            {
                OnParentChanged(this.Parent, null);

                ToolStripBuilder.Clear(this.DropDownItems);

                // VERY IMPORTANT: instances of this class will be created and discarded frequently
                // throughout the lifetime of the application
                // therefore is it extremely important that the event handlers are disconnected
                // from the underlying _action events
                // otherwise, this object will hang around for the entire lifetime of the _action object,
                // even though this object is no longer needed
                _action.EnabledChanged   -= _actionEnabledChangedHandler;
                _action.CheckedChanged   -= _actionCheckedChangedHandler;
                _action.VisibleChanged   -= _actionVisibleChangedHandler;
                _action.AvailableChanged -= _actionAvailableChangedHandler;
                _action.LabelChanged     -= _actionLabelChangedHandler;
                _action.TooltipChanged   -= _actionTooltipChangedHandler;
                _action.IconSetChanged   -= _actionIconSetChangedHandler;

                _action = null;
            }

            base.Dispose(disposing);
        }
예제 #2
0
        public ActiveToolbarButton(IClickAction action, Tooltips tooltips)
        {
            _action = action;

            _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);

            _action.EnabledChanged += _actionEnabledChangedHandler;
            _action.CheckedChanged += _actionCheckedChangedHandler;

            this.Sensitive = _action.Enabled;
            this.Active    = _action.IsCheckAction && _action.Checked;
            this.SetTooltip(tooltips, _action.Tooltip, "");

            this.Clicked += OnActivated;

            if (_action.IconSet != null)
            {
                try
                {
                    // load the tool's icon from it's assembly
                    System.Reflection.Assembly asm = _action.Target.GetType().Assembly;
                    Image icon = new Image(asm, asm.GetName().Name + "." + _action.IconSet.LargeIcon);
//					icon.Pixbuf = icon.Pixbuf.AddAlpha(true, 255, 0, 0);	// make "red" transparent
                    this.IconWidget = icon;
                }
                catch (Exception e)
                {
                    // TODO the icon was either null or not found - log some helpful message
                }
            }
        }
예제 #3
0
        private bool ProcessKeyboardMessage(KeyboardButtonMessage keyboardMessage)
        {
            //keyboard up messages are just consumed.
            if (keyboardMessage.ButtonAction == KeyboardButtonMessage.ButtonActions.Up)
            {
                _key = new KeyboardButtonMessage(XKeys.None, KeyboardButtonMessage.ButtonActions.Up);
                return(true);
            }

            _key = keyboardMessage;

            ReleaseCapture(true);
            this.CaptureMouseWheelHandler = null;

            IClickAction action = _shortcutManager.GetKeyboardAction(keyboardMessage.Shortcut);

            Trace.WriteLine(String.Format("Finding shortcut for: {0}", keyboardMessage.Shortcut));
            if (action != null)
            {
                action.Click();
                return(true);
            }

            return(false);
        }
예제 #4
0
        public ActiveToolbarButton(IClickAction action, Tooltips tooltips)
        {
            _action = action;

            _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);

            _action.EnabledChanged += _actionEnabledChangedHandler;
            _action.CheckedChanged += _actionCheckedChangedHandler;

            this.Sensitive = _action.Enabled;
            this.Active = _action.IsCheckAction && _action.Checked;
			this.SetTooltip(tooltips, _action.Tooltip, "");

            this.Clicked += OnActivated;
			
            if (_action.IconSet != null)
            {
                try
                {
					// load the tool's icon from it's assembly
					System.Reflection.Assembly asm = _action.Target.GetType().Assembly;
					Image icon = new Image(asm, asm.GetName().Name + "." + _action.IconSet.LargeIcon);
//					icon.Pixbuf = icon.Pixbuf.AddAlpha(true, 255, 0, 0);	// make "red" transparent
					this.IconWidget = icon;
                }
                catch (Exception e)
                {
                    // TODO the icon was either null or not found - log some helpful message
                }
            }

        }
예제 #5
0
        void ExecuteTranslate(object o)
        {
            var ac = new TranslatePointsClickAction(CurrentPolygon);

            _currentClickableAction      = ac;
            _currentUpdatableMouseAction = ac;
            ac.ActionDone += afterAction;
        }
예제 #6
0
 // Methods
 public DynamicActionButton(IClickAction action)
 {
     this._action = action;
     base.ToolTip = action.Tooltip;
     this.UpdateIcon();
     base.Click += new EventHandler(this.BindingAction);
     this.BindingActionEvents();
 }
예제 #7
0
        /// <summary>
        /// Builds a menu from the specified action model nodes.
        /// </summary>
        /// <param name="parentItemCollection"></param>
        /// <param name="nodes"></param>
        public static void BuildMenu(ToolStripItemCollection parentItemCollection, IEnumerable <ActionModelNode> nodes)
        {
            List <ActionModelNode> nodeList = CombineAdjacentSeparators(new List <ActionModelNode>(nodes));

            foreach (ActionModelNode node in nodeList)
            {
                ToolStripItem toolstripItem;

                if (node is ActionNode)
                {
                    // this is a leaf node (terminal menu item)
                    ActionNode  actionNode = (ActionNode)node;
                    IAction     action     = actionNode.Action;
                    IActionView view       = CreateActionView(ToolStripKind.Menu, action, IconSize.Medium);
                    toolstripItem     = (ToolStripItem)view.GuiElement;
                    toolstripItem.Tag = new ItemTag(node, view);
                    parentItemCollection.Add(toolstripItem);

                    // Determine whether we should check the parent menu items too
                    IClickAction clickAction = actionNode.Action as IClickAction;

                    if (clickAction != null && clickAction.CheckParents && clickAction.Checked)
                    {
                        CheckParentItems(toolstripItem);
                    }
                }
                else if (node is SeparatorNode)
                {
                    toolstripItem     = new ToolStripSeparator();
                    toolstripItem.Tag = new ItemTag(node, null);
                    parentItemCollection.Add(toolstripItem);
                }
                else
                {
                    // this menu item has a sub menu
                    toolstripItem = new ToolStripMenuItem(node.PathSegment.LocalizedText);

                    toolstripItem.Tag = new ItemTag(node, null);
                    parentItemCollection.Add(toolstripItem);

                    BuildMenu(((ToolStripMenuItem)toolstripItem).DropDownItems, node.ChildNodes);
                }

                // When you get Visible, it refers to whether the object is really visible, as opposed to whether it _can_ be visible.
                // When you _set_ Visible, it affects whether it _can_ be visible.
                // For example, an item is really invisible but _can_ be visible before it is actually drawn.
                // This is why we use the Available property, which give us the information when we are interested in "_Could_ this be Visible?"
                ToolStripMenuItem parent = toolstripItem.OwnerItem as ToolStripMenuItem;
                if (parent != null)
                {
                    SetParentAvailability(parent);
                    toolstripItem.AvailableChanged += delegate { SetParentAvailability(parent); };
                }
            }
        }
예제 #8
0
        void ExecutePerformAction(object o)
        {
            if (!CanExecutePerformAction(o))
            {
                return;
            }

            var point    = FieldView.GetCurrentMousePos();
            var location = zoomManager.RecalcZoomDiv(point);

            _currentClickableAction.Perform(location);
            _currentClickableAction.Dispose();
            _currentClickableAction = null;
        }
예제 #9
0
            public void UnregisterDoubleClickHandler(IClickAction clickAction)
            {
                if (clickAction == null)
                {
                    return;
                }

                foreach (var handler in _owner._doubleClickHandlers)
                {
                    if (handler.ClickAction.ActionID == clickAction.ActionID)
                    {
                        _owner._doubleClickHandlers.Remove(handler);
                        return;
                    }
                }
            }
예제 #10
0
        public ActiveMenuItem(IClickAction action)
            : base(action.Label.Replace('&', '_'))
        {
            _action = action;

            _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);

            _action.EnabledChanged += _actionEnabledChangedHandler;
            _action.CheckedChanged += _actionCheckedChangedHandler;

            this.Sensitive = _action.Enabled;
            this.Active    = _action.IsCheckAction && _action.Checked;

            this.Activated += OnActivated;
        }
예제 #11
0
        public ActiveMenuItem(IClickAction action)
		:base(action.Label.Replace('&', '_'))
        {
            _action = action;

            _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);

            _action.EnabledChanged += _actionEnabledChangedHandler;
            _action.CheckedChanged += _actionCheckedChangedHandler;

            this.Sensitive = _action.Enabled;
            this.Active = _action.IsCheckAction && _action.Checked;

            this.Activated += OnActivated;
        }
        public DropDownButtonToolbarItem(IClickAction action, IconSize iconSize)
            : base()
        {
            IDropDownAction dropAction = (IDropDownAction)action;

            _fakeButton = new FakeToolstripButton(this);
            base.DropDownButtonWidth = 15;

            _action = action;

            _actionEnabledChangedHandler   = new EventHandler(OnActionEnabledChanged);
            _actionVisibleChangedHandler   = new EventHandler(OnActionVisibleChanged);
            _actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged);
            _actionLabelChangedHandler     = new EventHandler(OnActionLabelChanged);
            _actionTooltipChangedHandler   = new EventHandler(OnActionTooltipChanged);
            _actionIconSetChangedHandler   = new EventHandler(OnActionIconSetChanged);
            _actionCheckedChangedHandler   = new EventHandler(OnActionCheckedChanged);

            _action.EnabledChanged   += _actionEnabledChangedHandler;
            _action.VisibleChanged   += _actionVisibleChangedHandler;
            _action.AvailableChanged += _actionAvailableChangedHandler;
            _action.LabelChanged     += _actionLabelChangedHandler;
            _action.TooltipChanged   += _actionTooltipChangedHandler;
            _action.IconSetChanged   += _actionIconSetChangedHandler;
            _action.CheckedChanged   += _actionCheckedChangedHandler;

            _iconSize = iconSize;

            this.DropDown = new ContextMenuStrip();
            this.DropDown.ImageScalingSize = StandardIconSizes.Small;
            this.DropDownOpening          += new EventHandler(OnDropDownOpening);

            this.Text    = _action.Label;
            this.Enabled = _action.Enabled;
            this.Visible = _action.Visible;
            SetTooltipText();

            UpdateCheckedState();
            UpdateVisibility();
            UpdateEnablement();
            UpdateIcon();

            this.ButtonClick += delegate(object sender, EventArgs e)
            {
                _action.Click();
            };
        }
예제 #13
0
 void ExecuteRejectAction(object o)
 {
     if (_currentClickableAction != null)
     {
         _currentClickableAction.Reject();
     }
     _currentUpdatableMouseAction = null;
     if (_currentClickableAction != null)
     {
         _currentClickableAction.Dispose();
     }
     _currentClickableAction = null;
     if (CurrentUpdatableMouseAction != null)
     {
         CurrentUpdatableMouseAction.Dispose();
     }
 }
예제 #14
0
        public override void Dispose()
        {
            if (_action != null)
            {
                // VERY IMPORTANT: instances of this class will be created and discarded frequently
                // throughout the lifetime of the application
                // therefore is it extremely important that the event handlers are disconnected
                // from the underlying _action events
                // otherwise, this object will hang around for the entire lifetime of the _action object,
                // even though this object is no longer needed
                _action.EnabledChanged -= _actionEnabledChangedHandler;
                _action.CheckedChanged -= _actionCheckedChangedHandler;

                _action = null;
            }
            base.Dispose();
        }
예제 #15
0
        void ExecuteAddNew(object o)
        {
            if (CurrentPolygon != null)
            {
                CurrentPolygon.DeselectAll();
            }


            _currentClickableAction             = new NewFieldClickAction();
            _currentClickableAction.ActionDone += (sender, args) =>
            {
                var poly = args.Result as IFieldPolygon;
                if (poly == null)
                {
                    return;
                }
                commitPoly(poly);

                FieldView.RefreshView();
            };
        }
예제 #16
0
        public ActiveMenuItem(IClickAction action, IconSize iconSize)
        {
            _action   = action;
            _iconSize = iconSize;
            _actionEnabledChangedHandler   = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler   = new EventHandler(OnActionCheckedChanged);
            _actionVisibleChangedHandler   = new EventHandler(OnActionVisibleChanged);
            _actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged);
            _actionLabelChangedHandler     = new EventHandler(OnActionLabelChanged);
            _actionIconSetChangedHandler   = new EventHandler(OnActionIconSetChanged);

            _action.EnabledChanged   += _actionEnabledChangedHandler;
            _action.CheckedChanged   += _actionCheckedChangedHandler;
            _action.VisibleChanged   += _actionVisibleChangedHandler;
            _action.AvailableChanged += _actionAvailableChangedHandler;
            _action.LabelChanged     += _actionLabelChangedHandler;
            _action.IconSetChanged   += _actionIconSetChangedHandler;

            this.Text    = _action.Label;
            this.Checked = _action.Checked;

            UpdateVisibility();
            UpdateEnablement();
            UpdateIcon();

            this.Click += delegate(object sender, EventArgs e)
            {
                _action.Click();
            };

            try
            {
                this.ShortcutKeys = (Keys)_action.KeyStroke;
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Debug, e);
            }
        }
예제 #17
0
        private void BuildActionButtons(IAction freeTool, IAction fixedTool)
        {
            base.SuspendLayout();
            IClickAction action = freeTool as IClickAction;

            if (action != null)
            {
                if (this._freeToolBtn == null)
                {
                    this._freeToolBtn          = new DynamicActionButton(action);
                    this._freeToolBtn.Location = new Point(0x56, this.BtnSinglePrint.Location.Y);
                    this._freeToolBtn.Size     = new Size(0x2e, 0x2e);
                    this.toolTip.SetToolTip(this._freeToolBtn, action.Tooltip);
                    base.Controls.Add(this._freeToolBtn);
                }
                else
                {
                    this._freeToolBtn.Action = action;
                }
            }
            IClickAction action2 = fixedTool as IClickAction;

            if (action2 != null)
            {
                if (this._FixedToolBtn == null)
                {
                    this._FixedToolBtn          = new DynamicActionButton(action2);
                    this._FixedToolBtn.Location = new Point(13, this.BtnSinglePrint.Location.Y);
                    this._FixedToolBtn.Size     = new Size(0x2e, 0x2e);
                    this.toolTip.SetToolTip(this._FixedToolBtn, action2.Tooltip);
                    base.Controls.Add(this._FixedToolBtn);
                }
                else
                {
                    this._FixedToolBtn.Action = action2;
                }
            }
            base.ResumeLayout(true);
        }
예제 #18
0
        public ActiveMenuItem(IClickAction action, IconSize iconSize)
        {
            _action = action;
			_iconSize = iconSize;
            _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);
			_actionVisibleChangedHandler = new EventHandler(OnActionVisibleChanged);
			_actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged);
			_actionLabelChangedHandler = new EventHandler(OnActionLabelChanged);
			_actionIconSetChangedHandler = new EventHandler(OnActionIconSetChanged);

            _action.EnabledChanged += _actionEnabledChangedHandler;
            _action.CheckedChanged += _actionCheckedChangedHandler;
			_action.VisibleChanged += _actionVisibleChangedHandler;
        	_action.AvailableChanged += _actionAvailableChangedHandler;
			_action.LabelChanged += _actionLabelChangedHandler;
        	_action.IconSetChanged += _actionIconSetChangedHandler;

            this.Text = _action.Label;
            this.Checked = _action.Checked;

            UpdateVisibility();
            UpdateEnablement();
        	UpdateIcon();

            this.Click += delegate(object sender, EventArgs e)
            {
                _action.Click();
            };

            try
            {
                this.ShortcutKeys = (Keys)_action.KeyStroke;
            }
            catch (Exception e)
            {
                Platform.Log(LogLevel.Debug, e);
            }
        }
예제 #19
0
        /// <summary>
        /// Processes an <paramref name="xmlAction"/> element in the XML model, deserializing the persisted values into the provided <paramref name="action"/>.
        /// </summary>
        private static void ProcessXmlAction(XmlElement xmlAction, IAction action)
        {
            string path = xmlAction.GetAttribute("path");

            action.Path = new ActionPath(path, action.ResourceResolver);
            //The group hint from the xml never overrides the action's group hint!!!  Otherwise, we can't change
            //the group hint of an action for the purpose of placing a new one near it.
            //string grouphint = xmlAction.GetAttribute("group-hint");
            //action.GroupHint = new GroupHint(grouphint);

            bool   available      = true;
            string availableValue = xmlAction.GetAttribute("available");

            if (!string.IsNullOrEmpty(availableValue))
            {
                if (!bool.TryParse(availableValue, out available))
                {
                    available = true;
                }
            }
            action.Available = available;

            if (action is IClickAction)
            {
                IClickAction clickAction = (IClickAction)action;

                XKeys  keyStroke      = XKeys.None;
                string keystrokeValue = xmlAction.GetAttribute("keystroke");
                if (!string.IsNullOrEmpty(keystrokeValue))
                {
                    if (!XKeysConverter.TryParseInvariant(keystrokeValue, out keyStroke))
                    {
                        Platform.Log(LogLevel.Debug, "Invalid value for attribute keystroke for action {0}", action.ActionID);
                    }
                }
                clickAction.KeyStroke = keyStroke;
            }
        }
예제 #20
0
		public ActiveToolbarButton(IClickAction action, IconSize iconSize)
        {
            _action = action;

            _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);
			_actionVisibleChangedHandler = new EventHandler(OnActionVisibleChanged);
			_actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged);
			_actionLabelChangedHandler = new EventHandler(OnActionLabelChanged);
			_actionTooltipChangedHandler = new EventHandler(OnActionTooltipChanged);
			_actionIconSetChangedHandler = new EventHandler(OnActionIconSetChanged);

            _action.EnabledChanged += _actionEnabledChangedHandler;
            _action.CheckedChanged += _actionCheckedChangedHandler;
			_action.VisibleChanged += _actionVisibleChangedHandler;
			_action.AvailableChanged += _actionAvailableChangedHandler;
			_action.LabelChanged += _actionLabelChangedHandler;
			_action.TooltipChanged += _actionTooltipChangedHandler;
			_action.IconSetChanged += _actionIconSetChangedHandler;

			_iconSize = iconSize;

            this.Text = _action.Label;
            this.Enabled = _action.Enabled;
			SetTooltipText();
			this.Checked = _action.Checked;

            UpdateVisibility();
            UpdateEnablement();
			UpdateIcon();

            this.Click += delegate(object sender, EventArgs e)
            {
                _action.Click();
            };
        }
예제 #21
0
        public ActiveToolbarButton(IClickAction action, IconSize iconSize)
        {
            _action = action;

            _actionEnabledChangedHandler   = new EventHandler(OnActionEnabledChanged);
            _actionCheckedChangedHandler   = new EventHandler(OnActionCheckedChanged);
            _actionVisibleChangedHandler   = new EventHandler(OnActionVisibleChanged);
            _actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged);
            _actionLabelChangedHandler     = new EventHandler(OnActionLabelChanged);
            _actionTooltipChangedHandler   = new EventHandler(OnActionTooltipChanged);
            _actionIconSetChangedHandler   = new EventHandler(OnActionIconSetChanged);

            _action.EnabledChanged   += _actionEnabledChangedHandler;
            _action.CheckedChanged   += _actionCheckedChangedHandler;
            _action.VisibleChanged   += _actionVisibleChangedHandler;
            _action.AvailableChanged += _actionAvailableChangedHandler;
            _action.LabelChanged     += _actionLabelChangedHandler;
            _action.TooltipChanged   += _actionTooltipChangedHandler;
            _action.IconSetChanged   += _actionIconSetChangedHandler;

            _iconSize = iconSize;

            this.Text    = _action.Label;
            this.Enabled = _action.Enabled;
            SetTooltipText();
            this.Checked = _action.Checked;

            UpdateVisibility();
            UpdateEnablement();
            UpdateIcon();

            this.Click += delegate(object sender, EventArgs e)
            {
                _action.Click();
            };
        }
예제 #22
0
 public DoubleClickHandlerRegistration(IClickAction clickAction)
 {
     _clickAction = clickAction;
 }
예제 #23
0
			public AbstractClickAction(IClickAction concreteAction)
				: base(concreteAction)
			{
				_keyStroke = concreteAction.KeyStroke;
			}
예제 #24
0
 public void RegisterDoubleClickHandler(IClickAction clickAction)
 {
     Platform.CheckForNullReference(clickAction, "clickAction");
     _owner._doubleClickHandlers.Add(new DoubleClickHandlerRegistration(clickAction));
 }
예제 #25
0
		public ActiveToolbarButton(IClickAction action)
			: this(action, IconSize.Medium)
		{
		}
예제 #26
0
 public AbstractClickAction(IClickAction concreteAction)
     : base(concreteAction)
 {
     _keyStroke = concreteAction.KeyStroke;
 }
 public AbstractActionModelTreeLeafClickAction(IClickAction clickAction) : base(clickAction)
 {
     _keyStroke = clickAction.KeyStroke;
 }
		public DropDownButtonToolbarItem(IClickAction action, IconSize iconSize)
			: base()
		{
			IDropDownAction dropAction = (IDropDownAction) action;

			_fakeButton = new FakeToolstripButton(this);
			base.DropDownButtonWidth = 15;

			_action = action;

			_actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged);
			_actionVisibleChangedHandler = new EventHandler(OnActionVisibleChanged);
			_actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged);
			_actionLabelChangedHandler = new EventHandler(OnActionLabelChanged);
			_actionTooltipChangedHandler = new EventHandler(OnActionTooltipChanged);
			_actionIconSetChangedHandler = new EventHandler(OnActionIconSetChanged);
			_actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged);

			_action.EnabledChanged += _actionEnabledChangedHandler;
			_action.VisibleChanged += _actionVisibleChangedHandler;
			_action.AvailableChanged += _actionAvailableChangedHandler;
			_action.LabelChanged += _actionLabelChangedHandler;
			_action.TooltipChanged += _actionTooltipChangedHandler;
			_action.IconSetChanged += _actionIconSetChangedHandler;
			_action.CheckedChanged += _actionCheckedChangedHandler;

			_iconSize = iconSize;

			this.DropDown = new ContextMenuStrip();
			this.DropDown.ImageScalingSize = StandardIconSizes.Small;
			this.DropDownOpening += new EventHandler(OnDropDownOpening);

			this.Text = _action.Label;
			this.Enabled = _action.Enabled;
			this.Visible = _action.Visible;
			SetTooltipText();

			UpdateCheckedState();
			UpdateVisibility();
			UpdateEnablement();
			UpdateIcon();

			this.ButtonClick += delegate(object sender, EventArgs e)
			{
				_action.Click();
			};
		}
		public DropDownButtonToolbarItem(IClickAction action)
			: this(action, IconSize.Medium)
		{
		}
예제 #30
0
        public ActiveMenuItem(IClickAction action)
			: this(action, Desktop.IconSize.Small)
        {
        }
		protected override void Dispose(bool disposing)
		{
			if (disposing && _action != null)
			{
				OnParentChanged(this.Parent, null);

				ToolStripBuilder.Clear(this.DropDownItems);

				// VERY IMPORTANT: instances of this class will be created and discarded frequently
				// throughout the lifetime of the application
				// therefore is it extremely important that the event handlers are disconnected
				// from the underlying _action events
				// otherwise, this object will hang around for the entire lifetime of the _action object,
				// even though this object is no longer needed
				_action.EnabledChanged -= _actionEnabledChangedHandler;
				_action.CheckedChanged -= _actionCheckedChangedHandler;
				_action.VisibleChanged -= _actionVisibleChangedHandler;
				_action.AvailableChanged -= _actionAvailableChangedHandler;
				_action.LabelChanged -= _actionLabelChangedHandler;
				_action.TooltipChanged -= _actionTooltipChangedHandler;
				_action.IconSetChanged -= _actionIconSetChangedHandler;

				_action = null;
			}

			base.Dispose(disposing);
		}
		public AbstractActionModelTreeLeafClickAction(IClickAction clickAction) : base(clickAction)
		{
			_keyStroke = clickAction.KeyStroke;
		}
예제 #33
0
 public ActiveToolbarButton(IClickAction action)
     : this(action, IconSize.Medium)
 {
 }
예제 #34
0
 public ActiveMenuItem(IClickAction action)
     : this(action, Desktop.IconSize.Small)
 {
 }
 public DropDownButtonToolbarItem(IClickAction action)
     : this(action, IconSize.Medium)
 {
 }
예제 #36
0
        public override void Dispose()
        {
            if (_action != null)
            {
                // VERY IMPORTANT: instances of this class will be created and discarded frequently
                // throughout the lifetime of the application
                // therefore is it extremely important that the event handlers are disconnected
                // from the underlying _action events
                // otherwise, this object will hang around for the entire lifetime of the _action object,
                // even though this object is no longer needed
                _action.EnabledChanged -= _actionEnabledChangedHandler;
                _action.CheckedChanged -= _actionCheckedChangedHandler;

                _action = null;
            }
            base.Dispose();
        }