示例#1
0
        unsafe void ShowPalette(int[] PaletteFormat)
        {
            Gdk.Window gr      = image1.GdkWindow;
            int        y       = 0;
            int        x       = 0;
            int        xoffset = 500;
            int        yoffset = 70;
            int        w       = 16;
            int        h       = 10;

            for (int j = 0; j < PaletteFormat.Length; j++)
            {
                y = (j / 16) * h;
                x = (j % w) * w;
                List <byte> buff = new List <byte>();
                for (int i = 0; i < w * h; i++)
                {
                    int color = PaletteFormat[j];
                    buff.Add((byte)((color >> 16) & 0xFF)); //Red
                    buff.Add((byte)((color >> 8) & 0xFF));  //Green
                    buff.Add((byte)((color >> 0) & 0xFF));  //Blue
                }
                gr.DrawRgbImage(image1.Style.BackgroundGC(StateType.Normal), xoffset + x, yoffset + y, w, h,
                                RgbDither.Normal, buff.ToArray(), 0);
            }
        }
        protected override bool OnKeyReleaseEvent(Gdk.EventKey evnt)
        {
            bool ret;

            if (evnt.Key == Gdk.Key.Control_L || evnt.Key == Gdk.Key.Control_R)
            {
                Gdk.Window focusTarget = null;
                Document   doc         = SelectedDocument;
                if (doc != null)
                {
                    doc.Select();
                    focusTarget = doc.ActiveView.Control.Toplevel.GdkWindow;
                }
                else
                {
                    Pad pad = SelectedPad;
                    if (pad != null)
                    {
                        pad.BringToFront(true);
                        focusTarget = pad.Window.Content.Control.Toplevel.GdkWindow;
                    }
                }
                ret = base.OnKeyReleaseEvent(evnt);
                Gtk.Window parent = this.TransientFor;
                this.Destroy();

                (focusTarget ?? parent.GdkWindow).Focus(0);
            }
            else
            {
                ret = base.OnKeyReleaseEvent(evnt);
            }
            return(ret);
        }
示例#3
0
        /// <summary>
        /// Called when the window is realized (shown).
        /// </summary>
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized;
            var attributes = new WindowAttr();

            attributes.WindowType = WindowType.Child;
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Width      = Allocation.Width;
            attributes.Height     = Allocation.Height;
            attributes.Wclass     = WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.Colormap   = Colormap;
            attributes.EventMask  = (int)(Events | EventMask.ExposureMask);
            attributes.Mask       = Events | EventMask.ExposureMask;

            const WindowAttributesType mask =
                WindowAttributesType.X | WindowAttributesType.Y
                | WindowAttributesType.Colormap | WindowAttributesType.Visual;

            GdkWindow          = new Window(ParentWindow, attributes, mask);
            GdkWindow.UserData = Raw;
            Style        = Style.Attach(GdkWindow);
            WidgetFlags &= ~WidgetFlags.NoWindow;
        }
示例#4
0
        protected override void OnRealized()
        {
            base.OnRealized();

            var alloc = Allocation;
            int bw    = (int)BorderWidth;

            var attributes = new Gdk.WindowAttr()
            {
                WindowType = Gdk.WindowType.Child,
                Wclass     = Gdk.WindowClass.InputOnly,
                EventMask  = (int)(
                    EventMask.EnterNotifyMask |
                    EventMask.LeaveNotifyMask |
                    EventMask.PointerMotionMask |
                    EventMask.ButtonPressMask |
                    EventMask.ButtonReleaseMask
                    ),
                X      = alloc.X + bw,
                Y      = alloc.Y + bw,
                Width  = alloc.Width - bw * 2,
                Height = alloc.Height - bw * 2,
            };

            var attrMask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y;

            inputWindow          = new Gdk.Window(Parent.GdkWindow, attributes, (int)attrMask);
            inputWindow.UserData = Handle;
        }
        protected void EmbedWidgetIntoWinFormPanel()
        {
            if (m_gdkWrapperOfForm != null)
            {
                return;
            }

            if (m_parent == null)
            {
                return;
            }

            // Wraps the panel native (X) window handle in a GdkWrapper
            m_gdkWrapperOfForm = Gdk.Window.ForeignNewForDisplay(Gdk.Display.Default, (uint)m_parent.Handle);

            System.Windows.Forms.Application.DoEvents();
            ProcessPendingGtkEvents();

            // embed m_popupWindow into winform (m_parent)
            m_popupWindow.GdkWindow.Reparent(m_gdkWrapperOfForm, 0, 0);
            ProcessPendingGtkEvents();

            m_popupWindow.GdkWindow.AddFilter(FilterFunc);
            _filterAdded = true;
        }
示例#6
0
        protected override void OnRealized ()
        {
            base.OnRealized ();

            WindowAttr attributes = new WindowAttr ();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.X = Allocation.X;
            attributes.Y = Allocation.Y;
            attributes.Width = Allocation.Width;
            attributes.Height = Allocation.Height;
            attributes.Wclass = WindowClass.InputOnly;
            attributes.EventMask = (int)(
                EventMask.PointerMotionMask |
                EventMask.ButtonPressMask |
                EventMask.ButtonReleaseMask |
                EventMask.EnterNotifyMask |
                EventMask.LeaveNotifyMask |
                EventMask.ExposureMask);

            WindowAttributesType attributes_mask =
                WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Wmclass;

            event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
            event_window.UserData = Handle;

            AllocateChild ();
            QueueResize ();
        }
示例#7
0
        static void MotionNotifyEvent(object obj, MotionNotifyEventArgs args)
        {
            int x, y;

            Gdk.ModifierType state;
            Gdk.EventMotion  ev     = args.Event;
            Gdk.Window       window = ev.Window;

            if (ev.IsHint)
            {
                Gdk.ModifierType s;
                window.GetPointer(out x, out y, out s);
                state = s;
            }
            else
            {
                x     = (int)ev.X;
                y     = (int)ev.Y;
                state = ev.State;
            }

            if ((state & Gdk.ModifierType.Button1Mask) != 0 && pixmap != null)
            {
                DrawBrush(x, y, true);
            }
            else if ((state & Gdk.ModifierType.Button3Mask) != 0 && pixmap != null)
            {
                DrawBrush(x, y, false);
            }

            args.RetVal = true;
        }
