Exemplo n.º 1
0
        public DropDownBoxListWindow(DropDownBox parent) : base(Gtk.WindowType.Popup)
        {
            this.parent       = parent;
            this.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
            this.TypeHint     = Gdk.WindowTypeHint.Menu;
            this.BorderWidth  = 1;

            hBox             = new HBox();
            list             = new ListWidget(this);
            list.SelectItem += delegate {
                parent.SetItem(list.Selection);
                Destroy();
            };

            list.ScrollEvent += delegate(object o, ScrollEventArgs args) {
                if (args.Event.Direction == Gdk.ScrollDirection.Up)
                {
                    vScrollbar.Value--;
                }
                else if (args.Event.Direction == Gdk.ScrollDirection.Down)
                {
                    vScrollbar.Value++;
                }
            };
            list.SizeAllocated += delegate {
                QueueResize();
            };
            list.PageChanged += HandleListPageChanged;
            hBox.PackStart(list, true, true, 0);

            vScrollbar = new VScrollbar(null);
            vScrollbar.ValueChanged += delegate {
                list.ForcePage((int)vScrollbar.Value);
            };

            hBox.PackStart(vScrollbar, false, false, 0);
            Add(hBox);
            ShowAll();
        }
		public DropDownBoxListWindow (DropDownBox parent) : base(Gtk.WindowType.Popup)
		{
			this.parent = parent;
			this.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
			this.TypeHint = Gdk.WindowTypeHint.Menu;
			this.BorderWidth = 1;
			
			hBox = new HBox ();
			list = new ListWidget (this);
			list.SelectItem += delegate {
				parent.SetItem (list.Selection);
				Destroy ();
			};
			
			list.ScrollEvent += delegate(object o, ScrollEventArgs args) {
				if (args.Event.Direction == Gdk.ScrollDirection.Up) {
					vScrollbar.Value--;
				} else if (args.Event.Direction == Gdk.ScrollDirection.Down) {
					vScrollbar.Value++;
				}
			};
			list.SizeAllocated += delegate {
				QueueResize ();
			};
			list.PageChanged += HandleListPageChanged;
			hBox.PackStart (list, true, true, 0);
			
			vScrollbar = new VScrollbar (null);
			vScrollbar.ValueChanged += delegate {
				list.ForcePage ((int)vScrollbar.Value);
			};
			
			hBox.PackStart (vScrollbar, false, false, 0);
			Add (hBox);
			ShowAll ();
		}