public TalkView()
            : base(new TextBuffer(null))
        {
            CursorVisible = false;
            Editable = false;
            WrapMode = WrapMode.WordChar;

            lastMessage = DateTime.MinValue;

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

            TextTag tag;
            tag = new TextTag("status");
            tag.Foreground = "darkgrey";
            tag.Weight = Pango.Weight.Bold;
            Buffer.TagTable.Add(tag);

            tag = new TextTag("error");
            tag.Foreground = "dark red";
            Buffer.TagTable.Add(tag);

            tag = new TextTag("time");
            tag.Foreground = "darkgrey";
            tag.Justification = Justification.Center;
            Buffer.TagTable.Add(tag);

            linkTag = new TextTag("link");
            linkTag.Foreground = "blue";
            linkTag.Underline = Pango.Underline.Single;
            Buffer.TagTable.Add(linkTag);

            tag = new TextTag("nick-self");
            tag.Foreground = "sea green";
            tag.Weight = Pango.Weight.Bold;
            Buffer.TagTable.Add(tag);

            tag = new TextTag("nick-other");
            tag.Foreground = "skyblue4";
            tag.Weight = Pango.Weight.Bold;
            Buffer.TagTable.Add(tag);

            endIter = Buffer.GetIterAtOffset(0);
            endMark = Buffer.CreateMark("end", endIter, true);
        }
            public ChessGameView()
                : base()
            {
                handCursor =
                    new Gdk.Cursor (Gdk.CursorType.Hand2);
                regularCursor =
                    new Gdk.Cursor (Gdk.CursorType.Xterm);

                marks = new Hashtable ();
                tag_links = new Hashtable ();
                taglinks = new ArrayList ();
                curMoveIdx = -1;

                view = new TextView ();
                view.WrapMode = WrapMode.Word;
                view.Editable = false;
                view.WidgetEventAfter += EventAfter;
                view.MotionNotifyEvent += MotionNotify;
                view.VisibilityNotifyEvent +=
                    VisibilityNotify;

                ScrolledWindow win = new ScrolledWindow ();
                  win.SetPolicy (PolicyType.Never,
                         PolicyType.Automatic);
                  win.Add (view);

                  PackStart (win, true, true, 0);
                  view.WidthRequest = 150;

                  CreateTags ();
                  ShowAll ();
            }
Beispiel #3
0
        private void ShowHideGrip()
        {
            DetachMenu(this, null);

            if (grip != null)
            {
                Gdk.Cursor cursor = null;

                if (GripShown && !Locked)
                {
                    cursor = new Gdk.Cursor(Display, Gdk.CursorType.Hand2);
                }

                if (grip.TitleWindow != null)
                {
                    grip.TitleWindow.Cursor = cursor;
                }

                if (GripShown)
                {
                    grip.Show();
                }
                else
                {
                    grip.Hide();
                }
            }
            QueueResize();
        }
Beispiel #4
0
        public int Grab(uint event_mask, Gdk.Cursor cursor, uint etime)
        {
            int raw_ret = gnome_canvas_item_grab(Handle, event_mask, cursor == null ? IntPtr.Zero : cursor.Handle, etime);
            int ret     = raw_ret;

            return(ret);
        }
 public CombineEntryFeatureSelector()
 {
     this.Build();
     handCursor      = new Gdk.Cursor(Gdk.CursorType.Hand1);
     box.Spacing     = 6;
     box.BorderWidth = 3;
     box.Show();
 }
		public CombineEntryFeatureSelector ()
		{
			this.Build();
			handCursor = new Gdk.Cursor (Gdk.CursorType.Hand1);
			box.Spacing = 6;
			box.BorderWidth = 3;
			box.Show ();
		}
Beispiel #7
0
 public static void Initialize()
 {
     DragCursor = CreateMacOSNamedCursor("closedHandCursor");
     CopyCursor = CreateMacOSNamedCursor("dragCopyCursor");
     SizeWE     = new Gdk.Cursor(Gdk.CursorType.SbHDoubleArrow);
     SizeNS     = new Gdk.Cursor(Gdk.CursorType.SbVDoubleArrow);
     Eyedrop    = CreateCursorFromResource("EyedropCursor", 7, 24);
 }
		public static Gdk.Cursor GetCursorFromType (Gdk.CursorType cursorType) {
			Gdk.Cursor cursor = null;

			if (CursorClass.Cursors.TryGetValue (cursorType, out cursor) == false) {
				cursor = new Gdk.Cursor (cursorType);
				CursorClass.Cursors.Add (cursorType, cursor);
			}
			return cursor;
		}
