protected override void OnSizeRequested(ref Requisition requisition) { base.OnSizeRequested(ref requisition); if (box.Child != null) { requisition = box.Child.SizeRequest(); requisition.Height += 2 * box.Child.Style?.YThickness ?? 0; } else { requisition = box.SizeRequest(); } }
private void PositionPopup() { int x, y; Gtk.Requisition event_box_req = event_box.SizeRequest(); Gtk.Requisition popup_req = popup.SizeRequest(); PositionWidget(popup, out x, out y, 5); int monitor = event_box.Screen.GetMonitorAtPoint(x, y); var monitor_rect = event_box.Screen.GetMonitorGeometry(monitor); x = x - (popup_req.Width / 2) + (event_box_req.Width / 2); if (x + popup_req.Width >= monitor_rect.Right - 5) { x = monitor_rect.Right - popup_req.Width - 5; } else if (x < monitor_rect.Left + 5) { x = monitor_rect.Left + 5; } popup.Move(x, y); }
protected override void OnSizeAllocated(Gdk.Rectangle allocation) { base.OnSizeAllocated(allocation); box.SizeRequest(); box.Allocation = allocation; }
protected override void OnSizeRequested(ref Requisition requisition) { base.OnSizeRequested(ref requisition); requisition = box.SizeRequest(); }