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(); }
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 (); }
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) : 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) : 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 (); }