forked from gomita/firegestures
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FireGestures.idl
221 lines (172 loc) · 5.26 KB
/
FireGestures.idl
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#include "nsISupports.idl"
interface nsIDOMElement;
interface nsIDOMEvent;
interface nsIDOMEventTarget;
interface nsILocalFile;
interface nsIVariant;
interface mozIStorageConnection;
interface xdIGestureService;
interface xdIGestureHandler;
interface xdIGestureObserver;
interface xdIGestureMapping;
interface xdIGestureCommand;
[scriptable, uuid(1d26f3e7-d92e-4bcc-ac79-9624bb181308)]
interface xdIGestureService : nsISupports
{
/**
* A wrapper function to create instance of xdIGestureObserver.
*/
xdIGestureHandler createHandler();
/**
* Registers a mapping to service for later use.
* @param aID The id of the mapping to identify it. It must equal to
* the database table name which preserves the user mapping.
* @param aURI The URI of RDF datasource which preserves the default mapping.
* @param aName The name of the mapping.
*/
void registerMapping(in AUTF8String aID, in string aURI, in AUTF8String aName);
/**
* Returns a registered mapping from service.
* At the first-time calling, creates instance of xdIGestureMapping and initializes it.
* @throws NS_ERROR_NOT_INITIALIZED if the mapping is not registered.
*/
xdIGestureMapping getMapping(in AUTF8String aID);
/**
* A special version of getMapping, which returns the mapping for browser.
*/
xdIGestureMapping getMappingForBrowser();
/**
* Returns meta data of all registered mappings.
*/
nsIVariant getMappingsInfo();
/**
* Backups all user mappings to a file.
*/
void backupMappings(in nsILocalFile aFile);
/**
* Restores all user mappings from a file.
*/
void restoreMappings(in nsILocalFile aFile);
/**
* Returns database connection.
* @param aForceOpen false: Returns null if database file doesn't exist.
* true : Returns connection regardless of the file existence.
*/
mozIStorageConnection getDBConnection(in boolean aForceOpen);
/**
* Returns localized string from string bundle.
*/
wstring getLocaleString(in wstring aName);
};
[scriptable, uuid(ca559550-8ab4-41c5-a72f-fd931322cc7e)]
interface xdIGestureHandler : nsISupports
{
/**
* Get DOM element at the starting point of current mouse gesture.
*/
readonly attribute nsIDOMEventTarget sourceNode;
/**
* This method starts to handle mouse gestures at |nsIDOMEventTarget|
* and register |xdIGestureObserver| as a observer,
* which responds to mouse gestures.
* @param aDrawArea The element where an user can perform gestures.
* @param aObserver The gesture observer which is called back from handler.
*/
void attach(in nsIDOMElement aDrawArea, in xdIGestureObserver aObserver);
/**
* This method stops to handle mouse gestures.
*/
void detach();
/**
* This method opens a popup at pointer and aborts the current mouse gesture.
*/
void openPopupAtPointer(in nsIDOMElement aPopup);
};
[scriptable, uuid(c0db6b26-01d2-4060-91ff-b54af54bdd92)]
interface xdIGestureObserver : nsISupports
{
/**
* Called when the direction is changed in progress of mouse gesture.
*/
void onDirectionChanged(in nsIDOMEvent event, in ACString aDirectionChain);
/**
* Called when user perform mouse gesture.
*/
void onMouseGesture(in nsIDOMEvent event, in ACString aDirectionChain);
/**
* Called when user perform some extra gestures.
*/
void onExtraGesture(in nsIDOMEvent event, in ACString aGestureType);
};
[scriptable, uuid(d7018e80-d6da-4cbc-b77f-8dca4d95bbbf)]
interface xdIGestureMapping : nsISupports
{
/**
* Types of commands.
*/
const unsigned short TYPE_CATEGORY = 0;
const unsigned short TYPE_NORMAL = 1;
const unsigned short TYPE_SCRIPT = 2;
/**
* The id of mapping, which equals to the table name.
*/
readonly attribute AUTF8String id;
/**
* The name of the mapping.
*/
readonly attribute AUTF8String name;
/**
* Initializes mapping.
*/
void init(in AUTF8String aID, in string aURI, in AUTF8String aName);
/**
* Finalizes mapping.
*/
void finalize();
/**
* Returns xdIGestureCommand object for given direction.
* Returns undefined if there are no definition for the given direction.
*/
xdIGestureCommand getCommandForDirection(in ACString aDirection);
/**
* Opens options window to configure mapping.
*/
void configure();
/**
* Returns 2D array of mapping.
*/
nsIVariant getMappingArray();
/**
* Flushes user mapping to local disk.
*/
void saveUserMapping(in nsIVariant aItems);
/**
* API for third-party extensions to add script-type commands.
* Does not add command if there is one which has same script.
* @param aItems Array of JavaScript object which has the following properties:
* name : name of the command.
* script : script of the command.
* direction: default normal gesture to be assigned to the command (e.g. "LRUD").
*/
void addScriptCommands(in nsIVariant aItems);
};
[scriptable, uuid(2a8d26ee-6b43-4e73-9352-7632c128b006)]
interface xdIGestureCommand : nsISupports
{
/**
* Represents the type of the command.
*/
readonly attribute PRUint8 type;
/**
* Represents the localized name of the command.
*/
readonly attribute AString name;
/**
* Represents the value of the command.
*/
readonly attribute AString value;
/**
* Represents the direction of the command.
*/
readonly attribute ACString direction;
};