Example #1
0
            public override void  SetParent(WindowFrame r, WindowFrame parentWindow)
            {
                var gtkwin       = r.GetBackend().Window;
                var gtkwinparent = parentWindow.GetBackend().Window;

                gtkwin.GetType().SetPropertyValue(gtkwin, "TransientFor", gtkwinparent);
            }
Example #2
0
            public override void SetParent(WindowFrame r, WindowFrame parentWindow)
            {
                Type et    = Platform.GetType("AppKit.NSWindowLevel");
                var  level = Enum.ToObject(et, 3L /*floating*/);
                var  w     = r.GetBackend().Window;

                w.GetType().SetPropertyValue(w, "Level", level);
            }
Example #3
0
 /// <summary>
 /// Gets a native window reference from an Xwt window.
 /// </summary>
 /// <returns> The native window object. </returns>
 /// <param name='window'> The Xwt window. </param>
 public virtual object GetNativeWindow(WindowFrame window)
 {
     if (window == null)
     {
         return(null);
     }
     return(GetNativeWindow(window.GetBackend() as IWindowFrameBackend));
 }
Example #4
0
            public override IntPtr GetDisplay(WindowFrame window)
            {
                var gtkkwin = window.GetBackend().Window;
                var gdkdisp = gtkkwin.GetType().GetPropertyValue(gtkkwin, "Display");
                var display = (IntPtr)gdkdisp.GetType().GetPropertyValue(gdkdisp, "Handle");
                var xdisp   = getxdisplay(display);

                return(xdisp);
            }
Example #5
0
            public override void GetMouseInfo(WindowFrame window, out int mx, out int my, out uint buttons)
            {
                if (Platform.OSPlatform == PlatformID.MacOSX)
                {
                    Type et    = Platform.GetType("AppKit.NSEvent");
                    var  flags = et.GetPropertyValueStatic("CurrentPressedMouseButtons");
                    var  pos   = et.GetPropertyValueStatic("CurrentMouseLocation");

                    var screens = (Array)Platform.GetType("AppKit.NSScreen").GetPropertyValueStatic("Screens");

                    Rectangle desktopBounds = Rectangle.Zero;

                    foreach (var s in screens)
                    {
                        var r = s.GetType().GetPropertyValue(s, "Frame");
                        desktopBounds = desktopBounds.Union(new Rectangle(
                                                                (r.GetType().GetPropertyValue(r, "X") as IConvertible).ToInt32(null),
                                                                (r.GetType().GetPropertyValue(r, "Y") as IConvertible).ToInt32(null),
                                                                (r.GetType().GetPropertyValue(r, "Width") as IConvertible).ToInt32(null),
                                                                (r.GetType().GetPropertyValue(r, "Height") as IConvertible).ToInt32(null)));
                    }

                    mx      = (pos.GetType().GetPropertyValue(pos, "X") as IConvertible).ToInt32(null);
                    my      = Convert.ToInt32(desktopBounds.Bottom - (pos.GetType().GetPropertyValue(pos, "Y") as IConvertible).ToInt32(null));
                    buttons = (uint)(flags as IConvertible).ToInt32(null);

                    return;
                }
                Type t = BaseLib.Xwt.Platform.GetType("Gdk.ModifierType");

                var display = Interop.Gtk.gtk_window.GetPropertyValue(window.GetBackend().Window, "Display");

                var parms = new object[] { 0, 0, Enum.ToObject(t, 0) };
                var mi    = display.GetType().GetMethod("GetPointer", new Type[] { Type.GetType("System.Int32&"), Type.GetType("System.Int32&"), BaseLib.Xwt.Platform.GetType("Gdk.ModifierType&") });

                mi.Invoke(display, parms);

                mx = (int)parms[0];
                my = (int)parms[1];

                int mask = (int)parms[2];

                buttons = (uint)
                          ((mask & 0x100) != 0 ? 1 : 0);
            }
Example #6
0
            public override void GetMouseInfo(WindowFrame window, out int mx, out int my, out uint buttons)
            {
                Type t = BaseLib.Xwt.Platform.GetType("Gdk.ModifierType");

                var display = Interop.Gtk.gtk_window.GetPropertyValue(window.GetBackend().Window, "Display");

                var parms = new object[] { 0, 0, Enum.ToObject(t, 0) };
                var mi    = display.GetType().GetMethod("GetPointer", new Type[] { Type.GetType("System.Int32&"), Type.GetType("System.Int32&"), BaseLib.Xwt.Platform.GetType("Gdk.ModifierType&") });

                mi.Invoke(display, parms);

                mx = (int)parms[0];
                my = (int)parms[1];

                int mask = (int)parms[2];

                buttons = (uint)
                          ((mask & 0x100) != 0 ? 1 : 0);
            }
Example #7
0
        public IEnumerable <Tuple <IntPtr, object> > AllForms(WindowFrame windowfordisplay)
        {
            var disp = GetDisplay(windowfordisplay);

            return(AllForms(disp, windowfordisplay.GetBackend()));
        }
Example #8
0
        public IEnumerable <Tuple <IntPtr, object> > Search(WindowFrame window, Point pt)
        {
            var disp = GetDisplay(window);

            return(AllForms(disp, window.GetBackend()).Where(_t => GetWindowRect(disp, _t.Item2).Contains(pt)));
        }
Example #9
0
 public void SetPos(WindowFrame window, Rectangle pos)
 {
     window.GetBackend().Bounds = pos;
 }
Example #10
0
            private IntPtr GetHwnd(WindowFrame r)
            {
                var wh = Activator.CreateInstance(Win32.swi_wininterophelper, new object[] { r.GetBackend().Window });

                return((IntPtr)wh.GetType().GetPropertyValue(wh, "Handle"));
            }
Example #11
0
            public override void SetParent(WindowFrame r, WindowFrame parentWindow)
            {
                var w = r.GetBackend().Window;

                w.GetType().SetPropertyValue(w, "Owner", (parentWindow.GetBackend() as IWindowFrameBackend).Window);
            }