Inheritance: EventBox, IDesignArea
Exemple #1
0
        internal WidgetDesignerBackend(Gtk.Container container, int designWidth, int designHeight)
        {
            ShadowType       = ShadowType.None;
            HscrollbarPolicy = PolicyType.Automatic;
            VscrollbarPolicy = PolicyType.Automatic;

            resizableFixed = new ResizableFixed();
            resizableFixed.ObjectViewer = defaultObjectViewer;

            wrapper = ObjectWrapper.Lookup(container);
            Gtk.Window window = container as Gtk.Window;

            if (window != null)
            {
                try {
                    metacityPreview = CreateMetacityPreview(window);
                    preview         = metacityPreview;
                    if (wrapper != null)
                    {
                        wrapper.Notify += OnWindowPropChange;
                    }
                } catch {
                    // If metacity is not available, use a regular box.
                    EventBox eventBox = new EventBox();
                    eventBox.Add(container);
                    preview = eventBox;
                }
            }
            else
            {
                EventBox eventBox = new EventBox();
                eventBox.Add(container);
                preview = eventBox;
            }

            resizableFixed.Put(preview, container);

            if (designWidth != -1)
            {
                preview.WidthRequest       = designWidth;
                preview.HeightRequest      = designHeight;
                resizableFixed.AllowResize = true;
            }
            else
            {
                resizableFixed.AllowResize = false;
            }

            preview.SizeAllocated += new Gtk.SizeAllocatedHandler(OnResized);

            AddWithViewport(resizableFixed);

            if (wrapper != null)
            {
                wrapper.AttachDesigner(resizableFixed);
            }

            resizableFixed.SelectionChanged += OnSelectionChanged;
        }
Exemple #2
0
        internal WidgetDesignerBackend(Gtk.Container container, int designWidth, int designHeight)
        {
            ShadowType = ShadowType.None;
            HscrollbarPolicy = PolicyType.Automatic;
            VscrollbarPolicy = PolicyType.Automatic;

            resizableFixed = new ResizableFixed ();
            resizableFixed.ObjectViewer = defaultObjectViewer;

            wrapper = ObjectWrapper.Lookup (container);
            Gtk.Window window = container as Gtk.Window;

            if (window != null) {
                try {
                    metacityPreview = CreateMetacityPreview (window);
                    preview = metacityPreview;
                    if (wrapper != null)
                        wrapper.Notify += OnWindowPropChange;
                } catch {
                    // If metacity is not available, use a regular box.
                    EventBox eventBox = new EventBox ();
                    eventBox.Add (container);
                    preview = eventBox;
                }

            } else {
                EventBox eventBox = new EventBox ();
                eventBox.Add (container);
                preview = eventBox;
            }

            resizableFixed.Put (preview, container);

            if (designWidth != -1) {
                preview.WidthRequest = designWidth;
                preview.HeightRequest = designHeight;
                resizableFixed.AllowResize = true;
            } else {
                resizableFixed.AllowResize = false;
            }

            preview.SizeAllocated += new Gtk.SizeAllocatedHandler (OnResized);

            AddWithViewport (resizableFixed);

            if (wrapper != null)
                wrapper.AttachDesigner (resizableFixed);

            resizableFixed.SelectionChanged += OnSelectionChanged;
        }
 protected override void OnDestroyed()
 {
     if (preview != null)
     {
         if (wrapper != null)
         {
             wrapper.DetachDesigner(resizableFixed);
         }
         preview.SizeAllocated           -= new Gtk.SizeAllocatedHandler(OnResized);
         resizableFixed.SelectionChanged -= OnSelectionChanged;
         resizableFixed = null;
         preview        = null;
         wrapper        = null;
     }
     base.OnDestroyed();
 }
Exemple #4
0
        public override void Dispose()
        {
            if (preview != null)
            {
                if (wrapper != null)
                {
                    wrapper.DetachDesigner(resizableFixed);
                }
                preview.SizeAllocated           -= new Gtk.SizeAllocatedHandler(OnResized);
                resizableFixed.SelectionChanged -= OnSelectionChanged;
//				resizableFixed.Destroy ();
                resizableFixed = null;
                preview        = null;
                wrapper        = null;
            }
            base.Dispose();
        }
 public ObjectSelection(ResizableFixed box, Gtk.Widget widget, object dataObject)
 {
     this.box        = box;
     this.widget     = widget;
     this.dataObject = dataObject;
 }
		public ObjectSelection (ResizableFixed box, Gtk.Widget widget, object dataObject)
		{
			this.box = box;
			this.widget = widget;
			this.dataObject = dataObject;
		}
		protected override void OnDestroyed ()
		{
			if (preview != null) {
				if (wrapper != null)
					wrapper.DetachDesigner (resizableFixed);
				preview.SizeAllocated -= new Gtk.SizeAllocatedHandler (OnResized);
				resizableFixed.SelectionChanged -= OnSelectionChanged;
				resizableFixed = null;
				preview = null;
				wrapper = null;
			}
			base.OnDestroyed ();
		}
Exemple #8
0
 public override void Dispose()
 {
     if (preview != null) {
         if (wrapper != null)
             wrapper.DetachDesigner (resizableFixed);
         preview.SizeAllocated -= new Gtk.SizeAllocatedHandler (OnResized);
         resizableFixed.SelectionChanged -= OnSelectionChanged;
     //				resizableFixed.Destroy ();
         resizableFixed = null;
         preview = null;
         wrapper = null;
     }
     base.Dispose ();
 }