Beispiel #9
0
        public ZoomTool(IServiceManager services) : base(services)
        {
            mouseDown = 0;

            cursorZoomIn  = new Gdk.Cursor(Gdk.Display.Default, Gtk.IconTheme.Default.LoadIcon(Pinta.Resources.Icons.ViewZoomIn, 16), 0, 0);
            cursorZoomOut = new Gdk.Cursor(Gdk.Display.Default, Gtk.IconTheme.Default.LoadIcon(Pinta.Resources.Icons.ViewZoomOut, 16), 0, 0);
            cursorZoom    = new Gdk.Cursor(Gdk.Display.Default, Gtk.IconTheme.Default.LoadIcon(Pinta.Resources.Icons.ToolZoom, 16), 0, 0);
            cursorZoomPan = new Gdk.Cursor(Gdk.Display.Default, Gtk.IconTheme.Default.LoadIcon(Pinta.Resources.Icons.ToolPan, 16), 0, 0);
        }
 protected override void OnDestroyed()
 {
     if (handCursor != null)
     {
         handCursor.Dispose();
         handCursor = null;
     }
     base.OnDestroyed();
 }
Beispiel #11
0
 public static void Initialize()
 {
     Default    = Gdk.Cursor.NewFromName(Gdk.Display.Default, "default");
     SizeWE     = Gdk.Cursor.NewFromName(Gdk.Display.Default, "col-resize");
     SizeNS     = Gdk.Cursor.NewFromName(Gdk.Display.Default, "row-resize");
     DragCursor = Gdk.Cursor.NewFromName(Gdk.Display.Default, "grab");
     CopyCursor = Gdk.Cursor.NewFromName(Gdk.Display.Default, "copy");
     Eyedrop    = CreateCursorFromResource("EyedropCursor", 7, 24);
 }
Beispiel #12
0
        public ZoomTool()
        {
            this.mouseDown = 0;

            cursorZoomIn = new Gdk.Cursor (PintaCore.Chrome.DrawingArea.Display, PintaCore.Resources.GetIcon ("Menu.View.ZoomIn.png"), 0, 0);
            cursorZoomOut = new Gdk.Cursor (PintaCore.Chrome.DrawingArea.Display, PintaCore.Resources.GetIcon ("Menu.View.ZoomOut.png"), 0, 0);
            cursorZoom = new Gdk.Cursor (PintaCore.Chrome.DrawingArea.Display, PintaCore.Resources.GetIcon ("Tools.Zoom.png"), 0, 0);
            cursorZoomPan = new Gdk.Cursor (PintaCore.Chrome.DrawingArea.Display, PintaCore.Resources.GetIcon ("Tools.Pan.png"), 0, 0);
        }
Beispiel #13
0
		public ZoomTool ()
		{
			this.mouseDown = 0;

            cursorZoomIn = new Gdk.Cursor (Gdk.Display.Default, PintaCore.Resources.GetIcon ("Menu.View.ZoomIn.png"), 0, 0);
            cursorZoomOut = new Gdk.Cursor (Gdk.Display.Default, PintaCore.Resources.GetIcon ("Menu.View.ZoomOut.png"), 0, 0);
            cursorZoom = new Gdk.Cursor (Gdk.Display.Default, PintaCore.Resources.GetIcon ("Tools.Zoom.png"), 0, 0);
            cursorZoomPan = new Gdk.Cursor (Gdk.Display.Default, PintaCore.Resources.GetIcon ("Tools.Pan.png"), 0, 0);
		}
Beispiel #14
0
 void SetDefaultCursor()
 {
     if (!IsRealized)
     {
         return;
     }
     Gdk.Cursor cursor = Sensitive && Selectable ? DefaultCursor : null;
     GetWindow(Gtk.TextWindowType.Text).Cursor = cursor;
 }
Beispiel #15
0
        public ZoomTool()
        {
            this.mouseDown = 0;

            cursorZoomIn  = new Gdk.Cursor(PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon("Menu.View.ZoomIn.png"), 0, 0);
            cursorZoomOut = new Gdk.Cursor(PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon("Menu.View.ZoomOut.png"), 0, 0);
            cursorZoom    = new Gdk.Cursor(PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon("Tools.Zoom.png"), 0, 0);
            cursorZoomPan = new Gdk.Cursor(PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon("Tools.Pan.png"), 0, 0);
        }
Beispiel #16
0
 public virtual void Dispose()
 {
     if (cursor != null)
     {
         cursor.Dispose();
         cursor = null;
     }
     PurgeLayoutCache();
     PurgeGCs();
 }
Beispiel #17
0
 public static void Initialize()
 {
     Default    = Gdk.Cursor.NewFromName(Gdk.Display.Default, "default");
     DragCursor = Gdk.Cursor.NewFromName(Gdk.Display.Default, "grab");
     CopyCursor = Gdk.Cursor.NewFromName(Gdk.Display.Default, "copy");
     Move       = Gdk.Cursor.NewFromName(Gdk.Display.Default, "move");
     SizeWE     = new Gdk.Cursor(Gdk.CursorType.SbHDoubleArrow);
     SizeNS     = new Gdk.Cursor(Gdk.CursorType.SbVDoubleArrow);
     Eyedrop    = CreateCursorFromResource("EyedropCursor", 7, 24);
 }