示例#8
0
        protected override void OnRealized()
        {
            SetFlag(Gtk.WidgetFlags.Realized);
            GdkWindow = new Gdk.Window(ParentWindow,
                                       new Gdk.WindowAttr {
                WindowType = Gdk.WindowType.Child,
                X          = Allocation.X,
                Y          = Allocation.Y,
                Width      = Allocation.Width,
                Height     = Allocation.Height,
                Wclass     = Gdk.WindowClass.InputOutput,
                Visual     = ParentWindow.Visual,
                Colormap   = ParentWindow.Colormap,
                Mask       = this.Events
                             | EventMask.ExposureMask
                             | EventMask.ButtonPressMask
                             | EventMask.ButtonReleaseMask
                             | EventMask.PointerMotionMask
                             | EventMask.PointerMotionHintMask
                             | EventMask.ScrollMask
                             | EventMask.KeyPressMask
                             | EventMask.LeaveNotifyMask
            },
                                       Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y |
                                       Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap);

            GdkWindow.SetBackPixmap(null, false);
            GdkWindow.UserData = Handle;

            Style.Attach(GdkWindow);
            Style.SetBackground(GdkWindow, Gtk.StateType.Normal);

            OnRealizedChildren();
        }
示例#9
0
        public static void TestGDK()
        {
            // https://github.com/GtkSharp/GtkSharp
            Gdk.Window window = Gdk.Global.DefaultRootWindow;
            if (window != null)
            {
                // Gdk.Pixbuf pixBuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8,
                //     window.Screen.Width, window.Screen.Height);

                // Gdk.CursorType.Arrow
                // Gdk.Display.Default.GetPointer();
                // Gdk.Cursor.GetObject().
                // Gdk.Display.Default.GetMonitor(0).Geometry.Bottom
                // Gdk.Display.Default.GetMonitor(0).IsPrimary
                // Gdk.Display.Default.NMonitors
                // Gdk.Display.Default.GetMonitorAtPoint()
                // Gdk.Display.Default.GetPointer();


                // pixBuf.dr
                // pixBuf.GetPixelsWithLength()
                // Gdk.Pixbuf buf;

                // pixBuf.GetFromDrawable(window, Gdk.Colormap.System, 0, 0, 0, 0, window.Screen.Width, window.Screen.Height);
                // pixBuf.ScaleSimple(400, 300, Gdk.InterpType.Bilinear);
                // pixBuf.Save("screenshot0.jpeg", "jpeg");
            } // End if (window!=null)
        }     // End Sub TestGDK()
示例#10
0
    public static int GetHeight(this Gdk.Window gdkWindow)
    {
        int w, h;

        gdkWindow.GetSize(out w, out h);
        return(h);
    }
示例#11
0
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized;

            Gdk.WindowAttr attributes = new Gdk.WindowAttr();
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Height     = Allocation.Height;
            attributes.Width      = Allocation.Width;
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass     = Gdk.WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.Colormap   = Colormap;
            attributes.EventMask  = (int)(Events |
                                          Gdk.EventMask.ExposureMask |
                                          Gdk.EventMask.Button1MotionMask |
                                          Gdk.EventMask.ButtonPressMask |
                                          Gdk.EventMask.ButtonReleaseMask);

            Gdk.WindowAttributesType attributes_mask =
                Gdk.WindowAttributesType.X |
                Gdk.WindowAttributesType.Y |
                Gdk.WindowAttributesType.Colormap |
                Gdk.WindowAttributesType.Visual;
            GdkWindow          = new Gdk.Window(ParentWindow, attributes, (int)attributes_mask);
            GdkWindow.UserData = Handle;

            Style = Style.Attach(GdkWindow);
            Style.SetBackground(GdkWindow, State);
            this.WidgetFlags &= ~WidgetFlags.NoWindow;

            //GdkWindow.SetBackPixmap (null, true);

            ModifyBase(StateType.Normal, Styles.DockFrameBackground.ToGdkColor());
        }
示例#12
0
        protected override void OnRealized()
        {
            base.OnRealized();

            WindowAttr attributes = new WindowAttr();

            attributes.WindowType = Gdk.WindowType.Child;
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Width      = Allocation.Width;
            attributes.Height     = Allocation.Height;
            attributes.Wclass     = WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.Colormap   = Colormap;
            attributes.EventMask  = (int)Events;
            attributes.EventMask  = attributes.EventMask | ((int)Gdk.EventMask.ExposureMask |
                                                            (int)Gdk.EventMask.KeyPressMask |
                                                            (int)Gdk.EventMask.KeyReleaseMask |
                                                            (int)Gdk.EventMask.EnterNotifyMask |
                                                            (int)Gdk.EventMask.LeaveNotifyMask |
                                                            (int)Gdk.EventMask.StructureMask |
                                                            (int)Gdk.EventMask.FocusChangeMask);

            GdkWindow = new Gdk.Window(ParentWindow, attributes, Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y |
                                       Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual);
            GdkWindow.UserData = this.Handle;

            Style = Style.Attach(GdkWindow);
            Style.Background(StateType.Normal);

            browser.Load(this.Handle, width, height);
        }
示例#13
0
    public static int GetWidth(this Gdk.Window gdkWindow)
    {
        int w, h;

        gdkWindow.GetSize(out w, out h);
        return(w);
    }
示例#14
0
        /// <summary>
        /// Shows the about dialog.
        /// </summary>
        /// <param name='ProgramVersion'>
        /// Program version.
        /// </param>
        /// <param name='wind'>
        /// The Parent windows
        /// </param>
        public static void showAboutDialog(Version ProgramVersion, Gdk.Window wind)
        {
            try {
                AboutDialog about = new AboutDialog();
                about.ProgramName  = g_programName;
                about.ParentWindow = wind;
                about.Comments     = Catalog.GetString("Erstellen und Testen Sie schnell und einfach reguläre Ausdrücke mit der verbesserten Version von Phrasis.Studio");
                about.Version      = ProgramVersion.ToString();            //.Replace (".0", "");
                about.Logo         = new Gdk.Pixbuf(new cPathEnvironment().const_program_image, 128, 128, true);
                about.Icon         = new Gdk.Pixbuf(new cPathEnvironment().const_program_image, 64, 64, true);
                about.Title        = Catalog.GetString("Info über das Programm");
                about.Website      = "https://github.com/squarerootfury/terminus-project";
                about.License      = System.IO.File.ReadAllText(new cPathEnvironment().const_program_license, System.Text.Encoding.UTF8);
                about.WrapLicense  = true;
                about.Copyright   += Catalog.GetString("\nCopyright 2012 (c) Terminus Entwickler");
                about.SetPosition(WindowPosition.Center);

                /*about.Authors = new string[] {"Terminus - Team:\n","\"Fury\""};
                 * about.Artists = new string[] {"Anwendungsicon:\n","\"anonymous\""};
                 * about.Documenters = new string[] {"Anwendungsdokumentation:\n","ups keiner :)"};
                 */
                about.Run();
                about.Destroy();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, cTerminus.g_programName, ButtonsType.Close, MessageType.Error);
            }
        }
