Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/include/mupdf/pdf/event.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 // Copyright (C) 2004-2022 Artifex Software, Inc. | |
| 2 // | |
| 3 // This file is part of MuPDF. | |
| 4 // | |
| 5 // MuPDF is free software: you can redistribute it and/or modify it under the | |
| 6 // terms of the GNU Affero General Public License as published by the Free | |
| 7 // Software Foundation, either version 3 of the License, or (at your option) | |
| 8 // any later version. | |
| 9 // | |
| 10 // MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY | |
| 11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
| 12 // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | |
| 13 // details. | |
| 14 // | |
| 15 // You should have received a copy of the GNU Affero General Public License | |
| 16 // along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html> | |
| 17 // | |
| 18 // Alternative licensing terms are available from the licensor. | |
| 19 // For commercial licensing, see <https://www.artifex.com/> or contact | |
| 20 // Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, | |
| 21 // CA 94129, USA, for further information. | |
| 22 | |
| 23 #ifndef MUPDF_PDF_EVENT_H | |
| 24 #define MUPDF_PDF_EVENT_H | |
| 25 | |
| 26 #include "mupdf/pdf/document.h" | |
| 27 | |
| 28 /* | |
| 29 Document events: the objects via which MuPDF informs the calling app | |
| 30 of occurrences emanating from the document, possibly from user interaction | |
| 31 or javascript execution. MuPDF informs the app of document events via a | |
| 32 callback. | |
| 33 */ | |
| 34 | |
| 35 struct pdf_doc_event | |
| 36 { | |
| 37 int type; | |
| 38 }; | |
| 39 | |
| 40 enum | |
| 41 { | |
| 42 PDF_DOCUMENT_EVENT_ALERT, | |
| 43 PDF_DOCUMENT_EVENT_PRINT, | |
| 44 PDF_DOCUMENT_EVENT_LAUNCH_URL, | |
| 45 PDF_DOCUMENT_EVENT_MAIL_DOC, | |
| 46 PDF_DOCUMENT_EVENT_SUBMIT, | |
| 47 PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM, | |
| 48 }; | |
| 49 | |
| 50 /* | |
| 51 set the function via which to receive | |
| 52 document events. | |
| 53 */ | |
| 54 void pdf_set_doc_event_callback(fz_context *ctx, pdf_document *doc, pdf_doc_event_cb *event_cb, pdf_free_doc_event_data_cb *free_event_data_cb, void *data); | |
| 55 void *pdf_get_doc_event_callback_data(fz_context *ctx, pdf_document *doc); | |
| 56 | |
| 57 /* | |
| 58 The various types of document events | |
| 59 */ | |
| 60 | |
| 61 /* | |
| 62 details of an alert event. In response the app should | |
| 63 display an alert dialog with the buttons specified by "button_type_group". | |
| 64 If "check_box_message" is non-NULL, a checkbox should be displayed in | |
| 65 the lower-left corned along with the message. | |
| 66 | |
| 67 "finally_checked" and "button_pressed" should be set by the app | |
| 68 before returning from the callback. "finally_checked" need be set | |
| 69 only if "check_box_message" is non-NULL. | |
| 70 */ | |
| 71 typedef struct | |
| 72 { | |
| 73 pdf_document *doc; | |
| 74 const char *message; | |
| 75 int icon_type; | |
| 76 int button_group_type; | |
| 77 const char *title; | |
| 78 int has_check_box; | |
| 79 const char *check_box_message; | |
| 80 int initially_checked; | |
| 81 int finally_checked; | |
| 82 int button_pressed; | |
| 83 } pdf_alert_event; | |
| 84 | |
| 85 /* Possible values of icon_type */ | |
| 86 enum | |
| 87 { | |
| 88 PDF_ALERT_ICON_ERROR, | |
| 89 PDF_ALERT_ICON_WARNING, | |
| 90 PDF_ALERT_ICON_QUESTION, | |
| 91 PDF_ALERT_ICON_STATUS | |
| 92 }; | |
| 93 | |
| 94 /* Possible values of button_group_type */ | |
| 95 enum | |
| 96 { | |
| 97 PDF_ALERT_BUTTON_GROUP_OK, | |
| 98 PDF_ALERT_BUTTON_GROUP_OK_CANCEL, | |
| 99 PDF_ALERT_BUTTON_GROUP_YES_NO, | |
| 100 PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL | |
| 101 }; | |
| 102 | |
| 103 /* Possible values of button_pressed */ | |
| 104 enum | |
| 105 { | |
| 106 PDF_ALERT_BUTTON_NONE, | |
| 107 PDF_ALERT_BUTTON_OK, | |
| 108 PDF_ALERT_BUTTON_CANCEL, | |
| 109 PDF_ALERT_BUTTON_NO, | |
| 110 PDF_ALERT_BUTTON_YES | |
| 111 }; | |
| 112 | |
| 113 /* | |
| 114 access the details of an alert event | |
| 115 The returned pointer and all the data referred to by the | |
| 116 structure are owned by mupdf and need not be freed by the | |
| 117 caller. | |
| 118 */ | |
| 119 pdf_alert_event *pdf_access_alert_event(fz_context *ctx, pdf_doc_event *evt); | |
| 120 | |
| 121 /* | |
| 122 access the details of am execMenuItem | |
| 123 event, which consists of just the name of the menu item | |
| 124 */ | |
| 125 const char *pdf_access_exec_menu_item_event(fz_context *ctx, pdf_doc_event *evt); | |
| 126 | |
| 127 /* | |
| 128 details of a launch-url event. The app should | |
| 129 open the url, either in a new frame or in the current window. | |
| 130 */ | |
| 131 typedef struct | |
| 132 { | |
| 133 const char *url; | |
| 134 int new_frame; | |
| 135 } pdf_launch_url_event; | |
| 136 | |
| 137 /* | |
| 138 access the details of a launch-url | |
| 139 event. The returned pointer and all data referred to by the structure | |
| 140 are owned by mupdf and need not be freed by the caller. | |
| 141 */ | |
| 142 pdf_launch_url_event *pdf_access_launch_url_event(fz_context *ctx, pdf_doc_event *evt); | |
| 143 | |
| 144 /* | |
| 145 details of a mail_doc event. The app should save | |
| 146 the current state of the document and email it using the specified | |
| 147 parameters. | |
| 148 */ | |
| 149 typedef struct | |
| 150 { | |
| 151 int ask_user; | |
| 152 const char *to; | |
| 153 const char *cc; | |
| 154 const char *bcc; | |
| 155 const char *subject; | |
| 156 const char *message; | |
| 157 } pdf_mail_doc_event; | |
| 158 | |
| 159 pdf_mail_doc_event *pdf_access_mail_doc_event(fz_context *ctx, pdf_doc_event *evt); | |
| 160 | |
| 161 void pdf_event_issue_alert(fz_context *ctx, pdf_document *doc, pdf_alert_event *evt); | |
| 162 void pdf_event_issue_print(fz_context *ctx, pdf_document *doc); | |
| 163 void pdf_event_issue_exec_menu_item(fz_context *ctx, pdf_document *doc, const char *item); | |
| 164 void pdf_event_issue_launch_url(fz_context *ctx, pdf_document *doc, const char *url, int new_frame); | |
| 165 void pdf_event_issue_mail_doc(fz_context *ctx, pdf_document *doc, pdf_mail_doc_event *evt); | |
| 166 | |
| 167 #endif |