Beispiel #18
0
        public static Gdk.Cursor GetCursorFromType(Gdk.CursorType cursorType)
        {
            Gdk.Cursor cursor = null;

            if (CursorClass.Cursors.TryGetValue(cursorType, out cursor) == false)
            {
                cursor = new Gdk.Cursor(cursorType);
                CursorClass.Cursors.Add(cursorType, cursor);
            }
            return(cursor);
        }
Beispiel #19
0
        private void HideCursor()
        {
            if (Window == null)
            {
                return;
            }

            Gdk.Cursor cursor = new Gdk.Cursor(Gdk.CursorType.BlankCursor);

            Window.Cursor = cursor;

            cursor.Dispose();
        }
Beispiel #20
0
        public static void Initialize()
        {
#if FAMISTUDIO_LINUX
            Default    = Gdk.Cursor.NewFromName(Gdk.Display.Default, "default");
            DragCursor = Gdk.Cursor.NewFromName(Gdk.Display.Default, "grab");
            CopyCursor = Gdk.Cursor.NewFromName(Gdk.Display.Default, "copy");
            Move       = Gdk.Cursor.NewFromName(Gdk.Display.Default, "move");
#else
            DragCursor = CreateMacOSNamedCursor("closedHandCursor");
            CopyCursor = CreateMacOSNamedCursor("dragCopyCursor");
#endif
            SizeWE  = new Gdk.Cursor(Gdk.CursorType.SbHDoubleArrow);
            SizeNS  = new Gdk.Cursor(Gdk.CursorType.SbVDoubleArrow);
            Eyedrop = CreateCursorFromResource("EyedropCursor", 7, 24);
        }
Beispiel #21
0
        private static unsafe Gdk.Cursor CreateMacOSNamedCursor(string name)
        {
            var nsCursor  = MacUtils.GetCursorByName(name);
            var gdkCursor = new Gdk.Cursor(Gdk.CursorType.Cross);

            // HACK : Patch the Gdk internal struct with our NSCursor.
            // struct is :
            //   - 4 byte type
            //   - 4 byte ref count
            //   - 8 bytes NSCursor pointer.
            IntPtr *p = (IntPtr *)gdkCursor.Handle.ToPointer();

            p[1] = nsCursor;

            return(gdkCursor);
        }
Beispiel #22
0
        bool HideCursor()
        {
            if (view.InPanMotion)
            {
                return(false);
            }

            if (empty_cursor == null)
            {
                empty_cursor = GdkUtils.CreateEmptyCursor(GdkWindow.Display);
            }

            this.GdkWindow.Cursor = empty_cursor;
            view.GdkWindow.Cursor = empty_cursor;
            return(false);
        }
        public TalkView() : base(new TextBuffer(null))
        {
            CursorVisible = false;
            Editable      = false;
            WrapMode      = WrapMode.WordChar;

            lastMessage = DateTime.MinValue;

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

            TextTag tag;

            tag            = new TextTag("status");
            tag.Foreground = "darkgrey";
            tag.Weight     = Pango.Weight.Bold;
            Buffer.TagTable.Add(tag);

            tag            = new TextTag("error");
            tag.Foreground = "dark red";
            Buffer.TagTable.Add(tag);

            tag               = new TextTag("time");
            tag.Foreground    = "darkgrey";
            tag.Justification = Justification.Center;
            Buffer.TagTable.Add(tag);

            linkTag            = new TextTag("link");
            linkTag.Foreground = "blue";
            linkTag.Underline  = Pango.Underline.Single;
            Buffer.TagTable.Add(linkTag);

            tag            = new TextTag("nick-self");
            tag.Foreground = "sea green";
            tag.Weight     = Pango.Weight.Bold;
            Buffer.TagTable.Add(tag);

            tag            = new TextTag("nick-other");
            tag.Foreground = "skyblue4";
            tag.Weight     = Pango.Weight.Bold;
            Buffer.TagTable.Add(tag);

            endIter = Buffer.GetIterAtOffset(0);
            endMark = Buffer.CreateMark("end", endIter, true);
        }
Beispiel #24
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 DemoHyperText () : base ("HyperText")
		{
			handCursor = new Gdk.Cursor (Gdk.CursorType.Hand2);
			regularCursor = new Gdk.Cursor (Gdk.CursorType.Xterm);

			SetDefaultSize (450, 450);

			TextView view = new TextView ();
			view.WrapMode = WrapMode.Word;
			view.KeyPressEvent += new KeyPressEventHandler (KeyPress);
			view.WidgetEventAfter += new WidgetEventAfterHandler (EventAfter);
			view.MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotify);
			view.VisibilityNotifyEvent += new VisibilityNotifyEventHandler (VisibilityNotify);

			ScrolledWindow sw = new ScrolledWindow ();
			sw.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
			Add (sw);
			sw.Add (view);

			ShowPage (view.Buffer, 1);
			ShowAll ();
		}
