Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to size Composite based on CSS background-image?
How to size Composite based on CSS background-image? [message #1095278] Mon, 26 August 2013 17:54 Go to next message
Erwin Hogeweg is currently offline Erwin Hogeweg
Messages: 32
Registered: July 2009
Member
Hi,

This question is related to http://www.eclipse.org/forums/index.php/t/511895/

The CSS definition below works like a charm:

Composite.backgroundImage{
	background-color: #123456;
	background-image: url( images/my-image.jpg );
	background-repeat: no-repeat;
	background-position: center center;
}

How do I size the Composite based on the image size though? If I specify the parent's layout as FillLayout the background image is perfectly centered, surrounded by background-color (as expected), and if I specify the parent's layout as GridLayout the dialog shows up as a 100*100 section of my-image.

I am sure there is a solution, I just haven't figured it out yet.

As always, you help is highly appreciated.


Kind Regards,

Erwin
Re: How to size Composite based on CSS background-image? [message #1097112 is a reply to message #1095278] Thu, 29 August 2013 04:42 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 379
Registered: July 2009
Senior Member
Hi.

If you know the size of the image you can just give the Composite a
GridData with width/height hints. I don't think it's possible to make it
set the size automatically based on a theming image.

Greetings,
Tim



Am 26.08.2013 23:54, schrieb Erwin Hogeweg:
> Hi,
>
> This question is related to
> http://www.eclipse.org/forums/index.php/t/511895/
>
> The CSS definition below works like a charm:
>
> Composite.backgroundImage{
> background-color: #123456;
> background-image: url( images/my-image.jpg );
> background-repeat: no-repeat;
> background-position: center center;
> }
>
> How do I size the Composite based on the image size though? If I specify
> the parent's layout as FillLayout the background image is perfectly
> centered, surrounded by background-color (as expected), and if I specify
> the parent's layout as GridLayout the dialog shows up as a 100*100
> section of my-image.
>
> I am sure there is a solution, I just haven't figured it out yet.
>
> As always, you help is highly appreciated.
>
>
> Kind Regards,
>
> Erwin

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to size Composite based on CSS background-image? [message #1097573 is a reply to message #1097112] Thu, 29 August 2013 18:53 Go to previous messageGo to next message
Erwin Hogeweg is currently offline Erwin Hogeweg
Messages: 32
Registered: July 2009
Member
Thanks for your reply Tim,

> If you know the size of the image you can just give the Composite a GridData with width/height hints. I don't think it's possible to make it set the size automatically based on a theming image.

That is what I am doing now. It is not optimal because I have to tell the graphix guy to stick to those dimensions. It is workable though.

Cheers,

Erwin
Re: How to size Composite based on CSS background-image? [message #1101268 is a reply to message #1097573] Wed, 04 September 2013 04:24 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 379
Registered: July 2009
Senior Member
>
> That is what I am doing now. It is not optimal because I have to tell
> the graphix guy to stick to those dimensions. It is workable though.

I guess you could use setBackgroundImage instead of theming, in which
case the size of the image is known.

Greetings,
Tim

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: How to size Composite based on CSS background-image? [message #1101445 is a reply to message #1101268] Wed, 04 September 2013 09:18 Go to previous message
Erwin Hogeweg is currently offline Erwin Hogeweg
Messages: 32
Registered: July 2009
Member
Tim,

Yes, I could do that, but than I would loose the capability to brand the app through CSS (unless I am missing something here...).

Regards,

Erwin
Previous Topic:(Download-)Links in Table- and TreeViewer
Next Topic:Label textsize
Goto Forum:
  


Current Time: Tue Jul 22 15:36:50 EDT 2014

Powered by FUDForum. Page generated in 0.04448 seconds