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,
Shinya Kitaoka 120a6e
                         std::shared_ptr<paramview::component> component) {</paramview::component>
Shinya Kitaoka 120a6e
  if (ParamView *_ = reinterpret_cast<paramview *="">(view)) {</paramview>
Shinya Kitaoka 120a6e
    if (handle) {
Shinya Kitaoka 120a6e
      *handle = component.get();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    _->add_component(std::move(component));
Shinya Kitaoka 120a6e
  } else {
Shinya Kitaoka 120a6e
    return TOONZ_ERROR_INVALID_HANDLE;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return TOONZ_OK;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
#define TOONZ_DEFINE_ADD_COMPONENT(NAME, HANDLE, FIELD)                        \
Shinya Kitaoka 120a6e
  int NAME(toonz_param_view_handle_t view, HANDLE *handle) {                   \
Shinya Kitaoka 120a6e
    return add_component(view, handle, std::make_shared<paramview::field>());  \</paramview::field>
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TOONZ_DEFINE_ADD_COMPONENT(add_param_field, toonz_param_field_handle_t,
Shinya Kitaoka 120a6e
                           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);
Shinya Kitaoka 120a6e
TOONZ_DEFINE_ADD_COMPONENT(add_radiobutton, toonz_radiobutton_handle_t,
Shinya Kitaoka 120a6e
                           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