4#include <unordered_map>
9#include "webcface/common/webcface-config.h"
16#pragma message("warning: Disabling macro definition of 'min' and 'max', since they conflicts in webcface/component_view.h.")
30struct ViewComponentData;
33struct TemporalViewComponentData;
75WEBCFACE_DLL ViewColor colorFromRGB(
double r,
double g,
double b);
111 std::shared_ptr<message::ViewComponentData> msg_data;
112 std::weak_ptr<internal::ClientData> data_w;
116 mutable std::unique_ptr<wcfMultiVal[]> options_s;
117 mutable std::unique_ptr<wcfMultiValW[]> options_sw;
119 void checkData()
const;
121 template <
typename CComponent,
typename CVal, std::
size_t v_index>
122 CComponent cDataT()
const;
131 ViewComponent(
const std::shared_ptr<message::ViewComponentData> &msg_data,
132 const std::weak_ptr<internal::ClientData> &data_w,
153 std::
string id() const;
163 std::wstring idW() const;
180 return !(*
this == other);
192 std::string text()
const;
197 std::wstring textW()
const;
202 template <WEBCFACE_COMPLETE(Func)>
214 template <WEBCFACE_COMPLETE(Func)>
225 template <WEBCFACE_COMPLETE(Variant)>
226 std::optional<Variant_>
bind()
const;
243 std::optional<double> min()
const;
250 std::optional<double> max()
const;
256 std::optional<double> step()
const;
262 std::vector<ValAdaptor> option()
const;
274extern template std::optional<Func>
275ViewComponent::onClick<Func, true>()
const;
276extern template std::optional<Func>
277ViewComponent::onChange<Func, true>()
const;
278extern template std::optional<Variant>
279ViewComponent::bind<Variant, true>()
const;
287 std::unique_ptr<internal::TemporalViewComponentData> msg_data;
313 friend class internal::ViewBuf;
323 std::unique_ptr<internal::TemporalViewComponentData>
324 lockTmp(const std::shared_ptr<internal::ClientData> &data,
350 return std::move(*
this);
363 return std::move(*
this);
377 return std::move(*
this);
391 return std::move(*
this);
402 template <typename T, decltype(std::declval<T>()(),
nullptr) =
nullptr>
411 template <typename T, decltype(std::declval<T>()(),
nullptr) =
nullptr>
413 this->onClick(std::move(func));
414 return std::move(*
this);
436 return std::move(*
this);
447 template <
typename T>
452 [ref, func = std::move(func)](
ValAdaptor val) {
453 ref.lockedField().set(val);
462 template <
typename T>
464 this->onChange(std::move(func));
465 return std::move(*
this);
485 return std::move(*
this);
497 return std::move(*
this);
508 template <
typename T>
516 template <
typename T>
519 return std::move(*
this);
542 return std::move(*
this);
560 return std::move(*
this);
576 return std::move(*
this);
586 template <
typename T>
588 std::vector<ValAdaptor> option_v;
589 for (
const auto &v : option) {
592 return this->option(std::move(option_v));
598 template <
typename T>
600 this->option(option);
601 return std::move(*
this);
609 this->option(std::move(option));
610 return std::move(*
this);
626 return std::move(*
this);
640 this->height(height);
641 return std::move(*
this);
関数1つを表すクラス
Definition func.h:95
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:67
Viewを構築するときに使う一時的なViewComponent.
Definition component_view.h:286
TemporalViewComponent && onChange(T func) &&
値が変化した時に実行される関数を設定
Definition component_view.h:463
TemporalViewComponent && textColor(ViewColor c) &&
Definition component_view.h:483
TemporalViewComponent && init(const T &init) &&
デフォルト値を設定する。
Definition component_view.h:517
TemporalViewComponent && step(double step) &&
数値の刻み幅を設定する。
Definition component_view.h:574
TemporalViewComponent & init(const T &init) &
デフォルト値を設定する。
Definition component_view.h:509
TemporalViewComponent && onClick(T func) &&
クリック時に実行される関数を設定
Definition component_view.h:412
TemporalViewComponent & onChange(T func) &
値が変化した時に実行される関数を設定
Definition component_view.h:448
TemporalViewComponent && onClick(const Func &func) &&
クリック時に実行される関数を設定 (登録済みFunc)
Definition component_view.h:375
TemporalViewComponent & option(std::initializer_list< T > option) &
引数の選択肢を設定する。
Definition component_view.h:587
TemporalViewComponent & onClick(T func) &
クリック時に実行される関数を設定
Definition component_view.h:403
TemporalViewComponent && width(int width) &&
要素の幅を設定する。
Definition component_view.h:624
TemporalViewComponent && bind(const InputRef &ref) &&
変更した値を格納するInputRefを設定
Definition component_view.h:434
TemporalViewComponent & operator=(TemporalViewComponent &&other) noexcept
TemporalViewComponent && option(std::vector< ValAdaptor > option) &&
Definition component_view.h:608
TemporalViewComponent && max(double max) &&
最大値を設定する。
Definition component_view.h:558
TemporalViewComponent && min(double min) &&
最小値を設定する。
Definition component_view.h:540
TemporalViewComponent && option(std::initializer_list< T > option) &&
引数の選択肢を設定する。
Definition component_view.h:599
TemporalViewComponent(TemporalViewComponent &&other) noexcept
TemporalViewComponent && onClick(const FuncListener &func) &&
クリック時に実行される関数を設定 (FuncListener)
Definition component_view.h:389
~TemporalViewComponent() noexcept
TemporalViewComponent && height(int height) &&
要素の高さを設定する。
Definition component_view.h:639
TemporalViewComponent && bgColor(ViewColor c) &&
Definition component_view.h:495
TemporalViewComponent && text(std::wstring_view text) &&
表示する文字列を設定 (wstring)
Definition component_view.h:361
数値、文字列などの値を相互変換するクラス
Definition val_adaptor.h:87
Viewに表示する要素です
Definition component_view.h:110
std::optional< Func_ > onClick() const
クリック時に実行される関数を取得
std::optional< Variant_ > bind() const
inputの現在の値を取得
std::optional< Func_ > onChange() const
inputの値の変化時に実行される関数を取得
ViewComponent(ViewComponent &&) noexcept
Viewの送受信データを表すクラス
Definition view.h:36
TemporalViewComponent button(std::string_view text, T &&func)
buttonコンポーネント
Definition components.h:654
ViewComponentType
Definition component_view.h:77
ViewColor
Definition component_view.h:40
数値と文字列をまとめて扱うためのstruct (wstring)
Definition def_types.h:84
数値と文字列をまとめて扱うためのstruct
Definition def_types.h:50
Viewの要素を表すstruct (wstring)
Definition def_types.h:289
Viewの要素を表すstruct.
Definition def_types.h:218
#define WEBCFACE_DLL
Definition webcface-config.h:69
#define WEBCFACE_NS_END
Definition webcface-config.h:118
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:117
#define WEBCFACE_CALL_FP
Definition webcface-config.h:107