iPlug2 - C++ Audio Plug-in Framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
IControl Class Referenceabstract

The lowest level base class of an IGraphics control. More...

#include <IControl.h>

Inherited by GFXLabelControl, IBitmapControl, IBubbleControl, IButtonControlBase, IColorPickerControl, ICornerResizerControl, IDirBrowseControlBase, IFPSDisplayControl, IGraphicsLiveEdit, IKnobControlBase, ILambdaControl, ILEDControl, IPanelControl, IPopupMenuControl, IShaderControl, ISkLottieControl, ISkParagraphControl, ISliderControlBase, ISVGControl, ISwitchControlBase, ITextControl, ITextEntryControl, IVBakedPresetManagerControl, IVColorSwatchControl, IVDisplayControl, IVGroupControl, IVKeyboardControl, IVNumberBoxControl, IVPanelControl, IVPlotControl, IVScopeControl< MAXNC, MAXBUF >, IVTrackControlBase, IVXYPadControl, IWebViewControl, TestAnimationControl, TestBezierControl, TestColorControl, TestCursorControl, TestDrawContextControl, TestDropShadowControl, TestFlexBoxControl, TestFontControl, TestGLControl, TestImageControl, TestKeyboardControl, TestMPSControl, TestMTControl, TestShadowGradientControl, TestSizeControl, TestSVGControl, and TestTextControl.

Public Member Functions

 IControl (const IRECT &bounds, int paramIdx=kNoParameter, IActionFunction actionFunc=nullptr)
 Constructor. More...
 
 IControl (const IRECT &bounds, const std::initializer_list< int > &params, IActionFunction actionFunc=nullptr)
 Constructor (range of parameters) More...
 
 IControl (const IRECT &bounds, IActionFunction actionFunc)
 Constructor (no paramIdx) More...
 
 IControl (const IControl &)=delete
 
void operator= (const IControl &)=delete
 
virtual ~IControl ()
 Destructor. More...
 
virtual void OnMouseDown (float x, float y, const IMouseMod &mod)
 Implement this method to respond to a mouse down event on this control. More...
 
virtual void OnMouseUp (float x, float y, const IMouseMod &mod)
 Implement this method to respond to a mouse up event on this control. More...
 
virtual void OnMouseDrag (float x, float y, float dX, float dY, const IMouseMod &mod)
 Implement this method to respond to a mouse drag event on this control. More...
 
virtual void OnMouseDblClick (float x, float y, const IMouseMod &mod)
 Implement this method to respond to a mouse double click event on this control. More...
 
virtual void OnMouseWheel (float x, float y, const IMouseMod &mod, float d)
 Implement this method to respond to a mouse wheel event on this control. More...
 
virtual bool OnKeyDown (float x, float y, const IKeyPress &key)
 Implement this method to respond to a key down event on this control. More...
 
virtual bool OnKeyUp (float x, float y, const IKeyPress &key)
 Implement this method to respond to a key up event on this control. More...
 
virtual void OnMouseOver (float x, float y, const IMouseMod &mod)
 Implement this method to respond to a mouseover event on this control. More...
 
virtual void OnMouseOut ()
 Implement this method to respond to a mouseout event on this control. More...
 
virtual void OnTouchCancelled (float x, float y, const IMouseMod &mod)
 Implement this method to respond to a touch cancel event on this control. More...
 
virtual void OnDrop (const char *str)
 Implement to do something when something was drag 'n dropped onto this control.
 
