public FileDescriptorBasedAdapter (IFileDescriptorBasedImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		public ActivatableAdapter (IActivatableImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		public HyperlinkImplAdapter (IHyperlinkImplImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		protected SignalCallback (GLib.Object obj, Delegate eh, System.Type argstype)
		{
			_key = _NextKey++;
			_obj = obj;
			_handler = eh;
			_argstype = argstype;
			_Instances [_key] = this;
		}
		public TlsClientConnectionAdapter (ITlsClientConnectionImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		public TreeDragDestAdapter (ITreeDragDestImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
Exemple #7
0
        public bool GenerateThumbnail(FileInfo fi, string mimeType)
        {
            if (thumbnail != null) {
                thumbnail.Dispose();
                thumbnail = null;
            }

            string uri = new Uri(fi.FullName).ToString();
            if (CanThumbnail(uri, mimeType, fi.LastWriteTime)) {
                thumbnail = GenerateThumbnail(uri, mimeType);
                if (thumbnail != null)
                    return true;
            }
            return false;
        }
 public static ITreeDragDest GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is ITreeDragDestImplementor)
     {
         return(new TreeDragDestAdapter(obj as ITreeDragDestImplementor));
     }
     else if (obj as ITreeDragDest == null)
     {
         return(new TreeDragDestAdapter(obj.Handle));
     }
     else
     {
         return(obj as ITreeDragDest);
     }
 }
Exemple #9
0
        static IntPtr ConstructorCallback(IntPtr gtypeval, uint n_construct_properties, IntPtr construct_properties)
        {
            GType        gtype           = new GLib.GType(gtypeval);
            GObjectClass threshold_class = (GObjectClass)Marshal.PtrToStructure(gtype.GetThresholdType().GetClassPtr(), typeof(GObjectClass));
            IntPtr       raw             = threshold_class.constructor_cb(gtypeval, n_construct_properties, construct_properties);
            Dictionary <IntPtr, GLib.Value> deferred;

            GLib.Object obj = null;
            for (int i = 0; i < n_construct_properties; i++)
            {
                IntPtr p = new IntPtr(construct_properties.ToInt64() + i * 2 * IntPtr.Size);

                string prop_name = Marshaller.Utf8PtrToString(g_param_spec_get_name(Marshal.ReadIntPtr(p)));
                if (prop_name != "gtk-sharp-managed-instance")
                {
                    continue;
                }

                Value val = (Value)Marshal.PtrToStructure(Marshal.ReadIntPtr(p, IntPtr.Size), typeof(Value));
                if ((IntPtr)val.Val != IntPtr.Zero)
                {
                    GCHandle gch = (GCHandle)(IntPtr)val.Val;
                    obj     = (GLib.Object)gch.Target;
                    obj.Raw = raw;
                    break;
                }
            }

            if (obj == null)
            {
                obj = GetObject(raw, false);
            }

            if (PropertiesToSet.TryGetValue(raw, out deferred))
            {
                foreach (var item in deferred)
                {
                    SetDeferredProperty(obj, item.Value, item.Key);
                }
                PropertiesToSet.Remove(raw);
            }
            return(raw);
        }
        public static object Emit(GLib.Object instance, string detailed_signal, params object[] args)
        {
            uint   gquark, signal_id;
            string signal_name;

            ParseSignalDetail(detailed_signal, out signal_name, out gquark);
            signal_id = GetSignalId(signal_name, instance);
            if (signal_id <= 0)
            {
                throw new ArgumentException("Invalid signal name: " + signal_name);
            }
            GLib.Value[]    vals            = new GLib.Value [args.Length + 1];
            GLib.ValueArray inst_and_params = new GLib.ValueArray((uint)args.Length + 1);

            vals [0] = new GLib.Value(instance);
            inst_and_params.Append(vals [0]);
            for (int i = 1; i < vals.Length; i++)
            {
                vals [i] = new GLib.Value(args [i - 1]);
                inst_and_params.Append(vals [i]);
            }

            object ret_obj = null;

            if (glibsharp_signal_get_return_type(signal_id) != GType.None.Val)
            {
                GLib.Value ret = GLib.Value.Empty;
                g_signal_emitv(inst_and_params.ArrayPtr, signal_id, gquark, ref ret);
                ret_obj = ret.Val;
                ret.Dispose();
            }
            else
            {
                g_signal_emitv(inst_and_params.ArrayPtr, signal_id, gquark, IntPtr.Zero);
            }

            foreach (GLib.Value val in vals)
            {
                val.Dispose();
            }

            return(ret_obj);
        }
 public static Initable GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is InitableImplementor)
     {
         return(new InitableAdapter(obj as InitableImplementor));
     }
     else if (obj as Initable == null)
     {
         return(new InitableAdapter(obj.Handle));
     }
     else
     {
         return(obj as Initable);
     }
 }
Exemple #12
0
        private bool InternalTextEvent(GLib.Object event_object, Gdk.Event evnt, Gtk.TextIter iter)
        {
            TextEventNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("event"));
                unmanaged = (TextEventNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(TextEventNativeDelegate));
            }
            if (unmanaged == null)
            {
                return(false);
            }

            IntPtr native_iter = GLib.Marshaller.StructureToPtrAlloc(iter);
            bool   __result    = unmanaged(this.Handle, event_object == null ? IntPtr.Zero : event_object.Handle, evnt == null ? IntPtr.Zero : evnt.Handle, native_iter);

            Marshal.FreeHGlobal(native_iter);
            return(__result);
        }
 public static ITagXmpWriter GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is ITagXmpWriterImplementor)
     {
         return(new TagXmpWriterAdapter(obj as ITagXmpWriterImplementor));
     }
     else if (obj as ITagXmpWriter == null)
     {
         return(new TagXmpWriterAdapter(obj.Handle));
     }
     else
     {
         return(obj as ITagXmpWriter);
     }
 }
 public static IActionGroup GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IActionGroupImplementor)
     {
         return(new ActionGroupAdapter(obj as IActionGroupImplementor));
     }
     else if (obj as IActionGroup == null)
     {
         return(new ActionGroupAdapter(obj.Handle));
     }
     else
     {
         return(obj as IActionGroup);
     }
 }
 public static IComponent GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IComponentImplementor)
     {
         return(new ComponentAdapter(obj as IComponentImplementor));
     }
     else if (obj as IComponent == null)
     {
         return(new ComponentAdapter(obj.Handle));
     }
     else
     {
         return(obj as IComponent);
     }
 }
