Toshihiro Shimizu 890ddd
#include "plugin_param_view_interface.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
static int add_component(toonz_param_view_handle_t view, void **handle,
Toshihiro Shimizu 890ddd
						 std::shared_ptr<paramview::component> component)</paramview::component>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	if (ParamView *_ = reinterpret_cast<paramview *="">(view)) {</paramview>
Toshihiro Shimizu 890ddd
		if (handle) {
Toshihiro Shimizu 890ddd
			*handle = component.get();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		_->add_component(std::move(component));
Toshihiro Shimizu 890ddd
	} else {
Toshihiro Shimizu 890ddd
		return TOONZ_ERROR_INVALID_HANDLE;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	return TOONZ_OK;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TOONZ_DEFINE_ADD_COMPONENT(NAME, HANDLE, FIELD)                           \
Toshihiro Shimizu 890ddd
	int NAME(toonz_param_view_handle_t view, HANDLE *handle)                      \
Toshihiro Shimizu 890ddd
	{                                                                             \
Toshihiro Shimizu 890ddd
		return add_component(view, handle, std::make_shared<paramview::field>()); \</paramview::field>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_param_field, toonz_param_field_handle_t, ParamField);
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_lineedit, toonz_lineedit_handle_t, LineEdit);
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_slider, toonz_slider_handle_t, Slider);
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_spinbox, toonz_spinbox_handle_t, SpinBox);
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_checkbox, toonz_checkbox_handle_t, CheckBox);
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_radiobutton, toonz_radiobutton_handle_t, RadioButton);
Toshihiro Shimizu 890ddd
TOONZ_DEFINE_ADD_COMPONENT(add_combobox, toonz_combobox_handle_t, ComboBox);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef TOONZ_DEFINE_ADD_COMPONENT