[Gtk-sharp-list] Gtk# 2.99.0 released!

Curtis Wensley curtis.wensley at gmail.com
Sat Nov 17 17:39:11 UTC 2012


Bertrand-2 wrote
> I've just committed a fix for that. It's in a tricky area (GInterface
> support), hopefully I haven't introduced any regression.

Thanks for the quick fix on that!  It works great.


Bertrand-2 wrote
>> The other thing I noticed, was that there is no longer an easy way to set
>> a
>> minimum size for a control unless it is subclassed and override
>> OnGetPreferredWidth/Height.  I used to do this via the SizeRequested
>> event.
> 
> What do you mean by that ? Could you give some sample code ?

What I mean is I have code like this (makes a control have a minimum size),
which is shared code for all controls:

	Control.SizeRequested += (o, args) => {
		var alloc = args.Requisition;
		alloc.Width = Math.Max (alloc.Width, MinimumSize.Width);
		alloc.Height = Math.Max (alloc.Height, MinimumSize.Height);
		args.Requisition = alloc;
	};

To do this with gtk# 3, I'd have to subclass each control:

	class MyNotebook : Gtk.Notebook
	{
		public Gdk.Size MinimumSize { get; set; }

		protected override void OnGetPreferredHeight (out int minimum_height, out
int natural_height)
		{
			base.OnGetPreferredHeight (out minimum_height, out natural_height);
			minimum_height = MinimumSize.Height;
		}

		protected override void OnGetPreferredWidth (out int minimum_width, out
int natural_width)
		{
			base.OnGetPreferredWidth (out minimum_width, out natural_width);
			minimum_width = MinimumSize.Width;
		}
	}

It would be nice to have corresponding event(s) for the new
GetPreferredWidth/Height apis (as well as OnAdjustSizeAllocation,
OnAdjustSizeRequest, etc), so one could do something like this:

	Control.PreferredHeightRequested += (o, args) => {
		args.MinimumHeight = MinimumSize.Height;
	};
	Control.PreferredWidthRequested += (o, args) => {
		args.MinimumWidth = MinimumSize.Widgth;
	};

Thoughts?
Curtis.



--
View this message in context: http://mono.1490590.n4.nabble.com/Gtk-2-99-0-released-tp4657077p4657431.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list