Beispiel #26
0
        private void HideCursor()
        {
            if (GdkWindow == null)
            {
                return;
            }

            Gdk.Pixmap pixmap = Gdk.Pixmap.CreateBitmapFromData(GdkWindow, "0x0", 1, 1);
            if (pixmap == null)
            {
                return;
            }

            UpdateHiddenCursorPosition();
            cursor_is_hidden = true;

            Gdk.Color  color  = new Gdk.Color(0, 0, 0);
            Gdk.Cursor cursor = new Gdk.Cursor(pixmap, pixmap, color, color, 0, 0);

            GdkWindow.Cursor = cursor;

            pixmap.Dispose();
            cursor.Dispose();
        }
Beispiel #27
0
        public DemoHyperText() : base("HyperText")
        {
            handCursor    = new Gdk.Cursor(Gdk.CursorType.Hand2);
            regularCursor = new Gdk.Cursor(Gdk.CursorType.Xterm);

            SetDefaultSize(450, 450);

            TextView view = new TextView();

            view.WrapMode               = WrapMode.Word;
            view.KeyPressEvent         += new KeyPressEventHandler(KeyPress);
            view.WidgetEventAfter      += new WidgetEventAfterHandler(EventAfter);
            view.MotionNotifyEvent     += new MotionNotifyEventHandler(MotionNotify);
            view.VisibilityNotifyEvent += new VisibilityNotifyEventHandler(VisibilityNotify);

            ScrolledWindow sw = new ScrolledWindow();

            sw.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
            Add(sw);
            sw.Add(view);

            ShowPage(view.Buffer, 1);
            ShowAll();
        }
Beispiel #28
0
            public Graph()
                : base()
            {
                handCursor =
                    new Gdk.Cursor (Gdk.CursorType.Hand2);
                regularCursor =
                    new Gdk.Cursor (Gdk.CursorType.Arrow);

                Events = EventMask.ButtonPressMask
                    | EventMask.ButtonReleaseMask
                    | EventMask.PointerMotionMask
                    | EventMask.ButtonMotionMask;

                backgroundColor =
                    new Cairo.Color (1, 1, 1, 1);
                coordColor =
                    new Cairo.Color (0.5, 0.1, 0.1, 1);
                ratedColor =
                    new Cairo.Color (0.9, 0.6, 0.7, 1);
                computerColor =
                    new Cairo.Color (0.7, 0.6, 0.9, 1);
                unratedColor =
                    new Cairo.Color (0.6, 0.9, 0.7, 1);
                pointBorderColor =
                    new Cairo.Color (0, 0, 0, 1);

                layout = new Pango.Layout (PangoContext);
                x_marks = new GraphMark[3];
                y_marks = new GraphMark[2];

                points = new ArrayList ();
                ConfigureEvent += OnConfigured;
                WidgetEventAfter += OnEventAfter;
                MotionNotifyEvent += OnMotionNotify;
                ExposeEvent += OnExpose;
                //CanFocus = true;
            }
Beispiel #29
0
        public void SetCursor(CursorType cursor)
        {
            AllocEventBox ();
            CurrentCursor = cursor;
            Gdk.Cursor gc;
            if (!gtkCursors.TryGetValue (cursor, out gc)) {
                Gdk.CursorType ctype;
                if (cursor == CursorType.Arrow)
                    ctype = Gdk.CursorType.LeftPtr;
                else if (cursor == CursorType.Crosshair)
                    ctype = Gdk.CursorType.Crosshair;
                else if (cursor == CursorType.Hand)
                    ctype = Gdk.CursorType.Hand1;
                else if (cursor == CursorType.IBeam)
                    ctype = Gdk.CursorType.Xterm;
                else if (cursor == CursorType.ResizeDown)
                    ctype = Gdk.CursorType.BottomSide;
                else if (cursor == CursorType.ResizeUp)
                    ctype = Gdk.CursorType.TopSide;
                else if (cursor == CursorType.ResizeLeft)
                    ctype = Gdk.CursorType.LeftSide;
                else if (cursor == CursorType.ResizeRight)
                    ctype = Gdk.CursorType.RightSide;
                else if (cursor == CursorType.ResizeLeftRight)
                    ctype = Gdk.CursorType.SbHDoubleArrow;
                else if (cursor == CursorType.ResizeUpDown)
                    ctype = Gdk.CursorType.SbVDoubleArrow;
                else if (cursor == CursorType.Move)
                    ctype = Gdk.CursorType.Fleur;
                else if (cursor == CursorType.Wait)
                    ctype = Gdk.CursorType.Watch;
                else if (cursor == CursorType.Help)
                    ctype = Gdk.CursorType.QuestionArrow;
                else
                    ctype = Gdk.CursorType.Arrow;

                gtkCursors [cursor] = gc = new Gdk.Cursor (ctype);
            }

            gdkCursor = gc;

            if (EventsRootWidget.GdkWindow == null)
                SubscribeRealizedEvent ();
            else
                EventsRootWidget.GdkWindow.Cursor = gc;
        }
