The Stylesheet class represents all style information.
More...
#include <foleys_Stylesheet.h>
Inherits Listener.
|
| Stylesheet (MagicGUIBuilder &builder) |
|
| ~Stylesheet () override |
|
void | setStyle (const juce::ValueTree &node) |
| The Stylesheet node in the XML can contain several Styles to select from.
|
|
bool | setMediaSize (int width, int height) |
| Set the size of the UI.
|
|
void | updateValidRanges () |
| Reads the range, in which the properties won't change due to conditional classes.
|
|
void | updateStyleClasses () |
| Read the style classes and connect variables.
|
|
void | setColourPalette () |
| Updates the colourPalette.
|
|
void | addPaletteEntry (const juce::String &name, juce::Colour colour, bool keepIfExists) |
|
juce::ValueTree | getCurrentPalette () |
|
juce::StringArray | getPaletteEntryNames () const |
| Returns all variables for selection in colour values.
|
|
juce::var | getStyleProperty (const juce::Identifier &name, const juce::ValueTree &node, bool inherit=true, juce::ValueTree *definedHere=nullptr) const |
| This method traverses the dom and checks each style, if that property was defined.
|
|
juce::LookAndFeel * | getLookAndFeel (const juce::ValueTree &node) const |
| Return the LookAndFeel for the node.
|
|
juce::Image | getBackgroundImage (const juce::ValueTree &node) const |
| Finds a background image for the given node.
|
|
juce::Colour | getColour (const juce::String &name) const |
| Lookup a colour.
|
|
juce::ValueTree | getCurrentStyle () const |
|
juce::ValueTree | addNewStyleClass (const juce::String &name, juce::UndoManager *undo) |
| Add a new style class node, so elements of your GUI can inherit that class.
|
|
void | deleteStyleClass (const juce::String &name, juce::UndoManager *undo) |
| Delete a style class.
|
|
void | registerLookAndFeel (juce::String name, std::unique_ptr< juce::LookAndFeel > lookAndFeel) |
| With that method you can register your custom LookAndFeel class and apply it to different components.
|
|
juce::StringArray | getAllClassesNames () const |
|
juce::StringArray | getLookAndFeelNames () const |
|
bool | isClassNode (const juce::ValueTree &node) const |
|
bool | isTypeNode (const juce::ValueTree &node) const |
|
bool | isIdNode (const juce::ValueTree &node) const |
|
bool | isColourPaletteNode (const juce::ValueTree &node) const |
|
void | addListener (juce::ValueTree::Listener *listener) |
|
void | removeListener (juce::ValueTree::Listener *listener) |
|
|
static juce::Colour | parseColour (const juce::String &name) |
| This is a slightly more intelligent colour lookup than the JUCE one, as it allows to use colour names, as well as 6 digit colour tuples (JUCE will use red as alpha in that case)
|
|
The Stylesheet class represents all style information.
It is organised in types, which corresponds to the Components created, classes that can be referenced by any node, and nodes referenced by id.
◆ Stylesheet()
◆ ~Stylesheet()
◆ setStyle()
void setStyle |
( |
const juce::ValueTree & | node | ) |
|
◆ setMediaSize()
bool setMediaSize |
( |
int | width, |
|
|
int | height ) |
Set the size of the UI.
This will be used to resolve the properties from the style classes.
- Parameters
-
width | is the width of the UI |
height | is the height of the UI |
- Returns
- false, if the properties are likely to have changed (because a conditional class became valid or invalid)
◆ updateValidRanges()
void updateValidRanges |
( |
| ) |
|
Reads the range, in which the properties won't change due to conditional classes.
◆ updateStyleClasses()
void updateStyleClasses |
( |
| ) |
|
Read the style classes and connect variables.
◆ setColourPalette()
void setColourPalette |
( |
| ) |
|
◆ addPaletteEntry()
void addPaletteEntry |
( |
const juce::String & | name, |
|
|
juce::Colour | colour, |
|
|
bool | keepIfExists ) |
◆ getCurrentPalette()
juce::ValueTree getCurrentPalette |
( |
| ) |
|
◆ getPaletteEntryNames()
juce::StringArray getPaletteEntryNames |
( |
| ) |
const |
Returns all variables for selection in colour values.
◆ getStyleProperty()
juce::var getStyleProperty |
( |
const juce::Identifier & | name, |
|
|
const juce::ValueTree & | node, |
|
|
bool | inherit = true, |
|
|
juce::ValueTree * | definedHere = nullptr ) const |
This method traverses the dom and checks each style, if that property was defined.
- Parameters
-
name | the name of the property. |
node | is the node in the DOM. This is used for inheritance by traversing upwards. |
inherit | if this is true, it will impact child nodes as well |
definedHere | this is a hint for the editor where the property was actually set |
References getStyleProperty().
Referenced by getBackgroundImage(), getLookAndFeel(), and getStyleProperty().
◆ getLookAndFeel()
juce::LookAndFeel * getLookAndFeel |
( |
const juce::ValueTree & | node | ) |
const |
Return the LookAndFeel for the node.
Make sure never to remove a LookAndFeel, especially as long as the ComponentTree is still referencing any of them.
- Parameters
-
node | is the node in the GUI DOM |
References getStyleProperty().
◆ getBackgroundImage()
juce::Image getBackgroundImage |
( |
const juce::ValueTree & | node | ) |
const |
Finds a background image for the given node.
Note that this will only return anything useful, if you have added any actual images into the BinaryData and have enabled the FOLEYS_ENABLE_BINARY_DATA setting in the module page.
- Parameters
-
node | is the node in the GUI DOM |
References getStyleProperty().
◆ parseColour()
juce::Colour parseColour |
( |
const juce::String & | name | ) |
|
|
static |
This is a slightly more intelligent colour lookup than the JUCE one, as it allows to use colour names, as well as 6 digit colour tuples (JUCE will use red as alpha in that case)
- Parameters
-
name | a string representing the colour, can be an actual name or a RGB tuple or ARGB tuple. |
Referenced by getColour(), and RootItem::updateColours().
◆ getColour()
juce::Colour getColour |
( |
const juce::String & | name | ) |
const |
◆ getCurrentStyle()
juce::ValueTree getCurrentStyle |
( |
| ) |
const |
◆ addNewStyleClass()
juce::ValueTree addNewStyleClass |
( |
const juce::String & | name, |
|
|
juce::UndoManager * | undo ) |
Add a new style class node, so elements of your GUI can inherit that class.
- Parameters
-
name | is the name of the new class. Make sure you only use XML conform identifiers, i.e. characters, numbers but not starting with a number, dash and underscore only. |
undo | the UndoManager to track the action |
◆ deleteStyleClass()
void deleteStyleClass |
( |
const juce::String & | name, |
|
|
juce::UndoManager * | undo ) |
Delete a style class.
This will not delete references to the class.
- Parameters
-
name | the name of the class to be deleted. |
undo | the UndoManager to track the action |
◆ registerLookAndFeel()
void registerLookAndFeel |
( |
juce::String | name, |
|
|
std::unique_ptr< juce::LookAndFeel > | lookAndFeel ) |
With that method you can register your custom LookAndFeel class and apply it to different components.
- Parameters
-
◆ getAllClassesNames()
juce::StringArray getAllClassesNames |
( |
| ) |
const |
◆ getLookAndFeelNames()
juce::StringArray getLookAndFeelNames |
( |
| ) |
const |
◆ isClassNode()
bool isClassNode |
( |
const juce::ValueTree & | node | ) |
const |
◆ isTypeNode()
bool isTypeNode |
( |
const juce::ValueTree & | node | ) |
const |
◆ isIdNode()
bool isIdNode |
( |
const juce::ValueTree & | node | ) |
const |
◆ isColourPaletteNode()
bool isColourPaletteNode |
( |
const juce::ValueTree & | node | ) |
const |
◆ addListener()
void addListener |
( |
juce::ValueTree::Listener * | listener | ) |
|
◆ removeListener()
void removeListener |
( |
juce::ValueTree::Listener * | listener | ) |
|
The documentation for this class was generated from the following files: