20 #include <vstgui4/vstgui/lib/cview.h> 32 using namespace Params;
77 void setBackColor(CColor
const &iColor);
111 void setEditorMode(
bool iEditorMode);
141 bool getEditorMode()
const;
146 virtual void onEditorModeChanged() {}
153 void draw(CDrawContext *iContext)
override;
158 virtual void drawBackColor(CDrawContext *iContext);
163 void drawStyleChanged();
169 void onParameterChange(ParamID iParamID)
override;
189 registerParameters();
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) :
283 template<
typename TView,
typename TGUIState>
287 static_assert(std::is_convertible<TView *, CView*>::value,
"TView must be a subclass of CView");
290 static_assert(std::is_convertible<TGUIState *, GUIState*>::value,
"TGUIState must be a subclass of GUIState");
294 template<
typename... Args>
295 explicit StateAwareView(
const CRect &iSize, Args&& ...args) : TView(iSize, std::forward<Args>(args)...) {}
303 TView::initState(iGUIState);
312 template<
typename TGUIState>
334 template<
typename TView>
338 static_assert(std::is_convertible<TView *, CView*>::value,
"TView must be a subclass of CView");
342 template<
typename... Args>
358 if(fEditorMode != iEditorMode)
360 fEditorMode = iEditorMode;
361 onEditorModeChanged();
379 virtual void onEditorModeChanged() {}
390 registerParameters();
397 bool fEditorMode{
false};
409 explicit Creator(
char const *iViewName =
nullptr,
char const *iDisplayName =
nullptr) :
427 template<
typename TView,
typename TGUIState>
431 static_assert(std::is_convertible<TView *, CView*>::value,
"TView must be a subclass of CView");
434 static_assert(std::is_convertible<TGUIState *, GUIState*>::value,
"TGUIState must be a subclass of GUIState");
438 template<
typename... Args>
454 template<
typename TView,
typename TGUIState>
464 template<
typename TGUIState>
474 template<
typename TView,
typename TGUIState>
478 template<
typename... Args>
TagID getCustomViewTag() const
The tag associated to this custom view.
Definition: CustomView.h:352
void setBackColor(CColor const &iColor)
Definition: CustomView.cpp:62
StateAwareView(const CRect &iSize, Args &&...args)
Definition: CustomView.h:295
This class is inherited by classes who want to be aware of parameters and be notified when they chang...
Definition: ParamAware.h:63
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:387
This class is used to get access to the GUI state and parameters of the plugin with their actual type...
Definition: StateAware.h:30
Definition: GUIState.h:40
TagID fTag
Definition: CustomView.h:395
PluginView(const CRect &iSize)
Definition: CustomView.h:458
Class you should inherit from if you want to write a custom view.
Definition: CustomView.h:60
This interface defines some methods that are important in the lifecycle of a custom view.
Definition: CustomViewLifecycle.h:27
void initState(GUIState *iGUIState) override
This method is called by Jamba automatically to initialize the state.
Definition: CustomView.h:444
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:107
virtual void initState(GUIState *iGUIState)
Called during initialization.
Definition: ParamAware.cpp:36
void setCustomViewTag(TagID iTag)
Definition: CustomView.h:81
ParamID TagID
Defining a type for tags.
Definition: Types.h:57
void afterApplyAttributes() override
Handles the lifecycle behavior getting triggered once all the attributes have been set (which usually...
Definition: CustomView.h:186
Defines and registers the attributes exposed in the VSTGUI Editor and XML file (.uidesc) for CustomVi...
Definition: CustomView.h:406
This class can be used to extend VST SDK classes directly while still benefiting from the extensions ...
Definition: CustomView.h:428
void markDirty()
Marks this view dirty which will (at the appropriate time in the rendering lifecycle) trigger a call ...
Definition: CustomView.h:346
void onParameterChange(ParamID iParamID) override
Callback when a parameter changes.
Definition: CustomView.h:384
Definition: CustomView.h:475
void setEditorMode(bool iEditorMode)
Definition: CustomView.cpp:91
Definition: CustomView.h:455
This class can be used to extend VSTGUI classes directly while still benefiting from the extensions a...
Definition: CustomView.h:335
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition: CustomView.h:241
CColor fBackColor
Definition: CustomView.h:229
bool getEditorMode() const
A flag whose purpose is to render/log information during development when the flag is set to true.
Definition: CustomView.h:369
Defines and registers the attributes exposed in the VSTGUI Editor and XML file (.uidesc) for CustomVi...
Definition: CustomView.h:238
void markDirty()
Marks this view dirty which will (at the appropriate time in the rendering lifecycle) trigger a call ...
Definition: CustomView.h:177
virtual void initState(GUIState *iGUIState)
This method is called by Jamba automatically to initialize the state.
Definition: StateAware.h:41
Definition: CustomView.h:465
StateAwareCustomViewAdapter(const CRect &iSize, Args &&...args)
Definition: CustomView.h:439
Definition: CustomController.h:24
void setEditorMode(bool iEditorMode)
Definition: CustomView.h:355
void initState(GUIState *iGUIState) override
Overriden to call both ParamAware::initState() and StateAware::initState()
Definition: CustomView.h:301
Override from this class if you need to implement a (custom) view specific to a given plugin.
Definition: CustomView.h:284
bool sizeToFit(BitmapPtr iBitmap, int iFrameCount=1)
Convenient call to size to fit this view to match the bitmap.
Definition: CustomView.h:214
void setCustomViewTag(TagID iTag)
Definition: CustomView.h:349
PluginCustomView(const CRect &iSize)
Definition: CustomView.h:468
Generic custom view creator base class.
Definition: CustomViewCreator.h:155
CustomViewAdapter(const CRect &iSize, Args &&...args)
Definition: CustomView.h:343
TagID getCustomViewTag() const
The tag associated to this custom view.
Definition: CustomView.h:107
CBitmap * BitmapPtr
Definition: Types.h:49
PluginCustomViewAdapter(const CRect &iSize, Args &&... args)
Definition: CustomView.h:479
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:47
Creator(char const *iViewName=nullptr, char const *iDisplayName=nullptr)
Definition: CustomView.h:409
CColor const & getBackColor() const
The back color (background) for the view.
Definition: CustomView.h:73