Beispiel #30
0
        private bool HideCursor()
        {
            if (view.InPanMotion) {
                return false;
            }

            if (empty_cursor == null)
                empty_cursor = GdkUtils.CreateEmptyCursor (GdkWindow.Display);

            this.GdkWindow.Cursor = empty_cursor;
            view.GdkWindow.Cursor = empty_cursor;
            return false;
        }
Beispiel #31
0
        public void SetCursor(CursorType cursor)
        {
            AllocEventBox();
            CurrentCursor = cursor;
            Gdk.Cursor gc;
            if (!gtkCursors.TryGetValue(cursor, out gc))
            {
                Gdk.CursorType ctype;
                if (cursor == CursorType.Arrow)
                {
                    ctype = Gdk.CursorType.LeftPtr;
                }
                else if (cursor == CursorType.Crosshair)
                {
                    ctype = Gdk.CursorType.Crosshair;
                }
                else if (cursor == CursorType.Hand)
                {
                    ctype = Gdk.CursorType.Hand1;
                }
                else if (cursor == CursorType.IBeam)
                {
                    ctype = Gdk.CursorType.Xterm;
                }
                else if (cursor == CursorType.ResizeDown)
                {
                    ctype = Gdk.CursorType.BottomSide;
                }
                else if (cursor == CursorType.ResizeUp)
                {
                    ctype = Gdk.CursorType.TopSide;
                }
                else if (cursor == CursorType.ResizeLeft)
                {
                    ctype = Gdk.CursorType.LeftSide;
                }
                else if (cursor == CursorType.ResizeRight)
                {
                    ctype = Gdk.CursorType.RightSide;
                }
                else if (cursor == CursorType.ResizeLeftRight)
                {
                    ctype = Gdk.CursorType.SbHDoubleArrow;
                }
                else if (cursor == CursorType.ResizeUpDown)
                {
                    ctype = Gdk.CursorType.SbVDoubleArrow;
                }
                else
                {
                    ctype = Gdk.CursorType.Arrow;
                }

                gtkCursors [cursor] = gc = new Gdk.Cursor(ctype);
            }

            gdkCursor = gc;

            if (EventsRootWidget.GdkWindow == null)
            {
                SubscribeRealizedEvent();
            }
            else
            {
                EventsRootWidget.GdkWindow.Cursor = gc;
            }
        }
Beispiel #32
0
        private void HideCursor()
        {
            if (Window == null) {
                return;
            }

            Gdk.Cursor cursor = new Gdk.Cursor (Gdk.CursorType.BlankCursor);

            Window.Cursor = cursor;

            cursor.Dispose ();
        }
Beispiel #33
0
 public SelectTool()
 {
     CreateHandler ();
     cursor_hand = new Gdk.Cursor (PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon ("Tools.Pan.png"), 0, 0);
 }
Beispiel #34
0
        protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
        {
            if (!EventInGripWindow(evnt))
            {
                return(false);
            }

            bool eventHandled = false;
            bool inHandle;

            Gdk.Cursor cursor = null;

            /* Check if user clicked on the drag handle. */
            switch (Orientation)
            {
            case Orientation.Horizontal:
                inHandle = evnt.X < grip.Allocation.Width;
                break;

            case Orientation.Vertical:
                inHandle = evnt.Y < grip.Allocation.Height;
                break;

            default:
                inHandle = false;
                break;
            }

            /* Left mousebutton click on dockitem. */
            if (!Locked && evnt.Button == 1 && evnt.Type == Gdk.EventType.ButtonPress)
            {
                /* Set in_drag flag, grab pointer and call begin drag operation. */
                if (inHandle)
                {
                    startX                  = (int)evnt.X;
                    startY                  = (int)evnt.Y;
                    DockObjectFlags        |= DockObjectFlags.InPreDrag;
                    cursor                  = new Gdk.Cursor(Display, Gdk.CursorType.Fleur);
                    grip.TitleWindow.Cursor = cursor;
                    eventHandled            = true;
                }
            }
            else if (!Locked && evnt.Type == Gdk.EventType.ButtonRelease && evnt.Button == 1)
            {
                if (InDrag)
                {
                    /* User dropped widget somewhere. */
                    EndDrag(false);
                    eventHandled = true;
                }
                else if (InPreDrag)
                {
                    DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
                    eventHandled     = true;
                }

                /* we check the window since if the item was redocked it's
                 * been unrealized and maybe it's not realized again yet */
                if (grip.TitleWindow != null)
                {
                    cursor = new Gdk.Cursor(Display, Gdk.CursorType.Hand2);
                    grip.TitleWindow.Cursor = cursor;
                }
            }
            else if (evnt.Button == 3 && evnt.Type == Gdk.EventType.ButtonPress && inHandle)
            {
                DockPopupMenu(evnt.Button, evnt.Time);
                eventHandled = true;
            }

            return(eventHandled);
        }
		public virtual void Dispose ()
		{
			cursor = cursor.Kill ();
		}