Exemple #16
0
 public static IDevicePad GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IDevicePadImplementor)
     {
         return(new DevicePadAdapter(obj as IDevicePadImplementor));
     }
     else if (obj as IDevicePad == null)
     {
         return(new DevicePadAdapter(obj.Handle));
     }
     else
     {
         return(obj as IDevicePad);
     }
 }
Exemple #17
0
 public static IStreamableContent GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IStreamableContentImplementor)
     {
         return(new StreamableContentAdapter(obj as IStreamableContentImplementor));
     }
     else if (obj as IStreamableContent == null)
     {
         return(new StreamableContentAdapter(obj.Handle));
     }
     else
     {
         return(obj as IStreamableContent);
     }
 }
Exemple #18
0
 public static ITableCell GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is ITableCellImplementor)
     {
         return(new TableCellAdapter(obj as ITableCellImplementor));
     }
     else if (obj as ITableCell == null)
     {
         return(new TableCellAdapter(obj.Handle));
     }
     else
     {
         return(obj as ITableCell);
     }
 }
 public static ITreeDragSource GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is ITreeDragSourceImplementor)
     {
         return(new TreeDragSourceAdapter(obj as ITreeDragSourceImplementor));
     }
     else if (obj as ITreeDragSource == null)
     {
         return(new TreeDragSourceAdapter(obj.Handle));
     }
     else
     {
         return(obj as ITreeDragSource);
     }
 }
Exemple #20
0
 public static IPrintOperationPreview GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IPrintOperationPreviewImplementor)
     {
         return(new PrintOperationPreviewAdapter(obj as IPrintOperationPreviewImplementor));
     }
     else if (obj as IPrintOperationPreview == null)
     {
         return(new PrintOperationPreviewAdapter(obj.Handle));
     }
     else
     {
         return(obj as IPrintOperationPreview);
     }
 }
Exemple #21
0
 public static Io GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IoImplementor)
     {
         return(new IoAdapter(obj as IoImplementor));
     }
     else if (obj as Io == null)
     {
         return(new IoAdapter(obj.Handle));
     }
     else
     {
         return(obj as Io);
     }
 }
Exemple #22
0
 public static ITlsServerConnection GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is ITlsServerConnectionImplementor)
     {
         return(new TlsServerConnectionAdapter(obj as ITlsServerConnectionImplementor));
     }
     else if (obj as ITlsServerConnection == null)
     {
         return(new TlsServerConnectionAdapter(obj.Handle));
     }
     else
     {
         return(obj as ITlsServerConnection);
     }
 }
Exemple #23
0
 public static ICellLayout GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is ICellLayoutImplementor)
     {
         return(new CellLayoutAdapter(obj as ICellLayoutImplementor));
     }
     else if (obj as ICellLayout == null)
     {
         return(new CellLayoutAdapter(obj.Handle));
     }
     else
     {
         return(obj as ICellLayout);
     }
 }
 public static IActionObserver GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IActionObserverImplementor)
     {
         return(new ActionObserverAdapter(obj as IActionObserverImplementor));
     }
     else if (obj as IActionObserver == null)
     {
         return(new ActionObserverAdapter(obj.Handle));
     }
     else
     {
         return(obj as IActionObserver);
     }
 }
