GalleryItem & DefaultGalleryItemRenderer Problem [message #52792] |
Mon, 12 May 2008 08:24  |
Eclipse User |
|
|
|
Originally posted by: sandeep.goel.barco.com
Hi,
I am using nebula widgets (Gallery) to give view like ICON view in
Windows.
by the following code.
public static void main (final String[] args)
{
final Display display = new Display();
final Image itemImage = new Image(display,
Program.findProgram("gif").getImageData());
final Shell shell = new Shell(display);
shell.setSize(400, 300);
shell.setLayout(new FillLayout());
final Gallery gallery = new Gallery(shell, SWT.V_SCROLL | SWT.MULTI);
// Renderers
final NoGroupRenderer gr = new NoGroupRenderer();
gr.setMinMargin(2);
gr.setItemSize(76, 56);
gr.setAutoMargin(true);
gallery.setGroupRenderer(gr);
final DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
gallery.setItemRenderer(ir);
for (int g = 0; g {
final GalleryItem group = new GalleryItem(gallery, SWT.NONE);
group.setText("Group " + g);
group.setExpanded(true);
for (int i = 0; i {
final GalleryItem item = new GalleryItem(group, SWT.NONE);
if (itemImage != null)
{
item.setImage(itemImage);
}
item.setText("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
}
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
if (itemImage != null)
{
itemImage.dispose();
}
display.dispose();
}
here problem is that when I select an item I get a rectanle around it.(By
modifying implementation of render class I removed that recatangle.) But
now I need to make that image of the selected item must be selected as in
the windows means only image must get a thin blue layer on it which makes
it as selected.
Can any body help me??
Thanks..
With BR
Sandeep Goel...
|
|
|
Re: GalleryItem & DefaultGalleryItemRenderer Problem [message #53676 is a reply to message #52792] |
Thu, 22 May 2008 03:11  |
Eclipse User |
|
|
|
Hi,
You'll have to create a custom item renderer, paint the image first and
then draw a rectangle on it with the right pattern / transparency /
color settings.
There was an anwser to your post on the rcp group, saying that you can
use SWT.COLOR_LIST_SELECTION to get the right color
see fillRectancle(...), setBackground(), setBackgroundPattern()
in
http://help.eclipse.org/stable/nftopic/org.eclipse.platform. doc.isv/reference/api/org/eclipse/swt/graphics/GC.html
--
Nicolas
Sandeep Goel a écrit :
> Hi, I am using nebula widgets (Gallery) to give view like ICON view in
> Windows. by the following code. public static void main (final String[]
> args) { final Display display = new Display(); final Image itemImage =
> new Image(display, Program.findProgram("gif").getImageData());
> final Shell shell = new Shell(display); shell.setSize(400, 300);
> shell.setLayout(new FillLayout()); final Gallery gallery = new
> Gallery(shell, SWT.V_SCROLL | SWT.MULTI); // Renderers final
> NoGroupRenderer gr = new NoGroupRenderer(); gr.setMinMargin(2);
> gr.setItemSize(76, 56); gr.setAutoMargin(true);
> gallery.setGroupRenderer(gr);
> final DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
> gallery.setItemRenderer(ir);
> for (int g = 0; g { final GalleryItem group = new GalleryItem(gallery,
> SWT.NONE); group.setText("Group " + g); group.setExpanded(true);
> for (int i = 0; i { final GalleryItem item = new GalleryItem(group,
> SWT.NONE); if (itemImage != null) { item.setImage(itemImage); }
> item.setText("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } }
> shell.open(); while (!shell.isDisposed()) { if
> (!display.readAndDispatch()) { display.sleep(); } }
> if (itemImage != null) { itemImage.dispose(); } display.dispose(); }
> here problem is that when I select an item I get a rectanle around
> it.(By modifying implementation of render class I removed that
> recatangle.) But now I need to make that image of the selected item must
> be selected as in the windows means only image must get a thin blue
> layer on it which makes it as selected.
> Can any body help me?? Thanks.. With BR Sandeep Goel...
|
|
|
Re: GalleryItem & DefaultGalleryItemRenderer Problem [message #590057 is a reply to message #52792] |
Thu, 22 May 2008 03:11  |
Eclipse User |
|
|
|
Hi,
You'll have to create a custom item renderer, paint the image first and
then draw a rectangle on it with the right pattern / transparency /
color settings.
There was an anwser to your post on the rcp group, saying that you can
use SWT.COLOR_LIST_SELECTION to get the right color
see fillRectancle(...), setBackground(), setBackgroundPattern()
in
http://help.eclipse.org/stable/nftopic/org.eclipse.platform. doc.isv/reference/api/org/eclipse/swt/graphics/GC.html
--
Nicolas
Sandeep Goel a écrit :
> Hi, I am using nebula widgets (Gallery) to give view like ICON view in
> Windows. by the following code. public static void main (final String[]
> args) { final Display display = new Display(); final Image itemImage =
> new Image(display, Program.findProgram("gif").getImageData());
> final Shell shell = new Shell(display); shell.setSize(400, 300);
> shell.setLayout(new FillLayout()); final Gallery gallery = new
> Gallery(shell, SWT.V_SCROLL | SWT.MULTI); // Renderers final
> NoGroupRenderer gr = new NoGroupRenderer(); gr.setMinMargin(2);
> gr.setItemSize(76, 56); gr.setAutoMargin(true);
> gallery.setGroupRenderer(gr);
> final DefaultGalleryItemRenderer ir = new DefaultGalleryItemRenderer();
> gallery.setItemRenderer(ir);
> for (int g = 0; g { final GalleryItem group = new GalleryItem(gallery,
> SWT.NONE); group.setText("Group " + g); group.setExpanded(true);
> for (int i = 0; i { final GalleryItem item = new GalleryItem(group,
> SWT.NONE); if (itemImage != null) { item.setImage(itemImage); }
> item.setText("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } }
> shell.open(); while (!shell.isDisposed()) { if
> (!display.readAndDispatch()) { display.sleep(); } }
> if (itemImage != null) { itemImage.dispose(); } display.dispose(); }
> here problem is that when I select an item I get a rectanle around
> it.(By modifying implementation of render class I removed that
> recatangle.) But now I need to make that image of the selected item must
> be selected as in the windows means only image must get a thin blue
> layer on it which makes it as selected.
> Can any body help me?? Thanks.. With BR Sandeep Goel...
|
|
|
Powered by
FUDForum. Page generated in 0.04472 seconds