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);
        }
Example #2
0
        private void BuildInterface()
        {
            HBox box = new HBox();

            volume_button = new ConnectedVolumeButton();

            box.PackStart(action_service.PlaybackActions["PreviousAction"].CreateToolItem(), false, false, 0);
            box.PackStart(action_service.PlaybackActions["PlayPauseAction"].CreateToolItem(), false, false, 0);
            box.PackStart(new NextButton(action_service), false, false, 0);
            box.PackStart(new RepeatActionButton(true), false, false, 0);
            box.PackStart(slider = new ConnectedSeekSlider(SeekSliderLayout.Horizontal), true, true, 0);
            box.PackStart(volume_button, false, false, 0);

            Button exit = new Button(Stock.LeaveFullscreen);

            exit.Relief   = ReliefStyle.None;
            exit.Clicked += delegate { TransientFor.Hide(); };
            box.PackStart(exit, false, false, 0);

            Add(box);
            box.ShowAll();
        }