Exemple #25
0
 public static IColorChooser GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IColorChooserImplementor)
     {
         return(new ColorChooserAdapter(obj as IColorChooserImplementor));
     }
     else if (obj as IColorChooser == null)
     {
         return(new ColorChooserAdapter(obj.Handle));
     }
     else
     {
         return(obj as IColorChooser);
     }
 }
 public static IHypertext GetObject(GLib.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     else if (obj is IHypertextImplementor)
     {
         return(new HypertextAdapter(obj as IHypertextImplementor));
     }
     else if (obj as IHypertext == null)
     {
         return(new HypertextAdapter(obj.Handle));
     }
     else
     {
         return(obj as IHypertext);
     }
 }
Exemple #27
0
        static void SetDeferredProperty(GLib.Object obj, GLib.Value value, IntPtr param_spec)
        {
            var type = (Type)obj.LookupGType();

            Dictionary <IntPtr, PropertyInfo> props;

            if (!Properties.TryGetValue(type, out props))
            {
                return;
            }

            PropertyInfo prop;

            if (!props.TryGetValue(param_spec, out prop))
            {
                return;
            }

            prop.SetValue(obj, value.Val, new object [0]);
        }
Exemple #28
0
        public bool GenerateThumbnail(FileInfo fi, string mimeType)
        {
            if (thumbnail != null)
            {
                thumbnail.Dispose();
                thumbnail = null;
            }

            string uri = new Uri(fi.FullName).ToString();

            if (CanThumbnail(uri, mimeType, fi.LastWriteTime))
            {
                thumbnail = GenerateThumbnail(uri, mimeType);
                if (thumbnail != null)
                {
                    return(true);
                }
            }
            return(false);
        }
        public ListViewAccessible(GLib.Object widget) : base(widget as Gtk.Widget)
        {
            list_view = widget as ListView <T>;
            // TODO replace with list_view.Name?
            Name        = "ListView";
            Description = "ListView";
            Role        = Atk.Role.Table;
            Parent      = list_view.Parent.RefAccessible();

            cell_cache = new Dictionary <int, ColumnCellAccessible> ();

            list_view.ModelChanged  += OnModelChanged;
            list_view.ModelReloaded += OnModelChanged;
            OnModelChanged(null, null);

            list_view.SelectionProxy.FocusChanged += OnSelectionFocusChanged;
            list_view.ActiveColumnChanged         += OnSelectionFocusChanged;

            ListViewAccessible_Selection();
            ListViewAccessible_Table();
        }
Exemple #30
0
        static void GetPropertyCallback(IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec)
        {
            GLib.Object obj  = GLib.Object.GetObject(handle, false);
            var         type = (Type)obj.LookupGType();

            Dictionary <IntPtr, PropertyInfo> props;

            if (!Properties.TryGetValue(type, out props))
            {
                return;
            }

            PropertyInfo prop;

            if (!props.TryGetValue(param_spec, out prop))
            {
                return;
            }

            value.Val = prop.GetValue(obj, new object [0]);
        }
Exemple #31
0
        /// <summary>Initialise widget.</summary>
        /// <param name="ownerView">The owner of the widget.</param>
        /// <param name="gtkControl">The raw gtk control.</param>
        protected override void Initialise(ViewBase ownerView, GLib.Object gtkControl)
        {
            container = (VBox)gtkControl;
            textView  = (TextView)container.Children[0];
            textView.PopulatePopup += OnPopulatePopupMenu;
            findView = new MarkdownFindView();

            textView.Editable = false;
            textView.WrapMode = WrapMode.Word;
            textView.VisibilityNotifyEvent += OnVisibilityNotify;
            textView.MotionNotifyEvent     += OnMotionNotify;
            textView.WidgetEventAfter      += OnWidgetEventAfter;
            CreateStyles(textView);
            mainWidget = container;
            container.ShowAll();
            mainWidget.Destroyed += OnDestroyed;

            handCursor    = new Gdk.Cursor(Gdk.CursorType.Hand2);
            regularCursor = new Gdk.Cursor(Gdk.CursorType.Xterm);

            textView.KeyPressEvent += OnTextViewKeyPress;
        }
