void CalcVisibleRows() { Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtWindow(GdkWindow)); int winHeight = geometry.Height / 2; int lvWidth, lvHeight; this.GetSizeRequest(out lvWidth, out lvHeight); if (layout == null) { return; } int visibleRows = (winHeight + padding - margin * 2) / rowHeight; int newHeight; if (this.win.DataProvider.IconCount > visibleRows) { newHeight = (rowHeight * visibleRows) + margin * 2; } else { newHeight = (rowHeight * this.win.DataProvider.IconCount) + margin * 2; } if (lvWidth != listWidth || lvHeight != newHeight) { this.SetSizeRequest(listWidth, newHeight); } }
public void ShowTooltip(string text, int x, int y, int altY) { if (tooltipWindow != null) { tooltipWindow.Hide(); } else { tooltipWindow = new CustomTooltipWindow(); tooltipWindow.TransientFor = this; tooltipWindow.DestroyWithParent = true; } tooltipWindow.Tooltip = text; int ox, oy; this.GdkWindow.GetOrigin(out ox, out oy); int w = tooltipWindow.Child.SizeRequest().Width; int h = tooltipWindow.Child.SizeRequest().Height; Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtWindow(this.GdkWindow)); if (ox + x + w + tooltipXOffset >= geometry.Right || oy + y + h >= geometry.Bottom) { tooltipWindow.Move(ox + x - w, oy + altY - h); } else { tooltipWindow.Move(ox + x + tooltipXOffset, oy + y); } tooltipWindow.ShowAll(); }
protected override void OnSizeAllocated(Gdk.Rectangle allocation) { const int edgeGap = 2; int oldY, x, y; this.GetPosition(out x, out y); oldY = y; Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(x, y)); if (allocation.Height <= geometry.Height && y + allocation.Height >= geometry.Height - edgeGap) { y = geometry.Top + (geometry.Height - allocation.Height - edgeGap); } if (y < geometry.Top + edgeGap) { y = geometry.Top + edgeGap; } if (y != oldY) { Move(x, y); } base.OnSizeAllocated(allocation); }
protected override void OnSizeAllocated(Gdk.Rectangle allocation) { if (MonoDevelop.Core.Platform.IsMac || MonoDevelop.Core.Platform.IsWindows) { // fails on linux see: Bug 8481 - Debug value tooltips very often appear at the top-left corner of the screen instead of near the element to inspect const int edgeGap = 2; int oldY, x, y; this.GetPosition(out x, out y); oldY = y; Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(x, y)); if (allocation.Height <= geometry.Height && y + allocation.Height >= geometry.Y + geometry.Height - edgeGap) { y = geometry.Top + (geometry.Height - allocation.Height - edgeGap); } if (y < geometry.Top + edgeGap) { y = geometry.Top + edgeGap; } if (y != oldY) { Move(x, y); // If the window is moved, hide the arrow since it will be pointing to the wrong place ShowArrow = false; } } base.OnSizeAllocated(allocation); }
void PositionListWindow() { if (window == null) { return; } int ox, oy; ParentWindow.GetOrigin(out ox, out oy); int dx = ox + this.Allocation.X; int dy = oy + this.Allocation.Bottom; window.WidthRequest = Allocation.Width; int width, height; window.GetSizeRequest(out width, out height); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(dx, dy)); if (dy + height > geometry.Bottom) { dy = oy + this.Allocation.Y - height; } if (dx + width > geometry.Right) { dx = geometry.Right - width; } window.Move(dx, dy); window.GetSizeRequest(out width, out height); window.GrabFocus(); window.FocusOutEvent += delegate { DestroyWindow(); }; }
void ShowOverload() { ClearDescriptions(); if (current_overload >= 0 && current_overload < overloads.Count) { var o = overloads[current_overload]; headlabel.BreakOnCamelCasing = false; headlabel.BreakOnPunctuation = false; headlabel.Markup = o.SignatureMarkup; headlabel.Visible = true; int x, y; GetPosition(out x, out y); var geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(x, y)); headlabel.MaxWidth = Math.Max(geometry.Width / 5, 480); if (Theme.DrawPager && overloads.Count > 1) { headlabel.WidthRequest = headlabel.RealWidth + 70; } else { headlabel.WidthRequest = -1; } foreach (var cat in o.Categories) { descriptionBox.PackStart(CreateCategory(cat.Item1, cat.Item2), true, true, 4); } if (!string.IsNullOrEmpty(o.SummaryMarkup)) { descriptionBox.PackStart(CreateCategory(GettextCatalog.GetString("Summary"), o.SummaryMarkup), true, true, 4); } if (!string.IsNullOrEmpty(o.FooterMarkup)) { var contentLabel = new FixedWidthWrapLabel(); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = false; contentLabel.BreakOnPunctuation = false; contentLabel.MaxWidth = 400; contentLabel.Markup = o.FooterMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, (HslColor)foreColor); descriptionBox.PackEnd(contentLabel, true, true, 4); } if (string.IsNullOrEmpty(o.SummaryMarkup) && string.IsNullOrEmpty(o.FooterMarkup) && !o.Categories.Any()) { descriptionBox.Hide(); } else { descriptionBox.ShowAll(); } Theme.CurrentPage = current_overload; QueueResize(); } }
protected override void OnSizeAllocated(Gdk.Rectangle allocation) { if (NudgeHorizontal || NudgeVertical) { int x, y; this.GetPosition(out x, out y); int oldY = y, oldX = x; const int edgeGap = 2; // int w = allocation.Width; // // if (fitWidthToScreen && (x + w >= screenW - edgeGap)) { // int fittedWidth = screenW - x - edgeGap; // if (fittedWidth < minFittedWidth) { // x -= (minFittedWidth - fittedWidth); // fittedWidth = minFittedWidth; // } // LimitWidth (fittedWidth); // } Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen.Number, Screen.GetMonitorAtPoint(x, y)); int left = (int)geometry.Left; int top = (int)geometry.Top; int width = (int)geometry.Width; int height = (int)geometry.Height; if (NudgeHorizontal) { if (allocation.Width <= geometry.Width && x + allocation.Width >= geometry.Left + geometry.Width - edgeGap) { x = left + (width - allocation.Width - edgeGap); } if (x <= left + edgeGap) { x = left + edgeGap; } } if (NudgeVertical) { if (allocation.Height <= geometry.Height && y + allocation.Height >= geometry.Top + geometry.Height - edgeGap) { y = top + (height - allocation.Height - edgeGap); } if (y <= top + edgeGap) { y = top + edgeGap; } } if (y != oldY || x != oldX) { Move(x, y); } } base.OnSizeAllocated(allocation); }
Gdk.Size GetIdealSize() { Gdk.Size retVal = new Gdk.Size(); int ox, oy; GetPosition(out ox, out oy); Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen.Number, Screen.GetMonitorAtPoint(ox, oy)); int maxHeight = (int)geometry.Height * 4 / 5; double startY = yMargin + ChildAllocation.Y; double y = startY; calculatedItems = 0; foreach (var result in results) { var dataSrc = result.Item2; if (dataSrc.Count == 0) { continue; } for (int i = 0; i < maxItems && i < dataSrc.Count; i++) { layout.SetMarkup(GetRowMarkup(dataSrc[i])); int w, h; layout.GetPixelSize(out w, out h); if (y + h + itemSeparatorHeight > maxHeight) { break; } y += h + itemSeparatorHeight; calculatedItems++; } } retVal.Width = Math.Min((int)geometry.Width * 4 / 5, 480); if (Math.Abs(y - startY) < 1) { layout.SetMarkup(GettextCatalog.GetString("No matches")); int w, h; layout.GetPixelSize(out w, out h); var realHeight = h + itemSeparatorHeight + 4; y += realHeight; } else { y -= itemSeparatorHeight; } var calculatedHeight = Math.Min( maxHeight, (int)y + yMargin + results.Count(res => res.Item2.Count > 0) * categorySeparatorHeight ); retVal.Height = calculatedHeight; return(retVal); }
internal static void UpdateWindow(CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget) { // Updates the parameter information window from the information // of the current method overload if (methods.Count > 0) { if (window == null) { window = new ParameterInformationWindow(); window.Ext = textEditorExtension; window.Widget = completionWidget; window.SizeAllocated += delegate(object o, SizeAllocatedArgs args) { if (args.Allocation.Width == lastW && args.Allocation.Height == lastH && wasVisi == CompletionWindowManager.IsVisible) { return; } PositionParameterInfoWindow(args.Allocation); }; window.Hidden += delegate { lastW = -1; lastH = -1; }; } else { window.Ext = textEditorExtension; window.Widget = completionWidget; } wasAbove = false; var lastMethod = methods [methods.Count - 1]; int curParam = window.Ext != null?window.Ext.GetCurrentParameterIndex(lastMethod.MethodProvider.StartOffset) : 0; var geometry2 = DesktopService.GetUsableMonitorGeometry(window.Screen, window.Screen.GetMonitorAtPoint(X, Y)); window.ShowParameterInfo(lastMethod.MethodProvider, lastMethod.CurrentOverload, curParam - 1, geometry2.Width); window.ChangeOverload(); PositionParameterInfoWindow(window.Allocation); window.Show(); } if (methods.Count == 0) { if (window != null) { // window.HideParameterInfo (); DestroyWindow(); wasAbove = false; wasVisi = false; lastW = -1; lastH = -1; } return; } }
static void PositionParameterInfoWindow(Rectangle allocation) { lastW = allocation.Width; lastH = allocation.Height; wasVisi = CompletionWindowManager.IsVisible; var ctx = window.Widget.CurrentCodeCompletionContext; var md = methods [methods.Count - 1]; int cparam = window.Ext != null?window.Ext.GetCurrentParameterIndex(md.MethodProvider.StartOffset) : 0; X = md.CompletionContext.TriggerXCoord; if (CompletionWindowManager.IsVisible) { // place above Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - allocation.Height - 10; } else { // place below Y = ctx.TriggerYCoord; } var geometry = DesktopService.GetUsableMonitorGeometry(window.Screen, window.Screen.GetMonitorAtPoint(X, Y)); window.ShowParameterInfo(md.MethodProvider, md.CurrentOverload, cparam - 1, geometry.Width); if (X + allocation.Width > geometry.Right) { X = geometry.Right - allocation.Width; } if (Y < geometry.Top) { Y = ctx.TriggerYCoord; } if (wasAbove || Y + allocation.Height > geometry.Bottom) { Y = Y - ctx.TriggerTextHeight - allocation.Height - 4; wasAbove = true; } if (CompletionWindowManager.IsVisible) { var completionWindow = new Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height); if (completionWindow.IntersectsWith(new Rectangle(X, Y, allocation.Width, allocation.Height))) { X = completionWindow.X; Y = completionWindow.Y - allocation.Height - 6; if (Y < 0) { Y = completionWindow.Bottom + 6; } } } window.Move(X, Y); }
static async void PositionParameterInfoWindow(Rectangle allocation) { lastW = allocation.Width; lastH = allocation.Height; var isCompletionWindowVisible = wasCompletionWindowVisible = (CompletionWindowManager.Wnd?.Visible ?? false); var ctx = window.Widget.CurrentCodeCompletionContext; int cparam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex(currentMethodGroup.MethodProvider.StartOffset) : 0; X = currentMethodGroup.CompletionContext.TriggerXCoord; if (isCompletionWindowVisible) { // place above Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - allocation.Height - 10; } else { // place below Y = ctx.TriggerYCoord; } var geometry = DesktopService.GetUsableMonitorGeometry(window.Screen.Number, window.Screen.GetMonitorAtPoint(X, Y)); window.ShowParameterInfo(currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, cparam - 1, (int)geometry.Width); if (X + allocation.Width > geometry.Right) { X = (int)geometry.Right - allocation.Width; } if (Y < geometry.Top) { Y = ctx.TriggerYCoord; } if (wasAbove || Y + allocation.Height > geometry.Bottom) { Y = Y - ctx.TriggerTextHeight - allocation.Height - 4; wasAbove = true; } if (isCompletionWindowVisible) { var completionWindow = new Xwt.Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height); if (completionWindow.IntersectsWith(new Xwt.Rectangle(X, Y, allocation.Width, allocation.Height))) { X = (int)completionWindow.X; Y = (int)completionWindow.Y - allocation.Height - 6; if (Y < 0) { Y = (int)completionWindow.Bottom + 6; } } } window.Move(X, Y); }
void PositionPopupMenu(Menu menu, out int x, out int y, out bool pushIn) { popupEditor.GdkWindow.GetOrigin(out x, out y); x += this.menuPopupLocation.X; y += this.menuPopupLocation.Y; Requisition request = menu.SizeRequest(); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(x, y)); y = Math.Max(geometry.Top, Math.Min(y, geometry.Bottom - request.Height)); x = Math.Max(geometry.Left, Math.Min(x, geometry.Right - request.Width)); pushIn = true; }
internal static async void UpdateWindow(CompletionTextEditorExtension textEditorExtension, ICompletionWidget completionWidget) { // Updates the parameter information window from the information // of the current method overload if (currentMethodGroup != null) { if (window == null) { window = new ParameterInformationWindow(); window.Ext = textEditorExtension; window.Widget = completionWidget; window.SizeAllocated += delegate(object o, SizeAllocatedArgs args) { if (args.Allocation.Width == lastW && args.Allocation.Height == lastH && wasCompletionWindowVisible == (CompletionWindowManager.Wnd?.Visible ?? false)) { return; } PositionParameterInfoWindow(args.Allocation); }; window.Hidden += delegate { lastW = -1; lastH = -1; }; } else { window.Ext = textEditorExtension; window.Widget = completionWidget; } wasAbove = false; int curParam = window.Ext != null ? await window.Ext.GetCurrentParameterIndex(currentMethodGroup.MethodProvider.StartOffset) : 0; var geometry2 = DesktopService.GetUsableMonitorGeometry(window.Screen.Number, window.Screen.GetMonitorAtPoint(X, Y)); window.ShowParameterInfo(currentMethodGroup.MethodProvider, currentMethodGroup.CurrentOverload, curParam - 1, (int)geometry2.Width); PositionParameterInfoWindow(window.Allocation); } if (currentMethodGroup == null) { if (window != null) { window.HideParameterInfo(); // DestroyWindow (); wasAbove = false; wasCompletionWindowVisible = false; lastW = -1; lastH = -1; } return; } }
Gdk.Size GetIdealSize() { Gdk.Size retVal = new Gdk.Size(); int ox, oy; GetPosition(out ox, out oy); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(ox, oy)); double startY = yMargin + ChildAllocation.Y; double y = startY; foreach (var result in results) { // var category = result.Item1; var dataSrc = result.Item2; if (dataSrc.ItemCount == 0) { continue; } for (int i = 0; i < maxItems && i < dataSrc.ItemCount; i++) { layout.SetMarkup(GetRowMarkup(dataSrc, i)); int w, h; layout.GetPixelSize(out w, out h); y += h + itemSeparatorHeight; } } retVal.Width = Math.Min(geometry.Width * 4 / 5, 480); if (y == startY) { layout.SetMarkup(GettextCatalog.GetString("No matches")); int w, h; layout.GetPixelSize(out w, out h); y += h + itemSeparatorHeight + 4; } else { y -= itemSeparatorHeight; } var calculedHeight = Math.Min(geometry.Height * 4 / 5, (int)y + yMargin + results.Count(res => res.Item2.ItemCount > 0) * categorySeparatorHeight); retVal.Height = calculedHeight; return(retVal); }
void Reposition(bool force) { X = CodeCompletionContext.TriggerXCoord - TextOffset; Y = CodeCompletionContext.TriggerYCoord; int w, h; GetSize(out w, out h); if (!force && previousHeight != h && previousWidth != w) { return; } // Note: we add back the TextOffset here in case X and X+TextOffset are on different monitors. Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(X + TextOffset, Y)); previousHeight = h; previousWidth = w; if (X + w > geometry.Right) { X = geometry.Right - w; } else if (X < geometry.Left) { X = geometry.Left; } if (Y + h > geometry.Bottom || yPosition == WindowPositonY.Top) { // Put the completion-list window *above* the cursor Y = Y - CodeCompletionContext.TriggerTextHeight - h; yPosition = WindowPositonY.Top; } else { yPosition = WindowPositonY.Bottom; } curXPos = X; curYPos = Y; Move(X, Y); UpdateDeclarationView(); ParameterInformationWindowManager.UpdateWindow(CompletionWidget); }
void PositionWidget(Gtk.Widget widget) { if (!(widget is Gtk.Window)) { return; } int ox, oy; ParentWindow.GetOrigin(out ox, out oy); int w; int itemXPosition = GetHoverXPosition(out w); int dx = ox + this.Allocation.X + itemXPosition; int dy = oy + this.Allocation.Bottom; var req = widget.SizeRequest(); Xwt.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen.Number, Screen.GetMonitorAtPoint(dx, dy)); int geomWidth = (int)geometry.Width; int geomLeft = (int)geometry.Left; int geomRight = (int)geometry.Right; int width = System.Math.Max(req.Width, w); if (width >= geomWidth - spacing * 2) { width = geomWidth - spacing * 2; dx = geomLeft + spacing; } widget.WidthRequest = width; if (dy + req.Height > geometry.Bottom) { dy = oy + this.Allocation.Y - req.Height; } if (dx + width > geomRight) { dx = geomRight - width; } (widget as Gtk.Window).Move(dx, dy); (widget as Gtk.Window).Resize(width, req.Height); widget.GrabFocus(); }
internal static void UpdateWindow(ICompletionWidget widget) { // Updates the parameter information window from the information // of the current method overload if (window == null && methods.Count > 0) { window = new ParameterInformationWindow(); wasAbove = false; } if (methods.Count == 0) { if (window != null) { window.Hide(); wasAbove = false; } return; } var ctx = widget.CurrentCodeCompletionContext; MethodData md = methods[methods.Count - 1]; int cparam = md.MethodProvider.GetCurrentParameterIndex(widget, md.CompletionContext); Gtk.Requisition reqSize = window.ShowParameterInfo(md.MethodProvider, md.CurrentOverload, cparam - 1); X = md.CompletionContext.TriggerXCoord; if (CompletionWindowManager.IsVisible) { // place above Y = ctx.TriggerYCoord - ctx.TriggerTextHeight - reqSize.Height - 10; } else { // place below Y = ctx.TriggerYCoord; } Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(window.Screen, window.Screen.GetMonitorAtPoint(X, Y)); if (X + reqSize.Width > geometry.Right) { X = geometry.Right - reqSize.Width; } if (Y < geometry.Top) { Y = ctx.TriggerYCoord; } if (wasAbove || Y + reqSize.Height > geometry.Bottom) { Y = Y - ctx.TriggerTextHeight - reqSize.Height - 4; wasAbove = true; } if (CompletionWindowManager.IsVisible) { Rectangle completionWindow = new Rectangle(CompletionWindowManager.X, CompletionWindowManager.Y, CompletionWindowManager.Wnd.Allocation.Width, CompletionWindowManager.Wnd.Allocation.Height); if (completionWindow.IntersectsWith(new Rectangle(X, Y, reqSize.Width, reqSize.Height))) { X = completionWindow.X; Y = completionWindow.Y - reqSize.Height - 6; if (Y < 0) { Y = completionWindow.Bottom + 6; } } } window.Move(X, Y); window.Show(); }
bool DelayedTooltipShow() { Gdk.Rectangle rect = List.GetRowArea(List.SelectionFilterIndex); if (rect.IsEmpty) { return(false); } int listpos_x = 0, listpos_y = 0, i = 0; while ((listpos_x == 0 || listpos_y == 0) && (i++ < 10)) { GetPosition(out listpos_x, out listpos_y); } if (i >= 10) { return(false); } int vert = listpos_y + rect.Y; int lvWidth = 0, lvHeight = 0; while (lvWidth == 0) { this.GdkWindow.GetSize(out lvWidth, out lvHeight); } if (vert >= listpos_y + lvHeight - 2 || vert < listpos_y) { HideDeclarationView(); return(false); } /* if (vert >= listpos_y + lvHeight - 2) { * vert = listpos_y + lvHeight - rect.Height; * } else if (vert < listpos_y) { * vert = listpos_y; * }*/ if (declarationViewHidden && Visible) { declarationviewwindow.Move(this.Screen.Width + 1, vert); declarationviewwindow.SetFixedWidth(-1); declarationviewwindow.ReshowWithInitialSize(); declarationviewwindow.Show(); if (declarationViewWindowOpacityTimer != 0) { GLib.Source.Remove(declarationViewWindowOpacityTimer); } declarationViewWindowOpacityTimer = GLib.Timeout.Add(50, new OpacityTimer(this).Timer); declarationViewHidden = false; } Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtWindow(GdkWindow)); Requisition req = declarationviewwindow.SizeRequest(); int dvwWidth = req.Width; int horiz = listpos_x + lvWidth + declarationWindowMargin; if (geometry.Right - horiz >= lvWidth) { if (geometry.Right - horiz < dvwWidth) { declarationviewwindow.SetFixedWidth(geometry.Right - horiz); } } else { if (listpos_x - dvwWidth - declarationWindowMargin < 0) { declarationviewwindow.SetFixedWidth(listpos_x - declarationWindowMargin); dvwWidth = declarationviewwindow.SizeRequest().Width; } horiz = curXPos - dvwWidth - declarationWindowMargin; } if (declarationViewX != horiz || declarationViewY != vert) { declarationviewwindow.Move(horiz, vert); declarationViewX = horiz; declarationViewY = vert; } declarationViewTimer = 0; return(false); }
GenerateCodeWindow(CodeGenerationOptions options, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext) : base(Gtk.WindowType.Toplevel) { this.options = options; this.Build(); scrolledwindow1.Child = treeviewGenerateActions; scrolledwindow1.ShowAll(); scrolledwindow2.Child = treeviewSelection; scrolledwindow2.ShowAll(); treeviewGenerateActions.Cancel += delegate { Destroy(); }; treeviewGenerateActions.Submit += delegate { treeviewSelection.GrabFocus(); }; treeviewSelection.Cancel += delegate { treeviewGenerateActions.GrabFocus(); }; treeviewSelection.Submit += delegate { if (curInitializeObject != null) { curInitializeObject.GenerateCode(); curInitializeObject = null; } Destroy(); }; WindowTransparencyDecorator.Attach(this); treeviewSelection.HeadersVisible = false; treeviewGenerateActions.HeadersVisible = false; treeviewGenerateActions.Model = generateActionsStore; TreeViewColumn column = new TreeViewColumn(); var pixbufRenderer = new CellRendererImage(); column.PackStart(pixbufRenderer, false); column.AddAttribute(pixbufRenderer, "image", 0); CellRendererText textRenderer = new CellRendererText(); column.PackStart(textRenderer, true); column.AddAttribute(textRenderer, "text", 1); column.Expand = true; treeviewGenerateActions.AppendColumn(column); treeviewGenerateActions.Selection.Changed += TreeviewGenerateActionsSelectionChanged; this.Remove(this.vbox1); BorderBox messageArea = new BorderBox(); messageArea.Add(vbox1); this.Add(messageArea); this.ShowAll(); int x = completionContext.TriggerXCoord; int y = completionContext.TriggerYCoord; int w, h; GetSize(out w, out h); int myMonitor = Screen.GetMonitorAtPoint(x, y); Gdk.Rectangle geometry = DesktopService.GetUsableMonitorGeometry(Screen, myMonitor); if (x + w > geometry.Right) { x = geometry.Right - w; } if (y + h > geometry.Bottom) { y = y - completionContext.TriggerTextHeight - h; } Move(x, y); }
void ShowOverload() { ClearDescriptions(); if (current_overload >= 0 && current_overload < overloads.Count) { var o = overloads[current_overload]; headLabel.Markup = o.SignatureMarkup; headLabel.Visible = !string.IsNullOrEmpty(o.SignatureMarkup); int x, y; GetPosition(out x, out y); var geometry = DesktopService.GetUsableMonitorGeometry(Screen.Number, Screen.GetMonitorAtPoint(x, y)); headLabel.MaxWidth = Math.Max((int)geometry.Width / 5, 480); if (Theme.DrawPager && overloads.Count > 1) { headLabel.WidthRequest = headLabel.RealWidth + 70; } else { headLabel.WidthRequest = -1; } foreach (var cat in o.Categories) { descriptionBox.PackStart(CreateCategory(GetHeaderMarkup(cat.Item1), cat.Item2, foreColor, Theme.Font), true, true, 4); } if (!string.IsNullOrEmpty(o.SummaryMarkup)) { descriptionBox.PackStart(CreateCategory(GetHeaderMarkup(GettextCatalog.GetString("Summary")), o.SummaryMarkup, foreColor, Theme.Font), true, true, 4); } if (!string.IsNullOrEmpty(o.FooterMarkup)) { var contentLabel = new FixedWidthWrapLabel(); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = false; contentLabel.BreakOnPunctuation = false; contentLabel.MaxWidth = 400; contentLabel.Markup = o.FooterMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = Theme.Font; descriptionBox.PackEnd(contentLabel, true, true, 4); } if (string.IsNullOrEmpty(o.SummaryMarkup) && string.IsNullOrEmpty(o.FooterMarkup) && !o.Categories.Any()) { descriptionBox.Hide(); } else { descriptionBox.ShowAll(); } Theme.CurrentPage = current_overload; // if the target is not on the left or top side, we may loose the arrow alignment on our target // and must reposition if (!CurrentPosition.HasFlag(PopupPosition.Left) && !CurrentPosition.HasFlag(PopupPosition.Top)) { RepositionWindow(); } else { QueueResize(); } } }