aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/api/service/svcs/svc_action.cpp
blob: bb6954de2b947ad381ed8349ecff214387766001 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <precomp.h>

#include "svc_action.h"

#define CBCLASS svc_actionI
START_DISPATCH;
CB(HASACTION, hasAction);
CB(ONACTION, onAction);
END_DISPATCH;
#undef CBCLASS

svc_actionI::~svc_actionI()
{
	actions.deleteAll();
}

void svc_actionI::registerAction(const wchar_t *actionid, int pvtid)
{
	ASSERT(actionid != NULL);
	actions.addItem(new ActionEntry(actionid, pvtid));
}

int svc_actionI::hasAction(const wchar_t *name)
{
	if (name == NULL) return FALSE;
	return (actions.findItem(name) != NULL);
}

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)
{
	if (action == NULL) return 0;
	int pos = -1;
	if (actions.findItem(action, &pos))
	{
		return onActionId(actions.enumItem(pos)->getId(), action, param, p1, p2, data, datalen, source);
	}
	return 0;
}