public static int Main(string [] args)
        {
            Application.Init();
            Gtk.Window win = new Gtk.Window("testing");

            VBox          vbox = new VBox(false, 10);
            GroupSelector gs   = new GroupSelector();

            gs.Counts = new int [] { 20, 100, 123, 10, 5, 2, 3, 50, 8, 10, 22, 0, 55, 129, 120, 30, 14, 200, 21, 55 };
            gs.Mode   = RangeType.Fixed;
            vbox.PackStart(gs);

            gs        = new GroupSelector();
            gs.Counts = new int [] { 20, 100, 123, 10, 5, 2, 3, 50, 8, 10, 22, 0, 55, 129, 120, 30, 14, 200, 21, 55 };
            gs.Mode   = RangeType.Fixed;
            vbox.PackStart(gs);

            win.Add(vbox);
            win.ShowAll();
            win.AddEvents((int)EventMask.KeyPressMask);
            win.KeyPressEvent += gs.HandleKeyPressEvent;

            Application.Run();
            return(0);
        }
示例#2
0
        public static int Main(string [] args)
        {
            Application.Init ();
            Gtk.Window win = new Gtk.Window ("testing");

            VBox vbox = new VBox (false, 10);
            GroupSelector gs = new GroupSelector ();
            gs.Counts = new int [] {20, 100, 123, 10, 5, 2, 3, 50, 8, 10, 22, 0, 55, 129, 120, 30, 14, 200, 21, 55};
            gs.Mode = RangeType.Fixed;
            vbox.PackStart (gs);

            gs = new GroupSelector ();
            gs.Counts = new int [] {20, 100, 123, 10, 5, 2, 3, 50, 8, 10, 22, 0, 55, 129, 120, 30, 14, 200, 21, 55};
            gs.Mode = RangeType.Fixed;
            vbox.PackStart (gs);

            win.Add (vbox);
            win.ShowAll ();
            win.AddEvents ((int) EventMask.KeyPressMask);
            win.KeyPressEvent += gs.HandleKeyPressEvent;

            Application.Run ();
            return 0;
        }
        public void ShowAt(int x, int y)
        {
            //if(win != null) KillMenu (true);

            //foreach(ApplicationMenuItem item in items) item.Parent = this;

            if(win == null)
            {
                win = new SyntheticWindow (WindowType.Popup);
                win.Child = this;

                win.Hidden += delegate { KillMenu (true); };

                win.ShowAll ();
                win.GdkWindow.Move (x, y - verticalWindowOffset);

                win.ButtonPressEvent += delegate { KillMenu (true); };
                win.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));
            }
            else
            {
                win.ShowAll ();
                win.GdkWindow.Move (x, y - verticalWindowOffset);
            }

            Grab.Add (win);
            Gdk.GrabStatus grabbed = Gdk.Pointer.Grab (win.GdkWindow, true, Gdk.EventMask.ButtonPressMask, null, null, 0);
            if(grabbed != Gdk.GrabStatus.Success)
            {
                KillMenu (false);
                return;
            }

            grabbed = Gdk.Keyboard.Grab (win.GdkWindow, true, 0);
            if(grabbed != Gdk.GrabStatus.Success)
            {
                KillMenu (false);
                return;
            }
        }