21#include <vstgui4/vstgui/lib/cview.h>
31using namespace VSTGUI;
32using namespace Params;
146 virtual void onEditorModeChanged() {}
153 void draw(CDrawContext *iContext)
override;
197 using CView::sizeToFit;
204 CRect vs(getViewSize());
206 vs.setHeight(iHeight);
207 setViewSize(vs,
true);
208 setMouseableArea(vs);
218 sizeToFit(iBitmap->getWidth(), iBitmap->getHeight() / iFrameCount);
227 bool fEditorMode{
false};
241 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
283template<CViewSub
class TView, GUIStateSub
class TGUIState>
288 template<
typename... Args>
289 explicit StateAwareView(
const CRect &iSize, Args&& ...args) : TView(iSize, std::forward<Args>(args)...) {}
297 TView::initState(iGUIState);
306template<GUIStateSub
class TGUIState>
328template<CViewSub
class TView>
333 template<
typename... Args>
349 if(fEditorMode != iEditorMode)
351 fEditorMode = iEditorMode;
352 onEditorModeChanged();
371 virtual void onEditorModeChanged() {}
388 bool fEditorMode{
false};
400 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
418template<CViewSub
class TView, GUIStateSub
class TGUIState>
423 template<
typename... Args>
This class is inherited by classes who want to be aware of parameters and be notified when they chang...
Definition ParamAware.h:64
virtual void initState(GUIState *iGUIState)
Called during initialization.
Definition ParamAware.cpp:37
virtual void registerParameters()
Subclasses should override this method to register each parameter.
Definition ParamAware.h:485
void unregisterAll()
Unregisters all parameters.
Definition ParamAware.cpp:82
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition CustomView.h:241
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition CustomView.h:400
TagID getCustomViewTag() const
The tag associated with this custom view.
Definition CustomView.h:343
void onParameterChange(ParamID iParamID) override
Callback when a parameter changes.
Definition CustomView.h:375
void markDirty()
Marks this view dirty which will (at the appropriate time in the rendering lifecycle) trigger a call ...
Definition CustomView.h:337
void afterApplyAttributes() override
Handles the lifecycle behavior getting triggered once all the attributes have been set (which usually...
Definition CustomView.h:378
bool getEditorMode() const
A flag whose purpose is to render/log information during development when the flag is set to true.
Definition CustomView.h:360
void setCustomViewTag(TagID iTag)
Definition CustomView.h:340
CustomViewAdapter(const CRect &iSize, Args &&...args)
Definition CustomView.h:334
TCustomViewCreator< CustomViewAdapter > creator_super_type
Definition CustomView.h:392
TagID fTag
Definition CustomView.h:386
void setEditorMode(bool iEditorMode)
Definition CustomView.h:346
Class you should inherit from if you want to write a custom view.
Definition CustomView.h:61
virtual void drawBackColor(CDrawContext *iContext)
Draws the back color (if not set to transparent).
Definition CustomView.cpp:51
TagID getCustomViewTag() const
The tag associated with this custom view.
Definition CustomView.h:107
void onParameterChange(ParamID iParamID) override
Callback when a parameter changes.
Definition CustomView.cpp:84
CustomView(const CRect &iSize)
Definition CustomView.cpp:30
void markDirty()
Marks this view dirty which will (at the appropriate time in the rendering lifecycle) trigger a call ...
Definition CustomView.h:177
void sizeToFit(CCoord iWidth, CCoord iHeight)
Convenient call to size to fit this view according to the and height provided.
Definition CustomView.h:202
void afterApplyAttributes() override
Handles the lifecycle behavior getting triggered once all the attributes have been set (which usually...
Definition CustomView.h:186
bool sizeToFit(BitmapPtr iBitmap, int iFrameCount=1)
Convenient call to size to fit this view to match the bitmap.
Definition CustomView.h:214
void draw(CDrawContext *iContext) override
The basic draw method which will erase the background with the back color.
Definition CustomView.cpp:41
ParamID fTag
Definition CustomView.h:225
bool getEditorMode() const
A flag whose purpose is to render/log information during development when the flag is set to true.
Definition CustomView.cpp:108
CColor fBackColor
Definition CustomView.h:229
CustomView(const CustomView &c)=delete
void setCustomViewTag(TagID iTag)
Definition CustomView.h:81
CColor const & getBackColor() const
The back color (background) for the view.
Definition CustomView.h:73
void setBackColor(CColor const &iColor)
Definition CustomView.cpp:63
void drawStyleChanged()
Called when the draw style is changed (simply marks the view dirty).
Definition CustomView.cpp:76
void setEditorMode(bool iEditorMode)
Definition CustomView.cpp:92
This interface defines some methods that are important in the lifecycle of a custom view.
Definition CustomViewLifecycle.h:29
StateAwareCustomViewAdapter(const CRect &iSize, Args &&...args)
Definition CustomView.h:424
void initState(GUIState *iGUIState) override
Called during initialization.
Definition CustomView.h:429
This class is used to get access to the GUI state and parameters of the plugin with their actual type...
Definition StateAware.h:32
virtual void initState(GUIState *iGUIState)
This method is called by Jamba automatically to initialize the state.
Definition StateAware.h:43
Override from this class if you need to implement a (custom) view specific to a given plugin.
Definition CustomView.h:285
void initState(GUIState *iGUIState) override
Overriden to call both ParamAware::initState() and StateAware::initState().
Definition CustomView.h:295
StateAwareView(const CRect &iSize, Args &&...args)
Definition CustomView.h:289
Generic custom view creator base class.
Definition CustomViewCreator.h:163
void registerBooleanAttribute(std::string const &iName, BooleanAttribute::Getter iGetter, BooleanAttribute::Setter iSetter)
Definition CustomViewCreator.h:1114
void registerColorAttribute(std::string const &iName, ColorAttribute::Getter iGetter, ColorAttribute::Setter iSetter)
Definition CustomViewCreator.h:966
friend class TCustomViewCreator
Definition CustomViewCreator.h:1214
void registerTagAttribute(std::string const &iName, TagAttribute::Getter iGetter, TagAttribute::Setter iSetter)
Definition CustomViewCreator.h:1063
Definition CustomController.h:26
StateAwareView< CustomView, TGUIState > StateAwareCustomView
Shortcut alias when implementing a StateAwareView where the view is a CustomView.
Definition CustomView.h:307
CBitmap * BitmapPtr
Definition Types.h:48
ParamID TagID
Defining a type for tags.
Definition Types.h:58
constexpr ParamID UNDEFINED_PARAM_ID
Constant used throughout the code to test whether the ParamID represents a valid id or an undefined o...
Definition Types.h:48