private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) { if ((this.child != null)) { args.Requisition = this.child.SizeRequest(); } }
public void HandleControlSizeRequested(object o, Gtk.SizeRequestedArgs args) { if (Handler.autoSize) { args.Requisition = Handler.vp.SizeRequest(); } }
void HandleWidgetSizeRequested(object o, Gtk.SizeRequestedArgs args) { var req = args.Requisition; if (!gettingPreferredSize && (enabledEvents & WidgetEvent.PreferredSizeCheck) != 0) { SizeConstraint wc = SizeConstraint.Unconstrained, hc = SizeConstraint.Unconstrained; var cp = Widget.Parent as IConstraintProvider; if (cp != null) { cp.GetConstraints(Widget, out wc, out hc); } ApplicationContext.InvokeUserCode(delegate { var w = eventSink.GetPreferredSize(wc, hc); req.Width = (int)w.Width; req.Height = (int)w.Height; }); } if (Frontend.MinWidth != -1 && Frontend.MinWidth > req.Width) { req.Width = (int)Frontend.MinWidth; } if (Frontend.MinHeight != -1 && Frontend.MinHeight > req.Height) { req.Height = (int)Frontend.MinHeight; } args.Requisition = req; }
void HandleLabelDynamicSizeRequest(object o, Gtk.SizeRequestedArgs args) { if (wrapHeight > 0) { var req = args.Requisition; req.Width = 0; req.Height = wrapHeight; args.Requisition = req; } }
public void HandleViewportSizeRequested(object o, Gtk.SizeRequestedArgs args) { var handler = Handler; if (handler != null) { var viewport = (Gtk.Viewport)o; if (handler.autoSize) { var size = viewport.SizeRequest(); //Console.WriteLine ("Autosizing to {0}x{1}", size.Width, size.Height); args.Requisition = size; } } }
public void HandleButtonSizeRequested(object o, Gtk.SizeRequestedArgs args) { var handler = Handler; if (handler != null) { var size = args.Requisition; //if (handler.PreferredSize.Width == -1 && (size.Width > 1 || size.Height > 1)) { var minSize = handler.MinimumSize; size.Width = Math.Max(size.Width, minSize.Width); size.Height = Math.Max(size.Height, minSize.Height); args.Requisition = size; } } }
void HandleSizeRequested(object o, Gtk.SizeRequestedArgs args) { IWidgetSurface ws = (IWidgetSurface)Frontend; Gtk.Requisition req = args.Requisition; int w = (int)ws.GetPreferredWidth().MinSize; int h = (int)ws.GetPreferredHeight().MinSize; if (req.Width < w) { req.Width = w; } if (req.Height < h) { req.Height = h; } args.Requisition = req; }
public void HandleContentSizeRequested(object o, Gtk.SizeRequestedArgs args) { var handler = Handler; if (handler != null) { var alloc = args.Requisition; var minimumSize = handler.MinimumSize; if (minimumSize.Width > 0) { alloc.Width = Math.Max(alloc.Width, minimumSize.Width); } if (minimumSize.Height > 0) { alloc.Height = Math.Max(alloc.Height, minimumSize.Height); } args.Requisition = alloc; } }
void HandleSizeRequested(object sender, Gtk.SizeRequestedArgs args) { if (!Window.Resizable) { int w = args.Requisition.Width, h = args.Requisition.Height; if (w < (int)requestedSize.Width) { w = (int)requestedSize.Width; } if (h < (int)requestedSize.Height) { h = (int)requestedSize.Height; } args.Requisition = new Gtk.Requisition() { Width = w, Height = h }; } }
void HandleSizeRequested(object o, Gtk.SizeRequestedArgs args) { args.Requisition = Widget.Child.SizeRequest(); }
void HandleSizeRequested(object o, Gtk.SizeRequestedArgs args) { SizeRequest(); }
void HandleSizeRequested(object o, Gtk.SizeRequestedArgs args) { OnParentSizeRequested(args); }
protected virtual void OnParentSizeRequested(Gtk.SizeRequestedArgs args) { SizeRequest(); }
void HandleWidgetSizeRequested(object o, Gtk.SizeRequestedArgs args) { if (gettingPreferredSize) { return; } var req = args.Requisition; if ((enabledEvents & sizeCheckEvents) == 0) { // If no sizing event is set, it means this handler was set because there is a min size. if (Frontend.MinWidth != -1) { req.Width = (int)Frontend.MinWidth; } if (Frontend.MinHeight != -1) { req.Height = (int)Frontend.MinHeight; } return; } if (sizeCheckStep == SizeCheckStep.AdjustSize) { req.Width = realRequestedWidth; req.Height = realRequestedHeight; sizeCheckStep = SizeCheckStep.FinalAllocate; } else { Toolkit.Invoke(delegate { if (EventSink.GetSizeRequestMode() == SizeRequestMode.HeightForWidth) { if ((enabledEvents & WidgetEvent.PreferredWidthCheck) != 0) { var w = eventSink.OnGetPreferredWidth(); req.Width = (int)w.MinSize; } if ((enabledEvents & WidgetEvent.PreferredHeightForWidthCheck) != 0) { if (doubleSizeRequestCheckSupported) { sizeCheckStep = SizeCheckStep.PreAllocate; realRequestedWidth = req.Width; // Store the width, since it will be used in the next iteration } else { var h = eventSink.OnGetPreferredHeightForWidth(req.Width); req.Height = (int)h.MinSize; sizeCheckStep = SizeCheckStep.FinalAllocate; } } else if ((enabledEvents & WidgetEvent.PreferredHeightCheck) != 0) { var h = eventSink.OnGetPreferredHeight(); req.Height = (int)h.MinSize; sizeCheckStep = SizeCheckStep.FinalAllocate; } } else { if ((enabledEvents & WidgetEvent.PreferredHeightCheck) != 0) { var h = eventSink.OnGetPreferredHeight(); req.Height = (int)h.MinSize; } if ((enabledEvents & WidgetEvent.PreferredWidthForHeightCheck) != 0) { if (doubleSizeRequestCheckSupported) { sizeCheckStep = SizeCheckStep.PreAllocate; realRequestedHeight = req.Height; // Store the height, since it will be used in the next iteration } else { var w = eventSink.OnGetPreferredWidthForHeight(req.Height); req.Width = (int)w.MinSize; sizeCheckStep = SizeCheckStep.FinalAllocate; } } else if ((enabledEvents & WidgetEvent.PreferredWidthCheck) != 0) { var w = eventSink.OnGetPreferredWidth(); req.Width = (int)w.MinSize; sizeCheckStep = SizeCheckStep.FinalAllocate; } } }); } args.Requisition = req; }
private void DetailsSizeRequested(object obj, Gtk.SizeRequestedArgs args) { if (maximized) { return; } // Add a placeholder widget Gtk.Label label = WidgetFu.NewLabel(""); Attach(label, 0, 2, current_row, ++current_row, fill, expand, 0, 0); Gtk.Table.TableChild[,] children = new Gtk.Table.TableChild[NColumns, NRows]; foreach (Gtk.Widget child in Children) { Gtk.Table.TableChild tc = this[child] as Gtk.Table.TableChild; children[tc.LeftAttach, tc.TopAttach] = tc; } // Expand the icon down to the bottom or the first label if (children[0, 0] != null && children[0, 0].Child == icon) { uint max_icon_row; for (max_icon_row = 1; max_icon_row < NRows; max_icon_row++) { if (children[0, max_icon_row] != null) { break; } } children[0, 0].BottomAttach = max_icon_row; } // Expand all labels (except in column 0) rightward for (uint row = 0; row < NRows; row++) { for (uint col = 1; col < NColumns; col++) { if (children[col, row] == null || !(children[col, row].Child is Gtk.Label)) { continue; } uint end = col + 1; while (end < NColumns && children[end, row] == null) { end++; } if (end > col + 1) { children[col, row].RightAttach = end; } } } // Vertically expand only the placeholder row for (uint row = 0; row < NRows; row++) { for (uint col = 1; col < NColumns; col++) { if (children[col, row] == null) { continue; } children[col, row].YOptions = (row == NRows - 1) ? expand : fill; } } maximized = true; }