示例#15
0
    public void TakeScreen(object obj, EventArgs args)
    {
        this.Opacity = 0.0;         //hide easyshot window

        int wight, height, x, y = 0;

        this.GetPosition(out x, out y);
        this.GetSize(out wight, out height);

        System.Threading.Thread.Sleep(500);         //waiting for the hiding window

        Gdk.Window window = Gdk.Global.DefaultRootWindow;
        if (window != null)
        {
            pixBuf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, false, 8, wight, height);
            pixBuf.GetFromDrawable(window, Gdk.Colormap.System, x, y, 0, 0, wight, height);
            //pixBuf.ScaleSimple(window.Screen.Width, window.Screen.Height, Gdk.InterpType.Hyper);
            try {
                pixBuf.Save(screenName, screenEx);
            } catch (Exception ex) {
                logLabel.Text = ex.Message;
            }
        }

        this.Opacity = 0.7;

        //can copy
        copyButton.Sensitive = true;
    }
示例#16
0
        void SetCursorIfAppropriate(TextView view, int x, int y)
        {
            bool     hovering = false;
            TextIter iter     = view.GetIterAtLocation(x, y);

            foreach (TextTag tag in iter.Tags)
            {
                if (tag.Underline == Pango.Underline.Single)
                {
                    hovering = true;
                    break;
                }
            }

            if (hovering != hoveringOverLink)
            {
                Gdk.Window window = view.GetWindow(Gtk.TextWindowType.Text);

                hoveringOverLink = hovering;
                if (hoveringOverLink)
                {
                    window.Cursor = handCursor;
                }
                else
                {
                    window.Cursor = regularCursor;
                }
            }
        }
示例#17
0
        protected override void OnRealized()
        {
            SetFlag(WidgetFlags.Realized);
            GdkWindow = ParentWindow;

            base.OnRealized();

            WindowAttr attr = WindowAttr.Zero;

            attr.WindowType = Gdk.WindowType.Child;



            attr.X          = action.X;
            attr.Y          = action.Y;
            attr.Width      = action.Width;
            attr.Height     = action.Height;
            attr.Wclass     = WindowClass.InputOnly;
            attr.EventMask  = (int)Events;
            attr.EventMask |= (int)(EventMask.ButtonPressMask |
                                    EventMask.KeyPressMask |
                                    EventMask.KeyReleaseMask |
                                    EventMask.ButtonReleaseMask |
                                    EventMask.PointerMotionMask);

            event_window          = new Gdk.Window(GdkWindow, attr, (int)(WindowAttributesType.X | WindowAttributesType.Y));
            event_window.UserData = this.Handle;
        }
示例#18
0
        /// <summary>
        /// Used internally - sends a keypress event to a widget.
        /// </summary>
        /// <param name="target">Target widget.</param>
        /// <param name="keyVal">Key value being sent.</param>
        /// <param name="state">Key press state - e.g. ctrl click.</param>
        /// <param name="eventType">Type of event to be sent.</param>
        private static void SendKeyEvent(Widget target, uint keyVal, ModifierType state, EventType eventType)
        {
            Gdk.KeymapKey[] keyms = Gdk.Keymap.Default.GetEntriesForKeyval(keyVal);
            if (keyms.Length == 0)
            {
                throw new Exception("Keyval not found");
            }

            Gdk.Window win = target.GdkWindow;

            var nativeEvent = new NativeEventKeyStruct
            {
                type             = eventType,
                send_event       = 1,
                window           = win.Handle,
                state            = (uint)state,
                keyval           = keyVal,
                group            = (byte)keyms[0].Group,
                hardware_keycode = (ushort)keyms[0].Keycode,
                length           = 0,
                time             = Gtk.Global.CurrentEventTime
            };

            IntPtr ptr = GLib.Marshaller.StructureToPtrAlloc(nativeEvent);

            try
            {
                Gdk.EventHelper.Put(new Gdk.EventKey(ptr));
            }
            finally
            {
                Marshal.FreeHGlobal(ptr);
            }
        }
示例#19
0
        protected override void OnRealized()
        {
            SetFlag(Gtk.WidgetFlags.Realized);

            Gdk.WindowAttr attributes = new Gdk.WindowAttr();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Width      = Allocation.Width;
            attributes.Height     = Allocation.Height;
            attributes.Wclass     = WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.Colormap   = Colormap;

            // This enables all events except PointerMotionHitMask which prevents correct behavior
            // of MotionNotifyEvent
            attributes.EventMask = (int)(Gdk.EventMask.AllEventsMask & (~Gdk.EventMask.PointerMotionHintMask));

            Gdk.WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y
                                            | WindowAttributesType.Visual | WindowAttributesType.Colormap;

            GdkWindow          = new Gdk.Window(ParentWindow, attributes, (int)mask);
            GdkWindow.UserData = Handle;
            GdkWindow.SetBackPixmap(null, false);

            Style = Style.Attach(GdkWindow);
            Style.SetBackground(GdkWindow, StateType.Normal);

            Color = new Cairo.Color(1.0, 1.0, 1.0);
        }
示例#20
0
        protected virtual void EmbedWidgetIntoWinFormPanel()
        {
            if (_gdkWrapperOfForm != null)
            {
                return;
            }

            if (_parent == null)
            {
                return;
            }

            if (!_resizeHasHappened)
            {
                return;
            }

            if (_popupWindow?.Window == null)
            {
                return;
            }

            // Wraps the panel native (X) window handle in a GdkWrapper

            IntPtr gdkHandle = ForeignNewForDisplay(Gdk.Display.Default.Handle, _parent.Handle);

            _gdkWrapperOfForm = new Gdk.Window(gdkHandle);
            System.Windows.Forms.Application.DoEvents();
            ProcessPendingGtkEvents();

            // embed _popupWindow into winform (m_parent)
            _originalParent = _popupWindow.Window.Parent;
            _popupWindow.Window.Reparent(_gdkWrapperOfForm, 0, 0);
            ProcessPendingGtkEvents();
        }
