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 interfaceThe IThemeEngine may broadcast an event using the OSGi EventAdmin service, if available, to notify of theme changes. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCSSEngine(CSSEngine cssswtEngine) voidapplyStyles(Object widget, boolean applyStylesToChildNodes) Force reapplying the style to the widget and its childrenGet the style currently active for a widgetvoidregisterResourceLocator(IResourceLocator locator, String... themes) Register a resource locator used to look up image sourcesvoidregisterStylesheet(String uri, String... themes) Register a stylesheetregisterTheme(String id, String label, String basestylesheetURI) Register a themevoidremoveCSSEngine(CSSEngine cssswtEngine) voidRestore the previously stored themevoidSet a theme by its id and restore it for the next time the engine is initialized (restore(String))voidSet 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
nullif no active theme
-
addCSSEngine
-
removeCSSEngine
-