1#ifndef WIDGET_RESOURCE_HPP
2#define WIDGET_RESOURCE_HPP
5#include <photon/PtWidget.h>
7#include "./stdex/stdex.h"
8#include "./WidgetEvents.h"
9#include "./WidgetKeys.h"
15 struct WidgetResourceGroupType
19 struct WidgetArgumentGroupType
35 struct WidgetCallbackGroupType
43 typedef WidgetArgumentGroupType::alloc_type alloc_type;
44 typedef WidgetArgumentGroupType::array_type array_type;
45 typedef WidgetArgumentGroupType::boolean_type boolean_type;
46 typedef WidgetArgumentGroupType::color_type color_type;
47 typedef WidgetArgumentGroupType::complex_type complex_type;
48 typedef WidgetArgumentGroupType::flag_type flag_type;
49 typedef WidgetArgumentGroupType::function_type function_type;
50 typedef WidgetArgumentGroupType::image_type image_type;
51 typedef WidgetArgumentGroupType::pointer_type pointer_type;
52 typedef WidgetArgumentGroupType::scalar_type scalar_type;
53 typedef WidgetArgumentGroupType::string_type string_type;
54 typedef WidgetArgumentGroupType::struct_type struct_type;
56 typedef WidgetCallbackGroupType::callback_type callback_type;
57 typedef WidgetCallbackGroupType::raw_type callback_raw_type;
58 typedef WidgetCallbackGroupType::hotkey_type callback_hotkey_type;
67 virtual ~IPtWidget() {}
72 class WidgetResourceBase
79 WidgetResourceBase(IPtWidget *widget, ArgT arg) :
92 sizeof(T) <=
sizeof(
long),
94 >::type setScalar(T scval)
96 return PtSetResource(_rwidget->widget(), _arg, scval, 0);
142 const PgColorModel_t * cm = PgGetColorModel();
144 if(!(cm && cm->id != Pg_CM_RGB->id))
157 return setScalar(color);
167 int setString(
const char *str)
169 return setScalar(str);
183 int setAlloc(
const void *pdata, std::size_t size)
185 return PtSetResource(_rwidget->widget(), _arg, pdata, size);
196 return setAlloc(pimage, 0);
202 template<
class T, std::
size_t count>
204 int setArray(T(&arr)[count])
206 return PtSetResource(_rwidget->widget(), _arg, arr, count);
210 int setArray(
const void *parr, std::size_t count)
212 return PtSetResource(_rwidget->widget(), _arg, parr, count);
220 int setFlag(
long flag,
long bits)
222 return PtSetResource(_rwidget->widget(), _arg, bits, flag);
226 int setFlag(
long flag,
bool on)
228 return PtSetResource(_rwidget->widget(), _arg, on ? Pt_TRUE : Pt_FALSE, flag);
238 int setPointer(
const void *p)
247 int setStruct(
const void *pdata)
249 return setScalar(pdata);
256 int setBoolean(
bool val)
258 return PtSetResource(_rwidget->widget(), _arg, val ? 1 : 0, 0);
261 template<std::
size_t count>
265 PtAddCallbacks(_rwidget->widget(), _arg, callbacks, count);
279 PtAddCallback(_rwidget->widget(), _arg, callback, data);
282 template<std::
size_t count>
286 PtAddFilterCallbacks(_rwidget->widget(), callbacks, count);
289 template<std::
size_t count>
293 PtAddEventHandlers(_rwidget->widget(), callbacks, count);
301 addLinkBefore(callbacks);
309 addLinkAfter(callbacks);
318 PtAddFilterCallback(_rwidget->widget(), _arg, callback, data);
325 PtAddEventHandler(_rwidget->widget(), _arg, callback, data);
329 void addLink(
int(*callback)(
PtWidget_t *,
void *,
PtCallbackInfo_t *), KeyModes::eKeyModes keymode = KeyModes::none,
bool chained =
false,
void *data =
nullptr)
331 PtAddHotkeyHandler(_rwidget->widget(), _arg, keymode, chained ? Pt_HOTKEY_CHAINED : 0, data, callback);
334 template<std::
size_t count>
338 PtRemoveCallbacks(_rwidget->widget(), _arg, callbacks, count);
346 removeLink(callbacks);
352 PtRemoveCallback(_rwidget->widget(), _arg, callback, data);
355 template<std::
size_t count>
359 PtRemoveFilterHandlers(_rwidget->widget(), callbacks, count);
362 template<std::
size_t count>
366 PtRemoveEventHandlers(_rwidget->widget(), callbacks, count);
374 removeLinkBefore(callbacks);
382 removeLinkAfter(callbacks);
388 PtRemoveFilterCallback(_rwidget->widget(), _arg, callback, data);
394 PtRemoveEventHandler(_rwidget->widget(), _arg, callback, data);
398 void removeLink(
int(*callback)(
PtWidget_t *,
void *,
PtCallbackInfo_t *), KeyModes::eKeyModes keymode = KeyModes::none,
bool chained =
false,
void *data =
nullptr)
400 PtRemoveHotkeyHandler(_rwidget->widget(), _arg, keymode, chained ? Pt_HOTKEY_CHAINED : 0, data, callback);
411 typename stdex::enable_if<
412 stdex::is_pointer<T>::value,
414 >::type getPointer()
const
419 PtSetArg(&args[0], _arg, &value, 0);
420 PtGetResources(_rwidget->widget(), 1, args);
431 typename stdex::enable_if<
432 stdex::is_pointer<T>::value ==
false,
433 typename stdex::remove_cv<T>::type
const &
434 >::type getScalar()
const
436 return *getPointer<const T*>();
440 const char* getString()
const
442 return getPointer<const char*>();
448 bool getBoolean()
const
452 PtSetArg(&arg, _arg, 0, 0);
453 PtGetResources(_rwidget->widget(), 1, &arg);
455 return (arg.value != 0);
462 typename stdex::enable_if<
463 stdex::is_pointer<T>::value ==
false,
465 >::type getStruct()
const
467 return getPointer<const T*>();
476 typename stdex::enable_if<
477 stdex::is_pointer<T>::value ==
true,
479 typename stdex::remove_pointer<
480 typename stdex::remove_cv<T>::type
482 >::type getAlloc()
const
486 typename stdex::remove_pointer<
487 typename stdex::remove_cv<T>::type
489 return getPointer<type>();
492 inline PtCallbackList_t *getLink()
const
494 PtCallbackList_t *cl;
496 cl =
reinterpret_cast<PtCallbackList_t *
>(PtGetCallbackList(_rwidget->widget(), _arg));
501 inline PtRawCallbackList_t *getLinkAfter()
const
503 PtRawCallbackList_t *cl;
505 cl =
reinterpret_cast<PtRawCallbackList_t *
>(PtGetCallbackList(_rwidget->widget(), Pt_CB_RAW));
510 inline PtRawCallbackList_t *getLinkBefore()
const
512 PtRawCallbackList_t *cl;
514 cl =
reinterpret_cast<PtRawCallbackList_t *
>(PtGetCallbackList(_rwidget->widget(), Pt_CB_FILTER));
521 PtCallbackList_t *cl = this->getLink();
528 PtInvokeCallbackList(cl, w, info);
534 ~WidgetResourceBase()
538 template<
class ArgT,
class ResourceGroupT,
class ResourceT>
539 struct WidgetArgument;
541 template<
class ArgT,
class ResourceT>
542 struct WidgetArgument<
544 typename stdex::enable_if<
546 stdex::is_pointer<ResourceT>::value ||
547 stdex::is_void<ResourceT>::value
549 WidgetResourceGroupType::alloc_type
553 private WidgetResourceBase<ArgT>
555 typedef WidgetResourceGroupType::WidgetArgumentGroupType::alloc_type resource_group_type;
557 typename stdex::conditional<
558 stdex::is_void<ResourceT>::value,
560 typename stdex::remove_cv<ResourceT>::type
const
561 >::type resource_type;
563 WidgetArgument(IPtWidget *widget, ArgT arg) :
564 WidgetResourceBase<ArgT>(widget, arg)
572 int set(resource_type pdata, std::size_t size)
574 return this->setAlloc(&pdata, size);
578 typename stdex::enable_if<
579 stdex::is_same<resource_type, const void*>::value,
581 >::type set(resource_type pdata)
583 typedef typename stdex::remove_pointer<resource_type>::type type;
584 return this->setAlloc(pdata,
sizeof(type));
588 resource_type get()
const
590 return WidgetResourceBase<ArgT>::template getAlloc<resource_type>();
601 template<
class ArgT,
class ResourceT>
602 struct WidgetArgument<ArgT, WidgetResourceGroupType::WidgetArgumentGroupType::array_type, ResourceT> :
603 private NotImplemented
605 typedef WidgetResourceGroupType::WidgetArgumentGroupType::array_type resource_group_type;
606 typedef ResourceT resource_type;
611 template<
class ArgT,
class ResourceT>
612 struct WidgetArgument<ArgT, WidgetResourceGroupType::boolean_type, ResourceT> :
613 private WidgetResourceBase<ArgT>
615 typedef WidgetResourceGroupType::boolean_type resource_group_type;
616 typedef ResourceT resource_type;
618 WidgetArgument(IPtWidget *widget, ArgT arg) :
619 WidgetResourceBase<ArgT>(widget, arg)
626 int set(resource_type value)
628 return this->setBoolean(value);
632 resource_type get()
const
634 return this->getBoolean();
638 template<
class ArgT,
class ResourceT>
639 struct WidgetArgument<ArgT, WidgetResourceGroupType::WidgetArgumentGroupType::color_type, ResourceT> :
640 private WidgetResourceBase<ArgT>
642 typedef WidgetResourceGroupType::color_type resource_group_type;
644 typename stdex::conditional<
645 stdex::is_void<ResourceT>::value,
648 >::type resource_type;
650 WidgetArgument(IPtWidget *widget, ArgT arg) :
651 WidgetResourceBase<ArgT>(widget, arg)
658 int set(resource_type color)
660 return setColor(color);
664 resource_type get()
const
666 return WidgetResourceBase<ArgT>::template getScalar<PgColor_t>();
670 template<
class ArgT,
class ResourceT>
671 struct WidgetArgument<ArgT, WidgetResourceGroupType::WidgetArgumentGroupType::complex_type, ResourceT> :
672 private NotImplemented
674 typedef WidgetResourceGroupType::WidgetArgumentGroupType::complex_type resource_group_type;
675 typedef ResourceT resource_type;
680 namespace flag_detail
682 template<
class T>
struct mask_type {
typedef long type; };
683 template<>
struct mask_type<bool> {
typedef bool type; };
686 template<
class ArgT,
class ResourceT>
687 struct WidgetArgument<ArgT, WidgetResourceGroupType::WidgetArgumentGroupType::flag_type, ResourceT> :
688 private WidgetResourceBase<ArgT>
690 typedef WidgetResourceGroupType::WidgetArgumentGroupType::flag_type resource_group_type;
691 typedef ResourceT resource_type;
693 WidgetArgument(IPtWidget *widget, ArgT arg) :
694 WidgetResourceBase<ArgT>(widget, arg)
701 template<
class A1,
typename A2>
702 inline int set(A1 flag, A2 mask)
704 return this->setFlag(flag,
static_cast<typename flag_detail::mask_type<A2>::type
>(mask));
708 inline int set(A1 bitmask)
710 int err = this->setFlag(bitmask,
true);
713 return this->setFlag(~bitmask,
false);
716 inline resource_type get()
const
718 return WidgetResourceBase<ArgT>::template getScalar<resource_type>();
722 inline bool get(A1 flag)
const
724 return ((get() & flag) == flag);
729 template<
class ArgT,
class ResourceT>
730 struct WidgetArgument<ArgT, WidgetResourceGroupType::WidgetArgumentGroupType::function_type, ResourceT> :
731 private NotImplemented
733 typedef WidgetResourceGroupType::WidgetArgumentGroupType::function_type resource_group_type;
734 typedef ResourceT resource_type;
739 template<
class ArgT,
class ResourceT>
740 struct WidgetArgument<ArgT, WidgetResourceGroupType::WidgetArgumentGroupType::image_type, ResourceT> :
741 private WidgetResourceBase<ArgT>
743 typedef WidgetResourceGroupType::image_type resource_group_type;
745 typename stdex::conditional<
746 stdex::is_void<ResourceT>::value,
749 >::type resource_type;
751 WidgetArgument(IPtWidget *widget, ArgT arg) :
752 WidgetResourceBase<ArgT>(widget, arg)
759 int set(resource_type pimage)
761 return setImage(pimage);
765 resource_type get()
const
767 return WidgetResourceBase<ArgT>::template getAlloc<resource_type>();
771 template<
class ArgT,
class ResourceT>
772 struct WidgetArgument<
777 stdex::is_pointer<ResourceT>::value ||
778 stdex::is_void<ResourceT>::value
780 WidgetResourceGroupType::pointer_type
784 private WidgetResourceBase<ArgT>
786 typedef WidgetResourceGroupType::pointer_type resource_group_type;
788 typename stdex::conditional<
789 stdex::is_void<ResourceT>::value,
792 >::type resource_type;
794 WidgetArgument(IPtWidget *widget, ArgT arg) :
795 WidgetResourceBase<ArgT>(widget, arg)
802 int set(resource_type value)
804 return this->setPointer(value);
808 resource_type get()
const
810 return WidgetResourceBase<ArgT>::template getPointer<resource_type>();
814 template<
class ArgT,
class ResourceT>
815 struct WidgetArgument<
817 typename stdex::enable_if<
818 sizeof(ResourceT) <= sizeof(long),
819 WidgetResourceGroupType::scalar_type
823 private WidgetResourceBase<ArgT>
825 typedef WidgetResourceGroupType::WidgetArgumentGroupType::scalar_type resource_group_type;
826 typedef ResourceT resource_type;
828 WidgetArgument(IPtWidget *widget, ArgT arg) :
829 WidgetResourceBase<ArgT>(widget, arg)
836 int set(resource_type value)
838 return this->setScalar(value);
842 resource_type get()
const
844 return WidgetResourceBase<ArgT>::template getScalar<resource_type>();
848 template<
class ArgT,
class ResourceT>
849 struct WidgetArgument<
851 typename stdex::enable_if<
853 stdex::is_same<typename stdex::remove_cv<ResourceT>::type, char*>::value ||
854 stdex::is_void<ResourceT>::value
856 WidgetResourceGroupType::string_type
860 private WidgetResourceBase<ArgT>
862 typedef WidgetResourceGroupType::string_type resource_group_type;
863 typedef const char * resource_type;
865 WidgetArgument(IPtWidget *widget, ArgT arg) :
866 WidgetResourceBase<ArgT>(widget, arg)
873 int set(resource_type str)
875 return this->setString(str);
879 resource_type get()
const
881 return this->getString();
886 template<
class ArgT,
class ResourceT>
887 struct WidgetArgument<
889 typename stdex::enable_if<
890 stdex::is_pointer<ResourceT>::value == false,
891 WidgetResourceGroupType::struct_type
895 private WidgetResourceBase<ArgT>
898 typedef WidgetResourceGroupType::struct_type resource_group_type;
899 typedef ResourceT resource_type;
901 WidgetArgument(IPtWidget *widget, ArgT arg) :
902 WidgetResourceBase<ArgT>(widget, arg)
910 int set(resource_type value)
912 return this->setStruct(&value);
917 int set(
const T &value)
919 return this->setStruct(&
static_cast<const resource_type&
>(value));
923 const resource_type& get()
const
925 return *WidgetResourceBase<ArgT>::template getStruct<resource_type>();
929 struct WidgetArgumentsBase
966 WidgetArgumentsBase(IPtWidget *widget) :
971 ~WidgetArgumentsBase()
977 template<
class ArgT,
class ResourceGroupT,
class ResourceT>
978 inline WidgetArgument<ArgT, ResourceGroupT, ResourceT> resource(
const ArgT indx)
const
980 return WidgetArgument <ArgT, ResourceGroupT, ResourceT>(_widget, indx);
984 template<
class LinkT,
class ResourceT = PtCallback_t*>
985 struct WidgetCallback :
986 private WidgetResourceBase<LinkT>
988 typedef WidgetResourceGroupType::WidgetCallbackGroupType::callback_type resource_group_type;
989 typedef ResourceT resource_type;
991 WidgetCallback(IPtWidget *widget, LinkT arg) :
992 WidgetResourceBase<LinkT>(widget, arg)
999 inline void add(resource_type callback)
1001 this->addLink(callback);
1006 this->addLink(callback, data);
1009 inline void remove(resource_type callback)
1011 this->removeLink(callback);
1016 this->removeLink(callback, data);
1019 inline PtCallbackList_t* get()
const
1021 return this->getLink();
1026 this->emitLink(info);
1104 struct WidgetCallbacksBase
1111 WidgetCallbacksBase(IPtWidget *widget) :
1116 ~WidgetCallbacksBase()
1121 template<
class LinkT,
class ResourceT>
1122 inline WidgetCallback<LinkT, ResourceT> resource(
const LinkT indx)
const
1124 return WidgetCallback <LinkT, ResourceT>(_widget, indx);
1129 template<
class EventT = Events::eEvents,
class ResourceT = PtRawCallback_t*>
1130 struct WidgetRawCallback:
1131 private WidgetResourceBase<EventT>
1133 typedef WidgetResourceGroupType::WidgetCallbackGroupType::raw_type resource_group_type;
1134 typedef ResourceT resource_type;
1136 WidgetRawCallback(IPtWidget *widget, EventT arg) :
1137 WidgetResourceBase<EventT>(widget, arg)
1141 ~WidgetRawCallback()
1145 inline void add(resource_type callback)
1147 this->addLinkAfter(callback);
1152 this->addLinkAfter(callback, data);
1155 inline void remove(resource_type callback)
1157 this->removeLinkAfter(callback);
1162 this->removeLinkAfter(callback, data);
1165 inline PtRawCallbackList_t* get()
const
1167 return this->getLinkAfter();
1173 struct WidgetRawCallbacksBase
1180 WidgetRawCallbacksBase(IPtWidget *widget) :
1185 ~WidgetRawCallbacksBase()
1190 template<
class EventT,
class ResourceT>
1191 inline WidgetRawCallback<EventT, ResourceT> resource(
const EventT indx)
const
1193 return WidgetRawCallback <EventT, ResourceT>(_widget, indx);
1198 template<
class EventT = Events::eEvents,
class ResourceT = PtRawCallback_t*>
1199 struct WidgetFilterCallback:
1200 private WidgetResourceBase<EventT>
1202 typedef WidgetResourceGroupType::WidgetCallbackGroupType::raw_type resource_group_type;
1203 typedef ResourceT resource_type;
1205 WidgetFilterCallback(IPtWidget *widget, EventT arg) :
1206 WidgetResourceBase<EventT>(widget, arg)
1210 ~WidgetFilterCallback()
1214 inline void add(resource_type callback)
1216 this->addLinkAfter(callback);
1221 this->addLinkBefore(callback, data);
1224 inline void remove(resource_type callback)
1226 this->removeLinkBefore(callback);
1231 this->removeLinkBefore(callback, data);
1234 inline PtRawCallbackList_t* get()
const
1236 return this->getLinkBefore();
1242 struct WidgetFilterCallbacksBase
1249 WidgetFilterCallbacksBase(IPtWidget *widget) :
1254 ~WidgetFilterCallbacksBase()
1259 template<
class EventT,
class ResourceT>
1260 inline WidgetFilterCallback<EventT, ResourceT> resource(
const EventT indx)
const
1262 return WidgetFilterCallback <EventT, ResourceT>(_widget, indx);
1272 typedef WidgetCallbacksBase WidgetCallbacks;
1273 typedef WidgetArgumentsBase WidgetArguments;
1277 template<
class PrevT>
1283 template<
class W
idgetArgumentsT,
class W
idgetCallbacksT,
class LinkT,
class ResourceT >
1286 struct WidgetCallbacks :
1287 public WidgetCallbacksT
1290 using WidgetCallbacksT::operator [];
1292 inline WidgetCallback<LinkT, ResourceT> operator [](
const LinkT indx)
const
1294 typedef WidgetCallbacksBase Base;
1296 return static_cast<const Base*
>(
this)->resource<LinkT, ResourceT>(indx);
1302 friend class LinkType<WidgetArgumentsT, WidgetCallbacksT, LinkT, ResourceT>;
1304 template<
class,
class,
class,
class,
class>
1305 friend class ArgumentType;
1307 WidgetCallbacks(IPtWidget *widget) :
1308 WidgetCallbacksT(widget)
1317 typedef WidgetArgumentsT WidgetArguments;
1319 WidgetArguments argument;
1320 WidgetCallbacks callback;
1322 LinkType(IPtWidget *widget) :
1329 LinkType(
const LinkType&);
1332 template<
class W
idgetArgumentsT,
class LinkT,
class ResourceT >
1333 struct LinkType<WidgetArgumentsT, WidgetCallbacksBase, LinkT, ResourceT>
1335 struct WidgetCallbacks:
1336 protected WidgetCallbacksBase
1339 inline WidgetCallback<LinkT, ResourceT> operator [](
const LinkT indx)
const
1341 typedef WidgetCallbacksBase Base;
1343 return static_cast<const Base*
>(
this)->resource<LinkT, ResourceT>(indx);
1348 friend class LinkType<WidgetArgumentsT, WidgetCallbacksBase, LinkT, ResourceT>;
1350 template<
class,
class,
class,
class,
class>
1351 friend class ArgumentType;
1353 WidgetCallbacks(IPtWidget *widget) :
1354 WidgetCallbacksBase(widget)
1363 typedef WidgetArgumentsT WidgetArguments;
1365 WidgetArguments argument;
1366 WidgetCallbacks callback;
1368 LinkType(IPtWidget *widget) :
1375 LinkType(
const LinkType&);
1378 template<
class W
idgetCallbacksT,
class LinkT,
class ResourceT >
1379 struct LinkType<WidgetArgumentsBase, WidgetCallbacksT, LinkT, ResourceT>
1381 struct WidgetCallbacks :
1382 public WidgetCallbacksT
1385 using WidgetCallbacksT::operator [];
1387 inline WidgetCallback<LinkT, ResourceT> operator [](
const LinkT indx)
const
1389 typedef WidgetCallbacksBase Base;
1391 return static_cast<const Base*
>(
this)->resource<LinkT, ResourceT>(indx);
1396 friend class LinkType<WidgetArgumentsBase, WidgetCallbacksT, LinkT, ResourceT>;
1398 template<
class,
class,
class,
class,
class>
1399 friend class ArgumentType;
1401 WidgetCallbacks(IPtWidget *widget) :
1402 WidgetCallbacksT(widget)
1411 typedef WidgetArgumentsBase WidgetArguments;
1413 WidgetCallbacks callback;
1415 LinkType(IPtWidget *widget) :
1421 LinkType(
const LinkType&);
1424 template<
class LinkT,
class ResourceT >
1425 struct LinkType<WidgetArgumentsBase, WidgetCallbacksBase, LinkT, ResourceT>
1427 struct WidgetCallbacks:
1428 protected WidgetCallbacksBase
1431 inline WidgetCallback<LinkT, ResourceT> operator [](
const LinkT indx)
const
1433 typedef WidgetCallbacksBase Base;
1435 return static_cast<const Base*
>(
this)->resource<LinkT, ResourceT>(indx);
1440 friend class LinkType<WidgetArgumentsBase, WidgetCallbacksBase, LinkT, ResourceT>;
1442 template<
class,
class,
class,
class,
class>
1443 friend class ArgumentType;
1445 WidgetCallbacks(IPtWidget *widget) :
1446 WidgetCallbacksBase(widget)
1455 typedef WidgetArgumentsBase WidgetArguments;
1457 WidgetCallbacks callback;
1459 LinkType(IPtWidget *widget) :
1465 LinkType(
const LinkType&);
1470 template<
class W
idgetArgumentsT,
class W
idgetCallbacksT,
class ArgT,
class ResourceGroupT,
class ResourceT >
1473 struct WidgetArguments :
1474 public WidgetArgumentsT
1477 using WidgetArgumentsT::operator [];
1479 inline WidgetArgument<ArgT, ResourceGroupT, ResourceT> operator [](
const ArgT indx)
const
1481 typedef WidgetArgumentsBase Base;
1483 return static_cast<const Base*
>(
this)->resource<ArgT, ResourceGroupT, ResourceT>(indx);
1488 friend class ArgumentType<WidgetArgumentsT, WidgetCallbacksT, ArgT, ResourceGroupT, ResourceT>;
1490 template<
class,
class,
class,
class>
1491 friend class LinkType;
1493 WidgetArguments(IPtWidget *widget) :
1494 WidgetArgumentsT(widget)
1503 typedef WidgetCallbacksT WidgetCallbacks;
1505 WidgetArguments argument;
1506 WidgetCallbacks callback;
1508 ArgumentType(IPtWidget *widget) :
1515 ArgumentType(
const ArgumentType&);
1518 template<
class W
idgetCallbacksT,
class ArgT,
class ResourceGroupT,
class ResourceT >
1519 struct ArgumentType<WidgetArgumentsBase, WidgetCallbacksT, ArgT, ResourceGroupT, ResourceT>
1521 struct WidgetArguments:
1522 protected WidgetArgumentsBase
1524 inline WidgetArgument<ArgT, ResourceGroupT, ResourceT> operator [](
const ArgT indx)
const
1526 typedef WidgetArgumentsBase Base;
1528 return static_cast<const Base*
>(
this)->resource<ArgT, ResourceGroupT, ResourceT>(indx);
1533 friend class ArgumentType<WidgetArgumentsBase, WidgetCallbacksT, ArgT, ResourceGroupT, ResourceT>;
1535 template<
class,
class,
class,
class>
1536 friend class LinkType;
1538 WidgetArguments(IPtWidget *widget) :
1539 WidgetArgumentsBase(widget)
1548 typedef WidgetCallbacksT WidgetCallbacks;
1550 WidgetArguments argument;
1551 WidgetCallbacks callback;
1553 ArgumentType(IPtWidget *widget) :
1560 ArgumentType(
const ArgumentType&);
1563 template<
class W
idgetArgumentsT,
class ArgT,
class ResourceGroupT,
class ResourceT >
1564 struct ArgumentType<WidgetArgumentsT, WidgetCallbacksBase, ArgT, ResourceGroupT, ResourceT>
1566 struct WidgetArguments :
1567 public WidgetArgumentsT
1570 using WidgetArgumentsT::operator [];
1572 inline WidgetArgument<ArgT, ResourceGroupT, ResourceT> operator [](
const ArgT indx)
const
1574 typedef WidgetArgumentsBase Base;
1576 return static_cast<const Base*
>(
this)->resource<ArgT, ResourceGroupT, ResourceT>(indx);
1581 friend class ArgumentType<WidgetArgumentsT, WidgetCallbacksBase, ArgT, ResourceGroupT, ResourceT>;
1583 template<
class,
class,
class,
class>
1584 friend class LinkType;
1586 WidgetArguments(IPtWidget *widget) :
1587 WidgetArgumentsT(widget)
1596 typedef WidgetCallbacksBase WidgetCallbacks;
1598 WidgetArguments argument;
1600 ArgumentType(IPtWidget *widget) :
1606 ArgumentType(
const ArgumentType&);
1609 template<
class ArgT,
class ResourceGroupT,
class ResourceT >
1610 struct ArgumentType<WidgetArgumentsBase, WidgetCallbacksBase, ArgT, ResourceGroupT, ResourceT>
1612 struct WidgetArguments:
1613 protected WidgetArgumentsBase
1615 inline WidgetArgument<ArgT, ResourceGroupT, ResourceT> operator [](
const ArgT indx)
const
1617 typedef WidgetArgumentsBase Base;
1619 return static_cast<const Base*
>(
this)->resource<ArgT, ResourceGroupT, ResourceT>(indx);
1624 friend class ArgumentType<WidgetArgumentsBase, WidgetCallbacksBase, ArgT, ResourceGroupT, ResourceT>;
1626 template<
class,
class,
class,
class>
1627 friend class LinkType;
1629 WidgetArguments(IPtWidget *widget) :
1630 WidgetArgumentsBase(widget)
1639 typedef WidgetCallbacksBase WidgetCallbacks;
1641 WidgetArguments argument;
1643 ArgumentType(IPtWidget *widget) :
1649 ArgumentType(
const ArgumentType&);
1653 template<
class PrevT,
class LinkT,
class ResourceT>
1656 template<
class PrevT,
class LinkT>
1659 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1660 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1661 typedef WidgetResourceGroupType::WidgetCallbackGroupType::callback_type resource_group_type;
1663 typedef LinkType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, PtCallback_t*> resource_type;
1664 typedef def_help::Define<resource_type> Define;
1667 template<
class PrevT,
class LinkT>
1670 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1671 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1672 typedef WidgetResourceGroupType::WidgetCallbackGroupType::raw_type resource_group_type;
1674 typedef LinkType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, PtRawCallback_t*> resource_type;
1675 typedef def_help::Define<resource_type> Define;
1678 template<
class PrevT,
class LinkT>
1681 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1682 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1683 typedef WidgetResourceGroupType::WidgetCallbackGroupType::hotkey_type resource_group_type;
1685 typedef LinkType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, PtHotkeyCallback_t*> resource_type;
1686 typedef def_help::Define<resource_type> Define;
1689 template<
class PrevT,
class LinkT,
class ResourceT>
1692 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1693 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1694 typedef WidgetResourceGroupType::WidgetCallbackGroupType::callback_type resource_group_type;
1696 typedef LinkType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, ResourceT> resource_type;
1697 typedef def_help::Define<resource_type> Define;
1700 template<
class PrevT,
class LinkT,
class ResourceT>
1703 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1704 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1705 typedef WidgetResourceGroupType::WidgetCallbackGroupType::raw_type resource_group_type;
1707 typedef LinkType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, ResourceT> resource_type;
1708 typedef def_help::Define<resource_type> Define;
1711 template<
class PrevT,
class LinkT,
class ResourceT>
1712 struct HotKeyCallback
1714 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1715 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1716 typedef WidgetResourceGroupType::WidgetCallbackGroupType::hotkey_type resource_group_type;
1718 typedef LinkType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, ResourceT> resource_type;
1719 typedef def_help::Define<resource_type> Define;
1723 template<
class PrevT,
class LinkT,
class ResourceT =
void>
1726 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1727 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1728 typedef WidgetResourceGroupType::WidgetArgumentGroupType::alloc_type resource_group_type;
1730 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1731 typedef def_help::Define<resource_type> Define;
1734 template<
class PrevT,
class LinkT,
class ResourceT>
1737 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1738 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1739 typedef WidgetResourceGroupType::WidgetArgumentGroupType::array_type resource_group_type;
1741 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1742 typedef def_help::Define<resource_type> Define;
1745 template<
class PrevT,
class LinkT,
class ResourceT>
1748 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1749 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1750 typedef WidgetResourceGroupType::WidgetArgumentGroupType::boolean_type resource_group_type;
1752 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1753 typedef def_help::Define<resource_type> Define;
1756 template<
class PrevT,
class LinkT,
class ResourceT =
void>
1759 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1760 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1761 typedef WidgetResourceGroupType::WidgetArgumentGroupType::color_type resource_group_type;
1763 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1764 typedef def_help::Define<resource_type> Define;
1767 template<
class PrevT,
class LinkT,
class ResourceT>
1770 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1771 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1772 typedef WidgetResourceGroupType::WidgetArgumentGroupType::complex_type resource_group_type;
1774 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1775 typedef def_help::Define<resource_type> Define;
1778 template<
class PrevT,
class LinkT,
class ResourceT>
1781 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1782 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1783 typedef WidgetResourceGroupType::WidgetArgumentGroupType::flag_type resource_group_type;
1785 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1786 typedef def_help::Define<resource_type> Define;
1789 template<
class PrevT,
class LinkT,
class ResourceT>
1792 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1793 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1794 typedef WidgetResourceGroupType::WidgetArgumentGroupType::function_type resource_group_type;
1796 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1797 typedef def_help::Define<resource_type> Define;
1800 template<
class PrevT,
class LinkT,
class ResourceT =
void>
1803 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1804 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1805 typedef WidgetResourceGroupType::WidgetArgumentGroupType::image_type resource_group_type;
1807 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1808 typedef def_help::Define<resource_type> Define;
1811 template<
class PrevT,
class LinkT,
class ResourceT =
void>
1814 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1815 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1816 typedef WidgetResourceGroupType::WidgetArgumentGroupType::pointer_type resource_group_type;
1818 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1819 typedef def_help::Define<resource_type> Define;
1822 template<
class PrevT,
class LinkT,
class ResourceT>
1825 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1826 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1827 typedef WidgetResourceGroupType::WidgetArgumentGroupType::scalar_type resource_group_type;
1829 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1830 typedef def_help::Define<resource_type> Define;
1833 template<
class PrevT,
class LinkT,
class ResourceT =
void>
1836 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1837 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1838 typedef WidgetResourceGroupType::WidgetArgumentGroupType::string_type resource_group_type;
1840 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1841 typedef def_help::Define<resource_type> Define;
1844 template<
class PrevT,
class LinkT,
class ResourceT>
1847 typedef typename PrevT::WidgetCallbacks prev_widget_callbacks_type;
1848 typedef typename PrevT::WidgetArguments prev_widget_arguments_type;
1849 typedef WidgetResourceGroupType::WidgetArgumentGroupType::struct_type resource_group_type;
1851 typedef ArgumentType<prev_widget_arguments_type, prev_widget_callbacks_type, LinkT, resource_group_type, ResourceT> resource_type;
1852 typedef def_help::Define<resource_type> Define;
1858 template<
class PrevT>
1861 template<
class LinkT,
class ResourceT>
1862 struct Link : def_orig::Link<PrevT, LinkT, ResourceT> {};
1864 template<
class LinkT,
class ResourceT>
1865 struct Callback : def_orig::Callback<PrevT, LinkT, ResourceT> {};
1867 template<
class LinkT,
class ResourceT>
1868 struct RawCallback : def_orig::RawCallback<PrevT, LinkT, ResourceT> {};
1870 template<
class LinkT,
class ResourceT>
1871 struct HotKeyCallback : def_orig::HotKeyCallback<PrevT, LinkT, ResourceT> {};
1873 template<
class ArgT,
class ResourceT =
void>
1874 struct Alloc : def_orig::Alloc<PrevT, ArgT, ResourceT> {};
1876 template<
class ArgT,
class ResourceT>
1877 struct Array : def_orig::Array<PrevT, ArgT, ResourceT> {};
1879 template<
class ArgT,
class ResourceT>
1880 struct Boolean : def_orig::Boolean<PrevT, ArgT, ResourceT> {};
1882 template<
class ArgT,
class ResourceT =
void>
1883 struct Color : def_orig::Color<PrevT, ArgT, ResourceT> {};
1885 template<
class ArgT,
class ResourceT>
1886 struct Complex : def_orig::Complex<PrevT, ArgT, ResourceT> {};
1888 template<
class ArgT,
class ResourceT>
1889 struct Flag : def_orig::Flag<PrevT, ArgT, ResourceT> {};
1891 template<
class ArgT,
class ResourceT>
1892 struct Function : def_orig::Function<PrevT, ArgT, ResourceT> {};
1894 template<
class ArgT,
class ResourceT =
void>
1895 struct Image : def_orig::Image<PrevT, ArgT, ResourceT> {};
1897 template<
class ArgT,
class ResourceT =
void>
1898 struct Pointer : def_orig::Pointer<PrevT, ArgT, ResourceT> {};
1900 template<
class ArgT,
class ResourceT>
1901 struct Scalar : def_orig::Scalar<PrevT, ArgT, ResourceT> {};
1903 template<
class ArgT,
class ResourceT =
void>
1904 struct String : def_orig::String<PrevT, ArgT, ResourceT> {};
1906 template<
class ArgT,
class ResourceT>
1907 struct Struct : def_orig::Struct<PrevT, ArgT, ResourceT> {};
1916 template<
class PrevT = detail::def_help::BasePrevType>
1920 detail::def_help::Define<PrevT>
1923 template<
class PrevTNext>
1925 ResourceFrom<PrevTNext>