• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Gdk.EventMotion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Gdk.EventMotion的典型用法代码示例。如果您正苦于以下问题:C# EventMotion类的具体用法?C# EventMotion怎么用?C# EventMotion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EventMotion类属于Gdk命名空间,在下文中一共展示了EventMotion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnWidgetEvent

		protected override bool OnWidgetEvent (Gdk.Event evnt)
		{
			// This method is hooked to block the event as soon as possible if required
			
			if(evnt.Window.Equals (this.GdkWindow))
			{
				switch(evnt.Type)
				{
					case Gdk.EventType.ButtonPress:
					case Gdk.EventType.ButtonRelease:
					case Gdk.EventType.ThreeButtonPress:
					case Gdk.EventType.TwoButtonPress:
						Gdk.EventButton eb = new Gdk.EventButton (evnt.Handle);
						return PropagateEventGivenCoordinate (evnt, eb.X, eb.XRoot, eb.Y, eb.YRoot);
					
					case Gdk.EventType.MotionNotify:
						Gdk.EventMotion em = new Gdk.EventMotion (evnt.Handle);
						return PropagateEventGivenCoordinate (evnt, em.X, em.XRoot, em.Y, em.YRoot);
					
					case Gdk.EventType.LeaveNotify:
						foreach(Widget w in lastHoveredWidgets)
						{
							w.ProcessEvent (evnt);
						}
						lastHoveredWidgets.Clear();
						return base.OnWidgetEvent (evnt);
				}
			}
			return base.OnWidgetEvent (evnt);
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:30,代码来源:SyntheticWindow.cs


示例2: ShowTooltip

 void ShowTooltip(EventMotion evnt)
 {
     HideTooltip ();
     tooltipTimeout = GLib.Timeout.Add (500, delegate {
         ShowTooltipWindow ((int)evnt.X, (int)evnt.Y);
         return false;
     });
 }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:8,代码来源:PropertyGridTable.cs


示例3: OnMotionNotifyEvent

		protected override bool OnMotionNotifyEvent (EventMotion e)
		{
			if (!buttonPressed)
				return base.OnMotionNotifyEvent (e);
			
			int winWidth, winHeight;
			this.GdkWindow.GetSize (out winWidth, out winHeight);
			
			int row = GetRowByPosition ((int) e.Y);
			
			if ((e.State & ModifierType.ControlMask) == ModifierType.ControlMask)
				SelectRow (row);
			else
				this.SelectedRow = row;
			
			return true;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:17,代码来源:ListView.cs


示例4: OnMotionNotifyEvent

			protected override bool OnMotionNotifyEvent (EventMotion evnt)
			{
				TooltipText = null;
				if (dragPosition >= 0) {
					int x, y;
					widget.GetPointer (out x, out y);
					int newWidthRequest = widget.Allocation.Width - x;
					newWidthRequest = Math.Min (widget.Allocation.Width - (int)widget.Editor.TextViewMargin.XOffset, Math.Max (leftSpacer, newWidthRequest));
					
					WidthRequest = newWidthRequest;
					QueueResize ();
				}
				int startLine = widget.Editor.YToLine (widget.Editor.VAdjustment.Value + evnt.Y);
				var ann = startLine > 0 && startLine <= annotations.Count ? annotations[startLine - 1] : null;
				if (ann != null)
					TooltipText = GetCommitMessage (startLine);
				
				highlightPositon = evnt.Y;
				if (highlightAnnotation != ann) {
					highlightAnnotation = ann;
					widget.QueueDraw ();
				}
				
				return base.OnMotionNotifyEvent (evnt);
			}
开发者ID:trustme,项目名称:monodevelop,代码行数:25,代码来源:BlameWidget.cs


示例5: OnMotionNotifyEvent

		protected override bool OnMotionNotifyEvent (EventMotion evnt)
		{
			var item = GetItemAt (evnt.X, evnt.Y);
			if (item != hoverItem) {
				hoverItem = item;
				QueueDraw ();
			}
			return base.OnMotionNotifyEvent (evnt);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:DocumentSwitcher.cs


示例6: OnMotionNotifyEvent

		protected override bool OnMotionNotifyEvent (EventMotion evnt)
		{
			SetHover (GetItemAt ((int)evnt.X, (int)evnt.Y));
			return true;
		}
开发者ID:msiyer,项目名称:Pinta,代码行数:5,代码来源:PathBar.cs


示例7: OnMotionNotifyEvent

        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            bool handled = false;

            handled = handled || OnPanMotionNotifyEvent (evnt);

            if (can_select)
                handled = handled || OnSelectionMotionNotifyEvent (evnt);

            return handled || base.OnMotionNotifyEvent (evnt);
        }
开发者ID:hbons,项目名称:f-spot,代码行数:11,代码来源:ImageView.cs


示例8: OnMotionNotifyEvent

        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            var position = new Point(evnt.X, evnt.Y);

            GtkMouseDevice.Instance.SetClientPosition(position);

            var e = new RawMouseEventArgs(
                GtkMouseDevice.Instance,
                evnt.Time,
                _inputRoot,
                RawMouseEventType.Move,
                position, GetModifierKeys(evnt.State));
            Input(e);
            return true;
        }
开发者ID:JackWangCUMT,项目名称:Perspex,代码行数:15,代码来源:WindowImpl.cs


示例9: OnMotionNotifyEvent

			protected override bool OnMotionNotifyEvent (EventMotion evnt)
			{
				if (button != 0)
					MouseMove (evnt.Y);
				return base.OnMotionNotifyEvent (evnt);
			}
开发者ID:acken,项目名称:monodevelop,代码行数:6,代码来源:ComparisonWidget.cs


示例10: OnMotionNotifyEvent

 /// <summary>
 /// Called on mouse move events.
 /// </summary>
 /// <param name="e">An instance that contains the event data.</param>
 /// <returns><c>true</c> if the event was handled.</returns>
 protected override bool OnMotionNotifyEvent(EventMotion e)
 {
     return this.ActualController.HandleMouseMove(this, e.ToMouseEventArgs());
 }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:9,代码来源:PlotView.cs


示例11: OnMotionNotifyEvent

			protected override bool OnMotionNotifyEvent (EventMotion evnt)
			{
				bool hideButton = widget.MainEditor.Document.ReadOnly;
				Mono.TextEditor.Utils.Hunk selectedHunk = Mono.TextEditor.Utils.Hunk.Empty;
				if (!hideButton) {
					int delta = widget.MainEditor.Allocation.Y - Allocation.Y;
					if (Diff != null) {
						foreach (var hunk in Diff) {
							double z1 = delta + fromEditor.LineToY (hunk.RemoveStart) - fromEditor.VAdjustment.Value;
							double z2 = delta + fromEditor.LineToY (hunk.RemoveStart + hunk.Removed) - fromEditor.VAdjustment.Value;
							if (z1 == z2)
								z2 = z1 + 1;
	
							double y1 = delta + toEditor.LineToY (hunk.InsertStart) - toEditor.VAdjustment.Value;
							double y2 = delta + toEditor.LineToY (hunk.InsertStart + hunk.Inserted) - toEditor.VAdjustment.Value;
	
							if (y1 == y2)
								y2 = y1 + 1;
							double x, y, w, h;
							GetButtonPosition (hunk, y1, y2, z1, z2, out x, out y, out w, out h);
	
							if (evnt.X >= x && evnt.X < x + w && evnt.Y >= y && evnt.Y < y + h) {
								selectedHunk = hunk;
								TooltipText = GettextCatalog.GetString ("Revert this change");
								QueueDrawArea ((int)x, (int)y, (int)w, (int)h);
								break;
							}
						}
					}
				} else {
					selectedHunk = Mono.TextEditor.Utils.Hunk.Empty;
				}

				if (selectedHunk.IsEmpty)
					TooltipText = null;

				if (this.selectedHunk != selectedHunk) {
					this.selectedHunk = selectedHunk;
					QueueDraw ();
				}
				return base.OnMotionNotifyEvent (evnt);
			}
开发者ID:Shanto,项目名称:monodevelop,代码行数:42,代码来源:EditorCompareWidgetBase.cs


示例12: OnMotionNotifyEvent

		protected override bool OnMotionNotifyEvent (EventMotion evnt)
		{
			if (!item.Disabled && !Selected) {
				Selected = true;
				if (SelectedChanged != null)
					SelectedChanged (this, EventArgs.Empty);
				QueueDraw ();
			}
			return false;
		}
开发者ID:Aurora-and-Equinox,项目名称:docky,代码行数:10,代码来源:MenuItemWidget.cs


示例13: OnMotionNotifyEvent

        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            // First check if we need to draw a box for multiple selection via dragging
            if (_dragStartTime != 0 && evnt.Time - _dragStartTime > 500)
            {
                Console.WriteLine("Motion {0}", _dragStartTime);
                TreePath endPath;
                GetPathAtPos((int)evnt.X, (int)evnt.Y, out endPath);
                if (!GetPathAtPos((int)evnt.X, (int)evnt.Y, out endPath))
                {
                    GetPathAtPos(1, 1, out endPath);
                }
                if (_dragStartPath.Compare(endPath) < 0)
                {
                    Selection.UnselectAll();
                    Selection.SelectRange(_dragStartPath, endPath);
                }
                else
                {
                    Selection.UnselectAll();
                    Selection.SelectRange(endPath, _dragStartPath);
                }
            }

            // Now start logic for tooltips
            if (!evnt.Window.Equals(BinWindow))
                goto hide;

            if (DateTime.Now.Subtract(TimeSpan.FromMilliseconds(500)) < _scrollStarted)
                goto hide;

            TreePath path;
            TreeViewColumn column;
            int cellX, cellY;
            if (!GetPathAtPos((int) evnt.X, (int) evnt.Y, out path, out column, out cellX, out cellY))
                goto hide;

            var cellRenderers = column.CellRenderers.Where(c =>
            {
                int startPos, width;
                column.CellGetPosition(c, out startPos, out width);
                return startPos < cellX && cellX < startPos + width;
            });

            var cellRendererText = (CellRendererText)cellRenderers.FirstOrDefault();

            TreeIter iter;
            Model.GetIter(out iter, path);
            column.CellSetCellData(Model, iter, false, false);

            if (cellRendererText != null)
            {
                Label label = Tooltip.Label;
                label.Text = cellRendererText.Text;
                label.SetPadding((int)cellRendererText.Xpad, (int)cellRendererText.Ypad);
                label.SizeRequest();
                label.Show();

                int listOriginX, listOriginY, labelWidth, labelHeight, labelLayoutOffsetX, labelLayoutOffsetY;
                BinWindow.GetOrigin(out listOriginX, out listOriginY);
                Rectangle cellRectangle = GetCellArea(path, column);
                var x = listOriginX + cellRectangle.X;
                var y = listOriginY + cellRectangle.Y;

                label.Layout.GetPixelSize(out labelWidth, out labelHeight);
                label.GetLayoutOffsets(out labelLayoutOffsetX, out labelLayoutOffsetY);
                labelWidth += labelLayoutOffsetX;
                labelWidth += (int)cellRendererText.Xpad;

                var height = cellRectangle.Height;
                Tooltip.Move(x, y);
                Tooltip.SetSizeRequest(labelWidth, height);
                Tooltip.Resize(labelWidth, height);

                if (labelWidth < cellRectangle.Width)
                    goto hide;
                Tooltip.Show();
                goto returnBase;
            }

            hide:
            Tooltip.Hide();

            returnBase:
            return base.OnMotionNotifyEvent(evnt);
        }
