|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef PLUGIN_PARAM_VIEW_INTERFACE
|
|
Toshihiro Shimizu |
890ddd |
#define PLUGIN_PARAM_VIEW_INTERFACE
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz_hostif.h"
|
|
|
7e85db |
|
|
|
7e85db |
#include <toonzqt fxsettings.h=""></toonzqt>
|
|
|
7e85db |
|
|
|
7e85db |
#include <qwidget></qwidget>
|
|
|
7e85db |
|
|
|
7e85db |
#include <vector></vector>
|
|
|
7e85db |
#include <memory></memory>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/* 公開ヘッダからは引っ込められた都合上ここで宣言(内部ではまだ使っているので) */
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_param_view_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/* あるパラメータの表示形式 */
|
|
Shinya Kitaoka |
120a6e |
class ParamView {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
struct Component {
|
|
Shinya Kitaoka |
120a6e |
virtual ~Component() {}
|
|
Shinya Kitaoka |
120a6e |
virtual QWidget *make_widget(TFx *fx, ParamsPage *page,
|
|
Shinya Kitaoka |
120a6e |
const char *name) const = 0;
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
#define TOONZ_DEFINE_COMPONENT(NAME) \
|
|
Shinya Kitaoka |
120a6e |
struct NAME : public Component { \
|
|
Shinya Kitaoka |
120a6e |
QWidget *make_widget(TFx *fx, ParamsPage *page, \
|
|
Shinya Kitaoka |
120a6e |
const char *name) const final override { \
|
|
Shinya Kitaoka |
120a6e |
return page->new##NAME(fx, name); \
|
|
Shinya Kitaoka |
120a6e |
} \
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(ParamField);
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(LineEdit);
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(Slider);
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(SpinBox);
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(CheckBox);
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(RadioButton);
|
|
Shinya Kitaoka |
120a6e |
TOONZ_DEFINE_COMPONENT(ComboBox);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef TOONZ_DEFINE_COMPONENT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ParamView() {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ParamView(const ParamView &rhs) : components_(rhs.components_) {}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
inline void add_component(std::shared_ptr<component> component) {</component>
|
|
Shinya Kitaoka |
120a6e |
components_.push_back(std::move(component));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
ParamView *clone(TFx *) const { return new ParamView(*this); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void build(TFx *fx, ParamsPage *page, const char *name) const {
|
|
Shinya Kitaoka |
120a6e |
for (const auto &component : components_) {
|
|
Shinya Kitaoka |
120a6e |
page->addWidget(component->make_widget(fx, page, name));
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
std::vector<std::shared_ptr<component>> components_;</std::shared_ptr<component>
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_param_field_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_lineedit_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_slider_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_spinbox_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_checkbox_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_radiobutton_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
typedef void *toonz_combobox_handle_t;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int add_param_field(toonz_param_view_handle_t view,
|
|
Shinya Kitaoka |
120a6e |
toonz_param_field_handle_t *ParamField);
|
|
Shinya Kitaoka |
120a6e |
int add_lineedit(toonz_param_view_handle_t view,
|
|
Shinya Kitaoka |
120a6e |
toonz_lineedit_handle_t *LineEdit);
|
|
Toshihiro Shimizu |
890ddd |
int add_slider(toonz_param_view_handle_t view, toonz_slider_handle_t *Slider);
|
|
Shinya Kitaoka |
120a6e |
int add_spinbox(toonz_param_view_handle_t view,
|
|
Shinya Kitaoka |
120a6e |
toonz_spinbox_handle_t *CheckBox);
|
|
Shinya Kitaoka |
120a6e |
int add_checkbox(toonz_param_view_handle_t view,
|
|
Shinya Kitaoka |
120a6e |
toonz_checkbox_handle_t *CheckBox);
|
|
Shinya Kitaoka |
120a6e |
int add_radiobutton(toonz_param_view_handle_t view,
|
|
Shinya Kitaoka |
120a6e |
toonz_radiobutton_handle_t *RadioButton);
|
|
Shinya Kitaoka |
120a6e |
int add_combobox(toonz_param_view_handle_t view,
|
|
Shinya Kitaoka |
120a6e |
toonz_combobox_handle_t *Combobox);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef TOONZ_DEFINE_ADD_COMPONENT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|