1 #ifndef MUPDF_PDF_EVENT_H
2 #define MUPDF_PDF_EVENT_H
6 HOTSPOT_POINTER_DOWN = 0x1,
7 HOTSPOT_POINTER_OVER = 0x2
10 /* Types of UI event */
13 PDF_EVENT_TYPE_POINTER,
16 /* Types of pointer event */
24 UI events that can be passed to an interactive document.
26 typedef struct pdf_ui_event_s
40 pdf_init_ui_pointer_event: Set up a pointer event
42 void pdf_init_ui_pointer_event(pdf_ui_event *event, int type, float x, float y);
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
52 pdf_pass_event: Pass a UI event to an interactive
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.
60 int pdf_pass_event(pdf_document *doc, pdf_page *page, pdf_ui_event *ui_event);
62 struct pdf_doc_event_s
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
79 pdf_set_doc_event_callback: set the function via which to receive
82 void pdf_set_doc_event_callback(pdf_document *doc, pdf_doc_event_cb *event_cb, void *data);
85 The various types of document events
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.
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.
102 int button_group_type;
104 char *check_box_message;
105 int initially_checked;
110 /* Possible values of icon_type */
113 PDF_ALERT_ICON_ERROR,
114 PDF_ALERT_ICON_WARNING,
115 PDF_ALERT_ICON_QUESTION,
116 PDF_ALERT_ICON_STATUS
119 /* Possible values of button_group_type */
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
128 /* Possible values of button_pressed */
131 PDF_ALERT_BUTTON_NONE,
133 PDF_ALERT_BUTTON_CANCEL,
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
144 pdf_alert_event *pdf_access_alert_event(pdf_doc_event *event);
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
150 char *pdf_access_exec_menu_item_event(pdf_doc_event *event);
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.
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.
170 pdf_submit_event *pdf_access_submit_event(pdf_doc_event *event);
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.
180 } pdf_launch_url_event;
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.
187 pdf_launch_url_event *pdf_access_launch_url_event(pdf_doc_event *event);
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
202 } pdf_mail_doc_event;
205 pdf_acccess_mail_doc_event: access the details of a mail-doc event.
207 pdf_mail_doc_event *pdf_access_mail_doc_event(pdf_doc_event *event);
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);