开发者ID:gclark916,项目名称:Howler,代码行数:86,代码来源:TrackListView.cs


示例14: OnMotionNotifyEvent

 protected override bool OnMotionNotifyEvent(EventMotion ev)
 {
     Gdk.ModifierType state = (Gdk.ModifierType)ev.State;
     if ((state & Gdk.ModifierType.Button1Mask) != 0) {
         if ((state & Gdk.ModifierType.ShiftMask) != 0) {
             X = dragStartX + (int)((dragStartMouseX - ev.X) / Scale);
             Y = dragStartY + (int)((dragStartMouseY - ev.Y) / Scale);
         } else {
             if (PixelQueried != null) {
                 int pixelX, pixelY;
                 MouseToImageCoords (ev.X, ev.Y, out pixelX, out pixelY);
                 PixelQueried (this, pixelX, pixelY);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:schani,项目名称:bwprocessor,代码行数:18,代码来源:GeglView.cs


示例15: OnMotionNotifyEvent

		protected override bool OnMotionNotifyEvent (EventMotion evnt)
		{
			if (draggingTab && mouseHasLeft) {
				var sr = GetScreenRect ();
				sr.Height = BarHeight;
				sr.Inflate (30, 30);

				int x, y;
				Gdk.Display.Default.GetPointer (out x, out y);

				if (x < sr.Left || x > sr.Right || y < sr.Top || y > sr.Bottom) {
					draggingTab = false;
					mouseHasLeft = false;
					CreatePlaceholderWindow ();
				}
			}

			string newTooltip = null;
			if (placeholderWindow != null) {
				int x, y;
				Gdk.Display.Default.GetPointer (out x, out y);
				placeholderWindow.MovePosition (x, y);
				return base.OnMotionNotifyEvent (evnt);
			}

			if (!draggingTab) {
				var t = FindTab ((int)evnt.X, (int)evnt.Y);

				// If the user clicks and drags on the 'x' which closes the current
				// tab we can end up with a null tab here
				if (t == null) {
					TooltipText = null;
					return base.OnMotionNotifyEvent (evnt);
				}
				SetHighlightedTab (t);

				var newOver = IsOverCloseButton (t, (int)evnt.X, (int)evnt.Y);
				if (newOver != overCloseButton) {
					overCloseButton = newOver;
					QueueDraw ();
				}
				if (!overCloseButton && !draggingTab && buttonPressedOnTab) {
					draggingTab = true;
					mouseHasLeft = false;
					dragXProgress = 1.0f;
					int x = (int)evnt.X;
					dragOffset = x - t.Allocation.X;
					dragX = x - dragOffset;
					lastDragX = (int)evnt.X;
				} else if (t != null)
					newTooltip = t.Tooltip;
			} else if (evnt.State.HasFlag (ModifierType.Button1Mask)) {
				dragX = (int)evnt.X - dragOffset;
				QueueDraw ();

				var t = FindTab ((int)evnt.X, TopPadding + 3);
				if (t == null) {
					var last = (DockNotebookTab)notebook.Tabs.Last ();
					if (dragX > last.Allocation.Right)
						t = last;
					if (dragX < 0)
						t = (DockNotebookTab)notebook.Tabs.First ();
				}
				if (t != null && t != notebook.CurrentTab && (
				        ((int)evnt.X > lastDragX && t.Index > notebook.CurrentTab.Index) ||
				        ((int)evnt.X < lastDragX && t.Index < notebook.CurrentTab.Index))) {
					t.SaveAllocation ();
					t.SaveStrength = 1;
					notebook.ReorderTab ((DockNotebookTab)notebook.CurrentTab, t);

					t.Animate ("TabMotion",
						f => t.SaveStrength = f,
						1.0f,
						0.0f,
						easing: Easing.CubicInOut);
				}
				lastDragX = (int)evnt.X;
			}

			if (newTooltip != null && TooltipText != null && TooltipText != newTooltip)
				TooltipText = null;
			else
				TooltipText = newTooltip;

			return base.OnMotionNotifyEvent (evnt);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:86,代码来源:TabStrip.cs


示例16: OnMotionNotifyEvent

        protected override bool OnMotionNotifyEvent(EventMotion e)
        {
            if (draggingCursor) {
                double x, y;
                GetValue ((int)e.X, (int)e.Y, out x, out y);

                if (activeCursor.Dimension == AxisDimension.X) {
                    if (x < startX) x = startX;
                    else if (x > endX) x = endX;
                    activeCursor.Value = x;
                }
                else {
                    if (y < startY) y = startY;
                    else if (y > endY) y = endY;
                    activeCursor.Value = y;
                }
                return true;
            }
            return base.OnMotionNotifyEvent (e);
        }
开发者ID:Kalnor,项目名称:monodevelop,代码行数:20,代码来源:BasicChart.cs


示例17: OnMotionNotifyEvent

		protected override bool OnMotionNotifyEvent (EventMotion evnt)
		{
			string newTooltip = null;

			if (!draggingTab) {
				var t = FindTab ((int)evnt.X, (int)evnt.Y);

				// If the user clicks and drags on the 'x' which closes the current
				// tab we can end up with a null tab here
				if (t == null)
					return base.OnMotionNotifyEvent (evnt);
				SetHighlightedTab (t);

				var newOver = IsOverCloseButton (t, (int)evnt.X, (int)evnt.Y);
				if (newOver != overCloseButton) {
					overCloseButton = newOver;
					QueueDraw ();
				}
				if (!overCloseButton && !draggingTab && buttonPressedOnTab) {
					draggingTab = true;
					dragXProgress = 1.0f;
					int x = (int)evnt.X;
					dragOffset = x - t.Allocation.X;
					dragX = x - dragOffset;
					lastDragX = (int)evnt.X;
				} else if (t != null)
					newTooltip = t.Tooltip;
			} else if (evnt.State.HasFlag (ModifierType.Button1Mask)) {
				dragX = (int)evnt.X - dragOffset;
				QueueDraw ();

				var t = FindTab ((int)evnt.X, TopPadding + 3);
				if (t == null) {
					var last = (DockNotebookTab)notebook.Tabs.Last ();
					if (dragX > last.Allocation.Right)
						t = last;
					if (dragX < 0)
						t = (DockNotebookTab)notebook.Tabs.First ();
				}
				if (t != null && t != notebook.CurrentTab && (
					((int)evnt.X > lastDragX && t.Index > notebook.CurrentTab.Index) ||
					((int)evnt.X < lastDragX && t.Index < notebook.CurrentTab.Index)))
				{
					t.SaveAllocation ();
					t.SaveStrength = 1;
					notebook.ReorderTab ((DockNotebookTab)notebook.CurrentTab, t);

					t.Animate ("TabMotion",
					           f => t.SaveStrength = f,
					           1.0f,
					           0.0f,
					           easing: Easing.CubicInOut);
				}
				lastDragX = (int)evnt.X;
			}

			if (newTooltip != null && TooltipText != null && TooltipText != newTooltip)
				TooltipText = null;
			else
				TooltipText = newTooltip;

			return base.OnMotionNotifyEvent (evnt);
		}
开发者ID:alexrp,项目名称:monodevelop,代码行数:63,代码来源:DockNotebook.cs


示例18: OnMotionNotifyEvent

 protected override bool OnMotionNotifyEvent(EventMotion evnt)
 {
     in_thumbnail_region = evnt.X <= Allocation.Height;
     return ShowHideCoverArt ();
 }
开发者ID:ptrimble,项目名称:banshee,代码行数:5,代码来源:ClassicTrackInfoDisplay.cs


示例19: OnMotionNotifyEvent

        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            if (placeholderVisible)
            {
                int sx,sy;
                this.Window.GetOrigin (out sx, out sy);
                int rx = (int)evnt.XRoot - sx;
                int ry = (int)evnt.YRoot - sy;

                int xDragDif=0;
                int yDragDif=0;

                ShowPlaceholder(false,rx,ry,xDragDif, yDragDif);
                setPlaceholderWindowsize(rx,ry);
            }
            return base.OnMotionNotifyEvent (evnt);
        }
开发者ID:sharpend,项目名称:Sharpend,代码行数:17,代码来源:DockFrame.cs


示例20: OnSelectionMotionNotifyEvent

        bool OnSelectionMotionNotifyEvent(EventMotion evnt)
        {
            int x, y;
            ModifierType mod;

            if (evnt.IsHint)
                GdkWindow.GetPointer (out x, out y, out mod);
            else {
                x = (int)evnt.X;
                y = (int)evnt.Y;
            }

            Point img = WindowCoordsToImage (new Point (x, y));
            if (is_dragging_selection) {
                Point win_anchor = ImageCoordsToWindow (selection_anchor);
                if (Selection == Rectangle.Zero &&
                    Math.Abs (evnt.X - win_anchor.X) < SELECTION_THRESHOLD &&
                    Math.Abs (evnt.Y - win_anchor.Y) < SELECTION_THRESHOLD) {
                    SelectionSetPointer (x, y);
                    return true;
                }

                if (selection_xy_ratio == 0)
                    Selection = new Rectangle (fixed_width ? Selection.X : Math.Min (selection_anchor.X, img.X),
                                   fixed_height ? Selection.Y : Math.Min (selection_anchor.Y, img.Y),
                                   fixed_width ? Selection.Width : Math.Abs (selection_anchor.X - img.X),
                                   fixed_height ? Selection.Height : Math.Abs (selection_anchor.Y - img.Y));

                else
                    Selection = ConstrainSelection (new Rectangle (Math.Min (selection_anchor.X, img.X),
                                               Math.Min (selection_anchor.Y, img.Y),
                                               Math.Abs (selection_anchor.X - img.X),
                                               Math.Abs (selection_anchor.Y - img.Y)),
                                    fixed_width, fixed_height);

                SelectionSetPointer (x, y);
                return true;
            }

            if (is_moving_selection) {
                Selection = new Rectangle (Clamp (Selection.X + img.X - selection_anchor.X, 0, Pixbuf.Width - Selection.Width),
                               Clamp (Selection.Y + img.Y - selection_anchor.Y, 0, Pixbuf.Height - Selection.Height),
                               Selection.Width, Selection.Height);
                selection_anchor = img;
                SelectionSetPointer (x, y);
                return true;
            }

            SelectionSetPointer (x, y);
            return true;
        }
开发者ID:hbons,项目名称:f-spot,代码行数:51,代码来源:ImageView.cs



注:本文中的Gdk.EventMotion类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Gdk.GC类代码示例发布时间:2022-05-26
下一篇:
C# Gdk.EventExpose类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap