ff_layout
Layout classes for JUCE
 All Classes Files Functions Variables Enumerations Enumerator
Classes | Public Member Functions | Static Public Attributes | List of all members
LayoutSplitter Class Reference

A splitter is a handle to drag boundaries inside the layout. More...

+ Inheritance diagram for LayoutSplitter:

Classes

class  Component
 Splitter component for mouse interaction. More...
 

Public Member Functions

 LayoutSplitter (juce::ValueTree &node)
 
virtual ~LayoutSplitter ()
 
void setRelativePosition (float position, juce::UndoManager *undo=nullptr)
 Set the position in normalized form. More...
 
float getRelativePosition () const
 Return the position in normalized form. More...
 
void setMinimumRelativePosition (const float min, juce::UndoManager *undo=nullptr)
 Set the minimum relative position in normalized coordinates. More...
 
void setMaximumRelativePosition (const float max, juce::UndoManager *undo=nullptr)
 Set the maximum relative position in normalized coordinates. More...
 
float getMinimumRelativePosition () const
 Return the minimum normalized position. More...
 
float getMaximumRelativePosition () const
 Return the maximum normalized position. More...
 
bool isHorizontal () const
 Return, if parent is horizontal. More...
 
void setBounds (juce::Rectangle< int > b)
 Set the bounds of the splitters component. More...
 
- Public Member Functions inherited from LayoutItem
 LayoutItem (LayoutItem::Orientation o)
 Create an empty layout as root node. More...
 
 LayoutItem (juce::ValueTree state)
 Instanciate a LayoutItem from it's state. More...
 
virtual ~LayoutItem ()
 
bool isValid ()
 Return if the layout item has a valid type. More...
 
void setOrientation (const Orientation, juce::UndoManager *undo=nullptr)
 Changes the orientation of the layout. More...
 
Orientation getOrientation () const
 Returns the orientation including direction. More...
 
bool isHorizontal () const
 Returns true if orientation is leftToRight or rightToLeft. More...
 
bool isVertical () const
 Returns true if orientation is topDown or BottomUp. More...
 
int isOverlay () const
 If overlay is set the item will be placed over an earlier defined item. More...
 
void setIsOverlay (const int overlay)
 
float getOverlayWidth () const
 Overlay width and overlay height are given in relative sizes to the referenced item. More...
 
void setOverlayWidth (float w)
 Overlay width and overlay height are given in relative sizes to the referenced item. More...
 
float getOverlayHeight () const
 Overlay width and overlay height are given in relative sizes to the referenced item. More...
 
void setOverlayHeight (float h)
 Overlay width and overlay height are given in relative sizes to the referenced item. More...
 
int getOverlayJustification () const
 overlayJustification defines, where the item is placed inside the referenced item More...
 
void setOverlayJustification (int j)
 overlayJustification defines, where the item is placed inside the referenced item More...
 
juce::Component * getComponent () const
 Return the managed component. More...
 
juce::String getComponentID () const
 Return the componentID. More...
 
bool hasComponent () const
 Returns true, if a component is set and available as pointer. More...
 
juce::Component * getWrappedComponent () const
 Return the wrapped component as pointer. More...
 
void setComponent (juce::Component *ptr, bool owned=false, juce::UndoManager *undo=nullptr)
 Replace the component pointer. More...
 
LayoutItem::SharedLayoutData * getOrCreateData (juce::UndoManager *undo=nullptr)
 Get or create a shared layout data blob. More...
 
bool isSpacerItem () const
 
bool isComponentItem () const
 
bool isSplitterItem () const
 
bool isSubLayout () const
 
void setLabelText (const juce::String &text, juce::UndoManager *undo=nullptr)
 Set the text for an automatically recreated Label as property. More...
 
void getStretch (float &w, float &h) const
 Return the stretch value of an item. More...
 
void setStretch (float w, float h, juce::UndoManager *undo=nullptr)
 Used to set stretch factors for the wrapped component. More...
 
