void UpdateRegionCombo(int line, int column)
        {
            if (parsedDocument == null)
            {
                return;
            }
            bool hasRegions = parsedDocument.UserRegions.Any();

            regionCombo.Sensitive = hasRegions;
            FoldingRegion region = hasRegions ? parsedDocument.UserRegions.Where(r => r.Region.Contains(line, column)).LastOrDefault() : null;

            if (regionCombo.CurrentItem == region)
            {
                return;
            }
            if (region == null)
            {
                regionCombo.SetItem("", null, null);
            }
            else
            {
                regionCombo.SetItem(region.Name,                  //GettextCatalog.GetString ("Region {0}", region.Name),
                                    ImageService.GetPixbuf(Gtk.Stock.Add, IconSize.Menu),
                                    region);
            }
            UpdateRegionComboTip(region);
        }
        void UpdateMemberCombo(IType parent, int line, int column)
        {
            bool hasMembers = parent != null && parent.ClassType != ClassType.Delegate;

            membersCombo.Sensitive = hasMembers;
            IMember member = hasMembers ? parent.GetMemberAt(line, column) : null;

            if (membersCombo.CurrentItem == member)
            {
                return;
            }
            if (member == null)
            {
                membersCombo.SetItem("", null, null);
            }
            else
            {
                membersCombo.SetItem(Editor.Ambience.GetString(member, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters),
                                     ImageService.GetPixbuf(member.StockIcon, IconSize.Menu),
                                     member);
            }
            UpdateMemberComboTip(member);
        }
        IType UpdateTypeCombo(int line, int column)
        {
            bool hasTypes = parsedDocument.CompilationUnit.Types.Any();

            typeCombo.Sensitive = hasTypes;
            IType result = hasTypes ? parsedDocument.CompilationUnit.GetTypeAt(line, column) : null;

            if (typeCombo.CurrentItem == result)
            {
                return(result);
            }
            if (result == null)
            {
                typeCombo.SetItem("", null, null);
            }
            else
            {
                typeCombo.SetItem(Editor.Ambience.GetString(result, OutputFlags.IncludeGenerics | OutputFlags.IncludeParameters | OutputFlags.UseFullInnerTypeName),
                                  ImageService.GetPixbuf(result.StockIcon, IconSize.Menu),
                                  result);
            }
            UpdateTypeComboTip(result);
            return(result);
        }
Exemple #4
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 ();
		}