Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Composite background & dark theme
Composite background & dark theme [message #1807246] Sun, 26 May 2019 02:25 Go to next message
Eclipse UserFriend
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 10:12 Go to previous messageGo to next message
Eclipse UserFriend
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 12:45 Go to previous messageGo to next message
Eclipse UserFriend
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 08:38 Go to previous message
Eclipse UserFriend
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: Thu Jul 10 00:06:54 EDT 2025

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

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

Back to the top