示例#21
0
        private void UpdateManagerWindow()
        {
            IntPtr xdisplay = gdk_x11_display_get_xdisplay(Display.Handle);

            if (manager_window != IntPtr.Zero)
            {
                Gdk.Window gdkwin = Gdk.Window.LookupForDisplay(Display, (uint)manager_window);
                //gdkwin.RemoveFilter (filter);
            }

            XGrabServer(xdisplay);

            manager_window = XGetSelectionOwner(xdisplay, selection_atom);
            if (manager_window != IntPtr.Zero)
            {
                XSelectInput(xdisplay, manager_window, EventMask.StructureNotifyMask | EventMask.PropertyChangeMask);
            }
            XUngrabServer(xdisplay);
            XFlush(xdisplay);

            if (manager_window != IntPtr.Zero)
            {
                Gdk.Window gdkwin = Gdk.Window.LookupForDisplay(Display, (uint)manager_window);
                //gdkwin.AddFilter (filter);
                SendDockRequest();
                GetOrientationProperty();
            }
        }
示例#22
0
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;

            GdkWindow             = Parent.GdkWindow;
            cell_context.Drawable = GdkWindow;

            WindowAttr attributes = new WindowAttr();

            attributes.WindowType = Gdk.WindowType.Child;
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Width      = Allocation.Width;
            attributes.Height     = Allocation.Height;
            attributes.Wclass     = WindowClass.InputOnly;
            attributes.EventMask  = (int)(
                EventMask.PointerMotionMask |
                EventMask.KeyPressMask |
                EventMask.KeyReleaseMask |
                EventMask.ButtonPressMask |
                EventMask.ButtonReleaseMask |
                EventMask.LeaveNotifyMask |
                EventMask.ExposureMask);

            WindowAttributesType attributes_mask =
                WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Wmclass;

            event_window          = new Gdk.Window(GdkWindow, attributes, attributes_mask);
            event_window.UserData = Handle;

            OnDragSourceSet();
            MoveResize(Allocation);

            base.OnRealized();
        }
示例#23
0
        // Methods
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized;
            WindowAttr attributes = default(WindowAttr);

            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Height     = Allocation.Height;
            attributes.Width      = Allocation.Width;
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass     = WindowClass.InputOutput;
            attributes.Visual     = Visual;
            attributes.TypeHint   = (WindowTypeHint)100;
            attributes.Colormap   = Colormap;
            attributes.EventMask  = (int)(Events | EventMask.ExposureMask | EventMask.Button1MotionMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.KeyPressMask | EventMask.KeyReleaseMask);
            WindowAttributesType attributes_mask = WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Colormap | WindowAttributesType.Visual;

            GdkWindow          = new Gdk.Window(ParentWindow, attributes, (int)attributes_mask);
            GdkWindow.UserData = Handle;
            Style = Style.Attach(GdkWindow);
            Style.SetBackground(GdkWindow, State);
            WidgetFlags &= ~WidgetFlags.NoWindow;
            NSView nSView = GtkMacInterop.GetNSView(this);

            nSView.RemoveFromSuperview();
            embedParent.AddSubview(nSView);
            nSView.Frame = new CGRect(0, 0, embedParent.Frame.Width, embedParent.Frame.Height);
        }
示例#24
0
        public void EnsureDragAndDropProxy()
        {
            // having a proxy window here is VERY bad ju-ju
            if (InternalDragActive)
            {
                return;
            }

            if (Owner.DockHovered)
            {
                if (proxy_window == null)
                {
                    return;
                }
                proxy_window = null;
                EnableDragTo();
            }
            else if ((Owner.CursorTracker.Modifier & ModifierType.Button1Mask) == ModifierType.Button1Mask)
            {
                Gdk.Window bestProxy = BestProxyWindow();
                if (bestProxy != null && proxy_window != bestProxy)
                {
                    proxy_window = bestProxy;
                    Gtk.Drag.DestSetProxy(Owner, proxy_window, DragProtocol.Xdnd, true);
                }
            }
        }
示例#25
0
		protected override void OnRealized ()
		{
			base.OnRealized ();

			WindowAttr attributes = new WindowAttr ();
			attributes.WindowType = Gdk.WindowType.Child;
			attributes.X = Allocation.X;
			attributes.Y = Allocation.Y;
			attributes.Width = Allocation.Width;
			attributes.Height = Allocation.Height;
			attributes.Wclass = WindowClass.InputOutput;
			attributes.Visual = Visual;
			attributes.Colormap = Colormap;
			attributes.EventMask = (int) Events;
			attributes.EventMask = attributes.EventMask | ((int) Gdk.EventMask.ExposureMask |
						(int) Gdk.EventMask.KeyPressMask |
						(int) Gdk.EventMask.KeyReleaseMask |
						(int) Gdk.EventMask.EnterNotifyMask |
						(int) Gdk.EventMask.LeaveNotifyMask |
						(int) Gdk.EventMask.StructureMask |
						(int) Gdk.EventMask.FocusChangeMask);

			GdkWindow = new Gdk.Window (ParentWindow, attributes, Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | 
			                            Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual);
			GdkWindow.UserData = this.Handle;

			Style = Style.Attach (GdkWindow);
			Style.Background (StateType.Normal);
			
			browser.Load (this.Handle, width, height);		
		}
示例#26
0
        protected override void OnRealized()
        {
            base.OnRealized();

            WindowAttr attributes = new WindowAttr();

            attributes.WindowType = Gdk.WindowType.Child;
            attributes.X          = Allocation.X;
            attributes.Y          = Allocation.Y;
            attributes.Width      = Allocation.Width;
            attributes.Height     = Allocation.Height;
            attributes.Wclass     = WindowClass.InputOnly;
            attributes.EventMask  = (int)(
                EventMask.PointerMotionMask |
                EventMask.ButtonPressMask |
                EventMask.ButtonReleaseMask |
                EventMask.EnterNotifyMask |
                EventMask.LeaveNotifyMask |
                EventMask.ExposureMask);

            WindowAttributesType attributes_mask =
                WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Wmclass;

            event_window          = new Gdk.Window(GdkWindow, attributes, attributes_mask);
            event_window.UserData = Handle;

            AllocateChild();
            QueueResize();
        }
