aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_pmp/DeviceCommands.h
blob: 3aa237d204ddf74a4ad247674298c24e52abb75c (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include "../nu/refcount.h"
#include "../devices/ifc_devicecommand.h"
#include "../devices/ifc_devicesupportedcommand.h"
#include "../devices/ifc_devicesupportedcommandenum.h"
class PortableCommand : public ifc_devicecommand
{
public:
	PortableCommand(const char *name, int title, int description);
	const char *name;
	int title;
	int description;

	const char *GetName();
	HRESULT GetIcon(wchar_t *buffer, size_t bufferSize, int width, int height);

	HRESULT GetDisplayName(wchar_t *buffer, size_t bufferSize);

	HRESULT GetDescription(wchar_t *buffer, size_t bufferSize);
RECVS_DISPATCH;
};

typedef struct DeviceCommandInfo
{
	const char *name;
	DeviceCommandFlags flags;
} DeviceCommandInfo;

BOOL SetDeviceCommandInfo(DeviceCommandInfo *info, const char *name, DeviceCommandFlags flags);

class DeviceCommand :  public Countable<ifc_devicesupportedcommand>
{
public:
	DeviceCommand(const char *name, DeviceCommandFlags flags);
	DeviceCommand(const DeviceCommandInfo *commandInfo);

public:
	const char *GetName();
	HRESULT GetFlags(DeviceCommandFlags *flags);
	REFERENCE_COUNT_IMPLEMENTATION;

public:
	const char *name;
	DeviceCommandFlags flags;
RECVS_DISPATCH;
};

class DeviceCommandEnumerator : public Countable<ifc_devicesupportedcommandenum>
{
public:
	DeviceCommandEnumerator(const DeviceCommandInfo *commandInfoList, size_t listSize);
	~DeviceCommandEnumerator();

	HRESULT Next(ifc_devicesupportedcommand **buffer, size_t bufferMax, size_t *count);
	HRESULT Reset(void);
	HRESULT Skip(size_t count);
	HRESULT GetCount(size_t *count);
	REFERENCE_COUNT_IMPLEMENTATION;

private:
	size_t position;
	DeviceCommand **commands;
	size_t count;
	RECVS_DISPATCH;
};