The GuiItem class will draw borders and descriptions around widgets, if defined. More...
#include <foleys_GuiItem.h>
Public Member Functions | |
GuiItem (MagicGUIBuilder &builder, juce::ValueTree node) | |
~GuiItem () override | |
virtual juce::Component * | getWrappedComponent ()=0 |
Allows accessing the Component inside that GuiItem. | |
virtual void | update ()=0 |
In update() the ValueTree properties should be used to set all properties to the component. | |
virtual void | updateColours () |
Set colours in the wrapped Component to the value from the stylesheet and palette. | |
virtual std::vector< SettableProperty > | getSettableProperties () const |
Override this to return each settable option the designer should be able to configure on your component. | |
void | setColourTranslation (std::vector< std::pair< juce::String, int > > mapping) |
For each factory you can register a translation table, which will forward the colours from the Stylesheet to the Components. | |
juce::StringArray | getColourNames () const |
Return the names of configurable colours. | |
virtual juce::String | getControlledParameterID (juce::Point< int >) |
Returns the parameterID that is controlled from this component. | |
juce::var | getProperty (const juce::Identifier &property) |
Look up a value through the DOM and CSS. | |
MagicGUIState & | getMagicState () |
virtual GuiItem * | findGuiItemWithId (const juce::String &name) |
Lookup a Component through the tree. | |
void | updateInternal () |
Reread properties from the config ValueTree. | |
void | paint (juce::Graphics &g) final |
void | resized () override |
virtual bool | isContainer () const |
virtual void | createSubComponents () |
virtual void | updateLayout () |
This will trigger a recalculation of the children layout regardless of resized. | |
LayoutType | getParentsLayoutType () const |
Returns the layout type this item is managed by. | |
void | configureFlexBoxItem (const juce::ValueTree &node) |
Parse the values and set it to the FlexBox::Item for layouting. | |
void | configurePosition (const juce::ValueTree &node) |
juce::Rectangle< int > | resolvePosition (juce::Rectangle< int > parent) |
Calculates the position according to the parent area. | |
juce::Rectangle< int > | getClientBounds () const |
Returns the bounds of the wrapped Component. | |
juce::String | getTabCaption (const juce::String &defaultName) const |
juce::Colour | getTabColour () const |
juce::FlexItem & | getFlexItem () |
void | itemDragEnter (const juce::DragAndDropTarget::SourceDetails &details) override |
void | itemDragExit (const juce::DragAndDropTarget::SourceDetails &details) override |
void | paintOverChildren (juce::Graphics &g) override |
virtual GuiItem * | findGuiItem (const juce::ValueTree &node) |
Seeks recursively for a GuiItem. | |
virtual void | setEditMode (bool shouldEdit) |
This method sets the GUI in edit mode, that allows to drag the components around. | |
void | setDraggable (bool selected) |
void | mouseDown (const juce::MouseEvent &event) override |
void | mouseDrag (const juce::MouseEvent &event) override |
void | mouseUp (const juce::MouseEvent &event) override |
bool | isInterestedInDragSource (const juce::DragAndDropTarget::SourceDetails &dragSourceDetails) override |
void | itemDropped (const juce::DragAndDropTarget::SourceDetails &dragSourceDetails) override |
Public Attributes | |
MagicGUIBuilder & | magicBuilder |
Protected Attributes | |
juce::ValueTree | configNode |
Decorator | decorator |
juce::FlexItem | flexItem { juce::FlexItem (*this).withFlex (1.0f) } |
std::vector< std::pair< juce::String, int > > | colourTranslation |
The GuiItem class will draw borders and descriptions around widgets, if defined.
It also owns the Component and the Attachment, in case the Component is connected to an AudioProcessorValueTreeState.
GuiItem | ( | MagicGUIBuilder & | builder, |
juce::ValueTree | node ) |
|
override |
|
pure virtual |
Allows accessing the Component inside that GuiItem.
Don't keep this pointer!
Implemented in ComboBoxItem, Container, DrumpadItem, KeyboardItem, LabelItem, LevelMeterItem, ListBoxItem, MidiLearnItem, PlotItem, SliderItem, TextButtonItem, ToggleButtonItem, and XYDraggerItem.
Referenced by GuiItem::resized(), GuiItem::setEditMode(), and GuiItem::updateColours().
|
pure virtual |
In update() the ValueTree properties should be used to set all properties to the component.
You can use the magicBuilder to resolve properties from CSS. The Colours will be handled by default.
Implemented in ComboBoxItem, Container, DrumpadItem, KeyboardItem, LabelItem, LevelMeterItem, ListBoxItem, MidiLearnItem, PlotItem, SliderItem, TextButtonItem, ToggleButtonItem, and XYDraggerItem.
Referenced by GuiItem::updateInternal().
|
virtual |
Set colours in the wrapped Component to the value from the stylesheet and palette.
Reimplemented in Container, and RootItem.
References GuiItem::colourTranslation, GuiItem::configNode, GuiItem::decorator, Stylesheet::getColour(), MagicGUIBuilder::getStyleProperty(), MagicGUIBuilder::getStylesheet(), GuiItem::getWrappedComponent(), GuiItem::magicBuilder, and Decorator::updateColours().
Referenced by GuiItem::updateInternal().
|
virtual |
Override this to return each settable option the designer should be able to configure on your component.
Reimplemented in ComboBoxItem, DrumpadItem, LabelItem, LevelMeterItem, ListBoxItem, PlotItem, SliderItem, TextButtonItem, ToggleButtonItem, and XYDraggerItem.
void setColourTranslation | ( | std::vector< std::pair< juce::String, int > > | mapping | ) |
For each factory you can register a translation table, which will forward the colours from the Stylesheet to the Components.
References GuiItem::colourTranslation.
Referenced by ComboBoxItem::ComboBoxItem(), DrumpadItem::DrumpadItem(), KeyboardItem::KeyboardItem(), LabelItem::LabelItem(), LevelMeterItem::LevelMeterItem(), PlotItem::PlotItem(), SliderItem::SliderItem(), TextButtonItem::TextButtonItem(), ToggleButtonItem::ToggleButtonItem(), and XYDraggerItem::XYDraggerItem().
juce::StringArray getColourNames | ( | ) | const |
Return the names of configurable colours.
References GuiItem::colourTranslation.
|
virtual |
Returns the parameterID that is controlled from this component.
To allow multiple return values depending of the position where the drop arrived there is the drop position supplied.
Reimplemented in SliderItem.
Referenced by GuiItem::itemDragEnter(), and GuiItem::itemDropped().
juce::var getProperty | ( | const juce::Identifier & | property | ) |
Look up a value through the DOM and CSS.
References GuiItem::configNode, MagicGUIBuilder::getStyleProperty(), and GuiItem::magicBuilder.
Referenced by DrumpadItem::update(), KeyboardItem::update(), LabelItem::update(), PlotItem::update(), SliderItem::update(), TextButtonItem::update(), ToggleButtonItem::update(), and XYDraggerItem::update().
MagicGUIState & getMagicState | ( | ) |
References MagicGUIBuilder::getMagicState(), and GuiItem::magicBuilder.
Referenced by ComboBoxItem::update(), Container::update(), LabelItem::update(), LevelMeterItem::update(), ListBoxItem::update(), PlotItem::update(), SliderItem::update(), TextButtonItem::update(), ToggleButtonItem::update(), and XYDraggerItem::update().
|
virtual |
Lookup a Component through the tree.
It will return the first with that id regardless if there is another one. We discourage using that function, because that Component can be deleted and recreated at any time without notice.
Reimplemented in Container.
References GuiItem::configNode.
void updateInternal | ( | ) |
Reread properties from the config ValueTree.
References GuiItem::configNode, Decorator::configure(), GuiItem::configureFlexBoxItem(), GuiItem::configurePosition(), GuiItem::decorator, MagicGUIBuilder::getStylesheet(), MagicGUIBuilder::isEditModeOn(), GuiItem::magicBuilder, GuiItem::setEditMode(), GuiItem::update(), and GuiItem::updateColours().
|
final |
References GuiItem::decorator, and Decorator::drawDecorator().
|
override |
References GuiItem::getClientBounds(), and GuiItem::getWrappedComponent().
Referenced by GuiItem::updateLayout().
|
virtual |
Reimplemented in Container.
|
virtual |
Reimplemented in Container.
|
virtual |
This will trigger a recalculation of the children layout regardless of resized.
Reimplemented in Container.
References GuiItem::resized().
LayoutType getParentsLayoutType | ( | ) | const |
Returns the layout type this item is managed by.
References foleys::Contents.
Referenced by GuiItem::setDraggable().
void configureFlexBoxItem | ( | const juce::ValueTree & | node | ) |
Parse the values and set it to the FlexBox::Item for layouting.
References GuiItem::flexItem, MagicGUIBuilder::getStyleProperty(), and GuiItem::magicBuilder.
Referenced by GuiItem::updateInternal().
void configurePosition | ( | const juce::ValueTree & | node | ) |
References GuiItem::configurePosition(), MagicGUIBuilder::getStyleProperty(), and GuiItem::magicBuilder.
Referenced by GuiItem::configurePosition(), and GuiItem::updateInternal().
juce::Rectangle< int > resolvePosition | ( | juce::Rectangle< int > | parent | ) |
Calculates the position according to the parent area.
juce::Rectangle< int > getClientBounds | ( | ) | const |
Returns the bounds of the wrapped Component.
This is the GuiItems bounds reduced by margin, padding and the caption, if one was set.
References Decorator::ClientBounds::client, GuiItem::decorator, and Decorator::getClientBounds().
Referenced by GuiItem::resized(), and Container::updateLayout().
juce::String getTabCaption | ( | const juce::String & | defaultName | ) | const |
References GuiItem::decorator, and Decorator::getTabCaption().
juce::Colour getTabColour | ( | ) | const |
References GuiItem::decorator, and Decorator::getTabColour().
juce::FlexItem & getFlexItem | ( | ) |
References GuiItem::flexItem.
|
override |
|
override |
|
override |
|
virtual |
|
virtual |
This method sets the GUI in edit mode, that allows to drag the components around.
Reimplemented in Container.
References GuiItem::getWrappedComponent().
Referenced by Container::setEditMode(), and GuiItem::updateInternal().
void setDraggable | ( | bool | selected | ) |
|
override |
References MagicGUIBuilder::getUndoManager(), and GuiItem::magicBuilder.
|
override |
|
override |
References GuiItem::configNode, GuiItem::magicBuilder, and MagicGUIBuilder::setSelectedNode().
|
override |
|
override |
MagicGUIBuilder& magicBuilder |
Referenced by Container::configureFlexBox(), GuiItem::configureFlexBoxItem(), GuiItem::configurePosition(), Container::createSubComponents(), GuiItem::getMagicState(), GuiItem::getProperty(), ComboBoxItem::getSettableProperties(), LabelItem::getSettableProperties(), LevelMeterItem::getSettableProperties(), ListBoxItem::getSettableProperties(), PlotItem::getSettableProperties(), SliderItem::getSettableProperties(), TextButtonItem::getSettableProperties(), ToggleButtonItem::getSettableProperties(), XYDraggerItem::getSettableProperties(), GuiItem::GuiItem(), GuiItem::itemDragEnter(), GuiItem::itemDropped(), GuiItem::mouseDown(), GuiItem::mouseUp(), GuiItem::paintOverChildren(), GuiItem::setDraggable(), Container::update(), LabelItem::update(), PlotItem::update(), TextButtonItem::update(), ToggleButtonItem::update(), Container::updateColours(), GuiItem::updateColours(), RootItem::updateColours(), GuiItem::updateInternal(), and GuiItem::~GuiItem().
|
protected |
Referenced by Container::createSubComponents(), Container::findGuiItem(), GuiItem::findGuiItem(), Container::findGuiItemWithId(), GuiItem::findGuiItemWithId(), SliderItem::getControlledParameterID(), GuiItem::getProperty(), ComboBoxItem::getSettableProperties(), DrumpadItem::getSettableProperties(), LabelItem::getSettableProperties(), LevelMeterItem::getSettableProperties(), ListBoxItem::getSettableProperties(), PlotItem::getSettableProperties(), SliderItem::getSettableProperties(), TextButtonItem::getSettableProperties(), ToggleButtonItem::getSettableProperties(), XYDraggerItem::getSettableProperties(), GuiItem::GuiItem(), GuiItem::itemDropped(), GuiItem::mouseUp(), GuiItem::paintOverChildren(), GuiItem::setDraggable(), ComboBoxItem::update(), Container::update(), LabelItem::update(), LevelMeterItem::update(), ListBoxItem::update(), PlotItem::update(), SliderItem::update(), TextButtonItem::update(), ToggleButtonItem::update(), XYDraggerItem::update(), Container::updateColours(), GuiItem::updateColours(), RootItem::updateColours(), and GuiItem::updateInternal().
|
protected |
|
protected |
Referenced by GuiItem::configureFlexBoxItem(), and GuiItem::getFlexItem().
|
protected |
Referenced by GuiItem::getColourNames(), GuiItem::setColourTranslation(), and GuiItem::updateColours().