示例#27
0
        // Looks at all tags covering the position (x, y) in the text view,
        // and if one of them is a link, change the cursor to the "hands" cursor
        // typically used by web browsers.
        private void SetCursorIfAppropriate(TextView textView, int x, int y)
        {
            TextIter iter = textView.GetIterAtLocation(x, y);

            var foundLink = false;

            foreach (TextTag tag in iter.Tags)
            {
                if (tag is LinkTag)
                {
                    foundLink = true;
                }
            }

            Gdk.Window window = textView.GetWindow(Gtk.TextWindowType.Text);
            if (window != null)
            {
                if (foundLink /*hovering != hoveringOverLink*/)
                {
                    window.Cursor = handCursor;
                }
                else
                {
                    window.Cursor = regularCursor;
                }
            }
            else
            {
            }
        }
示例#28
0
        private FilterReturn FilterFunc(IntPtr xevent, Event evnt)
        {
            if (xevent == IntPtr.Zero)
            {
                return(FilterReturn.Continue);
            }

            var e = (X11.XEvent)Marshal.PtrToStructure(xevent, typeof(X11.XEvent));

            if (e.type == X11.XEventName.PropertyNotify)
            {
                var actWin = Screen.Default.ActiveWindow;

                if (actWin != null)
                {
                    if (lastActive == null || actWin.Handle != lastActive.Handle)
                    {
                        lastActive = actWin;
                        var win = Windows.GetOrCreate(actWin.Handle);
                        RaiseWindowActivated(win);
                    }
                }
            }

            // Everything else just process as normal
            return(FilterReturn.Continue);
        }
示例#29
0
        public CodePreviewWindow(
            Gdk.Window parentWindow,
            string fontName   = null,
            EditorTheme theme = null)
            : base(Gtk.WindowType.Popup)
        {
            ParentWindow = parentWindow ?? MonoDevelop.Ide.IdeApp.Workbench.RootWindow.GdkWindow;

            AppPaintable  = true;
            SkipPagerHint = SkipTaskbarHint = true;
            TypeHint      = WindowTypeHint.Menu;

            this.fontName = fontName = fontName ?? DefaultSourceEditorOptions.Instance.FontName;

            layout                 = PangoUtil.CreateLayout(this);
            fontDescription        = Pango.FontDescription.FromString(fontName);
            fontDescription.Size   = (int)(fontDescription.Size * 0.8f);
            layout.FontDescription = fontDescription;
            layout.Ellipsize       = Pango.EllipsizeMode.End;

            var geometry = Screen.GetUsableMonitorGeometry(Screen.GetMonitorAtWindow(ParentWindow));

            maxWidth  = geometry.Width * 2 / 5;
            maxHeight = geometry.Height * 2 / 5;

            layout.SetText("n");
            layout.GetPixelSize(out int _, out int lineHeight);
            MaximumLineCount = maxHeight / lineHeight;

            theme     = theme ?? DefaultSourceEditorOptions.Instance.GetEditorTheme();
            colorText = SyntaxHighlightingService.GetColor(theme, EditorThemeColors.Foreground);
            colorBg   = SyntaxHighlightingService.GetColor(theme, EditorThemeColors.Background);
            colorFold = SyntaxHighlightingService.GetColor(theme, EditorThemeColors.CollapsedText);
        }
示例#30
0
    /// <summary>
    /// Triggered when the drawing area is configured.
    /// </summary>
    private void OnConfigure(
        object obj,
        ConfigureEventArgs args)
    {
        // Pull out some fields
        EventConfigure ev     = args.Event;
        Window         window = ev.Window;
        int            width  = Allocation.Width;
        int            height = Allocation.Height;
        int            min    = Math.Min(width, height);

        viewport.Height = height;
        viewport.Width  = width;

        // Create the backing pixmap
        pixmap = new Pixmap(window, width, height, -1);

        // Update the current pane
        if (Sprite != null)
        {
            Sprite.Height = Sprite.Width = ((int)(min * 0.75));
        }

        // Mark ourselves as done
        args.RetVal = true;
    }
示例#31
0
        // Looks at all tags covering the position (x, y) in the text view,
        // and if one of them is a link, change the cursor to the "hands" cursor
        // typically used by web browsers.
        private void SetCursorIfAppropriate(TextView textView, int x, int y)
        {
            TextIter iter      = textView.GetIterAtLocation(x, y);
            var      foundLink = false;

            // fixme: When we remove gtk2 deps, we can eliminate this check
            if (!iter.Equals(TextIter.Zero))
            {
                foreach (TextTag tag in iter.Tags)
                {
                    if (tag is LinkTag)
                    {
                        foundLink = true;
                    }
                }
            }

            Gdk.Window window = textView.GetWindow(TextWindowType.Text);
            if (window != null)
            {
                if (foundLink)
                {
                    window.Cursor = handCursor;
                }
                else
                {
                    window.Cursor = regularCursor;
                }
            }
        }
示例#32
0
        protected override void OnUnrealized()
        {
            base.OnUnrealized();

            inputWindow.UserData = IntPtr.Zero;
            inputWindow.Destroy();
            inputWindow = null;
        }
        public void Step4_Draw(Window window, Gdk.GC gc)
        {
            if (m_islands == null) return;
            if (!m_startSet) return;
            if (!m_endSet) return;

            // Draw a line from start point to ending point.
            gc.RgbFgColor = new Color(255, 0, 255);
            window.DrawLine(gc, m_startx, m_starty, m_endx, m_endy);
        }
 public static void Draw(Window window, Gdk.GC gc, int units, int width, int height)
 {
     var darkColor = new Gdk.Color(50, 50, 50);
     var brightColor = new Gdk.Color(100, 100, 100);
     int nw = width / units;
     int nh = height / units;
     for (int i = 0; i <= nw; i++) {
         for (int j = 0; j <= nh; j++) {
             bool dark = ((i + j) % 2) == 0;
             if (dark) gc.RgbFgColor = darkColor;
             else gc.RgbFgColor = brightColor;
             window.DrawRectangle(gc, true, units * i, units * j, units, units);
         }
     }
 }
        protected void EmbedWidgetIntoWinFormPanel()
        {
            if (m_gdkWrapperOfForm != null)
                return;

            // Wraps the panel native (X) window handle in a GdkWrapper
            m_gdkWrapperOfForm = Gdk.Window.ForeignNewForDisplay(Gdk.Display.Default, (uint)m_parent.Handle);

            m_parent.HandleCreated += delegate {
                // get low level access to x11 events
                Gdk.Window.AddFilterForAll(FilterFunc);
            };
            System.Windows.Forms.Application.DoEvents();
            ProcessPendingGtkEvents();

            // embed m_popupWindow into winform (m_parent)
            m_popupWindow.GdkWindow.Reparent(m_gdkWrapperOfForm, 0, 0);
            ProcessPendingGtkEvents();
        }
