Auto-Sizing Thumbnails [message #186318] |
Mon, 04 July 2005 18:50 |
Eclipse User |
|
|
|
Originally posted by: rcpnewsgroup_js.unsyn.com
Hi,
I need to resize the contents of a viewer, so that they always fit in an
outline view. The desired resize effect is pretty much the one from the
logic example's thumbnail view, but there it is done by putting the
Thumbnail directly on a LWS inside a Canvas, in what I think is the
draw2d way. However, since I'd like to allow some editing inside the
outline, I would prefer to build this using an EditPart hierarchy.
Now my problem is that I can't find a way to add my contents to the
controllistener of the canvas to be notified of resize events.
I am using a Layer with a ToolbarLayout to display a number of
Thumbnails in a horizontal row. The Thumbnails are supposed to scale to
fill the height of the view, while maintaining their aspect ratio. If
necessary, the view has a horizontal scrollbar. I am not sure if a
layoutmanager can do all this, so probably I need to calculate the
thumbnail constraints manually from the viewport's size. This is why it
would be cool to somehow listen to the resize events.
I hope there's an easy solution to this and I'm just being blind.
Thanks for any help,
Johannes
|
|
|
Re: Auto-Sizing Thumbnails [message #186843 is a reply to message #186318] |
Thu, 07 July 2005 06:04 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Draw2d and GEF are not exclusive and you don't need to add a listener
yourself. When the control is resized, your figure will be validated. The
layout manager will be asked for the preferred size. Calculate the new size
(the height is available as hHint when your viewport's tracking height), and
the parent will be resized accordingly. In your layout method, then resize
the children (thumbnails) based on the height of the client area.
"J. Stein" <rcpnewsgroup_js@unsyn.com> wrote in message
news:dac0nd$8v4$1@news.eclipse.org...
> Hi,
> I need to resize the contents of a viewer, so that they always fit in an
> outline view. The desired resize effect is pretty much the one from the
> logic example's thumbnail view, but there it is done by putting the
> Thumbnail directly on a LWS inside a Canvas, in what I think is the
> draw2d way. However, since I'd like to allow some editing inside the
> outline, I would prefer to build this using an EditPart hierarchy.
> Now my problem is that I can't find a way to add my contents to the
> controllistener of the canvas to be notified of resize events.
> I am using a Layer with a ToolbarLayout to display a number of
> Thumbnails in a horizontal row. The Thumbnails are supposed to scale to
> fill the height of the view, while maintaining their aspect ratio. If
> necessary, the view has a horizontal scrollbar. I am not sure if a
> layoutmanager can do all this, so probably I need to calculate the
> thumbnail constraints manually from the viewport's size. This is why it
> would be cool to somehow listen to the resize events.
>
> I hope there's an easy solution to this and I'm just being blind.
>
> Thanks for any help,
> Johannes
|
|
|
Powered by
FUDForum. Page generated in 0.02690 seconds