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 ClassesModifier and TypeInterfaceDescriptionstatic interface
The IThemeEngine may broadcast an event using the OSGi EventAdmin service, if available, to notify of theme changes. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCSSEngine
(CSSEngine cssswtEngine) void
applyStyles
(Object widget, boolean applyStylesToChildNodes) Force reapplying the style to the widget and its childrenGet the style currently active for a widgetvoid
registerResourceLocator
(IResourceLocator locator, String... themes) Register a resource locator used to look up image sourcesvoid
registerStylesheet
(String uri, String... themes) Register a stylesheetregisterTheme
(String id, String label, String basestylesheetURI) Register a themevoid
removeCSSEngine
(CSSEngine cssswtEngine) void
Restore the previously stored themevoid
Set a theme by its id and restore it for the next time the engine is initialized (restore(String)
)void
Set a theme and restore it for the next time the engine is initialized (restore(String)
)
-
Field Details
-
DEFAULT_THEME_ID
- See Also:
-
-
Method Details
-
registerTheme
ITheme registerTheme(String id, String label, String basestylesheetURI) throws IllegalArgumentException Register a theme- Parameters:
id
- the id of the themelabel
- the labelbasestylesheetURI
- the base stylesheet uri- Returns:
- the theme instance registered
- Throws:
IllegalArgumentException
- if a theme with this id is already registered
-
registerStylesheet
Register a stylesheet- Parameters:
uri
- the stylsheet urithemes
- the theme ids the stylesheet is added to or empty if should be added to all
-
registerResourceLocator
Register a resource locator used to look up image sources- Parameters:
locator
- the locatorthemes
- the theme ids the locator is registered for or empty if should be added to all
-
getThemes
- Returns:
- Unmodifiable list of themes
-
setTheme
Set a theme by its id and restore it for the next time the engine is initialized (restore(String)
)- Parameters:
themeId
- the theme idrestore
- restore the theme set for the next timerestore(String)
-
setTheme
Set a theme and restore it for the next time the engine is initialized (restore(String)
)- Parameters:
theme
- the themerestore
- restore the theme set for the next timerestore(String)
-
applyStyles
Force reapplying the style to the widget and its children- Parameters:
widget
- the widgetapplyStylesToChildNodes
- if the children should be updated as well
-
getStyle
Get the style currently active for a widget- Parameters:
widget
- the widget- Returns:
- the declaration or
null
-
restore
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
-
removeCSSEngine
-