Inheritance: System.Collections.CollectionBase
Example #1
0
        public override void Dispose()
        {
            if (Wrapped == null)
            {
                return;
            }

            if (Project != null && Project.Selection == Wrapped)
            {
                Project.Selection = null;
            }

            Wrapped.Destroyed    -= OnDestroyed;
            Wrapped.PopupMenu    -= PopupMenu;
            Wrapped.FocusInEvent -= OnFocusIn;
            UninterceptClicks(Wrapped);

            if (actionGroups != null)
            {
                foreach (ActionGroup ag in actionGroups)
                {
                    ag.Dispose();
                }
                actionGroups = null;
            }
            base.Dispose();
        }
        void Initialize(ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode)
        {
            this.frontend        = frontend;
            this.singleGroupMode = singleGroupMode;
            IconSize             = Gtk.IconSize.SmallToolbar;
            Orientation          = Gtk.Orientation.Horizontal;
            ToolbarStyle         = Gtk.ToolbarStyle.BothHoriz;

            combo = Gtk.ComboBox.NewText();

            if (!singleGroupMode)
            {
                combo.Changed += OnActiveChanged;

                Gtk.ToolItem comboItem = new Gtk.ToolItem();
                Gtk.HBox     cbox      = new Gtk.HBox();
                cbox.PackStart(new Gtk.Label(Catalog.GetString("Action Group:") + " "), false, false, 3);
                cbox.PackStart(combo, true, true, 3);
                comboItem.Add(cbox);
                comboItem.ShowAll();
                Insert(comboItem, -1);
                internalButtons.Add(comboItem);

                addButton          = new Gtk.ToolButton(Gtk.Stock.Add);
                addButton.Clicked += OnAddGroup;
                Insert(addButton, -1);
                internalButtons.Add(addButton);

                removeButton          = new Gtk.ToolButton(Gtk.Stock.Remove);
                removeButton.Clicked += OnRemoveGroup;
                Insert(removeButton, -1);
                internalButtons.Add(removeButton);

                ActionGroups = actionGroups;

                if (actionGroups != null && actionGroups.Count > 0)
                {
                    combo.Active = 0;
                }
            }
            else
            {
                UpdateActionCommands(null);
            }

            ShowAll();
        }
Example #3
0
 protected void ReadActionGroups(ObjectReader reader, XmlElement elem)
 {
     if (reader.Format == FileFormat.Native)
     {
         if (actionGroups == null)
         {
             actionGroups = new ActionGroupCollection();
             actionGroups.SetOwner(this);
             actionGroups.ActionGroupAdded   += OnGroupAdded;
             actionGroups.ActionGroupRemoved += OnGroupRemoved;
             actionGroups.ActionGroupChanged += OnGroupChanged;
         }
         else
         {
             actionGroups.Clear();
         }
         foreach (XmlElement groupElem in elem.SelectNodes("action-group"))
         {
             ActionGroup actionGroup = new ActionGroup();
             actionGroup.Read(reader, groupElem);
             actionGroups.Add(actionGroup);
         }
     }
 }
		public override void Dispose ()
		{
			if (Wrapped == null)
				return;

			if (Project != null && Project.Selection == Wrapped)
				Project.Selection = null;

			Wrapped.Destroyed -= OnDestroyed;
			Wrapped.PopupMenu -= PopupMenu;
			Wrapped.FocusInEvent -= OnFocusIn;
			UninterceptClicks (Wrapped);
			
			if (actionGroups != null) {
				foreach (ActionGroup ag in actionGroups)
					ag.Dispose ();
				actionGroups = null;
			}
			base.Dispose ();
		}
		protected void ReadActionGroups (ObjectReader reader, XmlElement elem)
		{
			if (reader.Format == FileFormat.Native) {
				if (actionGroups == null) {
					actionGroups = new ActionGroupCollection ();
					actionGroups.SetOwner (this);
					actionGroups.ActionGroupAdded += OnGroupAdded;
					actionGroups.ActionGroupRemoved += OnGroupRemoved;
					actionGroups.ActionGroupChanged += OnGroupChanged;
				} else
					actionGroups.Clear ();
				foreach (XmlElement groupElem in elem.SelectNodes ("action-group")) {
					ActionGroup actionGroup = new ActionGroup ();
					actionGroup.Read (reader, groupElem);
					actionGroups.Add (actionGroup); 
				}
			}
		}
 public ActionGroupToolbar(ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups)
 {
     Initialize(frontend, actionGroups, false);
 }