示例#36
0
        private FilterReturn FilterFunc(IntPtr xevent, Event evnt)
        {
            if (xevent == IntPtr.Zero)
                return FilterReturn.Continue;

            var e = (X11.XEvent)Marshal.PtrToStructure(xevent, typeof(X11.XEvent));

            if (e.type == X11.XEventName.PropertyNotify) {
                var actWin = Screen.Default.ActiveWindow;

                if (actWin != null) {
                    if (lastActive == null || actWin.Handle != lastActive.Handle) {
                        lastActive = actWin;
                        var win = Windows.GetOrCreate(actWin.Handle);
                        RaiseWindowActivated(win);
                    }
                }

            }

            // Everything else just process as normal
            return FilterReturn.Continue;
        }
示例#37
0
		public void EnsureDragAndDropProxy ()
		{
			// having a proxy window here is VERY bad ju-ju
			if (InternalDragActive)
				return;
			
			if (Owner.DockHovered) {
				if (proxy_window == null)
					return;
				proxy_window = null;
				EnableDragTo ();
			} else if ((Owner.CursorTracker.Modifier & ModifierType.Button1Mask) == ModifierType.Button1Mask) {
				Gdk.Window bestProxy = BestProxyWindow ();
				if (bestProxy != null && proxy_window != bestProxy) {
					proxy_window = bestProxy;
					Gtk.Drag.DestSetProxy (Owner, proxy_window, DragProtocol.Xdnd, true);
				}
			}
		}
示例#38
0
        protected override void OnUnrealized()
        {
            IsRealized = false;
            event_window.UserData = IntPtr.Zero;
            event_window.Destroy ();
            event_window = null;

            base.OnUnrealized ();
        }
示例#39
0
文件: ImageView.cs 项目: hbons/f-spot
        protected override void OnRealized()
        {
            SetFlag (Gtk.WidgetFlags.Realized);
            GdkWindow = new Gdk.Window (ParentWindow,
                    new Gdk.WindowAttr {
                        WindowType = Gdk.WindowType.Child,
                        X = Allocation.X,
                        Y = Allocation.Y,
                        Width = Allocation.Width,
                        Height = Allocation.Height,
                        Wclass = Gdk.WindowClass.InputOutput,
                        Visual = ParentWindow.Visual,
                        Colormap = ParentWindow.Colormap,
                        Mask = this.Events
                            | EventMask.ExposureMask
                            | EventMask.ButtonPressMask
                            | EventMask.ButtonReleaseMask
                            | EventMask.PointerMotionMask
                            | EventMask.PointerMotionHintMask
                            | EventMask.ScrollMask
                            | EventMask.KeyPressMask
                            | EventMask.LeaveNotifyMask
                    },
                    Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y |
                    Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap);

            GdkWindow.SetBackPixmap (null, false);
            GdkWindow.UserData = Handle;

            Style.Attach (GdkWindow);
            Style.SetBackground (GdkWindow, Gtk.StateType.Normal);

            OnRealizedChildren ();
        }
        private void DrawIslands(Window window, Gdk.GC gc)
        {
            if (m_app == null) return;
            if (m_app.Islands == null) return;

            gc.RgbFgColor = new Color(255, 0, 255);
            foreach (var island in m_app.Islands) {
                window.DrawRectangle(gc, false, island.X, island.Y, island.Width, island.Height);
            }
        }
示例#41
0
    /**
     * Resets the Drawing Area to blank
     */
    protected void OnCloseActionActivated(object sender, System.EventArgs e)
    {
        this.Title = "Screenary";
        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);
    }
        protected override void OnRealized ()
        {
            WidgetFlags |= WidgetFlags.Realized;

            Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass = Gdk.WindowClass.InputOutput;
            attributes.EventMask = (int)Gdk.EventMask.ExposureMask;

            GdkWindow = new Gdk.Window (Parent.GdkWindow, attributes, 0);
            GdkWindow.UserData = Handle;
            GdkWindow.Background = Style.Background (State);
            Style.Attach (GdkWindow);
        }
示例#43
0
        /// <summary>
        /// Loads plugin.
        /// </summary>
        public void Load()
        {
            this.rootWindow = Global.DefaultRootWindow;
            this.architecture = Stuff.Architecture();

            this.submenu = new Gtk.Menu();

            Gtk.MenuItem mi = new Gtk.MenuItem(Catalog.GetString("_Take region screenshot"));
            this.submenu.Append(mi);
            mi.Activated += (s, e) => this.TakeRegionScreenshot();
            mi.ButtonPressEvent += (s, e) => this.TakeRegionScreenshot();

            mi = new Gtk.MenuItem(Catalog.GetString("Take screenshot of _entire screen"));
            this.submenu.Append(mi);
            mi.Activated += (s, e) => this.TakeScreenScreenshot();
            mi.ButtonPressEvent += (s, e) => this.TakeScreenScreenshot();

            mi = new Gtk.MenuItem(Catalog.GetString("_Pick color"));
            this.submenu.Append(mi);
            mi.Activated += (s, e) => this.PickColor();
            mi.ButtonPressEvent += (s, e) => this.PickColor();
        }
