示例#1
0
		protected override bool OnButtonPressEvent (EventButton evnt)
		{
			if (evnt.Button != 1 || evnt.IsContextMenuButton ())
				return base.OnButtonPressEvent (evnt);

			if (IsOverIndicator (evnt.Y)) {
				parentStrip.GotoTask (parentStrip.SearchNextTask (GetHoverMode ()));
				return base.OnButtonPressEvent (evnt);
			}

			var hoverTask = GetHoverTask (evnt.Y);
			if (hoverTask != null)
				MoveToTask (hoverTask);

			if (IsInsideBar (evnt.X, evnt.Y)) {
				Grab.Add (this);
				grabCenter = GetSliderCenter ();
				grabY = evnt.Y;
			} else {
				MovePosition (evnt.Y);
			}

			return base.OnButtonPressEvent (evnt);
		}
		protected override bool OnButtonPressEvent (EventButton evnt)
		{
			var t = FindTab ((int)evnt.X, (int)evnt.Y);
			if (t != null) {
				if (evnt.IsContextMenuButton ()) {
					DockNotebook.ActiveNotebook = notebook;
					notebook.CurrentTab = t;
					notebook.DoPopupMenu (notebook, t.Index, evnt);
					return true;
				}
				// Don't select the tab if we are clicking the close button
				if (IsOverCloseButton (t, (int)evnt.X, (int)evnt.Y)) {
					overCloseOnPress = true;
					return true;
				}
				overCloseOnPress = false;

				if (evnt.Type == EventType.TwoButtonPress) {
					if (allowDoubleClick) {
						notebook.OnActivateTab (t);
						buttonPressedOnTab = false;
					}
					return true;
				}
				if (evnt.Button == 2) {
					notebook.OnCloseTab (t);
					return true;
				}

				DockNotebook.ActiveNotebook = notebook;
				buttonPressedOnTab = true;
				notebook.CurrentTab = t;
				return true;
			}
			buttonPressedOnTab = true;
			QueueDraw ();
			return base.OnButtonPressEvent (evnt);
		}