Beispiel #36
0
        public void SetCursor(CursorType cursor)
        {
            AllocEventBox ();
            Gdk.Cursor gc;
            if (!gtkCursors.TryGetValue (cursor, out gc)) {
                Gdk.CursorType ctype;
                if (cursor == CursorType.Arrow)
                    ctype = Gdk.CursorType.LeftPtr;
                else if (cursor == CursorType.Crosshair)
                    ctype = Gdk.CursorType.Crosshair;
                else if (cursor == CursorType.Hand)
                    ctype = Gdk.CursorType.Hand1;
                else if (cursor == CursorType.IBeam)
                    ctype = Gdk.CursorType.Xterm;
                else if (cursor == CursorType.ResizeDown)
                    ctype = Gdk.CursorType.BottomSide;
                else if (cursor == CursorType.ResizeUp)
                    ctype = Gdk.CursorType.TopSide;
                else if (cursor == CursorType.ResizeLeft)
                    ctype = Gdk.CursorType.LeftSide;
                else if (cursor == CursorType.ResizeRight)
                    ctype = Gdk.CursorType.RightSide;
                else if (cursor == CursorType.ResizeLeftRight)
                    ctype = Gdk.CursorType.SbHDoubleArrow;
                else if (cursor == CursorType.ResizeUpDown)
                    ctype = Gdk.CursorType.SbVDoubleArrow;
                else
                    ctype = Gdk.CursorType.Arrow;

                gtkCursors [cursor] = gc = new Gdk.Cursor (ctype);
            }
            if (EventsRootWidget.GdkWindow == null) {
                EventHandler h = null;
                h = delegate {
                    EventsRootWidget.GdkWindow.Cursor = gc;
                    EventsRootWidget.Realized -= h;
                };
                EventsRootWidget.Realized += h;
            } else
                EventsRootWidget.GdkWindow.Cursor = gc;
        }
		protected override void OnDestroyed ()
		{
			if (handCursor != null) {
				handCursor.Dispose ();
				handCursor = null;
			}
			base.OnDestroyed ();
		}
Beispiel #38
0
		static MouseHandWatcher ()
		{
			normal_cursor = new Gdk.Cursor (Gdk.CursorType.Xterm);
			hand_cursor = new Gdk.Cursor (Gdk.CursorType.Hand2);
		}
		public virtual void Dispose ()
		{
			if (cursor != null) {
				cursor.Dispose ();
				cursor = null;
			}
			PurgeLayoutCache ();
			PurgeGCs ();
		}
Beispiel #40
0
 protected void SetCursor(Gdk.Cursor cursor)
 {
     PintaCore.Chrome.Canvas.GdkWindow.Cursor = cursor;
 }
Beispiel #41
0
        public Gdk.GrabStatus Grab(Gdk.Window window, Gdk.SeatCapabilities capabilities, bool owner_events, Gdk.Cursor cursor, Gdk.Event evnt, Gdk.SeatGrabPrepareFunc prepare_func)
        {
            GdkSharp.SeatGrabPrepareFuncWrapper prepare_func_wrapper = new GdkSharp.SeatGrabPrepareFuncWrapper(prepare_func);
            int raw_ret = gdk_seat_grab(Handle, window == null ? IntPtr.Zero : window.Handle, (int)capabilities, owner_events, cursor == null ? IntPtr.Zero : cursor.Handle, evnt == null ? IntPtr.Zero : evnt.Handle, prepare_func_wrapper.NativeDelegate, IntPtr.Zero);

            Gdk.GrabStatus ret = (Gdk.GrabStatus)raw_ret;
            return(ret);
        }
Beispiel #42
0
        private void OnOperationStarted()
        {
            Gdk.Cursor busy = new Gdk.Cursor (Gdk.CursorType.Watch);
            Gdk.Window w = this.GdkWindow;

            w.Cursor = busy;
        }
Beispiel #43
0
 public SelectTool()
 {
     CreateHandler();
     cursor_hand = new Gdk.Cursor(PintaCore.Chrome.Canvas.Display, PintaCore.Resources.GetIcon("Tools.Pan.png"), 0, 0);
 }