示例#44
0
		protected override void OnRealized ()
		{
			base.OnRealized ();
			
			var alloc = Allocation;
			int bw = (int) BorderWidth;
			
			var attributes = new Gdk.WindowAttr () {
				WindowType = Gdk.WindowType.Child,
				Wclass = Gdk.WindowClass.InputOnly,
				EventMask = (int) (
					EventMask.EnterNotifyMask |
					EventMask.LeaveNotifyMask |
					EventMask.PointerMotionMask |
					EventMask.ButtonPressMask | 
					EventMask.ButtonReleaseMask
				),
				X = alloc.X + bw,
				Y = alloc.Y + bw,
				Width = alloc.Width - bw * 2,
				Height = alloc.Height - bw * 2,
			};
			
			var attrMask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y;
			
			inputWindow = new Gdk.Window (Parent.GdkWindow, attributes, (int) attrMask);
			inputWindow.UserData = Handle;
		}
示例#45
0
        protected override void OnRealized()
        {
            IsRealized = true;

            Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
            attributes.WindowType = Gdk.WindowType.Child;
            attributes.Wclass = Gdk.WindowWindowClass.InputOutput;
            attributes.EventMask = (int)Gdk.EventMask.ExposureMask;

            Window = new Gdk.Window (Parent.Window, attributes, 0);
            Window.UserData = Handle;
            Window.BackgroundRgba = StyleContext.GetBackgroundColor (StateFlags);
        }
示例#46
0
		protected override void OnUnrealized ()
		{
			base.OnUnrealized ();
			
			inputWindow.UserData = IntPtr.Zero;
			inputWindow.Destroy ();
			inputWindow = null;
		}
示例#47
0
		void ShowPopup (Gtk.Widget parent, Gdk.EventButton evt, Gdk.Rectangle caret, PopupPosition position)
		{
			this.parent = parent;
			this.currentCaret = caret;
			Theme.TargetPosition = position;

			if (evt != null) {
				eventProvided = true;
				targetWindow = evt.Window;
			} else
				targetWindow = parent.GdkWindow;

			RepositionWindow ();
		}
示例#48
0
		protected override void OnRealized ()
		{
			WidgetFlags |= WidgetFlags.Realized;
			
			Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
			attributes.X = Allocation.X;
			attributes.Y = Allocation.Y;
			attributes.Height = Allocation.Height;
			attributes.Width = Allocation.Width;
			attributes.WindowType = Gdk.WindowType.Child;
			attributes.Wclass = Gdk.WindowClass.InputOutput;
			attributes.Visual = Visual;
			attributes.Colormap = Colormap;
			attributes.EventMask = (int)(Events |
				Gdk.EventMask.ExposureMask |
				Gdk.EventMask.Button1MotionMask |
				Gdk.EventMask.ButtonPressMask |
				Gdk.EventMask.ButtonReleaseMask);
		
			Gdk.WindowAttributesType attributes_mask =
				Gdk.WindowAttributesType.X |
				Gdk.WindowAttributesType.Y |
				Gdk.WindowAttributesType.Colormap |
				Gdk.WindowAttributesType.Visual;
			GdkWindow = new Gdk.Window (ParentWindow, attributes, (int)attributes_mask);
			GdkWindow.UserData = Handle;

			Style = Style.Attach (GdkWindow);
			Style.SetBackground (GdkWindow, State);
			this.WidgetFlags &= ~WidgetFlags.NoWindow;
			
			//GdkWindow.SetBackPixmap (null, true);

			ModifyBase (StateType.Normal, Styles.DockFrameBackground);
		}
示例#49
0
        protected override void OnRealized()
        {
            SetFlag (WidgetFlags.Realized);
            GdkWindow = ParentWindow;

            base.OnRealized ();

            WindowAttr attr = WindowAttr.Zero;
            attr.WindowType = Gdk.WindowType.Child;

            attr.X = action.X;
            attr.Y = action.Y;
            attr.Width = action.Width;
            attr.Height = action.Height;
            attr.Wclass = WindowClass.InputOnly;
            attr.EventMask = (int) Events;
            attr.EventMask |= (int) (EventMask.ButtonPressMask |
                         EventMask.KeyPressMask |
                         EventMask.KeyReleaseMask |
                         EventMask.ButtonReleaseMask |
                         EventMask.PointerMotionMask);

            event_window = new Gdk.Window (GdkWindow, attr, (int) (WindowAttributesType.X | WindowAttributesType.Y));
            event_window.UserData = this.Handle;
        }
示例#50
0
    public MainWindow(int m)
        : base(Gtk.WindowType.Toplevel)
    {
        Build();

        /* Instantiate client states */
        clientStates = new IClientState[7]
        {
            new StartedState(this),
            new SenderCreatedState(this),
            new ReceiverJoinedState(this),
            new ReceiverAuthenticatedState(this),
            new SenderSendingState(this),
            new ReceiverInControlState(this),
            new SenderSendingRemoteState(this)
        };

        /* Set current state to STARTED */
        currentState = clientStates[STARTED_STATE];
        currentState.refresh();

        width = 1024;
        height = 768;

        config = Config.Load();

        window = mainDrawingArea.GdkWindow;
        drawable = (Gdk.Drawable) window;

        mainDrawingArea.AddEvents(
            (int) Gdk.EventMask.ButtonPressMask |
            (int) Gdk.EventMask.ButtonReleaseMask |
            (int) Gdk.EventMask.PointerMotionMask |
            (int) Gdk.EventMask.KeyPressMask |
            (int) Gdk.EventMask.KeyReleaseMask);

        gc = new Gdk.GC(drawable);
        gc.ClipRectangle = new Gdk.Rectangle(0, 0, width, height);

        surface = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, width, height);
        window.InvalidateRect(new Gdk.Rectangle(0, 0, width, height), true);

        receiver = new SurfaceReceiver(window, surface);

        this.transport = null;

        pcapSource = new PcapSource(this);

        keyboard = new Keyboard();

        if (config.BroadcasterAutoconnect)
            OnUserConnect(config.BroadcasterHostname, config.BroadcasterPort);
    }
示例#51
0
	protected override bool OnExposeEvent (Gdk.EventExpose ev)
	{
		window = ev.Window;
		Gdk.Rectangle area = ev.Area;

		//Console.WriteLine ("x={0}, y={1}, w={2}, h={3}", area.x, area.y, area.width, area.height);
		DrawAll ();
		
		return false;
	}
