Package org.eclipse.e4.ui.css.swt.theme

# Interface IThemeEngine

public interface IThemeEngine
The theme engine collects available themes (who are composed of stylesheets) and provides the possibility to change the theme

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`IThemeEngine.Events`
The IThemeEngine may broadcast an event using the OSGi EventAdmin service, if available, to notify of theme changes.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DEFAULT_THEME_ID`

## Method Summary

Modifier and Type
Method
Description
`void`
`addCSSEngine(CSSEngine cssswtEngine)`
`void`
`applyStyles(Object widget, boolean applyStylesToChildNodes)`
Force reapplying the style to the widget and its children
`ITheme`
`getActiveTheme()`
`CSSStyleDeclaration`
`getStyle(Object widget)`
Get the style currently active for a widget
`List<ITheme>`
`getThemes()`
`void`
`registerResourceLocator(IResourceLocator locator, String... themes)`
Register a resource locator used to look up image sources
`void`
`registerStylesheet(String uri, String... themes)`
Register a stylesheet
`ITheme`
`registerTheme(String id, String label, String basestylesheetURI)`
Register a theme
`void`
`removeCSSEngine(CSSEngine cssswtEngine)`
`void`
`restore(String alternate)`
Restore the previously stored theme
`void`
`setTheme(String themeId, boolean restore)`
Set a theme by its id and restore it for the next time the engine is initialized (`restore(String)`)
`void`
`setTheme(ITheme theme, boolean restore)`
Set a theme and restore it for the next time the engine is initialized ( `restore(String)`)

## Field Details

### DEFAULT_THEME_ID

static final String DEFAULT_THEME_ID

See Also:
  - Constant Field Values

## Method Details

### registerTheme

ITheme registerTheme(String id, String label, String basestylesheetURI) throws IllegalArgumentException
Register a theme

Parameters:
  `id` - the id of the theme
  `label` - the label
  `basestylesheetURI` - the base stylesheet uri
Returns:
  the theme instance registered
Throws:
  `IllegalArgumentException` - if a theme with this id is already registered

### registerStylesheet

void registerStylesheet(String uri, String... themes)
Register a stylesheet

Parameters:
  `uri` - the stylsheet uri
  `themes` - the theme ids the stylesheet is added to or empty if should be added to all

### registerResourceLocator

void registerResourceLocator(IResourceLocator locator, String... themes)
Register a resource locator used to look up image sources

Parameters:
  `locator` - the locator
  `themes` - the theme ids the locator is registered for or empty if should be added to all

### getThemes

List<ITheme> getThemes()

Returns:
  Unmodifiable list of themes

### setTheme

void setTheme(String themeId, boolean restore)
Set a theme by its id and restore it for the next time the engine is initialized (`restore(String)`)

Parameters:
  `themeId` - the theme id
  `restore` - restore the theme set for the next time `restore(String)`

### setTheme

void setTheme(ITheme theme, boolean restore)
Set a theme and restore it for the next time the engine is initialized ( `restore(String)`)

Parameters:
  `theme` - the theme
  `restore` - restore the theme set for the next time `restore(String)`

### applyStyles

void applyStyles(Object widget, boolean applyStylesToChildNodes)
Force reapplying the style to the widget and its children

Parameters:
  `widget` - the widget
  `applyStylesToChildNodes` - if the children should be updated as well

### getStyle

CSSStyleDeclaration getStyle(Object widget)
Get the style currently active for a widget

Parameters:
  `widget` - the widget
Returns:
  the declaration or `null`

### restore

void restore(String alternate)
Restore the previously stored theme

Parameters:
  `alternate` - the alternate theme if the restored one is not found

### getActiveTheme

ITheme getActiveTheme()

Returns:
  the current active theme or `null` if no active theme

### addCSSEngine

void addCSSEngine(CSSEngine cssswtEngine)

### removeCSSEngine

void removeCSSEngine(CSSEngine cssswtEngine)