summaryrefslogtreecommitdiff
path: root/plugins/ExternalAPI/m_hotkey.h
blob: 1af34b4342418fd7aee4131a9291410d99943d74 (plain)
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
66
67
#ifndef H_HOTKEY_H
#define H_HOTKEY_H

//hotkey struct
	typedef struct{
		BOOL isShift; //determines if hotkey uses shift
		BOOL isCtrl;  //determines if hotkey uses control
		BOOL isAlt;	//determines if hotkey uses alt
		UINT vkCode; 

	}KEYHASH,*PKEYHASH;

	//struct passed to HKS_GET_NAME_BYHASH the result of calling it will be stored in char* name
	typedef struct{
		char* name;	//pointer to buffer where the result will be stored
		size_t bufferlen; //size of the buffer
	}GETNAMEWPARAM;

	/*this below are registred miranda services and should be called by CallService */

	/* this funtion registers new hot key function, function must be registred as miranda service
	lParam = (KEYHASH*) hotKeyDefinition
	wParam = (const char*)ServiceName
	returns true on success and false if fails */
	#define HKS_REGISTERFUNCTION "mhotkeyregister"
		/* unregisters function as hot key function
	lParam = (KEYHASH*) hotKeyDefinition /search function by it's hotkey combination 
	wParam = NULL
	and if
	lParam = NULL
	wParam = (const char*) functionName //search function by it's name
	returns if function was propertly deleted returns true else returns false */
	#define HKS_UNREGISTERFUNCTION "mhotkeyunregister"
	
	/* 
	Updates hotkey to the specific function (if another function use this hot key it'll be assigned to this
	and that function will be unregistred as hotkey function) 
	wParam = (const char*) FunctoinName // name of the function you want to update
	lParam = (KEYHASH*)newHotKey

	returns: true on success and false on failure
	*/
	#define HKS_UPDATEHOTKEY "mhotkeyupdate"

	/* gets function hash by function name, the result is stored in lParam(KEYHASH*) 
	wParam = (const char*)functionName
	lParam = (KEYHASH*) - here the result is stored
	*/
	#define HKS_GET_HASH_BYNAME "mhgethashbyname"
	/*	gets functoin name by it's hash the GETNAMEPARAM struct must be filled before calling this
	it has to be passed as wParam, and there will be result stored.
	wParam=(GETNAMEPARAM*)Result
	lParam=(KEYHASH*)keyHash
	*/
	#define HKS_GET_NAME_BYHASH "mhgetnamebyhash"
	/* converts keyHash to windows hotkey 
	wParam=(DWORD*)result
	lParam=(KEYHASH*)hotKey
	*/
	#define HKS_HASH_TO_HOTKEY "mhhashtohotkey"
	/*converts windows hotkey to keyHash
	wParam=(DWORD*)hotkey
	lParam=(KEYHASH*)result
	*/
	#define MKS_HOTKEY_TO_HASH "mhhotkeytohash"

#endif