示例#52
0
        protected override void OnRealized()
        {
            WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;

            GdkWindow = Parent.GdkWindow;

            var attributes = new WindowAttr () {
                WindowType = Gdk.WindowType.Child,
                X = Allocation.X,
                Y = Allocation.Y,
                Width = Allocation.Width,
                Height = Allocation.Height,
                Wclass = WindowClass.InputOnly,
                EventMask = (int)(
                    EventMask.ButtonPressMask |
                    EventMask.ButtonReleaseMask |
                    EventMask.KeyPressMask |
                    EventMask.KeyReleaseMask |
                    EventMask.EnterNotifyMask |
                    EventMask.LeaveNotifyMask)
            };

            var attributes_mask =
                WindowAttributesType.X |
                WindowAttributesType.Y |
                WindowAttributesType.Wmclass;

            input_window = new Gdk.Window (GdkWindow, attributes, attributes_mask) {
                UserData = Handle
            };

            base.OnRealized ();
        }
示例#53
0
		protected override void OnRealized () {
			SetFlag(Gtk.WidgetFlags.Realized);
			
			Gdk.WindowAttr attributes = new Gdk.WindowAttr();
			attributes.WindowType = Gdk.WindowType.Child;
			attributes.X = Allocation.X;
			attributes.Y = Allocation.Y;
			attributes.Width = Allocation.Width;
			attributes.Height = Allocation.Height;
			attributes.Wclass = WindowClass.InputOutput;
			attributes.Visual = Visual;
			attributes.Colormap = Colormap;
			
			// This enables all events except PointerMotionHitMask which prevents correct behavior
			// of MotionNotifyEvent
			attributes.EventMask = (int) (Gdk.EventMask.AllEventsMask & (~Gdk.EventMask.PointerMotionHintMask));
			
			Gdk.WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y
				| WindowAttributesType.Visual | WindowAttributesType.Colormap;
			
			GdkWindow = new Gdk.Window(ParentWindow, attributes, (int) mask);
			GdkWindow.UserData = Handle;
			GdkWindow.SetBackPixmap(null, false);
			
			Style = Style.Attach(GdkWindow);
			Style.SetBackground(GdkWindow, StateType.Normal);
			
			Color = new Cairo.Color(1.0, 1.0, 1.0);
		}
示例#54
0
        private void drawSpectrum()
        {
            spectrumDrawn = true;
            window = this.GdkWindow;
            gc = new Gdk.GC (window);

            for (int i = 0; i < WIDTH; i++)
                for(int k = 0; k < HEIGHT; k++)
                {
                    gc.RgbFgColor = new Gdk.Color(redBuf[i,k],
                                                  greenBuf[i,k],
                                                  blueBuf[i,k]);
                    window.DrawPoint(gc, i, k);
                }

            SpectrumVerticalPixbuf.Pixbuf = SpectrumVerticalPixbuf.Pixbuf.GetFromDrawable(window, Gdk.Colormap.System,
                                                                                          0, 0, 0, 0, WIDTH, HEIGHT);
        }
示例#55
0
		/// <summary>
		/// Emitted on the drag source when drag is started
		/// </summary>
		void HandleDragBegin (object o, DragBeginArgs args)
		{
			Owner.CursorTracker.RequestHighResolution (this);
			InternalDragActive = true;
			Keyboard.Grab (Owner.GdkWindow, true, Gtk.Global.CurrentEventTime);
			drag_canceled = false;
			
			if (proxy_window != null) {
				EnableDragTo ();
				proxy_window = null;
			}
			
			Gdk.Pixbuf pbuf;
			drag_item = Owner.HoveredItem;
			original_item_pos.Clear ();
			
			// If we are in Reposition Mode or over a non-draggable item
			// dont drag it!
			if (drag_item is INonPersistedItem || RepositionMode)
				drag_item = null;
			
			if (drag_item != null) {
				foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items)
					original_item_pos [adi] = adi.Position;
				
				using (DockySurface surface = new DockySurface ((int) (1.2 * Owner.ZoomedIconSize), (int) (1.2 * Owner.ZoomedIconSize))) {
					pbuf = Owner.HoveredItem.IconSurface (surface, (int) (1.2 * Owner.ZoomedIconSize), Owner.IconSize, 0).LoadToPixbuf ();
				}
			} else {
				pbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
			}
			
			Gtk.Drag.SetIconPixbuf (args.Context, pbuf, pbuf.Width / 2, pbuf.Height / 2);
			pbuf.Dispose ();
			
			// Set up a cursor tracker so we can move the window on the fly
			if (RepositionMode)
				Owner.CursorTracker.CursorPositionChanged += HandleCursorPositionChanged;
		}
示例#56
0
 public DrawingArgs(EventExpose evt)
 {
     this.Window = evt.Window;
     this.GC = new Gdk.GC (this.Window);
     this.Rectangle = new Rectangle(0, 0, this.Window.FrameExtents.Width, this.Window.FrameExtents.Height);
 }
示例#57
0
		protected override void OnRealized ()
		{
			WidgetFlags |= WidgetFlags.Realized;
			WindowAttr attributes = new WindowAttr () {
				WindowType = Gdk.WindowType.Child,
				X = Allocation.X,
				Y = Allocation.Y,
				Width = Allocation.Width,
				Height = Allocation.Height,
				Wclass = WindowClass.InputOutput,
				Visual = this.Visual,
				Colormap = this.Colormap,
				EventMask = (int)(this.Events | Gdk.EventMask.ExposureMask),
				Mask = this.Events | Gdk.EventMask.ExposureMask,
			};
			
			WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Colormap | WindowAttributesType.Visual;
			GdkWindow = new Gdk.Window (ParentWindow, attributes, mask);
			GdkWindow.UserData = Raw;
			Style = Style.Attach (GdkWindow);
		}
        protected override void OnUnrealized ()
        {
            WidgetFlags ^= WidgetFlags.Realized;

            event_window.UserData = IntPtr.Zero;
            Hyena.Gui.GtkWorkarounds.WindowDestroy (event_window);
            event_window = null;

            base.OnUnrealized ();
        }
示例#59
0
        protected override bool OnExposeEvent(Gdk.EventExpose ev)
        {
            base.OnExposeEvent (ev);

            if (firstDraw)
            {
                window = this.GdkWindow;
                gc = new Gdk.GC (window);
                clickProcessing(0, HEIGHT - 1, 0);

                firstDraw = false;
            }
            else
            {
                redrawPanel();
                drawClickArc();
            }

            return true;
        }
示例#60
0
 protected override void OnUnrealized()
 {
     event_window.Dispose ();
     event_window = null;
     base.OnUnrealized ();
 }