14#if !defined(OWL_EVENTHAN_H)
18#if defined(BI_HAS_PRAGMA_ONCE)
25#if (defined(__TRACE) || defined(__WARN))
36#if OWL_NEW_RESPONSE_TABLE
116 const TResponseTableEntry* Entry;
120 TEventInfo(TMsgId
msg, uint
id = 0)
124 typedef bool (*TEqualOperator)(
const TResponseTableEntry&,
const TEventInfo&);
128 virtual bool Find(TEventInfo&
info, TEqualOperator
op = 0);
130 TResult Dispatch(TEventInfo&
info, TParam1, TParam2 = 0);
131 TResult DispatchMsg(TMsgId, uint
id, TParam1, TParam2);
135 bool SearchEntries(
const TResponseTableEntry*
entries, TEventInfo&
info, TEqualOperator
op);
143template <
class T>
class _OWLCLASS TResponseTableEntry;
249#if defined(__TRACE) || defined(__WARN)
276#if OWL_NEW_RESPONSE_TABLE
281#define DECLARE_RESPONSE_TABLE(cls)\
282 private: static ::owl::TResponseTableEntry __entries[];\
283 private: typedef cls TMyClass;\
284 public: auto Find(TEventInfo&, TEqualOperator = 0) -> bool override
286#define DECLARE_EXPORT_RESPONSE_TABLE(cls)\
287 private: static ::owl::TResponseTableEntry __entries[];\
288 private: typedef cls TMyClass;\
289 public: auto __declspec(dllexport) Find(TEventInfo&, TEqualOperator = 0) -> bool override
291#define DECLARE_IMPORT_RESPONSE_TABLE(cls)\
292 private: static ::owl::TResponseTableEntry __entries[];\
293 private: typedef cls TMyClass;\
294 public: auto __declspec(dllimport) Find(TEventInfo&, TEqualOperator = 0) -> bool override
299#define DEFINE_RESPONSE_TABLE_ENTRIES(cls)\
300 ::owl::TResponseTableEntry cls::__entries[] = {
302#define END_RESPONSE_TABLE\
316#define DEFINE_RESPONSE_TABLE(cls)\
317 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
319 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal);\
321 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
323#define DEFINE_RESPONSE_TABLE1(cls, base1)\
324 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
326 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
327 base1::Find(eventInfo, equal);\
329 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
331#define DEFINE_RESPONSE_TABLE2(cls, base1, base2)\
332 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
334 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
335 base1::Find(eventInfo, equal) ||\
336 base2::Find(eventInfo, equal);\
338 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
340#define DEFINE_RESPONSE_TABLE3(cls, base1, base2, base3)\
341 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
343 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
344 base1::Find(eventInfo, equal) ||\
345 base2::Find(eventInfo, equal) ||\
346 base3::Find(eventInfo, equal);\
348 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
350#define DEFINE_RESPONSE_TABLE4(cls, base1, base2, base3, base4)\
351 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
353 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
354 base1::Find(eventInfo, equal) ||\
355 base2::Find(eventInfo, equal) ||\
356 base3::Find(eventInfo, equal) ||\
357 base4::Find(eventInfo, equal);\
359 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
361#define DEFINE_RESPONSE_TABLE5(cls, base1, base2, base3, base4, base5)\
362 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
364 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
365 base1::Find(eventInfo, equal) ||\
366 base2::Find(eventInfo, equal) ||\
367 base3::Find(eventInfo, equal) ||\
368 base4::Find(eventInfo, equal) ||\
369 base5::Find(eventInfo, equal);\
371 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
373#define DEFINE_RESPONSE_TABLE6(cls, base1, base2, base3, base4, base5, base6)\
374 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
376 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
377 base1::Find(eventInfo, equal) ||\
378 base2::Find(eventInfo, equal) ||\
379 base3::Find(eventInfo, equal) ||\
380 base4::Find(eventInfo, equal) ||\
381 base5::Find(eventInfo, equal) ||\
382 base6::Find(eventInfo, equal);\
384 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
386#define DEFINE_RESPONSE_TABLE7(cls, base1, base2, base3, base4, base5, base6, base7)\
387 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
389 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
390 base1::Find(eventInfo, equal) ||\
391 base2::Find(eventInfo, equal) ||\
392 base3::Find(eventInfo, equal) ||\
393 base4::Find(eventInfo, equal) ||\
394 base5::Find(eventInfo, equal) ||\
395 base6::Find(eventInfo, equal) ||\
396 base7::Find(eventInfo, equal);\
398 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
400#define DEFINE_RESPONSE_TABLE8(cls, base1, base2, base3, base4, base5, base6, base7, base8)\
401 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
403 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
404 base1::Find(eventInfo, equal) ||\
405 base2::Find(eventInfo, equal) ||\
406 base3::Find(eventInfo, equal) ||\
407 base4::Find(eventInfo, equal) ||\
408 base5::Find(eventInfo, equal) ||\
409 base6::Find(eventInfo, equal) ||\
410 base7::Find(eventInfo, equal) ||\
411 base8::Find(eventInfo, equal);\
413 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
415#define DEFINE_RESPONSE_TABLE9(cls, base1, base2, base3, base4, base5, base6, base7, base8, base9)\
416 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
418 return SearchEntries(&__entries[0], (eventInfo.Object = this, eventInfo), equal) ||\
419 base1::Find(eventInfo, equal) ||\
420 base2::Find(eventInfo, equal) ||\
421 base3::Find(eventInfo, equal) ||\
422 base4::Find(eventInfo, equal) ||\
423 base5::Find(eventInfo, equal) ||\
424 base6::Find(eventInfo, equal) ||\
425 base7::Find(eventInfo, equal) ||\
426 base8::Find(eventInfo, equal) ||\
427 base9::Find(eventInfo, equal);\
429 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
436#define DECLARE_RESPONSE_TABLE(cls)\
438 static ::owl::TResponseTableEntry< cls > __entries[];\
439 typedef ::owl::TResponseTableEntry< cls >::PMF TMyPMF;\
440 typedef cls TMyClass;\
442 auto Find(TEventInfo&, TEqualOperator = 0) -> bool override
444#define DECLARE_EXPORT_RESPONSE_TABLE(cls)\
446 static ::owl::TResponseTableEntry< cls > __entries[];\
447 typedef ::owl::TResponseTableEntry< cls >::PMF TMyPMF;\
448 typedef cls TMyClass;\
450 auto __declspec(dllexport) Find(TEventInfo&, TEqualOperator = 0) -> bool override
452#define DECLARE_IMPORT_RESPONSE_TABLE(cls)\
454 static ::owl::TResponseTableEntry< cls > __entries[];\
455 typedef ::owl::TResponseTableEntry< cls >::PMF TMyPMF;\
456 typedef cls TMyClass;\
458 auto __declspec(dllimport) Find(TEventInfo&, TEqualOperator = 0) -> bool override
463#define DEFINE_RESPONSE_TABLE_ENTRIES(cls)\
464 ::owl::TResponseTableEntry< cls > cls::__entries[] = {
466#define END_RESPONSE_TABLE\
479#define DEFINE_RESPONSE_TABLE(cls)\
480 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
482 using namespace ::owl;\
483 eventInfo.Object = (TGeneric*)this;\
484 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal);\
486 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
492#define DEFINE_RESPONSE_TABLE1(cls, base)\
493 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
495 using namespace ::owl;\
496 eventInfo.Object = (TGeneric*)this;\
497 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
498 base::Find(eventInfo, equal);\
500 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
506#define DEFINE_RESPONSE_TABLE2(cls, base1, base2)\
507 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
509 using namespace ::owl;\
510 eventInfo.Object = (TGeneric*)this;\
511 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
512 base1::Find(eventInfo, equal) ||\
513 base2::Find(eventInfo, equal);\
515 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
521#define DEFINE_RESPONSE_TABLE3(cls, base1, base2, base3)\
522 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
524 using namespace ::owl;\
525 eventInfo.Object = (TGeneric*)this;\
526 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
527 base1::Find(eventInfo, equal) ||\
528 base2::Find(eventInfo, equal) ||\
529 base3::Find(eventInfo, equal);\
531 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
537#define DEFINE_RESPONSE_TABLE4(cls, base1, base2, base3, base4)\
538 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
540 using namespace ::owl;\
541 eventInfo.Object = (TGeneric*)this;\
542 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
543 base1::Find(eventInfo, equal) ||\
544 base2::Find(eventInfo, equal) ||\
545 base3::Find(eventInfo, equal) ||\
546 base4::Find(eventInfo, equal);\
548 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
554#define DEFINE_RESPONSE_TABLE5(cls, base1, base2, base3, base4, base5)\
555 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
557 using namespace ::owl;\
558 eventInfo.Object = (TGeneric*)this;\
559 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
560 base1::Find(eventInfo, equal) ||\
561 base2::Find(eventInfo, equal) ||\
562 base3::Find(eventInfo, equal) ||\
563 base4::Find(eventInfo, equal) ||\
564 base5::Find(eventInfo, equal);\
566 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
572#define DEFINE_RESPONSE_TABLE6(cls, base1, base2, base3, base4, base5, base6)\
573 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
575 using namespace ::owl;\
576 eventInfo.Object = (TGeneric*)this;\
577 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
578 base1::Find(eventInfo, equal) ||\
579 base2::Find(eventInfo, equal) ||\
580 base3::Find(eventInfo, equal) ||\
581 base4::Find(eventInfo, equal) ||\
582 base5::Find(eventInfo, equal) ||\
583 base6::Find(eventInfo, equal);\
585 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
591#define DEFINE_RESPONSE_TABLE7(cls, base1, base2, base3, base4, base5, base6, base7)\
592 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
594 using namespace ::owl;\
595 eventInfo.Object = (TGeneric*)this;\
596 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
597 base1::Find(eventInfo, equal) ||\
598 base2::Find(eventInfo, equal) ||\
599 base3::Find(eventInfo, equal) ||\
600 base4::Find(eventInfo, equal) ||\
601 base5::Find(eventInfo, equal) ||\
602 base6::Find(eventInfo, equal) ||\
603 base7::Find(eventInfo, equal);\
605 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
611#define DEFINE_RESPONSE_TABLE8(cls, base1, base2, base3, base4, base5, base6, base7, base8)\
612 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
614 using namespace ::owl;\
615 eventInfo.Object = (TGeneric*)this;\
616 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
617 base1::Find(eventInfo, equal) ||\
618 base2::Find(eventInfo, equal) ||\
619 base3::Find(eventInfo, equal) ||\
620 base4::Find(eventInfo, equal) ||\
621 base5::Find(eventInfo, equal) ||\
622 base6::Find(eventInfo, equal) ||\
623 base7::Find(eventInfo, equal) ||\
624 base8::Find(eventInfo, equal);\
626 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
632#define DEFINE_RESPONSE_TABLE9(cls, base1, base2, base3, base4, base5, base6, base7, base8, base9)\
633 bool cls::Find(TEventInfo& eventInfo, TEqualOperator equal)\
635 using namespace ::owl;\
636 eventInfo.Object = (TGeneric*)this;\
637 return SearchEntries((TGenericTableEntry *)&__entries[0], eventInfo, equal) ||\
638 base1::Find(eventInfo, equal) ||\
639 base2::Find(eventInfo, equal) ||\
640 base3::Find(eventInfo, equal) ||\
641 base4::Find(eventInfo, equal) ||\
642 base5::Find(eventInfo, equal) ||\
643 base6::Find(eventInfo, equal) ||\
644 base7::Find(eventInfo, equal) ||\
645 base8::Find(eventInfo, equal) ||\
646 base9::Find(eventInfo, equal);\
648 DEFINE_RESPONSE_TABLE_ENTRIES(cls)
655#if OWL_EV_SIGNATURE_CHECK
657#define OWL_ID_EV_GENERIC_(msgId, key, id, method, dispatchTemplate)\
658 {{static_cast<::owl::TMsgId>(key)}, static_cast<::owl::uint>(id),\
659 (::owl::CheckSignature<TMyClass, static_cast<::owl::TMsgId>(msgId), dispatchTemplate>(&TMyClass::method),\
660 OWL_DISPATCH(dispatchTemplate<static_cast<::owl::TMsgId>(msgId)>::Decode, method))}
662#define OWL_ID_EV_(msgId, id, method) OWL_ID_EV_GENERIC_(msgId, msgId, id, method, ::owl::TDispatch)
666#define OWL_ID_EV_(msgId, id, method)\
667 {{static_cast<::owl::TMsgId>(msgId)}, static_cast<::owl::uint>(id),\
668 OWL_DISPATCH(::owl::TDispatch<static_cast<::owl::TMsgId>(msgId)>::Decode, method)}
672#define OWL_EV_(msgId, method) OWL_ID_EV_(msgId, 0, method)
A nested class, TEventInfo provides specific information about the type of message sent,...
const TMsgId Msg
Contains the type of message sent.
TGeneric * Object
Points to the object that contains the function to be handled.
TEventInfo(TMsgId msg, uint id=0)
Constructs a TEventInfo object with the specified ID and message type.
const uint Id
Contains the menu or accelerator resource ID (CM_xxxx) for the message response member function.
const TGenericTableEntry * Entry
Points to the response table entry (for example, EvActivate).
TEventHandler is a base class from which you can derive classes that handle messages.
A template class, TResponseTableEntry lets you define a pattern for entries into a response table.
uint Id
Contains the menu or accelerator resource ID (CM_xxxx) for the message response member function.
PMF Pmf
Points to the actual handler or member function.
uint NotifyCode
Stores the control notification code (for example, ID_LISTBOX) for the response table entry.
TAnyDispatcher Dispatcher
An abstract dispatcher type that points to one of the dispatcher functions.
TMsgId Msg
Contains the ID of the message sent.
Dispatch functions (crackers) to crack a Windows message and pass control to a member function via a ...
TResponseTableEntry< TGeneric > TGenericTableEntry
Object Windows Library (OWLNext Core)
UINT TMsgId
Message ID type.
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
TResult(* TAnyDispatcher)(TGeneric &, TAnyPMF, TParam1, TParam2)
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
LRESULT TResult
Result type.
Message handler signature templates.