public DropDownBoxListWindow (IListDataProvider provider) : base(Gtk.WindowType.Popup)
		{
			this.DataProvider = provider;
			this.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
			this.TypeHint = Gdk.WindowTypeHint.Menu;
			this.BorderWidth = 1;
			this.Events |= Gdk.EventMask.KeyPressMask;
			hBox = new HBox ();
			list = new ListWidget (this);
			list.SelectItem += delegate {
				var sel = list.Selection;
				if (sel >= 0 && sel < DataProvider.IconCount) {
					DataProvider.ActivateItem (sel);
					Destroy ();
				}
			};
			
			list.ScrollEvent += HandleListScrollEvent;
			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 ();
		}
Пример #2
0
        public DropDownBoxListWindow(IListDataProvider provider) : base(Gtk.WindowType.Popup)
        {
            this.DataProvider = provider;
            this.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
            this.TypeHint     = Gdk.WindowTypeHint.Menu;
            this.BorderWidth  = 1;
            this.Events      |= Gdk.EventMask.KeyPressMask;
            hBox             = new HBox();
            list             = new ListWidget(this);
            list.SelectItem += delegate {
                var sel = list.Selection;
                if (sel >= 0 && sel < DataProvider.IconCount)
                {
                    DataProvider.ActivateItem(sel);
                    Destroy();
                }
            };

            list.ScrollEvent   += HandleListScrollEvent;
            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();
        }
Пример #3
0
        public DropDownBoxListWindow(IListDataProvider provider) : base(Gtk.WindowType.Popup)
        {
            this.DataProvider = provider;
            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 {
                DataProvider.ActivateItem(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 (IListDataProvider provider) : base(Gtk.WindowType.Popup)
		{
			this.DataProvider = provider;
			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 {
				DataProvider.ActivateItem (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 ();
		}