+template<class Widget>
+void AddDataCustom(DialogDataList &self, typename Widget::Type widget, Property<typename Widget::Other> const &property) {
+ using Self = typename Widget::Type;
+ using T = typename Widget::Other;
+ using native = typename std::remove_pointer<typename Self::native>::type;
+ struct Wrapper {
+ static void Export(const native &self, const Callback<void(T)> &returnz) {
+ native *p = &const_cast<native &>(self);
+ auto widget = Self::from(p);
+ Widget::Get::thunk_(widget, returnz);
+ }
+
+ static void Import(native &self, T value) {
+ native *p = &self;
+ auto widget = Self::from(p);
+ Widget::Set::thunk_(widget, value);
+ }
+ };
+ self.push_back(new CallbackDialogData<typename Widget::Other>(
+ make_property<PropertyAdaptor<native, T, Wrapper>>(*static_cast<native *>(widget)),
+ property
+ ));
+}
+
+template<class Widget, class D>
+void AddData(DialogDataList &self, typename Widget::Type widget, D &data) {
+ AddDataCustom<Widget>(self, widget, make_property<PropertyAdaptor<D, typename Widget::Other>>(data));
+}
+