Exemple #32
0
        private void AddAll(GLib.Object obj, Dictionary <GLib.Object, bool> ret)
        {
            ret[obj] = true;

            Cdn.Object o = obj as Cdn.Object;

            Cdn.Node grp = obj as Cdn.Node;

            if (grp != null)
            {
                foreach (Cdn.Object child in grp.Children)
                {
                    AddAll(child, ret);
                }

                foreach (string name in grp.VariableInterface.Names)
                {
                    d_selected[grp.Variable(name)] = true;
                }
            }

            if (o != null)
            {
                foreach (Cdn.Variable prop in o.Variables)
                {
                    d_selected[prop] = true;
                }
            }

            Cdn.Edge link = obj as Cdn.Edge;

            if (link != null)
            {
                foreach (Cdn.EdgeAction action in link.Actions)
                {
                    d_selected[action] = true;
                }
            }
        }
Exemple #33
0
            override public void Dispose()
            {
                base.Dispose();

                if (d_wrapper != null)
                {
                    d_wrapper.WrappedObject.RemoveNotification("from", OnLinkChanged);
                    d_wrapper.WrappedObject.RemoveNotification("to", OnLinkChanged);
                    d_wrapper.WrappedObject.RemoveNotification("id", OnIdChanged);

                    Wrappers.Node grp = d_wrapper as Wrappers.Node;

                    if (grp != null)
                    {
                        grp.ChildAdded   -= OnChildAdded;
                        grp.ChildRemoved -= OnChildRemoved;
                    }

                    d_wrapper.VariableAdded   -= OnVariableAdded;
                    d_wrapper.VariableRemoved -= OnVariableRemoved;
                }

                if (d_object != null)
                {
                    if (d_object is Cdn.Variable)
                    {
                        d_object.RemoveNotification("name", OnIdChanged);
                    }
                    else if (d_object is Cdn.EdgeAction)
                    {
                        d_object.RemoveNotification("target", OnIdChanged);
                    }

                    d_object = null;
                }

                d_wrapper = null;
            }
Exemple #34
0
        private bool InternalAccelActivate(GLib.Object acceleratable, uint keyval, Gdk.ModifierType modifier)
        {
            GLib.Value      ret             = new GLib.Value(GLib.GType.Boolean);
            GLib.ValueArray inst_and_params = new GLib.ValueArray(4);
            GLib.Value[]    vals            = new GLib.Value [4];
            vals [0] = new GLib.Value(this);
            inst_and_params.Append(vals [0]);
            vals [1] = new GLib.Value(acceleratable);
            inst_and_params.Append(vals [1]);
            vals [2] = new GLib.Value(keyval);
            inst_and_params.Append(vals [2]);
            vals [3] = new GLib.Value(modifier);
            inst_and_params.Append(vals [3]);
            g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret);
            foreach (GLib.Value v in vals)
            {
                v.Dispose();
            }
            bool result = (bool)ret;

            ret.Dispose();
            return(result);
        }
Exemple #35
0
 public static IMetaContainer GetObject(IntPtr handle, bool owned)
 {
     GLib.Object obj = GLib.Object.GetObject(handle, owned);
     return(GetObject(obj));
 }
Exemple #36
0
 protected virtual bool OnTextEvent(GLib.Object event_object, Gdk.Event evnt, Gtk.TextIter iter)
 {
     return(InternalTextEvent(event_object, evnt, iter));
 }
 protected virtual bool OnRun(GLib.SocketConnection connection, GLib.Object source_object)
 {
     return(InternalRun(connection, source_object));
 }
		public PollableOutputStreamAdapter (IPollableOutputStreamImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		public StreamableContentAdapter (IStreamableContentImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		public ToolShellAdapter (IntPtr handle)
		{
			if (!_gtype.IsInstance (handle))
				throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
			implementor = GLib.Object.GetObject (handle);
		}
		public PrintOperationPreviewAdapter (IPrintOperationPreviewImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
Exemple #42
0
 private void Dispose(bool disposing)
 {
     if (!disposed) {
         if (disposing && (thumbnail != null)) {
             thumbnail.Dispose();
         }
         thumbnail = null;
     }
     disposed = true;
 }
		public RecentChooserAdapter (IRecentChooserImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}
		protected virtual void Dispose (bool disposing)
		{
			if (disposing) {
				_obj = null;
				_handler = null;
				_argstype = null;
			}
		}
Exemple #45
0
 internal Signal(GLib.Object obj, string name, Delegate marshaler)
 {
     this.obj = obj;
     this.name = name;
     this.marshaler = marshaler;
 }
Exemple #46
0
 public ClosureInvokedArgs(GLib.Object obj, EventArgs args)
 {
     this.obj = obj;
     this.args = args;
 }
Exemple #47
0
 internal Signal(GLib.Object obj, string name, Type args_type)
 {
     this.obj = obj;
     this.name = name;
     this.args_type = args_type;
 }