Пример #1
0
        public static Gdk.GrabStatus Grab(Gdk.Window window, bool owner_events, Gdk.EventMask event_mask, Gdk.Window confine_to, Gdk.Cursor cursor, uint time_)
        {
            int raw_ret = gdk_pointer_grab(window == null ? IntPtr.Zero : window.Handle, owner_events, (int)event_mask, confine_to == null ? IntPtr.Zero : confine_to.Handle, cursor == null ? IntPtr.Zero : cursor.Handle, time_);

            Gdk.GrabStatus ret = (Gdk.GrabStatus)raw_ret;
            return(ret);
        }
Пример #2
0
        public override void Wrap(object obj, bool initialized)
        {
            base.Wrap(obj, initialized);

            oldName = ((Gtk.Widget)obj).Name;

            if (!initialized)
            {
                events   = Wrapped.Events;
                canFocus = Wrapped.CanFocus;
            }

            if (!(Wrapped is Gtk.Window))
            {
                Wrapped.ShowAll();
            }

            Wrapped.PopupMenu    += PopupMenu;
            Wrapped.FocusInEvent += OnFocusIn;
            InterceptClicks(Wrapped);

            hexpandable = this.ClassDescriptor.HExpandable;
            vexpandable = this.ClassDescriptor.VExpandable;

            if (ParentWrapper != null)
            {
                // Make sure the widget's name is not already being used.
                string nn = ParentWrapper.GetValidWidgetName(Wrapped);
                if (nn != Wrapped.Name)
                {
                    Wrapped.Name = nn;
                }
            }

            Wrapped.Destroyed += OnDestroyed;

            if (Wrapped.Parent != null)
            {
                // The object was added to the parent before creating the wrapper.
                // Since it's now a wrapped object, the parent don't need to
                // intercept clicks for it anymore
                Widget w = GetInterceptorParent();
                if (w != null)
                {
                    w.UninterceptClicks(Wrapped);
                }
            }
        }
Пример #3
0
        public static void Main(string[] args)
        {
            Toolkit opentk = Core.InitOpenTK();

            var platform = new Eto.GtkSharp.Platform();

            platform.Add <GLSurface.IHandler>(() => new GtkGlSurfaceHandler());

            Style.Add <View>(
                "hidecursor",
                view =>
            {
                Gdk.Window window = view.ToNative().GdkWindow;

                var pixmap = new Gdk.Pixmap(null, 1, 1, 1);
                var cursor = new Gdk.Cursor(pixmap, pixmap, Gdk.Color.Zero, Gdk.Color.Zero, 0, 0);

                Gdk.EventMask mask = Gdk.EventMask.PointerMotionMask | Gdk.EventMask.ButtonPressMask;

                // Doesn't successfully limit mouse motion when running in
                // Windows, but that's an edge case anyway, so no big deal.
                Gdk.Pointer.Grab(window, true, mask, window, cursor, 0);
            });

            Style.Add <View>(
                "showcursor",
                view =>
            {
                Gdk.Pointer.Ungrab(0);
            });

            var application = new Application(platform);

            application.UnhandledException += Core.UnhandledExceptionHandler;

            using (opentk)
            {
                application.Run(new MainForm());
            }
        }
		public override void Wrap (object obj, bool initialized)
		{
			base.Wrap (obj, initialized);
			
			oldName = ((Gtk.Widget)obj).Name;
			
			if (!initialized) {
				events = Wrapped.Events;
				canFocus = Wrapped.CanFocus;
			}
		
			if (!(Wrapped is Gtk.Window))
				Wrapped.ShowAll ();
			
			Wrapped.PopupMenu += PopupMenu;
			Wrapped.FocusInEvent += OnFocusIn;
			InterceptClicks (Wrapped);

			hexpandable = this.ClassDescriptor.HExpandable;
			vexpandable = this.ClassDescriptor.VExpandable;
			
			if (ParentWrapper != null) {
				// Make sure the widget's name is not already being used.
				string nn = ParentWrapper.GetValidWidgetName (Wrapped);
				if (nn != Wrapped.Name)
					Wrapped.Name = nn;
			}
			
			Wrapped.Destroyed += OnDestroyed;
			
			if (Wrapped.Parent != null) {
				// The object was added to the parent before creating the wrapper.
				// Since it's now a wrapped object, the parent don't need to
				// intercept clicks for it anymore
				Widget w = GetInterceptorParent ();
				if (w != null)
					w.UninterceptClicks (Wrapped);
			}
		}