svc_action.cpp 854 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <precomp.h>
  2. #include "svc_action.h"
  3. #define CBCLASS svc_actionI
  4. START_DISPATCH;
  5. CB(HASACTION, hasAction);
  6. CB(ONACTION, onAction);
  7. END_DISPATCH;
  8. #undef CBCLASS
  9. svc_actionI::~svc_actionI()
  10. {
  11. actions.deleteAll();
  12. }
  13. void svc_actionI::registerAction(const wchar_t *actionid, int pvtid)
  14. {
  15. ASSERT(actionid != NULL);
  16. actions.addItem(new ActionEntry(actionid, pvtid));
  17. }
  18. int svc_actionI::hasAction(const wchar_t *name)
  19. {
  20. if (name == NULL) return FALSE;
  21. return (actions.findItem(name) != NULL);
  22. }
  23. int svc_actionI::onAction(const wchar_t *action, const wchar_t *param, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source)
  24. {
  25. if (action == NULL) return 0;
  26. int pos = -1;
  27. if (actions.findItem(action, &pos))
  28. {
  29. return onActionId(actions.enumItem(pos)->getId(), action, param, p1, p2, data, datalen, source);
  30. }
  31. return 0;
  32. }