void setMinimumWidth (const int w, juce::UndoManager *undo=nullptr)
 Set constraints to the items size. More...
 
void setMaximumWidth (const int w, juce::UndoManager *undo=nullptr)
 Set the maximum width. More...
 
void setMinimumHeight (const int h, juce::UndoManager *undo=nullptr)
 Set the minimum height. More...
 
void setMaximumHeight (const int h, juce::UndoManager *undo=nullptr)
 Set the maximum height. More...
 
int getMinimumWidth () const
 Returns the minimum width. More...
 
int getMaximumWidth () const
 Returns the maximum width. More...
 
int getMinimumHeight () const
 Returns the minimum height. More...
 
int getMaximumHeight () const
 Returns the maximum height. More...
 
virtual void getSizeLimits (int &minW, int &maxW, int &minH, int &maxH)
 Return the size limits of the item. More...
 
void setPaddingTop (const int p, juce::UndoManager *undo=nullptr)
 Set a padding value for the wrapped component or item to it's calculated top bounds. More...
 
void setPaddingLeft (const int p, juce::UndoManager *undo=nullptr)
 Set a padding value for the wrapped component or item to it's calculated left bounds. More...
 
void setPaddingRight (const int p, juce::UndoManager *undo=nullptr)
 Set a padding value for the wrapped component or item to it's calculated right bounds. More...
 
void setPaddingBottom (const int p, juce::UndoManager *undo=nullptr)
 Set a padding value for the wrapped component or item to it's calculated bottom bounds. More...
 
void setPadding (const int p, juce::UndoManager *undo=nullptr)
 Set one value to all bounaries. More...
 
int getPaddingTop () const
 Returns the padding value for the wrapped component or item to it's calculated top bounds. More...
 
int getPaddingLeft () const
 Returns the padding value for the wrapped component or item to it's calculated left bounds. More...
 
int getPaddingRight () const
 Returns the padding value for the wrapped component or item to it's calculated right bounds. More...
 
int getPaddingBottom () const
 Returns the padding value for the wrapped component or item to it's calculated bottom bounds. More...
 
void setFixedWidth (const int w, juce::UndoManager *undo=nullptr)
 Sets fixed width as minimum width = maximum width. More...
 
void setFixedHeight (const int h, juce::UndoManager *undo=nullptr)
 Sets fixed height as minimum height = maximum height. More...
 
void setFixedSize (const int w, const int h, juce::UndoManager *undo=nullptr)
 Convenience method to set fixed width and height in one call. More...
 
void setAspectRatio (const float ratio, juce::UndoManager *undo=nullptr)
 Set an aspect ratio to constrain the bounds. More...
 
float getAspectRatio () const
 Set an aspect ratio to constrain the bounds. More...
 
void setItemParameters (float inStretchX, float inStretchY, int inMinWidth, int inMinHeight, int inMaxWidth, int inMaxHeight, int inPaddingTop, int inPaddingLeft, int inPaddingRight, int inPaddingBottom, float inAspectRatio, juce::UndoManager *undo=nullptr)
 Convenience method to set all parameters in one line. More...
 
void constrainBounds (juce::Rectangle< int > &bounds, bool &changedWidth, bool &changedHeight, bool preferVertical)
 Applies the size constraints to the items. More...
 
void setItemBounds (juce::Rectangle< int > b)
 This property is dynamically calculated each time updateGeometry is called. More...
 
void setItemBounds (int x, int y, int w, int h)
 Convenience method to save creation of a rectangle struct. More...
 
juce::Rectangle< int > getItemBounds () const
 returns the calculated bounds of the item or layout. More...
 
juce::Rectangle< int > getPaddedItemBounds () const
 Returns the computed bounds reduced by the specified padding of the item. More...
 
void setBoundsAreFinal (bool final)
 set the flag that the bounds are adapted with size limits and shall not change This is computed on each updateGeometry and should not be set More...
 
