mupdf
Toggle main menu visibility
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
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
PDF_ALERT_BUTTON_OK
@ PDF_ALERT_BUTTON_OK
Definition
event.h:107
PDF_ALERT_BUTTON_YES
@ PDF_ALERT_BUTTON_YES
Definition
event.h:110
PDF_ALERT_BUTTON_NO
@ PDF_ALERT_BUTTON_NO
Definition
event.h:109
PDF_ALERT_BUTTON_CANCEL
@ PDF_ALERT_BUTTON_CANCEL
Definition
event.h:108
PDF_ALERT_BUTTON_NONE
@ PDF_ALERT_BUTTON_NONE
Definition
event.h:106
pdf_get_doc_event_callback_data
void * pdf_get_doc_event_callback_data(fz_context *ctx, pdf_document *doc)
pdf_set_doc_event_callback
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_access_launch_url_event
pdf_launch_url_event * pdf_access_launch_url_event(fz_context *ctx, pdf_doc_event *evt)
PDF_DOCUMENT_EVENT_ALERT
@ PDF_DOCUMENT_EVENT_ALERT
Definition
event.h:42
PDF_DOCUMENT_EVENT_PRINT
@ PDF_DOCUMENT_EVENT_PRINT
Definition
event.h:43
PDF_DOCUMENT_EVENT_MAIL_DOC
@ PDF_DOCUMENT_EVENT_MAIL_DOC
Definition
event.h:45
PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM
@ PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM
Definition
event.h:47
PDF_DOCUMENT_EVENT_LAUNCH_URL
@ PDF_DOCUMENT_EVENT_LAUNCH_URL
Definition
event.h:44
PDF_DOCUMENT_EVENT_SUBMIT
@ PDF_DOCUMENT_EVENT_SUBMIT
Definition
event.h:46
pdf_event_issue_alert
void pdf_event_issue_alert(fz_context *ctx, pdf_document *doc, pdf_alert_event *evt)
pdf_access_mail_doc_event
pdf_mail_doc_event * pdf_access_mail_doc_event(fz_context *ctx, pdf_doc_event *evt)
pdf_access_alert_event
pdf_alert_event * pdf_access_alert_event(fz_context *ctx, pdf_doc_event *evt)
PDF_ALERT_ICON_QUESTION
@ PDF_ALERT_ICON_QUESTION
Definition
event.h:90
PDF_ALERT_ICON_STATUS
@ PDF_ALERT_ICON_STATUS
Definition
event.h:91
PDF_ALERT_ICON_ERROR
@ PDF_ALERT_ICON_ERROR
Definition
event.h:88
PDF_ALERT_ICON_WARNING
@ PDF_ALERT_ICON_WARNING
Definition
event.h:89
pdf_event_issue_exec_menu_item
void pdf_event_issue_exec_menu_item(fz_context *ctx, pdf_document *doc, const char *item)
pdf_event_issue_launch_url
void pdf_event_issue_launch_url(fz_context *ctx, pdf_document *doc, const char *url, int new_frame)
PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL
@ PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL
Definition
event.h:100
PDF_ALERT_BUTTON_GROUP_YES_NO
@ PDF_ALERT_BUTTON_GROUP_YES_NO
Definition
event.h:99
PDF_ALERT_BUTTON_GROUP_OK_CANCEL
@ PDF_ALERT_BUTTON_GROUP_OK_CANCEL
Definition
event.h:98
PDF_ALERT_BUTTON_GROUP_OK
@ PDF_ALERT_BUTTON_GROUP_OK
Definition
event.h:97
pdf_event_issue_print
void pdf_event_issue_print(fz_context *ctx, pdf_document *doc)
pdf_event_issue_mail_doc
void pdf_event_issue_mail_doc(fz_context *ctx, pdf_document *doc, pdf_mail_doc_event *evt)
pdf_access_exec_menu_item_event
const char * pdf_access_exec_menu_item_event(fz_context *ctx, pdf_doc_event *evt)
document.h
pdf_free_doc_event_data_cb
void pdf_free_doc_event_data_cb(fz_context *ctx, void *data)
Definition
document.h:80
pdf_doc_event_cb
void pdf_doc_event_cb(fz_context *ctx, pdf_document *doc, pdf_doc_event *evt, void *data)
Definition
document.h:74
fz_context
Definition
context.h:886
pdf_alert_event
Definition
event.h:72
pdf_alert_event::doc
pdf_document * doc
Definition
event.h:73
pdf_alert_event::button_pressed
int button_pressed
Definition
event.h:82
pdf_alert_event::check_box_message
const char * check_box_message
Definition
event.h:79
pdf_alert_event::button_group_type
int button_group_type
Definition
event.h:76
pdf_alert_event::title
const char * title
Definition
event.h:77
pdf_alert_event::finally_checked
int finally_checked
Definition
event.h:81
pdf_alert_event::has_check_box
int has_check_box
Definition
event.h:78
pdf_alert_event::message
const char * message
Definition
event.h:74
pdf_alert_event::icon_type
int icon_type
Definition
event.h:75
pdf_alert_event::initially_checked
int initially_checked
Definition
event.h:80
pdf_doc_event
Definition
event.h:36
pdf_doc_event::type
int type
Definition
event.h:37
pdf_document
Definition
document.h:463
pdf_launch_url_event
Definition
event.h:132
pdf_launch_url_event::new_frame
int new_frame
Definition
event.h:134
pdf_launch_url_event::url
const char * url
Definition
event.h:133
pdf_mail_doc_event
Definition
event.h:150
pdf_mail_doc_event::bcc
const char * bcc
Definition
event.h:154
pdf_mail_doc_event::subject
const char * subject
Definition
event.h:155
pdf_mail_doc_event::message
const char * message
Definition
event.h:156
pdf_mail_doc_event::ask_user
int ask_user
Definition
event.h:151
pdf_mail_doc_event::cc
const char * cc
Definition
event.h:153
pdf_mail_doc_event::to
const char * to
Definition
event.h:152
include
mupdf
pdf
event.h
Generated by
1.17.0