コード例 #1
0
ファイル: Gdk_Seat.cs プロジェクト: Kurasuke/gst-plugin-sub
        private void InternalDeviceAdded(Gdk.Device device)
        {
            DeviceAddedNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("device_added"));
                unmanaged = (DeviceAddedNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(DeviceAddedNativeDelegate));
            }
            if (unmanaged == null)
            {
                return;
            }

            unmanaged(this.Handle, device == null ? IntPtr.Zero : device.Handle);
        }
コード例 #2
0
 public PadController(Gtk.Window window, GLib.IActionGroup group, Gdk.Device pad) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(PadController))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         if (window != null)
         {
             names.Add("pad");
             vals.Add(new GLib.Value(pad));
         }
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_pad_controller_new(window == null ? IntPtr.Zero : window.Handle, group == null ? IntPtr.Zero : ((group is GLib.Object) ? (group as GLib.Object).Handle : (group as GLib.ActionGroupAdapter).Handle), pad == null ? IntPtr.Zero : pad.Handle);
 }
コード例 #3
0
 public void PopupForDevice(Gdk.Device device, Gtk.Widget parent_menu_shell, Gtk.Widget parent_menu_item, Gtk.MenuPositionFunc func, GLib.DestroyNotify destroy, uint button, uint activate_time)
 {
     GtkSharp.MenuPositionFuncWrapper func_wrapper = new GtkSharp.MenuPositionFuncWrapper(func);
     func_wrapper.PersistUntilCalled();
     gtk_menu_popup_for_device(Handle, device == null ? IntPtr.Zero : device.Handle, parent_menu_shell == null ? IntPtr.Zero : parent_menu_shell.Handle, parent_menu_item == null ? IntPtr.Zero : parent_menu_item.Handle, func_wrapper.NativeDelegate, IntPtr.Zero, destroy, button, activate_time);
 }
コード例 #4
0
 public static void GrabRemove(Gtk.Widget widget, Gdk.Device device)
 {
     gtk_device_grab_remove(widget == null ? IntPtr.Zero : widget.Handle, device == null ? IntPtr.Zero : device.Handle);
 }
コード例 #5
0
 public static void GrabAdd(Gtk.Widget widget, Gdk.Device device, bool block_others)
 {
     gtk_device_grab_add(widget == null ? IntPtr.Zero : widget.Handle, device == null ? IntPtr.Zero : device.Handle, block_others);
 }
コード例 #6
0
 public static void SetSourceDevice(Gdk.Event evnt, Gdk.Device device)
 {
     gdk_event_set_source_device(evnt == null ? IntPtr.Zero : evnt.Handle, device == null ? IntPtr.Zero : device.Handle);
 }
コード例 #7
0
ファイル: Gtk_ComboBox.cs プロジェクト: thiblahute/gtk-sharp
 public void PopupForDevice(Gdk.Device device)
 {
     gtk_combo_box_popup_for_device(Handle, device == null ? IntPtr.Zero : device.Handle);
 }
コード例 #8
0
 protected virtual void OnDeviceChanged(Gdk.Device device)
 {
     InternalDeviceChanged(device);
 }
コード例 #9
0
 protected virtual void OnDeviceRemoved(Gdk.Device device)
 {
     InternalDeviceRemoved(device);
 }
コード例 #10
0
        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;
        }