bool getBoundsAreFinal () const
 This is computed on each updateGeometry and should not be set. More...
 
void setWrappedComponentID (const juce::String &name, bool setComp)
 Set the wrapped components componentID and the item's componentID property. More...
 
virtual void fixUpLayoutItems ()
 Chance for LayoutItems to fix properties that might have changed for saving. More...
 
virtual void realize (juce::ValueTree &node, juce::Component *owningComponent, Layout *layout)
 Hook to component or create an owned component. More...
 
void addListener (Listener *newListener)
 Registers a listener to receive events when this button's state changes. More...
 
void removeListener (Listener *listener)
 Removes a previously-registered button listener. More...
 
void callListenersCallback (juce::Rectangle< int > newBounds)
 Call the callbacks of LayoutItem::Listeners. More...
 
void callListenersCallback (float relativePosition, bool final)
 Call the callbacks of LayoutItem::Listeners when splitter moved. More...
 

Static Public Attributes

static const juce::Identifier propRelativePosition
 
static const juce::Identifier propRelativeMinPosition
 
static const juce::Identifier propRelativeMaxPosition
 
- Static Public Attributes inherited from LayoutItem
static const juce::Identifier itemTypeInvalid
 
static const juce::Identifier itemTypeComponent
 
static const juce::Identifier itemTypeBuilder
 
static const juce::Identifier itemTypeLabeledComponent
 
static const juce::Identifier itemTypeSplitter
 
static const juce::Identifier itemTypeSpacer
 
static const juce::Identifier itemTypeLine
 
static const juce::Identifier itemTypeSubLayout
 
static const juce::Identifier orientationUnknown
 
static const juce::Identifier orientationLeftToRight
 
static const juce::Identifier orientationTopDown
 
static const juce::Identifier orientationRightToLeft
 
static const juce::Identifier orientationBottomUp
 
static const juce::Identifier propStretchX
 
static const juce::Identifier propStretchY
 
static const juce::Identifier propMinWidth
 
static const juce::Identifier propMaxWidth
 
static const juce::Identifier propMinHeight
 
static const juce::Identifier propMaxHeight
 
static const juce::Identifier propAspectRatio
 
static const juce::Identifier propPaddingTop
 
static const juce::Identifier propPaddingLeft
 
static const juce::Identifier propPaddingRight
 
static const juce::Identifier propPaddingBottom
 
static const juce::Identifier propOrientation
 
static const juce::Identifier propLayoutBounds
 
static const juce::Identifier propOverlay
 
static const juce::Identifier propOverlayWidth
 
static const juce::Identifier propOverlayHeight
 
static const juce::Identifier propOverlayJustification
 
static const juce::Identifier propComponentID
 
static const juce::Identifier propComponentName
 
static const juce::Identifier propLabelText
 
static const juce::Identifier propLabelFontSize
 
static const juce::Identifier propLabelJustification
 
static const juce::Identifier propGroupName
 
static const juce::Identifier propGroupText
 
static const juce::Identifier propGroupJustification
 

Additional Inherited Members

- Public Types inherited from LayoutItem
enum  ItemType {
  Invalid = 0, ComponentItem, LabeledComponentItem, SplitterItem,
  SpacerItem, LineItem, SubLayout
}
 
enum  Orientation {
  Unknown = 0, LeftToRight, TopDown, RightToLeft,
  BottomUp
}
 
- Static Public Member Functions inherited from LayoutItem
static Orientation getOrientationFromName (juce::Identifier name)
 
static juce::Identifier getNameFromOrientation (LayoutItem::Orientation o)
 
static
LayoutItem::SharedLayoutData * 
getOrCreateData (juce::ValueTree &node, juce::UndoManager *undo=nullptr)
 Get or create a shared layout data blob for state node. More...
 
static LayoutItem makeSubLayout (juce::ValueTree &parent, Orientation orientation, int idx=-1, juce::UndoManager *undo=nullptr)
 create a sub layout under the node parent with the given orientation. More...
 
