예제 #1
0
        internal void BeginComponentDrag(ProjectBackend project, string desc, string className, ObjectWrapper wrapper, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
        {
            if (wrapper != null)
            {
                Stetic.Wrapper.ActionPaletteItem it = new Stetic.Wrapper.ActionPaletteItem(Gtk.UIManagerItemType.Menuitem, null, (Wrapper.Action)wrapper);
                DND.Drag(source, ctx, it);
            }
            else if (callback != null)
            {
                DND.Drag(source, ctx, delegate() {
                    callback();

                    // If the class name has an assembly name, remove it now
                    int i = className.IndexOf(',');
                    if (i != -1)
                    {
                        className = className.Substring(0, i);
                    }

                    ClassDescriptor cls = Registry.LookupClassByName(className);
                    if (cls != null)
                    {
                        return(cls.NewInstance(project) as Gtk.Widget);
                    }
                    else
                    {
                        // Class not found, show an error
                        string msg            = string.Format("The widget '{0}' could not be found.", className);
                        Gtk.MessageDialog dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg);
                        dlg.Run();
                        dlg.Destroy();
                        return(null);
                    }
                },
                         (desc != null && desc.Length > 0) ? desc : className
                         );
            }
            else
            {
                ClassDescriptor cls = Registry.LookupClassByName(className);
                DND.Drag(source, ctx, cls.NewInstance(project) as Gtk.Widget);
            }
        }
예제 #2
0
 public void BeginComponentDrag(string title, string className, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
 {
     app.Backend.BeginComponentDrag(project.ProjectBackend, title, className, null, source, ctx, callback);
 }
예제 #3
0
		public void BeginComponentDrag (string title, string className, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
		{
			app.Backend.BeginComponentDrag (editedProject.ProjectBackend, title, className, null, source, ctx, callback);
		}
예제 #4
0
		internal void BeginComponentDrag (ProjectBackend project, string desc, string className, ObjectWrapper wrapper, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
		{
			if (wrapper != null) {
				Stetic.Wrapper.ActionPaletteItem it = new Stetic.Wrapper.ActionPaletteItem (Gtk.UIManagerItemType.Menuitem, null, (Wrapper.Action) wrapper);
				DND.Drag (source, ctx, it);
			}
			else if (callback != null) {
				DND.Drag (source, ctx, delegate () {
					callback ();
					
					// If the class name has an assembly name, remove it now
					int i = className.IndexOf (',');
					if (i != -1)
						className = className.Substring (0, i);
					
					ClassDescriptor cls = Registry.LookupClassByName (className);
					if (cls != null)
						return cls.NewInstance (project) as Gtk.Widget;
					else {
						// Class not found, show an error
						string msg = string.Format ("The widget '{0}' could not be found.", className);
						Gtk.MessageDialog dlg = new Gtk.MessageDialog (null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg);
						dlg.Run ();
						dlg.Destroy ();
						return null;
					}
				},
				(desc != null && desc.Length > 0) ? desc : className
				);
			}
			else {
				ClassDescriptor cls = Registry.LookupClassByName (className);
				DND.Drag (source, ctx, cls.NewInstance (project) as Gtk.Widget);
			}
		}