Home » Eclipse Projects » Nebula » Newbie Gallery questions
|
Re: Newbie Gallery questions [message #479480 is a reply to message #479472] |
Tue, 11 August 2009 10:05 |
Nicolas Richeton Messages: 179 Registered: July 2009 |
Senior Member |
|
|
Hi Thomas,
This is exactly why Gallery supports pluggable item renderers. In your case, you should just create a new ItemRenderer by extending AbstractItemRenderer.
During redraw, 'draw' is invoked for each item.
public void draw(GC gc, GalleryItem item, int index, int x, int y,
int width, int height) {
you get an untouched area you can paint as you wish, without resizing.
width and height are the one defined with setItemSize(). If you want to draw labels, just add a little room for them.
(You can even contribute your item renderer to Nebula )
--
Nicolas
|
|
|
Re: Newbie Gallery questions [message #479653 is a reply to message #479480] |
Tue, 11 August 2009 20:24 |
Thomas Christensen Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Nicolas Richeton wrote:
> Hi Thomas,
> This is exactly why Gallery supports pluggable item renderers. In your case,
you should just create a new ItemRenderer by extending AbstractItemRenderer.
> During redraw, 'draw' is invoked for each item.
> public void draw(GC gc, GalleryItem item, int index, int x, int y,
> int width, int height) {
> you get an untouched area you can paint as you wish, without resizing.
> width and height are the one defined with setItemSize(). If you want to draw
labels, just add a little room for them.
Works like a charm, thanks.
> (You can even contribute your item renderer to Nebula :) )
If I get proud of it I will consider :-)
|
|
|
Re: Newbie Gallery questions [message #598115 is a reply to message #479472] |
Tue, 11 August 2009 10:05 |
Nicolas Richeton Messages: 179 Registered: July 2009 |
Senior Member |
|
|
Hi Thomas,
This is exactly why Gallery supports pluggable item renderers. In your case, you should just create a new ItemRenderer by extending AbstractItemRenderer.
During redraw, 'draw' is invoked for each item.
public void draw(GC gc, GalleryItem item, int index, int x, int y,
int width, int height) {
you get an untouched area you can paint as you wish, without resizing.
width and height are the one defined with setItemSize(). If you want to draw labels, just add a little room for them.
(You can even contribute your item renderer to Nebula :) )
--
Nicolas
|
|
|
Re: Newbie Gallery questions [message #598133 is a reply to message #598115] |
Tue, 11 August 2009 20:24 |
Thomas Christensen Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Nicolas Richeton wrote:
> Hi Thomas,
> This is exactly why Gallery supports pluggable item renderers. In your case,
you should just create a new ItemRenderer by extending AbstractItemRenderer.
> During redraw, 'draw' is invoked for each item.
> public void draw(GC gc, GalleryItem item, int index, int x, int y,
> int width, int height) {
> you get an untouched area you can paint as you wish, without resizing.
> width and height are the one defined with setItemSize(). If you want to draw
labels, just add a little room for them.
Works like a charm, thanks.
> (You can even contribute your item renderer to Nebula :) )
If I get proud of it I will consider :-)
|
|
|
Goto Forum:
Current Time: Tue Apr 23 13:30:14 GMT 2024
Powered by FUDForum. Page generated in 0.03368 seconds
|