]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/include/mupdf/pdf/event.h
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / include / mupdf / pdf / event.h
1 #ifndef MUPDF_PDF_EVENT_H
2 #define MUPDF_PDF_EVENT_H
3
4 enum
5 {
6         HOTSPOT_POINTER_DOWN = 0x1,
7         HOTSPOT_POINTER_OVER = 0x2
8 };
9
10 /* Types of UI event */
11 enum
12 {
13         PDF_EVENT_TYPE_POINTER,
14 };
15
16 /* Types of pointer event */
17 enum
18 {
19         PDF_POINTER_DOWN,
20         PDF_POINTER_UP,
21 };
22
23 /*
24         UI events that can be passed to an interactive document.
25 */
26 typedef struct pdf_ui_event_s
27 {
28         int etype;
29         union
30         {
31                 struct
32                 {
33                         int ptype;
34                         fz_point pt;
35                 } pointer;
36         } event;
37 } pdf_ui_event;
38
39 /*
40         pdf_init_ui_pointer_event: Set up a pointer event
41 */
42 void pdf_init_ui_pointer_event(pdf_ui_event *event, int type, float x, float y);
43
44 /*
45         Document events: the objects via which MuPDF informs the calling app
46         of occurrences emanating from the document, possibly from user interaction
47         or javascript execution. MuPDF informs the app of document events via a
48         callback.
49 */
50
51 /*
52         pdf_pass_event: Pass a UI event to an interactive
53         document.
54
55         Returns a boolean indication of whether the ui_event was
56         handled. Example of use for the return value: when considering
57         passing the events that make up a drag, if the down event isn't
58         accepted then don't send the move events or the up event.
59 */
60 int pdf_pass_event(pdf_document *doc, pdf_page *page, pdf_ui_event *ui_event);
61
62 struct pdf_doc_event_s
63 {
64         int type;
65 };
66
67 enum
68 {
69         PDF_DOCUMENT_EVENT_ALERT,
70         PDF_DOCUMENT_EVENT_PRINT,
71         PDF_DOCUMENT_EVENT_LAUNCH_URL,
72         PDF_DOCUMENT_EVENT_MAIL_DOC,
73         PDF_DOCUMENT_EVENT_SUBMIT,
74         PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM,
75         PDF_DOCUMENT_EVENT_EXEC_DIALOG
76 };
77
78 /*
79         pdf_set_doc_event_callback: set the function via which to receive
80         document events.
81 */
82 void pdf_set_doc_event_callback(pdf_document *doc, pdf_doc_event_cb *event_cb, void *data);
83
84 /*
85         The various types of document events
86 */
87
88 /*
89         pdf_alert_event: details of an alert event. In response the app should
90         display an alert dialog with the bittons specified by "button_type_group".
91         If "check_box_message" is non-NULL, a checkbox should be displayed in
92         the lower-left corned along with the messsage.
93
94         "finally_checked" and "button_pressed" should be set by the app
95         before returning from the callback. "finally_checked" need be set
96         only if "check_box_message" is non-NULL.
97 */
98 typedef struct
99 {
100         char *message;
101         int icon_type;
102         int button_group_type;
103         char *title;
104         char *check_box_message;
105         int initially_checked;
106         int finally_checked;
107         int button_pressed;
108 } pdf_alert_event;
109
110 /* Possible values of icon_type */
111 enum
112 {
113         PDF_ALERT_ICON_ERROR,
114         PDF_ALERT_ICON_WARNING,
115         PDF_ALERT_ICON_QUESTION,
116         PDF_ALERT_ICON_STATUS
117 };
118
119 /* Possible values of button_group_type */
120 enum
121 {
122         PDF_ALERT_BUTTON_GROUP_OK,
123         PDF_ALERT_BUTTON_GROUP_OK_CANCEL,
124         PDF_ALERT_BUTTON_GROUP_YES_NO,
125         PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL
126 };
127
128 /* Possible values of button_pressed */
129 enum
130 {
131         PDF_ALERT_BUTTON_NONE,
132         PDF_ALERT_BUTTON_OK,
133         PDF_ALERT_BUTTON_CANCEL,
134         PDF_ALERT_BUTTON_NO,
135         PDF_ALERT_BUTTON_YES
136 };
137
138 /*
139         pdf_access_alert_event: access the details of an alert event
140         The returned pointer and all the data referred to by the
141         structire are owned by mupdf and need not be freed by the
142         caller.
143 */
144 pdf_alert_event *pdf_access_alert_event(pdf_doc_event *event);
145
146 /*
147         pdf_access_exec_menu_item_event: access the details of am execMenuItem
148         event, which consists of just the name of the menu item
149 */
150 char *pdf_access_exec_menu_item_event(pdf_doc_event *event);
151
152 /*
153         pdf_submit_event: details of a submit event. The app should submit
154         the specified data to the specified url. "get" determines whether
155         to use the GET or POST method.
156 */
157 typedef struct
158 {
159         char *url;
160         char *data;
161         int data_len;
162         int get;
163 } pdf_submit_event;
164
165 /*
166         pdf_access_submit_event: access the details of a submit event
167         The returned pointer and all data referred to by the structure are
168         owned by mupdf and need not be freed by the caller.
169 */
170 pdf_submit_event *pdf_access_submit_event(pdf_doc_event *event);
171
172 /*
173         pdf_launch_url_event: details of a launch-url event. The app should
174         open the url, either in a new frame or in the current window.
175 */
176 typedef struct
177 {
178         char *url;
179         int new_frame;
180 } pdf_launch_url_event;
181
182 /*
183         pdf_access_launch_url_event: access the details of a launch-url
184         event. The returned pointer and all data referred to by the structure
185         are owned by mupdf and need not be freed by the caller.
186 */
187 pdf_launch_url_event *pdf_access_launch_url_event(pdf_doc_event *event);
188
189 /*
190         pdf_mail_doc_event: details of a mail_doc event. The app should save
191         the current state of the document and email it using the specified
192         parameters.
193 */
194 typedef struct
195 {
196         int ask_user;
197         char *to;
198         char *cc;
199         char *bcc;
200         char *subject;
201         char *message;
202 } pdf_mail_doc_event;
203
204 /*
205         pdf_acccess_mail_doc_event: access the details of a mail-doc event.
206 */
207 pdf_mail_doc_event *pdf_access_mail_doc_event(pdf_doc_event *event);
208
209 void pdf_event_issue_alert(pdf_document *doc, pdf_alert_event *event);
210 void pdf_event_issue_print(pdf_document *doc);
211 void pdf_event_issue_exec_menu_item(pdf_document *doc, char *item);
212 void pdf_event_issue_exec_dialog(pdf_document *doc);
213 void pdf_event_issue_launch_url(pdf_document *doc, char *url, int new_frame);
214 void pdf_event_issue_mail_doc(pdf_document *doc, pdf_mail_doc_event *event);
215
216 #endif