diff options
Diffstat (limited to 'fitz/fitz.h')
-rw-r--r-- | fitz/fitz.h | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/fitz/fitz.h b/fitz/fitz.h index ba7088ae..520058b1 100644 --- a/fitz/fitz.h +++ b/fitz/fitz.h @@ -2212,6 +2212,32 @@ fz_link *fz_load_links(fz_document *doc, fz_page *page); fz_rect fz_bound_page(fz_document *doc, fz_page *page); /* + fz_annot: opaque pointer to annotation details. +*/ +typedef struct fz_annot_s fz_annot; + +/* + fz_first_annot: Return a pointer to the first annotation on a page. + + Does not throw exceptions. +*/ +fz_annot *fz_first_annot(fz_document *doc, fz_page *page); + +/* + fz_next_annot: Return a pointer to the next annotation on a page. + + Does not throw exceptions. +*/ +fz_annot *fz_next_annot(fz_document *doc, fz_annot *annot); + +/* + fz_bound_annot: Return the bounding rectangle of the annotation. + + Does not throw exceptions. +*/ +fz_rect fz_bound_annot(fz_document *doc, fz_annot *annot); + +/* fz_run_page: Run a page through a device. page: Page obtained from fz_load_page. @@ -2311,6 +2337,137 @@ enum FZ_META_INFO = 4, }; + +/* Interactive features */ + +/* Types of widget */ +enum +{ + FZ_WIDGET_TYPE_PUSHBUTTON, + FZ_WIDGET_TYPE_CHECKBOX, + FZ_WIDGET_TYPE_RADIOBUTTON, + FZ_WIDGET_TYPE_TEXT, + FZ_WIDGET_TYPE_LISTBOX, + FZ_WIDGET_TYPE_COMBOBOX +}; + +/* Types of UI event */ +enum +{ + FZ_EVENT_TYPE_POINTER, +}; + +/* Types of pointer event */ +enum +{ + FZ_POINTER_DOWN, + FZ_POINTER_UP, +}; + +/* + Interface supported by some types of documents, + via which interactions (such as filling in forms) + can be achieved. +*/ +typedef struct fz_interactive_s fz_interactive; + +/* + UI events that can be passed to an interactive document. +*/ +typedef struct fz_ui_event_s +{ + int etype; + union + { + struct + { + int ptype; + fz_point pt; + } pointer; + } event; +} fz_ui_event; + +/* + Widgets that may appear in PDF forms +*/ +typedef struct fz_widget_s fz_widget; + +/* + Specific types of widget +*/ +typedef struct fz_widget_text_s fz_widget_text; + +/* + Obtain an interface for interaction from a document. + For document types that don't support interaction, NULL + is returned. +*/ +fz_interactive *fz_interact(fz_document *doc); + +/* + fz_pass_event: Pass a UI event to an interactive + document. + + Returns a boolean indication of whether the ui_event was + handled. Example of use for the return value: when considering + passing the events that make up a drag, if the down event isn't + accepted then don't send the move events or the up event. +*/ +int fz_pass_event(fz_interactive *idoc, fz_page *page, fz_ui_event *ui_event); + +/* + fz_ui_event_pointer: Set up a pointer event +*/ +void fz_ui_event_pointer(fz_ui_event *event, int type, float x, float y); + +/* + fz_get_screen_update: Get the bounding box of an area needing + update because of a visual change. + + After a sequence of interactions with a document that may cause + it to change in appearance - such as passing ui events - this + method should be called repeatedly until it returns NULL, to + enumerate the changed areas for which screen updates are + needed. +*/ +fz_rect *fz_get_screen_update(fz_interactive *idoc); + +/* + fz_get_focussed_widget: returns the currently focussed widget + + Widgets can become focussed as a result of passing in ui events. + NULL is returned if there is no currently focussed widget. An + app may wish to create a native representative of the focussed + widget, e.g., to collect the text for a text widget, rather than + routing key strokes through fz_pass_event. +*/ +fz_widget *fz_get_focussed_widget(fz_interactive *idoc); + +/* + fz_widget_get_type: find out the type of a widget. + + The type determines what widget subclass the widget + can safely be cast to. +*/ +int fz_widget_get_type(fz_widget *widget); + +/* + fz_widget_get_bbox: get the bounding box of a widget. +*/ +fz_bbox *fz_widget_get_bbox(fz_widget *widget); + +/* + fz_widget_text_get_text: Get the text currently displayed in + a text widget. +*/ +char *fz_widget_text_get_text(fz_widget_text *tw); + +/* + fz_widget_text_set_text: Update the text of a text widget. +*/ +void fz_widget_text_set_text(fz_widget_text *tw, char *text); + + typedef struct fz_write_options_s fz_write_options; /* |