Run() public method

public Run ( object obj ) : void
obj object
return void
        void AppendCommand(CommandDescriptor cmd, ObjectWrapper widget)
        {
            Gtk.ToolButton button;

            if (cmd.IsToggleCommand(widget.Wrapped))
            {
                button = new Gtk.ToggleToolButton();
                ((Gtk.ToggleToolButton)button).Active = cmd.IsToogled(widget.Wrapped);
                toggles.Add(cmd);
                editors[cmd.Name] = button;
            }
            else
            {
                button = new Gtk.ToolButton(null, null);
            }

            Gtk.Image img = cmd.GetImage();
            if (img != null)
            {
                button.IconWidget = img;
                button.Label      = cmd.Label;
                if (cmd.Label != null && cmd.Label.Length > 0)
                {
                    button.TooltipText = cmd.Label;
                }
            }
            else
            {
                button.Label       = cmd.Label;
                button.IsImportant = true;
            }
            button.Clicked += delegate(object o, EventArgs args)
            {
                if (!updating)
                {
                    cmd.Run(widget.Wrapped);
                }
            };
            button.ShowAll();
            Insert(button, -1);

            if (cmd.HasDependencies)
            {
                editors[cmd.Name] = button;
                sensitives[cmd]   = cmd;
            }
            if (cmd.HasVisibility)
            {
                editors[cmd.Name] = button;
                invisibles[cmd]   = cmd;
            }
            wrappers [cmd] = widget;
        }
        public ContextMenu(Stetic.Wrapper.Widget wrapper, Gtk.Widget context)
        {
            MenuItem item;

            editable = wrapper;
            widget   = wrapper.Wrapped;

            if (widget == context)
            {
                item           = LabelItem(widget);
                item.Sensitive = false;
                Add(item);
            }

            item            = new MenuItem(Catalog.GetString("_Select"));
            item.Activated += DoSelect;
            Add(item);

            ClassDescriptor klass = wrapper.ClassDescriptor;

            if (klass != null)
            {
                foreach (ItemDescriptor id in klass.ContextMenu)
                {
                    CommandDescriptor cmd = (CommandDescriptor)id;
                    if (!cmd.VisibleFor(widget))
                    {
                        continue;
                    }
                    item = new MenuItem(cmd.Label);
                    if (cmd.Enabled(widget, context))
                    {
                        Gtk.Widget wdup = widget, cdup = context; // FIXME bxc 75689
                        item.Activated += delegate(object o, EventArgs args)
                        {
                            cmd.Run(wdup, cdup);
                        };
                    }
                    else
                    {
                        item.Sensitive = false;
                    }
                    Add(item);
                }
            }

            BuildContextMenu(wrapper.ParentWrapper, widget == context, context);
        }
Example #3
0
        void AppendCommand(CommandDescriptor cmd)
        {
            Gtk.Button button = new Gtk.Button(cmd.Label);
            button.Clicked += delegate(object o, EventArgs args) {
                cmd.Run(this.obj);
            };
            button.Show();
            Append(button, cmd.Description);

            if (cmd.HasDependencies)
            {
                editors[cmd.Name] = button;
                sensitives[cmd]   = cmd;
            }
            if (cmd.HasVisibility)
            {
                editors[cmd.Name] = button;
                invisibles[cmd]   = cmd;
            }
        }
Example #4
0
		void AppendCommand (CommandDescriptor cmd, ObjectWrapper widget)
		{
			Gtk.ToolButton button;
			
			if (cmd.IsToggleCommand (widget.Wrapped)) {
				button = new Gtk.ToggleToolButton ();
				((Gtk.ToggleToolButton)button).Active = cmd.IsToogled (widget.Wrapped);
				toggles.Add (cmd);
				editors[cmd.Name] = button;
			} else {
				button = new Gtk.ToolButton (null, null);
			}
				
			Gtk.Image img = cmd.GetImage ();
			if (img != null) {
				button.IconWidget = img;
				button.Label = cmd.Label;
				if (cmd.Label != null && cmd.Label.Length > 0)
					button.TooltipText = cmd.Label;
			}
			else {
				button.Label = cmd.Label;
				button.IsImportant = true;
			}
			button.Clicked += delegate (object o, EventArgs args) {
				if (!updating)
					cmd.Run (widget.Wrapped);
			};
			button.ShowAll ();
			Insert (button, -1);

			if (cmd.HasDependencies) {
				editors[cmd.Name] = button;
				sensitives[cmd] = cmd;
			}
			if (cmd.HasVisibility) {
				editors[cmd.Name] = button;
				invisibles[cmd] = cmd;
			}
			wrappers [cmd] = widget;
		}
Example #5
0
		void AppendCommand (CommandDescriptor cmd)
		{
			Gtk.Button button = new Gtk.Button (cmd.Label);
			button.Clicked += delegate (object o, EventArgs args) {
				cmd.Run (this.obj);
			};
			button.Show ();
			Append (button, cmd.Description);

			if (cmd.HasDependencies) {
				editors[cmd.Name] = button;
				sensitives[cmd] = cmd;
			}
			if (cmd.HasVisibility) {
				editors[cmd.Name] = button;
				invisibles[cmd] = cmd;
			}
		}