Beispiel #44
0
        public void SetCursor(CursorType cursor)
        {
            AllocEventBox ();
            CurrentCursor = cursor;
            Gdk.Cursor gc;
            if (!gtkCursors.TryGetValue (cursor, out gc)) {
                Gdk.CursorType ctype;
                if (cursor == CursorType.Arrow)
                    ctype = Gdk.CursorType.LeftPtr;
                else if (cursor == CursorType.Crosshair)
                    ctype = Gdk.CursorType.Crosshair;
                else if (cursor == CursorType.Hand)
                    ctype = Gdk.CursorType.Hand1;
                else if (cursor == CursorType.IBeam)
                    ctype = Gdk.CursorType.Xterm;
                else if (cursor == CursorType.ResizeDown)
                    ctype = Gdk.CursorType.BottomSide;
                else if (cursor == CursorType.ResizeUp)
                    ctype = Gdk.CursorType.TopSide;
                else if (cursor == CursorType.ResizeLeft)
                    ctype = Gdk.CursorType.LeftSide;
                else if (cursor == CursorType.ResizeRight)
                    ctype = Gdk.CursorType.RightSide;
                else if (cursor == CursorType.ResizeLeftRight)
                    ctype = Gdk.CursorType.SbHDoubleArrow;
                else if (cursor == CursorType.ResizeUpDown)
                    ctype = Gdk.CursorType.SbVDoubleArrow;
                else if (cursor == CursorType.Move)
                    ctype = Gdk.CursorType.Fleur;
                else if (cursor == CursorType.Wait)
                    ctype = Gdk.CursorType.Watch;
                else if (cursor == CursorType.Help)
                    ctype = Gdk.CursorType.QuestionArrow;
                else if (cursor == CursorType.Invisible)
                    ctype = (Gdk.CursorType)(-2); // Gdk.CursorType.None, since Gtk 2.16
                else
                    ctype = Gdk.CursorType.Arrow;

                gtkCursors [cursor] = gc = new Gdk.Cursor (ctype);
            }

            gdkCursor = gc;

            // subscribe mouse entered/leaved events, when widget gets/is realized
            RunWhenRealized(SubscribeCursorEnterLeaveEvent);

            if (immediateCursorChange) // if realized and mouse inside set immediatly
                EventsRootWidget.GdkWindow.Cursor = gdkCursor;
        }
Beispiel #45
0
 public virtual void Dispose()
 {
     cursor = cursor.Kill();
 }
Beispiel #46
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);
        }
Beispiel #47
0
        private Gdk.GrabStatus InternalGrab(Gdk.Window window, Gdk.SeatCapabilities capabilities, bool owner_events, Gdk.Cursor cursor, Gdk.Event evnt, Gdk.SeatGrabPrepareFunc prepare_func)
        {
            GrabNativeDelegate unmanaged = class_abi.BaseOverride <GrabNativeDelegate>(this.LookupGType(), "grab");

            if (unmanaged == null)
            {
                return((Gdk.GrabStatus) 0);
            }

            GdkSharp.SeatGrabPrepareFuncWrapper prepare_func_wrapper = new GdkSharp.SeatGrabPrepareFuncWrapper(prepare_func);
            int __result = unmanaged(this.Handle, window == null ? IntPtr.Zero : window.Handle, (int)capabilities, owner_events, cursor == null ? IntPtr.Zero : cursor.Handle, evnt == null ? IntPtr.Zero : evnt.Handle, prepare_func_wrapper.NativeDelegate, IntPtr.Zero);

            return((Gdk.GrabStatus)__result);
        }
        private void ShowHideGrip()
        {
            DetachMenu (this, null);

            if (grip != null) {
                Gdk.Cursor cursor = null;

                if (GripShown && !Locked)
                    cursor = new Gdk.Cursor (Display, Gdk.CursorType.Hand2);

                if (grip.TitleWindow != null)
                    grip.TitleWindow.Cursor = cursor;

                if (GripShown)
                    grip.Show ();
                else
                    grip.Hide ();
            }
            QueueResize ();
        }
Beispiel #49
0
 void HandleRealized(object sender, EventArgs e)
 {
     this.GdkWindow.Events |= Gdk.EventMask.PointerMotionMask
                           |  Gdk.EventMask.ButtonPressMask;
     m_resizeCursor = new Gdk.Cursor (Gdk.CursorType.BottomRightCorner);
 }
        protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
        {
            if (!EventInGripWindow (evnt))
                return false;

            bool eventHandled = false;
            bool inHandle;
            Gdk.Cursor cursor = null;

            /* Check if user clicked on the drag handle. */
            switch (Orientation) {
            case Orientation.Horizontal:
                inHandle = evnt.X < grip.Allocation.Width;
                break;
            case Orientation.Vertical:
                inHandle = evnt.Y < grip.Allocation.Height;
                break;
            default:
                inHandle = false;
                break;
            }

            /* Left mousebutton click on dockitem. */
            if (!Locked && evnt.Button == 1 && evnt.Type == Gdk.EventType.ButtonPress) {
                /* Set in_drag flag, grab pointer and call begin drag operation. */
                if (inHandle) {
                    startX = (int)evnt.X;
                    startY = (int)evnt.Y;
                    DockObjectFlags |= DockObjectFlags.InPreDrag;
                    cursor = new Gdk.Cursor (Display, Gdk.CursorType.Fleur);
                    grip.TitleWindow.Cursor = cursor;
                    eventHandled = true;
                }
            } else if (!Locked && evnt.Type == Gdk.EventType.ButtonRelease && evnt.Button == 1) {
                if (InDrag) {
                    /* User dropped widget somewhere. */
                    EndDrag (false);
                    eventHandled = true;
                } else if (InPreDrag) {
                    DockObjectFlags &= ~(DockObjectFlags.InPreDrag);
                    eventHandled = true;
                }

                /* we check the window since if the item was redocked it's
                   been unrealized and maybe it's not realized again yet */
                if (grip.TitleWindow != null) {
                    cursor = new Gdk.Cursor (Display, Gdk.CursorType.Hand2);
                    grip.TitleWindow.Cursor = cursor;
                }
            } else if (evnt.Button == 3 && evnt.Type == Gdk.EventType.ButtonPress && inHandle) {
                DockPopupMenu (evnt.Button, evnt.Time);
                eventHandled = true;
            }

            return eventHandled;
        }
