21#include <vstgui4/vstgui/lib/cview.h>
32using namespace VSTGUI;
33using namespace Params;
147 virtual void onEditorModeChanged() {}
154 void draw(CDrawContext *iContext)
override;
198 using CView::sizeToFit;
205 CRect vs(getViewSize());
207 vs.setHeight(iHeight);
208 setViewSize(vs,
true);
209 setMouseableArea(vs);
219 sizeToFit(iBitmap->getWidth(), iBitmap->getHeight() / iFrameCount);
228 bool fEditorMode{
false};
242 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
284template<
typename TView,
typename TGUIState>
288 static_assert(std::is_convertible<TView *, CView*>::value,
"TView must be a subclass of CView");
291 static_assert(std::is_convertible<TGUIState *, GUIState*>::value,
"TGUIState must be a subclass of GUIState");
295 template<
typename... Args>
296 explicit StateAwareView(
const CRect &iSize, Args&& ...args) : TView(iSize, std::forward<Args>(args)...) {}
304 TView::initState(iGUIState);
313template<
typename TGUIState>
335template<
typename TView>
339 static_assert(std::is_convertible<TView *, CView*>::value,
"TView must be a subclass of CView");
343 template<
typename... Args>
359 if(fEditorMode != iEditorMode)
361 fEditorMode = iEditorMode;
362 onEditorModeChanged();
381 virtual void onEditorModeChanged() {}
398 bool fEditorMode{
false};
410 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
428template<
typename TView,
typename TGUIState>
432 static_assert(std::is_convertible<TView *, CView*>::value,
"TView must be a subclass of CView");
435 static_assert(std::is_convertible<TGUIState *, GUIState*>::value,
"TGUIState must be a subclass of GUIState");
439 template<
typename... Args>
455template<
typename TView,
typename TGUIState>
465template<
typename TGUIState>
475template<
typename TView,
typename TGUIState>
479 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:65
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:498
void unregisterAll()
Unregisters all parameters.
Definition ParamAware.cpp:98
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition CustomView.h:242
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition CustomView.h:410
TagID getCustomViewTag() const
The tag associated to this custom view.
Definition CustomView.h:353
void onParameterChange(ParamID iParamID) override
Callback when a parameter changes.
Definition CustomView.h:385
void markDirty()
Marks this view dirty which will (at the appropriate time in the rendering lifecycle) trigger a call ...
Definition CustomView.h:347
void afterApplyAttributes() override
Handles the lifecycle behavior getting triggered once all the attributes have been set (which usually...
Definition CustomView.h:388
bool getEditorMode() const
A flag whose purpose is to render/log information during development when the flag is set to true.
Definition CustomView.h:370
void setCustomViewTag(TagID iTag)
Definition CustomView.h:350
CustomViewAdapter(const CRect &iSize, Args &&...args)
Definition CustomView.h:344
TCustomViewCreator< CustomViewAdapter > creator_super_type
Definition CustomView.h:402
TagID fTag
Definition CustomView.h:396
void setEditorMode(bool iEditorMode)
Definition CustomView.h:356
Class you should inherit from if you want to write a custom view.
Definition CustomView.h:62
virtual void drawBackColor(CDrawContext *iContext)
Draws the back color (if not set to transparent).
Definition CustomView.cpp:51
TagID getCustomViewTag() const
The tag associated to this custom view.
Definition CustomView.h:108
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:178
void sizeToFit(CCoord iWidth, CCoord iHeight)
Convenient call to size to fit this view according to the and height provided.
Definition CustomView.h:203
void afterApplyAttributes() override
Handles the lifecycle behavior getting triggered once all the attributes have been set (which usually...
Definition CustomView.h:187
bool sizeToFit(BitmapPtr iBitmap, int iFrameCount=1)
Convenient call to size to fit this view to match the bitmap.
Definition CustomView.h:215
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:226
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:230
CustomView(const CustomView &c)=delete
void setCustomViewTag(TagID iTag)
Definition CustomView.h:82
CColor const & getBackColor() const
The back color (background) for the view.
Definition CustomView.h:74
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
PluginCustomViewAdapter(const CRect &iSize, Args &&... args)
Definition CustomView.h:480
PluginCustomView(const CRect &iSize)
Definition CustomView.h:469
PluginView(const CRect &iSize)
Definition CustomView.h:459
StateAwareCustomViewAdapter(const CRect &iSize, Args &&...args)
Definition CustomView.h:440
void initState(GUIState *iGUIState) override
Called during initialization.
Definition CustomView.h:445
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:42
Override from this class if you need to implement a (custom) view specific to a given plugin.
Definition CustomView.h:286
void initState(GUIState *iGUIState) override
Overriden to call both ParamAware::initState() and StateAware::initState().
Definition CustomView.h:302
StateAwareView(const CRect &iSize, Args &&...args)
Definition CustomView.h:296
Generic custom view creator base class.
Definition CustomViewCreator.h:158
void registerColorAttribute(std::string const &iName, typename ColorAttribute::Getter iGetter, typename ColorAttribute::Setter iSetter)
Definition CustomViewCreator.h:952
friend class TCustomViewCreator
Definition CustomViewCreator.h:1200
void registerBooleanAttribute(std::string const &iName, typename BooleanAttribute::Getter iGetter, typename BooleanAttribute::Setter iSetter)
Definition CustomViewCreator.h:1100
void registerTagAttribute(std::string const &iName, typename TagAttribute::Getter iGetter, typename TagAttribute::Setter iSetter)
Definition CustomViewCreator.h:1049
Definition CustomController.h:25
StateAwareView< CustomView, TGUIState > StateAwareCustomView
Shortcut alias when implementing a StateAwareView where the view is a CustomView.
Definition CustomView.h:314
CBitmap * BitmapPtr
Definition Types.h:50
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