blob: 952a2542a0787aef069250c2aee00590793303d6 [file]
#ifndef _RIVE_VIEW_MODEL_INSTANCE_ARTBOARD_HPP_
#define _RIVE_VIEW_MODEL_INSTANCE_ARTBOARD_HPP_
#include "rive/generated/viewmodel/viewmodel_instance_artboard_base.hpp"
#include "rive/data_bind/data_values/data_value_integer.hpp"
#include "rive/bindable_artboard.hpp"
#include <stdio.h>
namespace rive
{
#ifdef WITH_RIVE_TOOLS
class ViewModelInstanceArtboard;
typedef void (
*ViewModelArtboardChanged)(ViewModelInstanceArtboard* vmi, uint32_t value);
#endif
class ViewModelInstanceArtboard : public ViewModelInstanceArtboardBase
{
protected:
void propertyValueChanged() override;
public:
void asset(rcp<BindableArtboard> value);
void boundViewModelInstance(rcp<ViewModelInstance> value);
rcp<BindableArtboard> asset() { return m_bindableArtboard; }
void applyValue(DataValueInteger*);
rcp<ViewModelInstance> boundViewModelInstance()
{
return m_boundViewModelInstance;
}
private:
rcp<BindableArtboard> m_bindableArtboard = nullptr;
rcp<ViewModelInstance> m_boundViewModelInstance = nullptr;
// Set when the bound instance changes, so the next asset() notifies even
// with the same bindable.
bool m_boundViewModelInstanceChanged = false;
#ifdef WITH_RIVE_TOOLS
public:
void onChanged(ViewModelArtboardChanged callback)
{
m_changedCallback = callback;
}
ViewModelArtboardChanged m_changedCallback = nullptr;
#endif
};
} // namespace rive
#endif