static LayoutItem makeChildComponent (juce::ValueTree &parent, juce::Component *component, bool owned=false, int idx=-1, juce::UndoManager *undo=nullptr)
 create a component container under the node parent. More...
 
static LayoutItem makeLabeledChildComponent (juce::ValueTree &parent, juce::Component *component, juce::String text, LayoutItem::Orientation o=LayoutItem::TopDown, bool owned=false, int idx=-1, juce::UndoManager *undo=nullptr)
 create a sub layout under the node parent with a child component and a label component. More...
 
static LayoutSplitter makeChildSplitter (juce::ValueTree &parent, float position, int idx=-1, juce::UndoManager *undo=nullptr)
 create a splitter under the node parent. More...
 
static LayoutItem makeChildSpacer (juce::ValueTree &parent, float stretchX=1.0, float stretchY=1.0, int idx=-1, juce::UndoManager *undo=nullptr)
 create a spacer under the node parent. More...
 
static void removeComponent (juce::ValueTree &parent, juce::Component *c, juce::UndoManager *undo=nullptr)
 Remove a component item from a specific layout level. More...
 
static juce::ValueTree getLayoutItem (juce::ValueTree &node, juce::Component *)
 Retrieve the LayoutItem for a component. More...
 
static juce::ValueTree getLayoutItem (juce::ValueTree &node, juce::String &componentID)
 Retrieve the LayoutItem for a component by componentID. More...
 
static void paintBounds (const juce::ValueTree &node, juce::Graphics &g)
 paint the bounds of the item and sub items for debugging More...
 
static int updateGeometry (juce::ValueTree &node, juce::Rectangle< int > bounds)
 Recompute the geometry of all components. More...
 
static int updateGeometry (juce::ValueTree &node, juce::Rectangle< int > bounds, int start, int end)
 Recompute the geometry of all components. More...
 
static void getStretch (const juce::ValueTree &node, float &w, float &h, int start=0, int end=-1)
 Cummulates all stretch factors inside the nested layout. More...
 
static void getSizeLimits (const juce::ValueTree &node, int &minW, int &maxW, int &minH, int &maxH, int start, int end)
 Compute size limits over all child nodes. More...
 
- Public Attributes inherited from LayoutItem
juce::ValueTree state
 The layout item's node in the ValueTree. More...
 

Detailed Description

A splitter is a handle to drag boundaries inside the layout.

Constructor & Destructor Documentation

LayoutSplitter::LayoutSplitter ( juce::ValueTree &  node)
virtual LayoutSplitter::~LayoutSplitter ( )
virtual

Member Function Documentation

void LayoutSplitter::setRelativePosition ( float  position,
juce::UndoManager *  undo = nullptr 
)

Set the position in normalized form.

float LayoutSplitter::getRelativePosition ( ) const

Return the position in normalized form.

void LayoutSplitter::setMinimumRelativePosition ( const float  min,
juce::UndoManager *  undo = nullptr 
)

Set the minimum relative position in normalized coordinates.

void LayoutSplitter::setMaximumRelativePosition ( const float  max,
juce::UndoManager *  undo = nullptr 
)

Set the maximum relative position in normalized coordinates.

float LayoutSplitter::getMinimumRelativePosition ( ) const

Return the minimum normalized position.

float LayoutSplitter::getMaximumRelativePosition ( ) const

Return the maximum normalized position.

bool LayoutSplitter::isHorizontal ( ) const

Return, if parent is horizontal.

void LayoutSplitter::setBounds ( juce::Rectangle< int >  b)

Set the bounds of the splitters component.

Member Data Documentation

const juce::Identifier LayoutSplitter::propRelativePosition
static
const juce::Identifier LayoutSplitter::propRelativeMinPosition
static
const juce::Identifier LayoutSplitter::propRelativeMaxPosition
static

The documentation for this class was generated from the following file: