Theme ClassDelta Engine Documentation
Holds a set of materials and colors for Scenes UI controls, as well as the font to be used. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Content ContentData
    DeltaEngine.Scenes.Controls Theme
      DeltaEngine.Scenes.Tests.Controls ThemeTests ThemeLoader

Namespace: DeltaEngine.Scenes.Controls
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class Theme : ContentData

The Theme type exposes the following members.

Constructors

  NameDescription
Public methodTheme
Initializes a new instance of the Theme class
Top
Methods

  NameDescription
Protected methodCreateDefault (Inherited from ContentData.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Overrides ContentData DisposeData .)
Public methodInternalCreateDefault (Inherited from ContentData.)
Protected methodLoadData (Overrides ContentData LoadData(Stream).)
Public methodLoadFromFile
Public methodToString (Inherited from ContentData.)
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Public propertyButton
Public propertyButtonDisabled
Public propertyButtonMouseover
Public propertyButtonPressed
Public propertyDropdownListBox
Public propertyDropdownListBoxDisabled
Public propertyFont
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyLabel
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Public propertyRadioButtonBackground
Public propertyRadioButtonBackgroundDisabled
Public propertyRadioButtonDisabled
Public propertyRadioButtonNotSelected
Public propertyRadioButtonNotSelectedMouseover
Public propertyRadioButtonSelected
Public propertyRadioButtonSelectedMouseover
Public propertyScrollbar
Public propertyScrollbarDisabled
Public propertyScrollbarPointer
Public propertyScrollbarPointerDisabled
Public propertyScrollbarPointerMouseover
Public propertySelectBox
Public propertySelectBoxDisabled
Public propertySlider
Public propertySliderDisabled
Public propertySliderPointer
Public propertySliderPointerDisabled
Public propertySliderPointerMouseover
Public propertyTextBox
Public propertyTextBoxDisabled
Public propertyTextBoxFocused
Top
Remarks

Tests: DeltaEngine.Scenes.Tests.Controls.ThemeTests
Examples

4 unit tests call DeltaEngine.Scenes.Controls.Theme
[Test, CloseAfterFirstFrame]
public void SaveAndLoadDefaultTheme()
{
    var theme = new Theme();
    var stream = BinaryDataExtensions.SaveToMemoryStream(theme);
    var loadedTheme = (Theme)stream.CreateFromMemoryStream();
    Assert.IsTrue(AreMaterialsEqual(theme.ButtonMouseover, loadedTheme.ButtonMouseover));
    Assert.IsTrue(AreMaterialsEqual(theme.ScrollbarPointer, loadedTheme.ScrollbarPointer));
    Assert.IsTrue(AreMaterialsEqual(theme.TextBoxFocused, loadedTheme.TextBoxFocused));
}
[Test, CloseAfterFirstFrame]
public void SaveAndLoadModifiedTheme()
{
    var theme = new Theme();
    theme.Slider = new Material(ShaderFlags.Position2DColoredTextured, "DeltaEngineLogo")
    {
        DefaultColor = Color.Red
    };
    var stream = BinaryDataExtensions.SaveToMemoryStream(theme);
    var loadedTheme = (Theme)stream.CreateFromMemoryStream();
    Assert.IsTrue(AreMaterialsEqual(theme.Slider, loadedTheme.Slider));
}
[Test, CloseAfterFirstFrame]
public void LoadTheme()
{
    Theme theme = CreateSampleTheme();
    var loadedData = new ThemeLoader().LoadValidData(dataStream);
    AssertLoadedThemeData(theme, loadedData);
}
See Also