Beispiel #51
0
        public void SetCursor(CursorType cursor)
        {
            AllocEventBox();
            CurrentCursor = cursor;
            Gdk.Cursor gc;
            if (!gtkCursors.TryGetValue(cursor, out gc))
            {
                Gdk.CursorType ctype;
                if (cursor == CursorType.Arrow)
                {
                    ctype = Gdk.CursorType.LeftPtr;
                }
                else if (cursor == CursorType.Crosshair)
                {
                    ctype = Gdk.CursorType.Crosshair;
                }
                else if (cursor == CursorType.Hand)
                {
                    ctype = Gdk.CursorType.Hand1;
                }
                else if (cursor == CursorType.IBeam)
                {
                    ctype = Gdk.CursorType.Xterm;
                }
                else if (cursor == CursorType.ResizeDown)
                {
                    ctype = Gdk.CursorType.BottomSide;
                }
                else if (cursor == CursorType.ResizeUp)
                {
                    ctype = Gdk.CursorType.TopSide;
                }
                else if (cursor == CursorType.ResizeLeft)
                {
                    ctype = Gdk.CursorType.LeftSide;
                }
                else if (cursor == CursorType.ResizeRight)
                {
                    ctype = Gdk.CursorType.RightSide;
                }
                else if (cursor == CursorType.ResizeLeftRight)
                {
                    ctype = Gdk.CursorType.SbHDoubleArrow;
                }
                else if (cursor == CursorType.ResizeUpDown)
                {
                    ctype = Gdk.CursorType.SbVDoubleArrow;
                }
                else if (cursor == CursorType.Move)
                {
                    ctype = Gdk.CursorType.Fleur;
                }
                else if (cursor == CursorType.Wait)
                {
                    ctype = Gdk.CursorType.Watch;
                }
                else if (cursor == CursorType.Help)
                {
                    ctype = Gdk.CursorType.QuestionArrow;
                }
                else if (cursor == CursorType.Invisible)
                {
                    ctype = (Gdk.CursorType)(-2);                     // Gdk.CursorType.None, since Gtk 2.16
                }
                else
                {
                    ctype = Gdk.CursorType.Arrow;
                }

                gtkCursors [cursor] = gc = new Gdk.Cursor(ctype);
            }

            gdkCursor = gc;

            // subscribe mouse entered/leaved events, when widget gets/is realized
            RunWhenRealized(SubscribeCursorEnterLeaveEvent);

            if (immediateCursorChange)             // if realized and mouse inside set immediatly
            {
                EventsRootWidget.GdkWindow.Cursor = gdkCursor;
            }
        }
        private void StartDrag()
        {
            if (!IsRealized)
                Realize ();

            DockObjectFlags |= DockObjectFlags.InDrag;

            /* grab the pointer so we receive all mouse events */
            Gdk.Cursor fleur = new Gdk.Cursor (Gdk.CursorType.Fleur);

            /* grab the keyboard & pointer */
            Grab.Add (this);

            OnDragBegin ();
            DockItemDragBeginHandler handler = DockItemDragBegin;
            if (handler != null)
                handler (this);
        }
Beispiel #53
0
 static MouseHandWatcher()
 {
     normal_cursor = new Gdk.Cursor(Gdk.CursorType.Xterm);
     hand_cursor   = new Gdk.Cursor(Gdk.CursorType.Hand2);
 }
Beispiel #54
0
        private void HideCursor ()
        {
            if (GdkWindow == null) {
                return;
            }

            Gdk.Pixmap pixmap = Gdk.Pixmap.CreateBitmapFromData (GdkWindow, "0x0", 1, 1);
            if (pixmap == null) {
                return;
            }

            UpdateHiddenCursorPosition ();
            cursor_is_hidden = true;

            Gdk.Color color = new Gdk.Color (0, 0, 0);
            Gdk.Cursor cursor = new Gdk.Cursor (pixmap, pixmap, color, color, 0, 0);

            GdkWindow.Cursor = cursor;

            pixmap.Dispose ();
            cursor.Dispose ();
        }