virtual void OnRescale ()
 Implement to do something when graphics is scaled globally (e.g. More...
 
virtual void OnResize ()
 Called when IControl is constructed or resized using SetRect(). More...
 
virtual void OnInit ()
 Called just prior to when the control is attached, after its delegate and graphics member variable set.
 
virtual void OnAttached ()
 Called after the control has been attached, and its delegate and graphics member variable set. More...
 
virtual void OnMsgFromDelegate (int msgTag, int dataSize, const void *pData)
 Implement to receive messages sent to the control, see IEditorDelegate:SendControlMsgFromDelegate()
 
virtual void OnMidi (const IMidiMsg &msg)
 Implement to receive MIDI messages sent to the control if mWantsMidi == true, see IEditorDelegate:SendMidiMsgFromDelegate()
 
virtual bool OnGesture (const IGestureInfo &info)
 
virtual void CreateContextMenu (IPopupMenu &contextMenu)
 Called by default when the user right clicks a control. More...
 
virtual void OnPopupMenuSelection (IPopupMenu *pSelectedMenu, int valIdx)
 Implement this method to handle popup menu selection after IGraphics::CreatePopupMenu/IControl::PromptUserInput. More...
 
virtual void OnTextEntryCompletion (const char *str, int valIdx)
 Implement this method to handle text input after IGraphics::CreateTextEntry/IControl::PromptUserInput. More...
 
virtual void OnContextSelection (int itemSelected)
 Implement this to respond to a menu selection from CreateContextMenu();. More...
 
virtual void Draw (IGraphics &g)=0
 Draw the control to the graphics context. More...
 
virtual void DrawPTHighlight (IGraphics &g)
 Implement this to customise how a colored highlight is drawn on the control in ProTools (AAX format only), when a control is linked to a parameter that is automated. More...
 
void PromptUserInput (int valIdx=0)
 Call this method in response to a mouse event to create an edit box so the user can enter a value, or pop up a pop-up menu, if the control is linked to a parameter (mParamIdx > kNoParameter) More...
 
void PromptUserInput (const IRECT &bounds, int valIdx=0)
 Create a text entry box so the user can enter a value, or pop up a pop-up menu, if the control is linked to a parameter (mParamIdx > kNoParameter) specifying the bounds. More...
 
IControlSetActionFunction (IActionFunction actionFunc)
 Set an Action Function for this control. More...
 
IControlSetAnimationEndActionFunction (IActionFunction actionFunc)
 Set an Action Function to be called at the end of an animation. More...
 
void SetTooltip (const char *str)
 Set a tooltip for the control. More...
 
const char * GetTooltip () const
 
int GetParamIdx (int valIdx=0) const
 Get the index of a parameter that the control is linked to Normaly controls are either linked to a single parameter or no parameter but some may be linked to multiple parameters. More...
 
virtual void SetParamIdx (int paramIdx, int valIdx=0)
 Set the index of a parameter that the control is linked to If you are calling this "manually" to reuse a control for multiple parameters, you probably want to call IEditorDelegate::SendCurrentParamValuesFromDelegate() afterward, to update the control values. More...
 
int LinkedToParam (int paramIdx) const
 Check if the control is linked to a particular parameter. More...
 
int NVals () const
 
virtual int GetValIdxForPos (float x, float y) const
 Check to see which of the control's values relates to this x and y coordinate. More...
 
const IParamGetParam (int valIdx=0) const
 Get a const pointer to the IParam object (owned by the editor delegate class), associated with this control. More...
 
virtual void SetValueFromDelegate (double value, int valIdx=0)
 Set the control's value from the delegate This method is called from the class implementing the IEditorDelegate interface in order to update a control's value members and set it to be marked dirty for redraw. More...
 
virtual void SetValueFromUserInput (double value, int valIdx=0)
 Set the control's value after user input. More...
 
virtual void SetValueToDefault (int valIdx=kNoValIdx)
 Set one or all of the control's values to the default value of the associated parameter. More...
 
virtual void SetValue (double value, int valIdx=0)
 Set one of the control's values. More...
 
double GetValue (int valIdx=0) const
 Get the control's value. More...
 
void SetGroup (const char *groupName)
 Assign the control to a control group. More...
 
const char * GetGroup () const
 Get the group that the control belongs to, if any. More...
 
const ITextGetText () const
 Get the Text object for the control. More...
 
void SetText (const IText &txt)
 Set the Text object typically used to determine font/layout/size etc of the main text in a control. More...
 
void SetBlend (const IBlend &blend)
 Set the Blend for this control. More...
 
IBlend GetBlend () const
 Get the Blend for this control.
 
int GetTextEntryLength () const
 Get the max number of characters that are allowed in text entry. More...
 
void SetTextEntryLength (int len)
 Set the max number of characters that are allowed in text entry. More...
 
const IRECTGetRECT () const
 Get the rectangular draw area for this control, within the graphics context. More...
 
void SetRECT (const IRECT &bounds)
 Set the rectangular draw area for this control, within the graphics context. More...
 
const IRECTGetTargetRECT () const
 Get the rectangular mouse tracking target area, within the graphics context for this control. More...
 
void SetTargetRECT (const IRECT &bounds)
 Set the rectangular mouse tracking target area, within the graphics context for this control. More...
 
void SetTargetAndDrawRECTs (const IRECT &bounds)
 Set BOTH the draw rect and the target area, within the graphics context for this control. More...
 
virtual void SetPosition (float x, float y)
 Set the position of the control, preserving the width and height. More...
 
virtual void SetSize (float w, float h)
 Set the size of the control, preserving the current position. More...
 
void SetPTParameterHighlight (bool isHighlighted, int color)
 Used internally by the AAX wrapper view interface to set the control parmeter highlight. More...
 
bool GetMouseDblAsSingleClick () const
 Get double click as single click By default, mouse double click has its own handler. More...
 
virtual void Hide (bool hide)
 Shows or hides the IControl. More...
 
bool IsHidden () const
 
virtual void SetDisabled (bool disable)
 Sets disabled mode for the control, the default implementation modifies the mBlend member. More...
 
bool IsDisabled () const
 
void SetMouseOverWhenDisabled (bool allow)
 Specify whether the control should respond to mouse overs when disabled. More...
 
void SetMouseEventsWhenDisabled (bool allow)
 Specify whether the control should respond to other mouse events when disabled. More...
 
bool GetMouseOverWhenDisabled () const
 
bool GetMouseEventsWhenDisabled () const
 
bool GetIgnoreMouse () const
 
bool GetPromptShowsParamLabel () const
 
void SetPromptShowsParamLabel (bool enable)
 Set if the control should show parameter labels/units e.g. More...
 
virtual bool IsHit (float x, float y) const
 Hit test the control. More...
 
virtual void SetDirty (bool triggerAction=true, int valIdx=kNoValIdx)
 Mark the control as dirty, i.e. More...
 
virtual void SetClean ()
 
void Animate ()
 
virtual bool IsDirty ()
 Called at each display refresh by the IGraphics draw loop, after IControl::Animate(), to determine if the control is marked as dirty. More...
 
void DisablePrompt (bool disable)
 Disable/enable default prompt for user input. More...
 
virtual void OnGUIIdle ()
 This is an idle timer tick call on the GUI thread, only active if USE_IDLE_CALLS is defined.
 
int GetTag () const
 Get the control's tag. More...
 
void SetWantsMidi (bool enable=true)
 Specify whether this control wants to know about MIDI messages sent to the UI. More...
 
bool GetWantsMidi () const
 
void SetWantsMultiTouch (bool enable=true)
 Specify whether this control supports multiple touches.
 
bool GetWantsMultiTouch () const
 
IControlAttachGestureRecognizer (EGestureType type, IGestureFunc func)
 Add a IGestureFunc that should be triggered in response to a certain type of gesture. More...
 
bool GetWantsGestures () const
 
EGestureType GetLastGesture () const
 
IGEditorDelegateGetDelegate ()
 Gets a pointer to the class implementing the IEditorDelegate interface that handles parameter changes from this IGraphics instance. More...
 
void SetDelegate (IGEditorDelegate &dlg)
 Used internally to set the mDelegate (and mGraphics) variables.
 
IGraphicsGetUI ()
 
const IGraphicsGetUI () const
 
bool GetMouseIsOver () const
 This can be used in IControl::Draw() to check if the mouse is over the control, without implementing mouse over methods. More...
 
virtual void SnapToMouse (float x, float y, EDirection direction, const IRECT &bounds, int valIdx=-1, double minClip=0., double maxClip=1.)
 Set control value based on x, y position within a rectangle. More...
 
virtual void OnEndAnimation ()
 
void StartAnimation (int duration)
 
void SetAnimation (IAnimationFunction func)
 Set the animation function. More...
 
void SetAnimation (IAnimationFunction func, int duration)
 Set the animation function and starts it. More...
 
IAnimationFunction GetAnimationFunction ()
 Get the control's animation function, if it exists.
 
IActionFunction GetActionFunction ()
 Get the control's action function, if it exists.
 
double GetAnimationProgress () const
 Get the progress in a control's animation, in the range 0-1.
 
Milliseconds GetAnimationDuration () const
 Get the duration of animations applied to the control.
 
template<class T >
T * As ()
 Helper function to dynamic cast an IControl to a subclass.
 

Protected Member Functions

template<typename T , typename... Args>
void ForValIdx (int valIdx, T func, Args...args)
 A helper template function to call a method for an individual value, or for all values. More...
 
void SetNVals (int nVals)
 

Protected Attributes

IRECT mRECT
 
IRECT mTargetRECT
 
WDL_String mGroup
 Controls can be grouped for hiding and showing panels.
 
IText mText
 
IBlend mBlend
 
int mTextEntryLength = DEFAULT_TEXT_ENTRY_LEN
 
bool mDirty = true
 
bool mHide = false
 
bool mDisabled = false
 
bool mDisablePrompt = true
 
bool mDblAsSingleClick = false
 
bool mMouseOverWhenDisabled = false
 
bool mMouseEventsWhenDisabled = false
 
bool mIgnoreMouse = false
 
bool mWantsMidi = false
 
bool mWantsMultiTouch = false
 
bool mPromptShowsParamLabel = false
 
bool mMouseIsOver = false
 if mGraphics::mHandleMouseOver = true, this will be true when the mouse is over control. More...
 
WDL_String mTooltip
 
IColor mPTHighlightColor = COLOR_RED
 
bool mPTisHighlighted = false
 

Detailed Description

The lowest level base class of an IGraphics control.

A control is anything on the GUI

Definition at line 42 of file IControl.h.

Constructor & Destructor Documentation

IControl::IControl ( const IRECT bounds,
int  paramIdx = kNoParameter,
IActionFunction  actionFunc = nullptr 
)

Constructor.

Creates an IControl NOTE: An IControl does not know about the delegate or graphics context to which it belongs in the constructor If you need to do something once those things are known, see IControl::OnInit()

Parameters
boundsThe rectangular area that the control occupies
paramIdxIf this is > -1 (kNoParameter) this control will be associated with a plugin parameter
actionFuncpass in a lambda function to provide custom functionality when the control "action" happens (usually mouse down).

Definition at line 81 of file IControl.cpp.

Referenced by IVPlotControl::AddPlotFunc(), GetAnimationProgress(), IBitmapControl::IBitmapControl(), IButtonControlBase::OnMouseDown(), IVRangeSliderControl::OnMouseDrag(), IKnobControlBase::OnMouseWheel(), IVGroupControl::OnResize(), and PlaceHolder::OnResize().

IControl::IControl ( const IRECT bounds,
const std::initializer_list< int > &  params,
IActionFunction  actionFunc = nullptr 
)

Constructor (range of parameters)

Creates an IControl which is linked to multiple parameters NOTE: An IControl does not know about the delegate or graphics context to which it belongs in the constructor If you need to do something once those things are known, see IControl::OnInit()

Parameters
boundsThe rectangular area that the control occupies
paramsAn initializer list of valid integer parameter indexes
actionFuncpass in a lambda function to provide custom functionality when the control "action" happens (usually mouse down).

Definition at line 89 of file IControl.cpp.

IControl::IControl ( const IRECT bounds,
IActionFunction  actionFunc 
)

Constructor (no paramIdx)

Creates an IControl which is not linked to a parameter NOTE: An IControl does not know about the delegate or graphics context to which it belongs in the constructor If you need to do something once those things are known, see IControl::OnInit()

Parameters
boundsThe rectangular area that the control occupies
actionFuncpass in a lambda function to provide custom functionality when the control "action" happens (usually mouse down).

Definition at line 100 of file IControl.cpp.

virtual IControl::~IControl ( )
inlinevirtual

Destructor.

Clean up any resources that your control owns.

Definition at line 79 of file IControl.h.

References OnMouseDown().

Member Function Documentation

IControl * IControl::AttachGestureRecognizer ( EGestureType  type,
IGestureFunc  func 
)

Add a IGestureFunc that should be triggered in response to a certain type of gesture.

Parameters
typeThe type of gesture to recognize on this control
functhe function to trigger

Definition at line 316 of file IControl.cpp.

References IGraphics::AttachGestureRecognizer(), and GetUI().

Referenced by IGraphics::AttachGestureRecognizerToRegion(), GetWantsMultiTouch(), and TestGesturesControl::OnInit().

virtual void IControl::CreateContextMenu ( IPopupMenu contextMenu)
inlinevirtual

Called by default when the user right clicks a control.

If IGRAPHICS_NO_CONTEXT_MENU is enabled as a preprocessor macro right clicking control will mean IControl::CreateContextMenu() and IControl::OnContextSelection() do not function on right clicking control. VST3 provides contextual menu support which is hard wired to right click controls by default. You can add custom items to the menu by implementing IControl::CreateContextMenu() and handle them in IControl::OnContextSelection(). In non-VST 3 hosts right clicking will still create the menu, but it will not feature entries added by the host.

Definition at line 166 of file IControl.h.

References OnPopupMenuSelection().

Referenced by IGraphics::PopupHostContextMenuForParam().

void IControl::DisablePrompt ( bool  disable)
inline

Disable/enable default prompt for user input.

Parameters
disableSet true to disable prompt

Definition at line 405 of file IControl.h.

Referenced by IVRadioButtonControl::GetButtonForPoint(), and IVKnobControl::OnInit().

virtual void IControl::Draw ( IGraphics g)
pure virtual

Draw the control to the graphics context.

Parameters
gThe graphics context to which this control belongs.

Implemented in PlaceHolder, ICaptionControl, IURLControl, ITextControl, ISVGControl, IBitmapControl, ILambdaControl, IPanelControl, IWheelControl, IBTextControl, IBSliderControl, IBKnobRotaterControl, IBKnobControl, IBSwitchControl, IBButtonControl, ISVGSliderControl, ISVGSwitchControl, ISVGButtonControl, ISVGKnobControl, IVColorSwatchControl, IVPanelControl, IVGroupControl, IVPlotControl, IVXYPadControl, IVRangeSliderControl, IVSliderControl, IGraphicsLiveEdit, IVKnobControl, IVKeyboardControl, TestGLControl, IVTabSwitchControl, IVDiskPresetManagerControl, IVLEDMeterControl< MAXNC >, IBubbleControl, IVSlideSwitchControl, TestKeyboardControl, IShaderControl, IVSwitchControl, TestMPSControl, IVMultiSliderControl< MAXNC >, IFPSDisplayControl, IWebViewControl, ISkParagraphControl, IVDisplayControl, IVButtonControl, IPopupMenuControl, IVNumberBoxControl, TestAnimationControl, IVLabelControl, ITextEntryControl, IVScopeControl< MAXNC, MAXBUF >, ISkLottieControl, ILEDControl, TestFlexBoxControl, TestColorControl, TestDirBrowseControl, ICornerResizerControl, IVMeterControl< MAXNC >, IVBakedPresetManagerControl, TestTextSizeControl, IColorPickerControl, TestTextOrientationControl, TestBezierControl, TestFontControl, TestBlendControl, TestGesturesControl, TestArcControl, TestDropShadowControl, TestMTControl, TestSVGControl, TestGradientControl, TestImageControl, TestMultiPathControl, TestSizeControl, TestTextControl, TestCursorControl, TestDrawContextControl, GFXLabelControl, TestLayerControl, TestPolyControl, TestShadowGradientControl, and TestMaskControl.

Referenced by IGraphics::BeginFrame(), and OnContextSelection().

void IControl::DrawPTHighlight ( IGraphics g)
virtual

Implement this to customise how a colored highlight is drawn on the control in ProTools (AAX format only), when a control is linked to a parameter that is automated.

Parameters
gThe graphics context to which this control belongs.

Definition at line 394 of file IControl.cpp.

References IGraphics::FillCircle(), IRECT::R, and IRECT::T.

Referenced by IGraphics::BeginFrame(), and OnContextSelection().

template<typename T , typename... Args>
void IControl::ForValIdx ( int  valIdx,
func,
Args...  args 
)
inlineprotected

A helper template function to call a method for an individual value, or for all values.

Parameters
valIdxIf this is > kNoValIdx execute the function for an individual value. If equal to kNoValIdx call the function for all values
funcA function that takes a single integer argument, the valIdx
Todo:
Parameters
argsArguments to the function

Definition at line 512 of file IControl.h.

References NVals().

Referenced by SetDirty(), SetValueToDefault(), and SnapToMouse().

IGEditorDelegate* IControl::GetDelegate ( )
inline
const char* IControl::GetGroup ( ) const
inline

Get the group that the control belongs to, if any.

Returns
A CString indicating the control group that this control belongs to (may be empty)

Definition at line 278 of file IControl.h.

References mGroup.

Referenced by IGraphics::ForControlInGroup().

bool IControl::GetIgnoreMouse ( ) const
inline
Returns
true if the control ignores mouse events

Definition at line 373 of file IControl.h.

Referenced by IGraphics::ReleaseMouseCapture().

EGestureType IControl::GetLastGesture ( ) const
inline
Returns
the last recognized gesture

Definition at line 434 of file IControl.h.

bool IControl::GetMouseDblAsSingleClick ( ) const
inline

Get double click as single click By default, mouse double click has its own handler.

A control can set mDblAsSingleClick to true which maps double click to single click for this control (and also causes the mouse to be captured by the control on double click).

Returns
/c true if double clicks should be mapped to single clicks

Definition at line 342 of file IControl.h.

References Hide().

Referenced by IGraphics::OnMouseDblClick().

bool IControl::GetMouseEventsWhenDisabled ( ) const
inline
Returns
true if the control responds to other mouse events when disabled

Definition at line 370 of file IControl.h.

Referenced by IGraphics::ReleaseMouseCapture().

bool IControl::GetMouseIsOver ( ) const
inline

This can be used in IControl::Draw() to check if the mouse is over the control, without implementing mouse over methods.

Note that this method is only enabled if IGraphics::EnableMouseOver() is set to true

Returns
if the mouse is over this control.

Definition at line 459 of file IControl.h.

References mMouseIsOver, SnapToMouse(), and StartAnimation().

Referenced by ICornerResizerControl::Draw(), and ICaptionControl::Draw().

bool IControl::GetMouseOverWhenDisabled ( ) const
inline
Returns
true if the control responds to mouse overs when disabled

Definition at line 367 of file IControl.h.

Referenced by IGraphics::ReleaseMouseCapture().

const IParam * IControl::GetParam ( int  valIdx = 0) const
int IControl::GetParamIdx ( int  valIdx = 0) const

Get the index of a parameter that the control is linked to Normaly controls are either linked to a single parameter or no parameter but some may be linked to multiple parameters.

Parameters
valIdxAn index to choose which of the controls linked parameters to retrieve. NOTE: since controls usually have only 1 parameter you can omit this argument and use the default index of 0
Returns
Parameter index, or kNoParameter if there is no parameter linked with this control at valIdx

Definition at line 107 of file IControl.cpp.

References NVals().

Referenced by IGraphics::CreateTextEntry(), GetParam(), IGraphics::GetParamIdxForPTAutomation(), GetTooltip(), ISwitchControlBase::OnInit(), IVNumberBoxControl::OnMouseDown(), IGraphics::OnMouseDown(), IVNumberBoxControl::OnMouseUp(), IGraphics::OnMouseUp(), OnPopupMenuSelection(), PromptUserInput(), IGEditorDelegate::SendParameterValueFromDelegate(), SetDirty(), and IGraphics::UpdatePeers().

bool IControl::GetPromptShowsParamLabel ( ) const
inline
Returns
true if the control should show parameter labels/units e.g. "Hz" in text entry prompts

Definition at line 376 of file IControl.h.

Referenced by IGraphics::PromptUserInput().

const IRECT& IControl::GetRECT ( ) const
inline
int IControl::GetTag ( ) const
inline

Get the control's tag.

See also
Control Tags

Definition at line 411 of file IControl.h.

References IGraphics::GetControlTag(), and GetUI().

Referenced by IWheelControl::OnPopupMenuSelection(), IGraphics::RemoveControl(), and IGraphics::RemoveControls().

const IRECT& IControl::GetTargetRECT ( ) const
inline

Get the rectangular mouse tracking target area, within the graphics context for this control.

Returns
The control's target bounds within the graphics context

Definition at line 313 of file IControl.h.

Referenced by IGraphicsLiveEdit::OnMouseDown().

const IText& IControl::GetText ( ) const
inline

Get the Text object for the control.

Returns
const IText& The control's mText object, typically used to determine font/layout/size etc of the main text in a control.

Definition at line 282 of file IControl.h.

Referenced by ITextEntryControl::OnKeyDown(), and IGraphics::PromptUserInput().

int IControl::GetTextEntryLength ( ) const
inline

Get the max number of characters that are allowed in text entry.

Returns
int The max number of characters allowed in text entry

Definition at line 297 of file IControl.h.

Referenced by IGraphics::CreateTextEntry().

const char* IControl::GetTooltip ( ) const
inline
Returns
Currently set tooltip text

Definition at line 213 of file IControl.h.

References GetParamIdx(), LinkedToParam(), and SetParamIdx().

IGraphics* IControl::GetUI ( )
inline
Returns
A pointer to the IGraphics context that owns this control

Definition at line 452 of file IControl.h.

Referenced by AttachGestureRecognizer(), IPopupMenuControl::CalculateMenuPanels(), IPopupMenuControl::CreatePopupMenu(), ICornerResizerControl::Draw(), GetTag(), IBubbleControl::IBubbleControl(), IWebViewControl::IWebViewControl(), IVBakedPresetManagerControl::OnAttached(), IWebViewControl::OnAttached(), IVNumberBoxControl::OnAttached(), IVDiskPresetManagerControl::OnAttached(), TestDropShadowControl::OnDrop(), TestImageControl::OnDrop(), TestSVGControl::OnDrop(), IGraphicsLiveEdit::OnInit(), ITextEntryControl::OnKeyDown(), IGraphicsLiveEdit::OnKeyDown(), TestTextControl::OnMouseDblClick(), ICornerResizerControl::OnMouseDblClick(), IVNumberBoxControl::OnMouseDblClick(), PlaceHolder::OnMouseDblClick(), TestCursorControl::OnMouseDown(), TestImageControl::OnMouseDown(), ITextEntryControl::OnMouseDown(), ICornerResizerControl::OnMouseDown(), IGraphicsLiveEdit::OnMouseDown(), TestSVGControl::OnMouseDown(), TestPolyControl::OnMouseDown(), TestArcControl::OnMouseDown(), TestDirBrowseControl::OnMouseDown(), IVNumberBoxControl::OnMouseDown(), TestFlexBoxControl::OnMouseDown(), ISkLottieControl::OnMouseDown(), IVXYPadControl::OnMouseDown(), IVColorSwatchControl::OnMouseDown(), IWheelControl::OnMouseDown(), IKnobControlBase::OnMouseDown(), ISliderControlBase::OnMouseDown(), IEditableTextControl::OnMouseDown(), IURLControl::OnMouseDown(), IGraphicsLiveEdit::OnMouseDrag(), TestCursorControl::OnMouseOut(), ICornerResizerControl::OnMouseOut(), IURLControl::OnMouseOut(), ICornerResizerControl::OnMouseOver(), IGraphicsLiveEdit::OnMouseOver(), IURLControl::OnMouseOver(), TestPolyControl::OnMouseUp(), TestArcControl::OnMouseUp(), IVNumberBoxControl::OnMouseUp(), IGraphicsLiveEdit::OnMouseUp(), IVXYPadControl::OnMouseUp(), IKnobControlBase::OnMouseUp(), ISliderControlBase::OnMouseUp(), IGraphicsLiveEdit::OnPopupMenuSelection(), ICornerResizerControl::OnRescale(), IWebViewControl::OnRescale(), IBButtonControl::OnRescale(), IBSwitchControl::OnRescale(), IBKnobControl::OnRescale(), IBSliderControl::OnRescale(), IBTextControl::OnRescale(), IBitmapControl::OnRescale(), TestSizeControl::OnResize(), IWebViewControl::OnResize(), IGraphicsLiveEdit::OnResize(), IVGroupControl::OnResize(), PromptUserInput(), ITextControl::SetBoundsBasedOnStr(), SetDirty(), IBubbleControl::SetStrokeColor(), SetValueFromDelegate(), ShowBubbleHorizontalActionFunc(), ShowBubbleVerticalActionFunc(), and SplashClickActionFunc().

const IGraphics* IControl::GetUI ( ) const
inline
Returns
A const pointer to the IGraphics context that owns this control

Definition at line 455 of file IControl.h.

virtual int IControl::GetValIdxForPos ( float  x,
float  y 
) const
inlinevirtual

Check to see which of the control's values relates to this x and y coordinate.

Parameters
xx coordinate to check
yx coordinate to check
Returns
An integer specifying which value matches the x, y coordinates, or kNoValIdx if the position is not linked to a value.

Reimplemented in IVTrackControlBase.

Definition at line 239 of file IControl.h.

References GetParam(), GetValue(), SetValue(), SetValueFromDelegate(), SetValueFromUserInput(), and SetValueToDefault().

Referenced by OnMouseDblClick(), OnMouseDown(), IGraphics::OnMouseDown(), and IVTrackControlBase::OnMouseOver().

double IControl::GetValue ( int  valIdx = 0) const

Get the control's value.

Returns
Value of the control, normalized in the range 0-1
Parameters
valIdxThe index of the value to set, which should be between 0 and NVals()

Definition at line 151 of file IControl.cpp.

References NVals().

Referenced by TestLayerControl::Draw(), TestPolyControl::Draw(), TestGradientControl::Draw(), TestMultiPathControl::Draw(), TestArcControl::Draw(), TestBlendControl::Draw(), TestTextOrientationControl::Draw(), TestTextSizeControl::Draw(), ILEDControl::Draw(), IVLEDMeterControl< MAXNC >::Draw(), IVRangeSliderControl::Draw(), ISVGKnobControl::Draw(), ISVGButtonControl::Draw(), ISVGSliderControl::Draw(), IBKnobRotaterControl::Draw(), IBSliderControl::Draw(), IWheelControl::Draw(), IVTrackControlBase::DrawBackground(), IVToggleControl::DrawValue(), IVButtonControl::DrawWidget(), IVToggleControl::DrawWidget(), IVKnobControl::DrawWidget(), IVSliderControl::DrawWidget(), IVRangeSliderControl::DrawWidget(), IVXYPadControl::DrawWidget(), GetValIdxForPos(), IWheelControl::IWheelControl(), IVMultiSliderControl< MAXNC >::OnMouseDown(), IBSwitchControl::OnMouseDown(), IKnobControlBase::OnMouseDown(), ISliderControlBase::OnMouseDown(), ISwitchControlBase::OnMouseDown(), ITextToggleControl::OnMouseDown(), IVRangeSliderControl::OnMouseDrag(), IWheelControl::OnMouseUp(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), ISVGSliderControl::OnResize(), SetDirty(), ITextToggleControl::SetDirty(), SetValueFromDelegate(), SetValueFromUserInput(), IVMultiSliderControl< MAXNC >::SnapToMouse(), and IGraphics::UpdatePeers().

bool IControl::GetWantsGestures ( ) const
inline
Returns
/c true if this control supports multiple gestures

Definition at line 431 of file IControl.h.

Referenced by IGraphics::OnGestureRecognized(), and IGraphics::RespondsToGesture().

bool IControl::GetWantsMidi ( ) const
inline
Returns
/c true if this control wants to know about MIDI messages send to the UI. See OnMIDIMsg()

Definition at line 417 of file IControl.h.

Referenced by IGEditorDelegate::SendMidiMsgFromDelegate().

bool IControl::GetWantsMultiTouch ( ) const
inline
Returns
/c true if this control supports multiple touches

Definition at line 423 of file IControl.h.

References AttachGestureRecognizer().

Referenced by IGraphics::ReleaseMouseCapture().

void IControl::Hide ( bool  hide)
virtual

Shows or hides the IControl.

Parameters
hideSet to true to hide the control

Definition at line 237 of file IControl.cpp.

References SetDirty().

Referenced by IPopupMenuControl::CalculateMenuPanels(), GetMouseDblAsSingleClick(), IGraphics::HideControl(), IBubbleControl::IBubbleControl(), and IBubbleControl::SetStrokeColor().

bool IControl::IsDirty ( )
virtual

Called at each display refresh by the IGraphics draw loop, after IControl::Animate(), to determine if the control is marked as dirty.

Returns
true if the control is marked dirty.

Reimplemented in IGraphicsLiveEdit, TestMTControl, and IFPSDisplayControl.

Definition at line 229 of file IControl.cpp.

References GetAnimationFunction().

Referenced by TestMTControl::IsDirty(), IGraphics::IsDirty(), and IsHit().

bool IControl::IsDisabled ( ) const
inline
bool IControl::IsHidden ( ) const
inline
virtual bool IControl::IsHit ( float  x,
float  y 
) const
inlinevirtual

Hit test the control.

Override this method if you want the control to be hit only if a visible part of it is hit, or whatever.

Parameters
xThe X coordinate within the control to test
yThe y coordinate within the control to test
Returns
Return true if the control was hit.

Reimplemented in IVSliderControl, IVKnobControl, IVTabSwitchControl, IVSwitchControl, and IVButtonControl.

Definition at line 385 of file IControl.h.

References IRECT::Contains(), IsDirty(), and SetDirty().

Referenced by IVSwitchControl::OnMouseOut(), IVTabSwitchControl::OnMouseOut(), IVKnobControl::OnMouseOut(), IVSliderControl::OnMouseOut(), and IGraphics::ReleaseMouseCapture().

int IControl::LinkedToParam ( int  paramIdx) const

Check if the control is linked to a particular parameter.

Parameters
paramIdxThe paramIdx to test
Returns
the valIdx if linked, or kNoValIdx if not

Definition at line 130 of file IControl.cpp.

References NVals().

Referenced by IGraphics::ForControlWithParam(), and GetTooltip().

int IControl::NVals ( ) const
inline
virtual void IControl::OnAttached ( )
inlinevirtual

Called after the control has been attached, and its delegate and graphics member variable set.

Use this method for controls that might need to attach sub controls that should be above their parent in the stack

Reimplemented in IVDiskPresetManagerControl, IVNumberBoxControl, IVBakedPresetManagerControl, and IWebViewControl.

Definition at line 154 of file IControl.h.

Referenced by IGraphics::AttachControl().

virtual void IControl::OnContextSelection ( int  itemSelected)
inlinevirtual

Implement this to respond to a menu selection from CreateContextMenu();.

See also
CreateContextMenu()

Definition at line 179 of file IControl.h.

References Draw(), DrawPTHighlight(), and PromptUserInput().

Referenced by As().

bool IControl::OnGesture ( const IGestureInfo info)
virtual
Returns
true if supports this gesture

Definition at line 325 of file IControl.cpp.

Referenced by IGraphics::OnGestureRecognized(), and OnMidi().

virtual bool IControl::OnKeyDown ( float  x,
float  y,
const IKeyPress key 
)
inlinevirtual

Implement this method to respond to a key down event on this control.

Parameters
xThe X coordinate of the mouse at the time of this key down event
yThe Y coordinate of the mouse at the time of this key down event
keyInfo about the keypress

Reimplemented in IGraphicsLiveEdit, TestKeyboardControl, and ITextEntryControl.

Definition at line 118 of file IControl.h.

Referenced by IGraphics::OnKeyDown().

virtual bool IControl::OnKeyUp ( float  x,
float  y,
const IKeyPress key 
)
inlinevirtual

Implement this method to respond to a key up event on this control.

Parameters
xThe X coordinate of the mouse at the time of this key down event
yThe Y coordinate of the mouse at the time of this key down event
keyInfo about the keypress

Definition at line 124 of file IControl.h.

References OnMouseOut(), and OnMouseOver().

Referenced by IGraphics::OnKeyUp().

void IControl::OnMouseDblClick ( float  x,
float  y,
const IMouseMod mod 
)
virtual

Implement this method to respond to a mouse double click event on this control.

Parameters
xThe X coordinate of the mouse event
yThe Y coordinate of the mouse event
modA struct indicating which modifier keys are held for the event

Reimplemented in PlaceHolder, IGraphicsLiveEdit, IVNumberBoxControl, ICornerResizerControl, ITextEntryControl, and TestTextControl.

Definition at line 263 of file IControl.cpp.

References GetValIdxForPos(), PromptUserInput(), and SetValueToDefault().

Referenced by IGraphics::OnMouseDblClick(), and OnMouseDrag().

void IControl::OnMouseDown ( float  x,
float  y,
const IMouseMod mod 
)
virtual
virtual void IControl::OnMouseDrag ( float  x,
float  y,
float  dX,
float  dY,
const IMouseMod mod 
)
inlinevirtual

Implement this method to respond to a mouse drag event on this control.

Parameters
xThe X coordinate of the mouse event
yThe Y coordinate of the mouse event
dXThe X delta (difference) since the last event
dYThe Y delta (difference) since the last event
modA struct indicating which modifier keys are held for the event

Reimplemented in ILambdaControl, ISliderControlBase, IKnobControlBase, IVXYPadControl, IVRangeSliderControl, IVMultiSliderControl< MAXNC >, IGraphicsLiveEdit, IVKeyboardControl, IShaderControl, IVNumberBoxControl, TestMTControl, TestBezierControl, IPopupMenuControl, TestTextOrientationControl, TestTextSizeControl, and ITextEntryControl.

Definition at line 99 of file IControl.h.

References OnMouseDblClick().

Referenced by IVRangeSliderControl::OnMouseDown(), IVXYPadControl::OnMouseDown(), IGraphics::OnMouseDrag(), and IVRangeSliderControl::OnMouseUp().

void IControl::OnMouseOut ( )
virtual
void IControl::OnMouseOver ( float  x,
float  y,
const IMouseMod mod 
)
virtual

Implement this method to respond to a mouseover event on this control.

Implementations should call base class, if you wish to use mMouseIsOver.

Parameters
xThe X coordinate of the mouse event
yThe Y coordinate of the mouse event
modA struct indicating which modifier keys are held for the event

Reimplemented in IURLControl, IVTrackControlBase, IVColorSwatchControl, IVRangeSliderControl, IVSliderControl, IVKnobControl, IVKeyboardControl, IVTabSwitchControl, IGraphicsLiveEdit, TestBezierControl, IPopupMenuControl, and ICornerResizerControl.

Definition at line 272 of file IControl.cpp.

References mMouseIsOver, and SetDirty().

Referenced by OnKeyUp(), ICornerResizerControl::OnMouseOver(), IVTabSwitchControl::OnMouseOver(), IVKnobControl::OnMouseOver(), IVSliderControl::OnMouseOver(), IGraphics::OnMouseOver(), IURLControl::OnMouseOver(), and IGraphics::OnMouseUp().

virtual void IControl::OnMouseUp ( float  x,
float  y,
const IMouseMod mod 
)
inlinevirtual

Implement this method to respond to a mouse up event on this control.

Parameters
xThe X coordinate of the mouse event
yThe Y coordinate of the mouse event
modA struct indicating which modifier keys are held for the event

Reimplemented in ILambdaControl, ISwitchControlBase, ISliderControlBase, IKnobControlBase, IWheelControl, IVXYPadControl, IVRangeSliderControl, IVSliderControl, IVKnobControl, TestKeyboardControl, IVKeyboardControl, IShaderControl, IGraphicsLiveEdit, IVNumberBoxControl, TestMTControl, TestBezierControl, TestArcControl, TestPolyControl, TestTextOrientationControl, TestTextSizeControl, and ITextEntryControl.

Definition at line 91 of file IControl.h.

Referenced by IGraphics::OnMouseUp().

virtual void IControl::OnMouseWheel ( float  x,
float  y,
const IMouseMod mod,
float  d 
)
inlinevirtual

Implement this method to respond to a mouse wheel event on this control.

Parameters
xThe X coordinate of the mouse event
yThe Y coordinate of the mouse event
modA struct indicating which modifier keys are held for the event
dThe delta value (difference) since the last mouse wheel event

Reimplemented in ISliderControlBase, IKnobControlBase, IWheelControl, IVNumberBoxControl, and IPopupMenuControl.

Definition at line 112 of file IControl.h.

Referenced by IGraphics::OnMouseWheel().

void IControl::OnPopupMenuSelection ( IPopupMenu pSelectedMenu,
int  valIdx 
)
virtual

Implement this method to handle popup menu selection after IGraphics::CreatePopupMenu/IControl::PromptUserInput.

Parameters
pSelectedMenuIf pSelectedMenu is invalid it means the user didn't select anything
valIdxAn index that indicates which of the controls vals the menu relates to

Reimplemented in IWheelControl, IGraphicsLiveEdit, IVDiskPresetManagerControl, TestFlexBoxControl, TestDirBrowseControl, and IVBakedPresetManagerControl.

Definition at line 288 of file IControl.cpp.

References GetParam(), GetParamIdx(), and SetValueFromUserInput().

Referenced by CreateContextMenu().

virtual void IControl::OnRescale ( )
inlinevirtual

Implement to do something when graphics is scaled globally (e.g.

moves to different DPI screen)

Reimplemented in IBitmapControl, IBTextControl, IBSliderControl, IBKnobControl, IBSwitchControl, IBButtonControl, IWebViewControl, ICornerResizerControl, and TestSizeControl.

Definition at line 145 of file IControl.h.

Referenced by IGraphics::CreatePopupMenu(), SetDelegate(), and IGraphics::SetScreenScale().

virtual void IControl::OnResize ( )
inlinevirtual
virtual void IControl::OnTextEntryCompletion ( const char *  str,
int  valIdx 
)
inlinevirtual

Implement this method to handle text input after IGraphics::CreateTextEntry/IControl::PromptUserInput.

Parameters
strA CString with the inputted text
valIdxAn index that indicates which of the controls vals the text completion relates to

Reimplemented in PlaceHolder, IEditableTextControl, and IVNumberBoxControl.

Definition at line 176 of file IControl.h.

virtual void IControl::OnTouchCancelled ( float  x,
float  y,
const IMouseMod mod 
)
inlinevirtual

Implement this method to respond to a touch cancel event on this control.

Parameters
xThe X coordinate of the mouse event
yThe Y coordinate of the mouse event
modA struct indicating which modifier keys are held for the event

Reimplemented in IVKeyboardControl, and TestMTControl.

Definition at line 139 of file IControl.h.

Referenced by IGraphics::OnTouchCancelled().

void IControl::PromptUserInput ( int  valIdx = 0)

Call this method in response to a mouse event to create an edit box so the user can enter a value, or pop up a pop-up menu, if the control is linked to a parameter (mParamIdx > kNoParameter)

Parameters
valIdxAn index to choose which of the controls linked parameters to retrieve. NOTE: since controls usually have only 1 parameter you can omit this argument and use the default index of 0

Definition at line 339 of file IControl.cpp.

References GetParam(), GetParamIdx(), GetUI(), IRECT::MH(), IRECT::MW(), IGraphics::PromptUserInput(), and SetDirty().

Referenced by OnContextSelection(), OnMouseDblClick(), OnMouseDown(), IVKnobControl::OnMouseDown(), IVSliderControl::OnMouseDown(), and ICaptionControl::OnMouseDown().

void IControl::PromptUserInput ( const IRECT bounds,
int  valIdx = 0 
)

Create a text entry box so the user can enter a value, or pop up a pop-up menu, if the control is linked to a parameter (mParamIdx > kNoParameter) specifying the bounds.

Parameters
boundsThe rectangle for the text entry. Pop-up menu's will appear below the rectangle.
valIdxAn index to choose which of the controls linked parameters to retrieve. NOTE: since controls usually have only 1 parameter you can omit this argument and use the default index of 0

Definition at line 362 of file IControl.cpp.

References GetParamIdx(), GetUI(), and IGraphics::PromptUserInput().

IControl* IControl::SetActionFunction ( IActionFunction  actionFunc)
inline

Set an Action Function for this control.

Parameters
actionFuncA std::function conforming to IActionFunction
Returns
Ptr to this control, for chaining

Definition at line 201 of file IControl.h.

Referenced by ISkLottieControl::Draw(), IVToggleControl::DrawValue(), IVRadioButtonControl::GetButtonForPoint(), IBubbleControl::IBubbleControl(), IPopupMenuControl::IPopupMenuControl(), IWheelControl::IWheelControl(), and IURLControl::OnMouseDown().

void IControl::SetAnimation ( IAnimationFunction  func)
inline
void IControl::SetAnimation ( IAnimationFunction  func,
int  duration 
)
inline

Set the animation function and starts it.

Parameters
funcA std::function conforming to IAnimationFunction
durationDuration in milliseconds for the animation

Definition at line 482 of file IControl.h.

References StartAnimation().

IControl* IControl::SetAnimationEndActionFunction ( IActionFunction  actionFunc)
inline

Set an Action Function to be called at the end of an animation.

Parameters
actionFuncA std::function conforming to IActionFunction
Returns
Ptr to this control, for chaining

Definition at line 206 of file IControl.h.

Referenced by IVToggleControl::DrawValue(), IBubbleControl::IBubbleControl(), IVBakedPresetManagerControl::OnAttached(), IVNumberBoxControl::OnAttached(), and IVDiskPresetManagerControl::OnAttached().

void IControl::SetBlend ( const IBlend blend)
inline

Set the Blend for this control.

This can be used differently by different controls, or not at all. By default it is used to change the opacity of controls when they are disabled

Definition at line 290 of file IControl.h.

void IControl::SetDirty ( bool  triggerAction = true,
int  valIdx = kNoValIdx 
)
virtual

Mark the control as dirty, i.e.

it should be redrawn on the next display refresh

Parameters
triggerActionIf this is true and the control is linked to a parameter notify the class implementing the IEditorDelegate interface that the parameter changed. If this control has an ActionFunction, that can also be triggered. NOTE: it is easy to forget that this method always sets the control dirty, the argument refers to whether a consecutive action should be performed

Reimplemented in ITextToggleControl, IVSliderControl, IVKnobControl, IVSlideSwitchControl, and IVSwitchControl.

Definition at line 196 of file IControl.cpp.

References Clip(), ForValIdx(), GetAnimationFunction(), GetDelegate(), GetParamIdx(), GetUI(), GetValue(), NVals(), IEditorDelegate::SendParameterValueFromUI(), SetValue(), and IGraphics::UpdatePeers().

Referenced by IVPlotControl::AddPlotFunc(), IPopupMenuControl::CalculateMenuPanels(), IVKeyboardControl::Draw(), ISVGKnobControl::Draw(), IPanelControl::Draw(), ILambdaControl::Draw(), Hide(), IBubbleControl::IBubbleControl(), IsHit(), TestDropShadowControl::OnDrop(), TestImageControl::OnDrop(), TestSVGControl::OnDrop(), TestGesturesControl::OnInit(), ITextEntryControl::OnKeyDown(), TestKeyboardControl::OnKeyDown(), IVKeyboardControl::OnMidi(), IWheelControl::OnMidi(), TestTextControl::OnMouseDblClick(), TestCursorControl::OnMouseDown(), TestTextControl::OnMouseDown(), TestGradientControl::OnMouseDown(), TestSVGControl::OnMouseDown(), TestFontControl::OnMouseDown(), TestLayerControl::OnMouseDown(), TestAnimationControl::OnMouseDown(), TestDirBrowseControl::OnMouseDown(), IVKeyboardControl::OnMouseDown(), IShaderControl::OnMouseDown(), ISkLottieControl::OnMouseDown(), IVTabSwitchControl::OnMouseDown(), TestMultiPathControl::OnMouseDown(), IVMultiSliderControl< MAXNC >::OnMouseDown(), IVKnobControl::OnMouseDown(), IBSwitchControl::OnMouseDown(), IButtonControlBase::OnMouseDown(), ISwitchControlBase::OnMouseDown(), ITextToggleControl::OnMouseDown(), IPopupMenuControl::OnMouseDrag(), TestBezierControl::OnMouseDrag(), TestMTControl::OnMouseDrag(), IShaderControl::OnMouseDrag(), IVKeyboardControl::OnMouseDrag(), IVXYPadControl::OnMouseDrag(), IKnobControlBase::OnMouseDrag(), ISliderControlBase::OnMouseDrag(), ILambdaControl::OnMouseDrag(), IVSwitchControl::OnMouseOut(), IVKeyboardControl::OnMouseOut(), OnMouseOut(), IVTabSwitchControl::OnMouseOut(), IVKnobControl::OnMouseOut(), IVSliderControl::OnMouseOut(), IVColorSwatchControl::OnMouseOut(), IVTrackControlBase::OnMouseOut(), IPopupMenuControl::OnMouseOver(), TestBezierControl::OnMouseOver(), OnMouseOver(), IVTabSwitchControl::OnMouseOver(), IVKeyboardControl::OnMouseOver(), IVKnobControl::OnMouseOver(), IVSliderControl::OnMouseOver(), IVRangeSliderControl::OnMouseOver(), IVColorSwatchControl::OnMouseOver(), IVTrackControlBase::OnMouseOver(), ITextEntryControl::OnMouseUp(), TestTextSizeControl::OnMouseUp(), TestTextOrientationControl::OnMouseUp(), TestMTControl::OnMouseUp(), IShaderControl::OnMouseUp(), IVKeyboardControl::OnMouseUp(), IVKnobControl::OnMouseUp(), IVSliderControl::OnMouseUp(), IVXYPadControl::OnMouseUp(), IWheelControl::OnMouseUp(), IKnobControlBase::OnMouseUp(), ISliderControlBase::OnMouseUp(), ISwitchControlBase::OnMouseUp(), ILambdaControl::OnMouseUp(), IKnobControlBase::OnMouseWheel(), ISliderControlBase::OnMouseWheel(), IRTTextControl< MAXNC, T >::OnMsgFromDelegate(), IVMeterControl< MAXNC >::OnMsgFromDelegate(), IVScopeControl< MAXNC, MAXBUF >::OnMsgFromDelegate(), IVDisplayControl::OnMsgFromDelegate(), TestDirBrowseControl::OnPopupMenuSelection(), TestFlexBoxControl::OnPopupMenuSelection(), IVDisplayControl::OnResize(), IVButtonControl::OnResize(), IVScopeControl< MAXNC, MAXBUF >::OnResize(), IVSwitchControl::OnResize(), IShaderControl::OnResize(), IVTabSwitchControl::OnResize(), IVKeyboardControl::OnResize(), IVKnobControl::OnResize(), IVSliderControl::OnResize(), IVXYPadControl::OnResize(), IVPlotControl::OnResize(), IVGroupControl::OnResize(), IVColorSwatchControl::OnResize(), ISVGSliderControl::OnResize(), IBSliderControl::OnResize(), ISliderControlBase::OnResize(), IVTrackControlBase::OnResize(), IEditableTextControl::OnTextEntryCompletion(), IVKeyboardControl::OnTouchCancelled(), PromptUserInput(), IGraphics::SetAllControlsDirty(), IVSwitchControl::SetDirty(), IVKnobControl::SetDirty(), IVSliderControl::SetDirty(), ITextToggleControl::SetDirty(), SetDisabled(), SetParamIdx(), IVTrackControlBase::SetParams(), SetPTParameterHighlight(), ITextControl::SetStr(), ITextControl::SetStrFmt(), IBubbleControl::SetStrokeColor(), IVNumberBoxControl::SetStyle(), SetValueFromDelegate(), SetValueFromUserInput(), SetValueToDefault(), IVMultiSliderControl< MAXNC >::SnapToMouse(), SnapToMouse(), and SplashAnimationFunc().

void IControl::SetDisabled ( bool  disable)
virtual

Sets disabled mode for the control, the default implementation modifies the mBlend member.

Parameters
disabletrue for disabled

Definition at line 243 of file IControl.cpp.

References SetDirty().

Referenced by IGraphics::DisableControl(), and IsHidden().

void IControl::SetGroup ( const char *  groupName)
inline

Assign the control to a control group.

See also
Control Groups
Parameters
groupNameA CString indicating the control group that this control should belong to

Definition at line 274 of file IControl.h.

References mGroup.

Referenced by IGraphics::AttachControl().

void IControl::SetMouseEventsWhenDisabled ( bool  allow)
inline

Specify whether the control should respond to other mouse events when disabled.

Parameters
allowtrue if it should respond to other mouse events when disabled (false by default)

Definition at line 364 of file IControl.h.

void IControl::SetMouseOverWhenDisabled ( bool  allow)
inline

Specify whether the control should respond to mouse overs when disabled.

Parameters
allowtrue if it should respond to mouse overs when disabled (false by default)

Definition at line 360 of file IControl.h.

void IControl::SetParamIdx ( int  paramIdx,
int  valIdx = 0 
)
virtual

Set the index of a parameter that the control is linked to If you are calling this "manually" to reuse a control for multiple parameters, you probably want to call IEditorDelegate::SendCurrentParamValuesFromDelegate() afterward, to update the control values.

Parameters
paramIdxParameter index, or kNoParameter if there is no parameter linked with this control at valIdx
valIdxAn index to choose which of the controls vals to set

Definition at line 113 of file IControl.cpp.

References NVals(), and SetDirty().

Referenced by GetTooltip(), ICaptionControl::ICaptionControl(), IURLControl::OnMouseDown(), and IVTrackControlBase::SetParams().

void IControl::SetPosition ( float  x,
float  y 
)
virtual

Set the position of the control, preserving the width and height.

This may need to be overriden if you maintain custom positioning data in your control

Parameters
xthe new x coordinate of the top left corner of the control
ythe new y coordinate of the top left corner of the control

Definition at line 296 of file IControl.cpp.

References IRECT::H(), IRECT::L, SetRECT(), SetTargetRECT(), IRECT::T, and IRECT::W().

Referenced by IGraphics::SetControlPosition(), and SetTargetAndDrawRECTs().

void IControl::SetPromptShowsParamLabel ( bool  enable)
inline

Set if the control should show parameter labels/units e.g.

"Hz" in text entry prompts

Definition at line 379 of file IControl.h.

void IControl::SetPTParameterHighlight ( bool  isHighlighted,
int  color 
)

Used internally by the AAX wrapper view interface to set the control parmeter highlight.

Parameters
isHighlighted/c true if the control should be highlighted
colorAn integer representing one of three colors that ProTools assigns automated controls

Definition at line 370 of file IControl.cpp.

References SetDirty().

Referenced by IGraphics::SetPTParameterHighlight(), and SetTargetAndDrawRECTs().

void IControl::SetRECT ( const IRECT bounds)
inline

Set the rectangular draw area for this control, within the graphics context.

Parameters
boundsThe control's bounds

Definition at line 309 of file IControl.h.

References mMouseIsOver, and OnResize().

Referenced by IPopupMenuControl::CalculateMenuPanels(), IGraphicsLiveEdit::OnMouseUp(), SetPosition(), and IBubbleControl::SetStrokeColor().

void IControl::SetSize ( float  w,
float  h 
)
virtual

Set the size of the control, preserving the current position.

This may need to be overriden if you maintain custom positioning data in your control, or if your TargetRECT is not the same as the main RECT.

Parameters
wthe new width of the control
hthe new height of the control

Definition at line 308 of file IControl.cpp.

References IRECT::L, SetTargetAndDrawRECTs(), and IRECT::T.

Referenced by IGraphics::SetControlSize(), and SetTargetAndDrawRECTs().

void IControl::SetTargetAndDrawRECTs ( const IRECT bounds)
inline

Set BOTH the draw rect and the target area, within the graphics context for this control.

Parameters
boundsThe control's new draw and target bounds within the graphics context

Definition at line 321 of file IControl.h.

References mMouseIsOver, OnResize(), SetPosition(), SetPTParameterHighlight(), and SetSize().

Referenced by ITextEntryControl::OnKeyDown(), ICornerResizerControl::OnRescale(), IVNumberBoxControl::OnResize(), IBubbleControl::ResetBounds(), ITextControl::SetBoundsBasedOnStr(), IGraphics::SetControlBounds(), and SetSize().

void IControl::SetTargetRECT ( const IRECT bounds)
inline
void IControl::SetText ( const IText txt)
inline

Set the Text object typically used to determine font/layout/size etc of the main text in a control.

Parameters
txtAn IText struct with the desired formatting

Definition at line 286 of file IControl.h.

Referenced by ITextEntryControl::OnKeyDown().

void IControl::SetTextEntryLength ( int  len)
inline

Set the max number of characters that are allowed in text entry.

Parameters
lenThe max number of characters allowed in text entry

Definition at line 301 of file IControl.h.

void IControl::SetTooltip ( const char *  str)
inline

Set a tooltip for the control.

Parameters
strCString tooltip to be displayed

Definition at line 210 of file IControl.h.

void IControl::SetValue ( double  value,
int  valIdx = 0 
)
virtual
void IControl::SetValueFromDelegate ( double  value,
int  valIdx = 0 
)
virtual

Set the control's value from the delegate This method is called from the class implementing the IEditorDelegate interface in order to update a control's value members and set it to be marked dirty for redraw.

Parameters
valueNormalised incoming value
valIdxThe index of the value to set, which should be between 0 and NVals()

Reimplemented in IVNumberBoxControl.

Definition at line 157 of file IControl.cpp.

References GetUI(), GetValue(), SetDirty(), and SetValue().

Referenced by GetValIdxForPos(), IGEditorDelegate::SendControlValueFromDelegate(), IGEditorDelegate::SendParameterValueFromDelegate(), and IVNumberBoxControl::SetValueFromDelegate().

void IControl::SetValueFromUserInput ( double  value,
int  valIdx = 0 
)
virtual

Set the control's value after user input.

This method is called after a text entry or popup menu prompt triggered by PromptUserInput(), calling SetDirty(true), which will mean that the new value gets sent back to the delegate

Parameters
valuethe normalised value after user input via text entry or pop-up menu
valIdxAn index to choose which of the controls linked parameters to retrieve. NOTE: since controls usually have only 1 parameter you can omit this argument and use the default index of 0

Reimplemented in IVNumberBoxControl.

Definition at line 172 of file IControl.cpp.

References GetValue(), SetDirty(), and SetValue().

Referenced by GetValIdxForPos(), OnPopupMenuSelection(), and IVNumberBoxControl::SetValueFromUserInput().

void IControl::SetValueToDefault ( int  valIdx = kNoValIdx)
virtual

Set one or all of the control's values to the default value of the associated parameter.

Parameters
valIdxeither an integer > -1 (kNoValIdx) in order to set an individual value to the default value of the associated parameter, or kNoValIdx to default all values This method will call through to SetDirty(true, valIdx), which will mean that the new value gets sent back to the delegate

Definition at line 181 of file IControl.cpp.

References ForValIdx(), IParam::GetDefault(), GetParam(), NVals(), SetDirty(), and SetValue().

Referenced by GetValIdxForPos(), OnMouseDblClick(), and OnMouseDown().

void IControl::SetWantsMidi ( bool  enable = true)
inline

Specify whether this control wants to know about MIDI messages sent to the UI.

See OnMIDIMsg()

Definition at line 414 of file IControl.h.

Referenced by IWheelControl::IWheelControl().

void IControl::SnapToMouse ( float  x,
float  y,
EDirection  direction,
const IRECT bounds,
int  valIdx = -1,
double  minClip = 0.,
double  maxClip = 1. 
)
virtual

Set control value based on x, y position within a rectangle.

Commonly used for slider/fader controls.

Parameters
xThe X coordinate for snapping
yThe Y coordinate for snapping
directionThe direction of the control's travel- horizontal or vertical fader
boundsThe area in which the track of e.g. a slider should be snapped
valIdx

Reimplemented in IVMultiSliderControl< MAXNC >.

Definition at line 402 of file IControl.cpp.

References Clip(), IRECT::Constrain(), ForValIdx(), IRECT::H(), IRECT::L, SetDirty(), SetValue(), IRECT::T, and IRECT::W().

Referenced by GetMouseIsOver(), ISliderControlBase::OnMouseDown(), IVRangeSliderControl::OnMouseDrag(), and ISliderControlBase::OnMouseDrag().

void IControl::StartAnimation ( int  duration)
Parameters
durationDuration in milliseconds for the animation

Definition at line 430 of file IControl.cpp.

Referenced by ILambdaControl::Draw(), GetMouseIsOver(), TestKeyboardControl::OnKeyDown(), and SetAnimation().

Member Data Documentation

bool IControl::mMouseIsOver = false
protected

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