20 #include <vstgui4/vstgui/lib/iviewlistener.h> 21 #include <vstgui4/vstgui/lib/cview.h> 22 #include <pongasoft/logging/logging.h> 98 template<
typename T,
typename ...Args>
99 static std::shared_ptr<T>
create(CView *iView, Args&& ...iArgs)
102 static_assert(std::is_convertible<T *, SelfContainedViewListener*>::value,
"T must be a subclass of SelfContainedViewListener");
104 auto res = std::make_shared<T>(std::forward<Args>(iArgs)...);
105 res->registerView(iView);
118 fView->unregisterViewListener(
this);
134 virtual std::shared_ptr<SelfContainedViewListener>
registerView(CView *iView)
136 DCHECK_F(iView !=
nullptr);
142 fView->registerViewListener(
this);
143 fThis = shared_from_this();
156 DCHECK_F(iView == fView);
162 std::shared_ptr<SelfContainedViewListener> fThis{};
void viewWillDelete(CView *iView) override
Called by the view itself when it is going to be deleted.
Definition: SelfContainedViewListener.h:154
virtual void unregister()
You can call this method at anytime to unregister this class as the listener to the view that was pre...
Definition: SelfContainedViewListener.h:114
static std::shared_ptr< T > create(CView *iView, Args &&...iArgs)
This is the main method that should be used to create an instance of this class.
Definition: SelfContainedViewListener.h:99
Definition: CustomController.h:24
virtual std::shared_ptr< SelfContainedViewListener > registerView(CView *iView)
Registers this class as a view listener.
Definition: SelfContainedViewListener.h:134
The purpose of this class is to implement a view listener that is "self-contained":
Definition: SelfContainedViewListener.h:85