mupdf
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
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
36{
37 int type;
38};
39
40enum
41{
48};
49
50/*
51 set the function via which to receive
52 document events.
53*/
54void 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);
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*/
84
85/* Possible values of icon_type */
86enum
87{
92};
93
94/* Possible values of button_group_type */
95enum
96{
101};
102
103/* Possible values of button_pressed */
104enum
105{
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*/
120
121/*
122 access the details of am execMenuItem
123 event, which consists of just the name of the menu item
124*/
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*/
131typedef struct
132{
133 const char *url;
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*/
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*/
149typedef struct
150{
152 const char *to;
153 const char *cc;
154 const char *bcc;
155 const char *subject;
156 const char *message;
158
160
163void pdf_event_issue_exec_menu_item(fz_context *ctx, pdf_document *doc, const char *item);
164void pdf_event_issue_launch_url(fz_context *ctx, pdf_document *doc, const char *url, int new_frame);
166
167#endif
@ PDF_DOCUMENT_EVENT_ALERT
Definition event.h:42
@ PDF_DOCUMENT_EVENT_PRINT
Definition event.h:43
@ PDF_DOCUMENT_EVENT_MAIL_DOC
Definition event.h:45
@ PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM
Definition event.h:47
@ PDF_DOCUMENT_EVENT_LAUNCH_URL
Definition event.h:44
@ PDF_DOCUMENT_EVENT_SUBMIT
Definition event.h:46
void * pdf_get_doc_event_callback_data(fz_context *ctx, pdf_document *doc)
@ PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL
Definition event.h:100
@ PDF_ALERT_BUTTON_GROUP_YES_NO
Definition event.h:99
@ PDF_ALERT_BUTTON_GROUP_OK_CANCEL
Definition event.h:98
@ PDF_ALERT_BUTTON_GROUP_OK
Definition event.h:97
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)
@ PDF_ALERT_ICON_QUESTION
Definition event.h:90
@ PDF_ALERT_ICON_STATUS
Definition event.h:91
@ PDF_ALERT_ICON_ERROR
Definition event.h:88
@ PDF_ALERT_ICON_WARNING
Definition event.h:89
pdf_launch_url_event * pdf_access_launch_url_event(fz_context *ctx, pdf_doc_event *evt)
void pdf_event_issue_alert(fz_context *ctx, pdf_document *doc, pdf_alert_event *evt)
@ PDF_ALERT_BUTTON_OK
Definition event.h:107
@ PDF_ALERT_BUTTON_YES
Definition event.h:110
@ PDF_ALERT_BUTTON_NO
Definition event.h:109
@ PDF_ALERT_BUTTON_CANCEL
Definition event.h:108
@ PDF_ALERT_BUTTON_NONE
Definition event.h:106
pdf_mail_doc_event * pdf_access_mail_doc_event(fz_context *ctx, pdf_doc_event *evt)
pdf_alert_event * pdf_access_alert_event(fz_context *ctx, pdf_doc_event *evt)
void pdf_event_issue_exec_menu_item(fz_context *ctx, pdf_document *doc, const char *item)
void pdf_event_issue_launch_url(fz_context *ctx, pdf_document *doc, const char *url, int new_frame)
void pdf_event_issue_print(fz_context *ctx, pdf_document *doc)
void pdf_event_issue_mail_doc(fz_context *ctx, pdf_document *doc, pdf_mail_doc_event *evt)
const char * pdf_access_exec_menu_item_event(fz_context *ctx, pdf_doc_event *evt)
void pdf_free_doc_event_data_cb(fz_context *ctx, void *data)
Definition document.h:80
void pdf_doc_event_cb(fz_context *ctx, pdf_document *doc, pdf_doc_event *evt, void *data)
Definition document.h:74
Definition context.h:886
Definition event.h:72
pdf_document * doc
Definition event.h:73
int button_pressed
Definition event.h:82
const char * check_box_message
Definition event.h:79
int button_group_type
Definition event.h:76
const char * title
Definition event.h:77
int finally_checked
Definition event.h:81
int has_check_box
Definition event.h:78
const char * message
Definition event.h:74
int icon_type
Definition event.h:75
int initially_checked
Definition event.h:80
Definition event.h:36
int type
Definition event.h:37
Definition document.h:463
Definition event.h:132
int new_frame
Definition event.h:134
const char * url
Definition event.h:133
Definition event.h:150
const char * bcc
Definition event.h:154
const char * subject
Definition event.h:155
const char * message
Definition event.h:156
int ask_user
Definition event.h:151
const char * cc
Definition event.h:153
const char * to
Definition event.h:152