Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Composite background & dark theme
Composite background & dark theme [message #1807246] Sun, 26 May 2019 06:25 Go to next message
Cyril LAGARDE is currently offline Cyril LAGARDEFriend
Messages: 14
Registered: January 2016
Junior Member
Hello

sry for my english :)

I am developing a small plugin and i have pb with composite background and dark theme.
If I do
Composite c = new Composite(parent, SWT.None)
, the dark theme is taken into account
but if I change to
Composite c = new Composite(parent, SWT.None) {}
or
Composite c = new SpecialComposite(parent, SWT.None);

class SpecialComposite extends Composite
{
 ...
}
the dark theme is not applied to my composite.

Possible to workaround?

thanks
Re: Composite background & dark theme [message #1807287 is a reply to message #1807246] Mon, 27 May 2019 14:12 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 877
Registered: January 2012
Senior Member

Most themes apply CSS using SWT Widget names, like `Composite`. By making a subclass of Composite, you introduce a new class with a different name and so those CSS rules won't match.

Why are you subclassing Composite?

Brian.
Re: Composite background & dark theme [message #1807297 is a reply to message #1807287] Mon, 27 May 2019 16:45 Go to previous messageGo to next message
Cyril LAGARDE is currently offline Cyril LAGARDEFriend
Messages: 14
Registered: January 2016
Junior Member
Hi Brian

Thanks for response

> you introduce a new class with a different name and so those CSS rules won't match.
Do I need to define CSS for each theme (light, dark, etc...)?


> Why are you subclassing Composite?
In fact, I subclass Section to access to protected field and I had pb with it but not with no subClass Section so I have tested with Composite class to post the problem.


Re: Composite background & dark theme [message #1822341 is a reply to message #1807297] Wed, 04 March 2020 13:38 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 43
Registered: July 2011
Member
I made Custom Element Provider, CustomCompositeElement, and overrided computeLocalName().
And made marker annnotation @CSSComposite.

Bit hacky but worked well.

By default, computeLocalName method returns SimpleClassName of the Widget.
Change this if you want to disguise your Custom Composite as Normal SWT Composite.
Previous Topic:Trying to theme SWT (CSS?)
Next Topic:ProgressMonitorDialog broke with update
Goto Forum:
  


Current Time: Wed Apr 14 05:59:28 GMT 2021

Powered by FUDForum. Page generated in 0.02442 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top