void ButtonPressEventHandler(object o, ButtonPressEventArgs a) { if (a.Event.Type != Gdk.EventType.ButtonPress) { return; } if (a.Event.Button == 1) { is_dragging = true; } HasFocus = true; Gdk.EventButton pos = a.Event; int new_selected = HitTest(pos.Y); int double_click_time = Settings.DoubleClickTime; if ((new_selected == Selected) && (a.Event.Time - last_click_time <= double_click_time)) { Selected = new_selected; Grab.Remove(this); if (ItemActivated != null) { ItemActivated(Selected); } } else { Selected = new_selected; } last_click_time = a.Event.Time; a.RetVal = true; }
public static void GrabWindow(Window window) { window.GrabFocus(); Grab.Add(window); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(window.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(window.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(window); window.Destroy(); } } else { Grab.Remove(window); window.Destroy(); } }
void ClearGrab() { if (IsInGrab()) { Grab.Remove(this); grabY = -1; } }
protected override bool OnButtonReleaseEvent(EventButton evnt) { Grab.Remove(this); //FIXME: remove inactive points CursorType = CursorType.Fleur; grab_point = null; return(true); }
public void LeaveDragMode(uint time) { if (DragInProgress) { Pointer.Ungrab(time); Grab.Remove(this); } MotionNotifyEvent -= new MotionNotifyEventHandler(OnMotionNotify); DragInProgress = false; }
private void ShowPopup() { win = new Gtk.Window(Gtk.WindowType.Popup); win.Screen = this.Screen; win.WidthRequest = this.Allocation.Width; cal = new Gtk.Calendar(); win.Add(cal); if (validDate) { cal.Date = date; } // events win.ButtonPressEvent += OnWinButtonPressEvent; cal.DaySelectedDoubleClick += OnCalDaySelectedDoubleClick; cal.KeyPressEvent += OnCalKeyPressEvent; cal.ButtonPressEvent += OnCalButtonPressEvent; int x, y; GetWidgetPos(this, out x, out y); win.Move(x, y + Allocation.Height + 2); win.ShowAll(); win.GrabFocus(); Grab.Add(win); Gdk.GrabStatus grabStatus; grabStatus = Gdk.Pointer.Grab(win.GdkWindow, true, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, null, Gtk.Global.CurrentEventTime); if (grabStatus == Gdk.GrabStatus.Success) { grabStatus = Gdk.Keyboard.Grab(win.GdkWindow, true, Gtk.Global.CurrentEventTime); if (grabStatus != Gdk.GrabStatus.Success) { Grab.Remove(win); win.Destroy(); win = null; } } else { Grab.Remove(win); win.Destroy(); win = null; } }
private void EndDrag(bool cancel) { /* Release pointer & keyboard. */ Grab.Remove(Grab.Current); OnDragEnd(cancel); DockItemDragEndHandler handler = DockItemDragEnd; if (handler != null) { handler(this, cancel); } DockObjectFlags &= ~(DockObjectFlags.InDrag); }
public void HideCalendar(bool update) { if (popup != null) { Grab.Remove(popup); Gdk.Pointer.Ungrab(CURRENT_TIME); Gdk.Keyboard.Ungrab(CURRENT_TIME); popup.Destroy(); popup = null; } if (update) { date = cal.GetDate(); Label = date.ToString(displayFormat); } Active = false; }
public void HideCalendar(bool update) { if (popup != null) { Grab.Remove(popup); Gdk.Pointer.Ungrab(CURRENT_TIME); Gdk.Keyboard.Ungrab(CURRENT_TIME); popup.Destroy(); popup = null; } if (update) { date = cal.GetDate(); if (Edited != null) { Edited(this, path); } } }
public void HideCalendar(bool update) { if (popup != null) { Grab.Remove(popup); Gdk.Pointer.Ungrab(CURRENT_TIME); Gdk.Keyboard.Ungrab(CURRENT_TIME); popup.Destroy(); popup = null; } if (update) { date = cal.GetDate(); // FIXME: If this is ever moved to its own library // this reference to Tomboy will obviously have to // be removed. Label = Tomboy.GuiUtils.GetPrettyPrintDate(date, show_time); } Active = false; }
private void ClosePopup(bool setDate) { if (win != null) { if (setDate) { //date = cal.Date; SetDate(cal.Date); //validDate = true; } Grab.Remove(win); Gdk.Pointer.Ungrab(Gtk.Global.CurrentEventTime); Gdk.Keyboard.Ungrab(Gtk.Global.CurrentEventTime); win.Destroy(); win = null; } if (btn != null) { btn.Active = false; } }
public void ShowCalendar() { popup = new Window(WindowType.Popup); popup.Screen = parent.Screen; Frame frame = new Frame(); frame.Shadow = ShadowType.Out; frame.Show(); popup.Add(frame); VBox box = new VBox(false, 0); box.Show(); frame.Add(box); cal = new Calendar(); cal.DisplayOptions = CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers; cal.KeyPressEvent += OnCalendarKeyPressed; popup.ButtonPressEvent += OnButtonPressed; cal.Show(); Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); calAlignment.Show(); calAlignment.SetPadding(4, 4, 4, 4); calAlignment.Add(cal); box.PackStart(calAlignment, false, false, 0); //Requisition req = SizeRequest(); parent.GdkWindow.GetOrigin(out xPos, out yPos); // popup.Move(x + Allocation.X, y + Allocation.Y + req.Height + 3); popup.Move(xPos, yPos); popup.Show(); popup.GrabFocus(); Grab.Add(popup); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(popup.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(popup); popup.Destroy(); popup = null; } } else { Grab.Remove(popup); popup.Destroy(); popup = null; } cal.DaySelected += OnCalendarDaySelected; cal.MonthChanged += OnCalendarMonthChanged; cal.Date = date; }
private void ShowCalendar() { popup = new Window(WindowType.Popup); popup.Screen = tree.Screen; Frame frame = new Frame(); frame.Shadow = ShadowType.Out; frame.Show(); popup.Add(frame); VBox box = new VBox(false, 0); box.Show(); frame.Add(box); cal = new Calendar(); cal.DisplayOptions = CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers; cal.KeyPressEvent += OnCalendarKeyPressed; popup.ButtonPressEvent += OnButtonPressed; cal.Show(); Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); calAlignment.Show(); calAlignment.SetPadding(4, 4, 4, 4); calAlignment.Add(cal); box.PackStart(calAlignment, false, false, 0); // FIXME: Make the popup appear directly below the date Gdk.Rectangle allocation = tree.Allocation; // Gtk.Requisition req = tree.SizeRequest (); int x = 0, y = 0; tree.GdkWindow.GetOrigin(out x, out y); // popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3); popup.Move(x + allocation.X, y + allocation.Y); popup.Show(); popup.GrabFocus(); Grab.Add(popup); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(popup.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(popup); popup.Destroy(); popup = null; } } else { Grab.Remove(popup); popup.Destroy(); popup = null; } cal.DaySelectedDoubleClick += OnCalendarDaySelected; cal.ButtonPressEvent += OnCalendarButtonPressed; cal.Date = date == DateTime.MinValue ? DateTime.Now : date; }
void HidePopup() { calendar_popup.Hide(); Grab.Remove(calendar_popup); }
protected override void OnUnmapped() { Grab.Remove(this); Gdk.Pointer.Ungrab(Global.CurrentEventTime); base.OnUnmapped(); }
public static void RemoveGrab(Window window) { Grab.Remove(window); Gdk.Pointer.Ungrab(CURRENT_TIME); Gdk.Keyboard.Ungrab(CURRENT_TIME); }
private void ShowCalendar() { popup = new Window(WindowType.Popup); popup.Screen = this.Screen; Frame frame = new Frame(); frame.ShadowType = ShadowType.Out; frame.Show(); popup.Add(frame); VBox box = new VBox(false, 0); box.Show(); frame.Add(box); cal = new Calendar(); cal.DisplayOptions = CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers; cal.KeyPressEvent += OnCalendarKeyPressed; popup.ButtonPressEvent += OnButtonPressed; cal.Show(); Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); calAlignment.Show(); calAlignment.SetPadding(4, 4, 4, 4); calAlignment.Add(cal); box.PackStart(calAlignment, false, false, 0); int minimum_height, natural_height; GetPreferredHeight(out minimum_height, out natural_height); int x = 0, y = 0; Window.GetOrigin(out x, out y); popup.Move(x + Allocation.X, y + Allocation.Y + natural_height + 3); popup.Show(); popup.GrabFocus(); Grab.Add(popup); Gdk.Device event_device = Gtk.Global.CurrentEventDevice; if (event_device.Source == Gdk.InputSource.Mouse) { pointer = event_device; keyboard = event_device.AssociatedDevice; } else { keyboard = event_device; pointer = event_device.AssociatedDevice; } Gdk.GrabStatus grabbed = pointer.Grab(popup.Window, Gdk.GrabOwnership.Application, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = keyboard.Grab(popup.Window, Gdk.GrabOwnership.Application, true, Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask, null, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(popup); popup.Destroy(); popup = null; } } else { Grab.Remove(popup); popup.Destroy(); popup = null; } cal.DaySelectedDoubleClick += OnCalendarDaySelected; cal.ButtonPressEvent += OnCalendarButtonPressed; cal.Date = date; }