public DropDownBoxListWindow(IListDataProvider provider, WindowType windowType) : base(windowType)
        {
            this.DataProvider = provider;
            this.TransientFor = IdeApp.Workbench.RootWindow;
            this.TypeHint     = Gdk.WindowTypeHint.Menu;
            this.Decorated    = false;
            this.BorderWidth  = 1;
            list             = new ListWidget(this);
            list.SelectItem += delegate {
                var sel = list.Selection;
                if (sel >= 0 && sel < DataProvider.IconCount)
                {
                    DataProvider.ActivateItem(sel);
                    Destroy();
                }
            };
            SetSizeRequest(list.WidthRequest + WidthModifier, list.HeightRequest);
            vScrollbar = new ScrolledWindow();
            vScrollbar.VScrollbar.SizeAllocated += (o, args) => {
                var minWidth = list.WidthRequest + args.Allocation.Width;
                if (this.Allocation.Width < minWidth)
                {
                    SetSizeRequest(minWidth, list.HeightRequest);
                }
            };
            vScrollbar.Child = list;
            var vbox = new VBox();

            vbox.PackStart(vScrollbar, true, true, 0);
            Add(vbox);
        }
        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;
            list             = new ListWidget(this);
            list.SelectItem += delegate {
                var sel = list.Selection;
                if (sel >= 0 && sel < DataProvider.IconCount)
                {
                    DataProvider.ActivateItem(sel);
                    Destroy();
                }
            };
            SetSizeRequest(list.WidthRequest, list.HeightRequest);
            vScrollbar = new ScrolledWindow();
            vScrollbar.VScrollbar.SizeAllocated += (object o, SizeAllocatedArgs args) => {
                var minWidth = list.WidthRequest + args.Allocation.Width;
                if (this.Allocation.Width < minWidth)
                {
                    SetSizeRequest(minWidth, list.HeightRequest);
                }
            };
            vScrollbar.Child = list;
            var vbox = new VBox();

            vbox.PackStart(vScrollbar, true, true, 0);
            Add(vbox);
        }
        public DropDownBoxListWindow(IListDataProvider provider, WindowType windowType) : base(windowType)
        {
            Accessible.Name = "DropDownBoxListWindow";

            this.DataProvider = provider;
            this.TransientFor = IdeApp.Workbench.RootWindow;
            this.TypeHint     = Gdk.WindowTypeHint.DropdownMenu;
            this.Decorated    = false;
            this.BorderWidth  = 1;
            list = new ListWidget(this);
            list.Accessible.Name = "DropDownBoxListWindow.List";

            list.SelectItem += delegate {
                var sel = list.Selection;
                if (sel >= 0 && sel < DataProvider.IconCount)
                {
                    try {
                        DataProvider.ActivateItem(sel);
                        // This is so parent window of dropdown regains focus
                        TransientFor?.Present();
                    } catch (Exception ex) {
                        LoggingService.LogInternalError("Offset seems to be out of sync with the snapshot.", ex);
                    }

                    Destroy();
                }
            };
            SetSizeRequest(list.WidthRequest + WidthModifier, list.HeightRequest);
            vScrollbar = new ScrolledWindow();
            vScrollbar.VScrollbar.SizeAllocated += (o, args) => {
                var minWidth = list.WidthRequest + args.Allocation.Width;
                if (this.Allocation.Width < minWidth)
                {
                    SetSizeRequest(minWidth, list.HeightRequest);
                }
            };
            vScrollbar.Child = list;
            var vbox = new VBox();

            vbox.PackStart(vScrollbar, true, true, 0);
            Add(vbox);
        }