tahoma2d/toonz/sources/toonzqt/plugin_param_view_interface.cpp

33 lines
1.3 KiB
C++
Raw Normal View History

2016-03-19 06:57:51 +13:00
#include "plugin_param_view_interface.h"
static int add_component(toonz_param_view_handle_t view, void **handle,
2016-06-15 18:43:10 +12:00
std::shared_ptr<ParamView::Component> component) {
if (ParamView *_ = reinterpret_cast<ParamView *>(view)) {
if (handle) {
*handle = component.get();
}
_->add_component(std::move(component));
} else {
return TOONZ_ERROR_INVALID_HANDLE;
}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
return TOONZ_OK;
2016-03-19 06:57:51 +13:00
}
2016-06-15 18:43:10 +12:00
#define TOONZ_DEFINE_ADD_COMPONENT(NAME, HANDLE, FIELD) \
int NAME(toonz_param_view_handle_t view, HANDLE *handle) { \
return add_component(view, handle, std::make_shared<ParamView::FIELD>()); \
}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TOONZ_DEFINE_ADD_COMPONENT(add_param_field, toonz_param_field_handle_t,
ParamField);
2016-03-19 06:57:51 +13:00
TOONZ_DEFINE_ADD_COMPONENT(add_lineedit, toonz_lineedit_handle_t, LineEdit);
TOONZ_DEFINE_ADD_COMPONENT(add_slider, toonz_slider_handle_t, Slider);
TOONZ_DEFINE_ADD_COMPONENT(add_spinbox, toonz_spinbox_handle_t, SpinBox);
TOONZ_DEFINE_ADD_COMPONENT(add_checkbox, toonz_checkbox_handle_t, CheckBox);
2016-06-15 18:43:10 +12:00
TOONZ_DEFINE_ADD_COMPONENT(add_radiobutton, toonz_radiobutton_handle_t,
RadioButton);
2016-03-19 06:57:51 +13:00
TOONZ_DEFINE_ADD_COMPONENT(add_combobox, toonz_combobox_handle_t, ComboBox);
#undef TOONZ_DEFINE_ADD_COMPONENT