#ifndef MUPDF_PDF_WIDGET_H1#define MUPDF_PDF_WIDGET_H23/* Types of widget */4enum5{6PDF_WIDGET_TYPE_NOT_WIDGET = -1,7PDF_WIDGET_TYPE_PUSHBUTTON,8PDF_WIDGET_TYPE_CHECKBOX,9PDF_WIDGET_TYPE_RADIOBUTTON,10PDF_WIDGET_TYPE_TEXT,11PDF_WIDGET_TYPE_LISTBOX,12PDF_WIDGET_TYPE_COMBOBOX,13PDF_WIDGET_TYPE_SIGNATURE14};1516/* Types of text widget content */17enum18{19PDF_WIDGET_CONTENT_UNRESTRAINED,20PDF_WIDGET_CONTENT_NUMBER,21PDF_WIDGET_CONTENT_SPECIAL,22PDF_WIDGET_CONTENT_DATE,23PDF_WIDGET_CONTENT_TIME24};2526/*27Widgets that may appear in PDF forms28*/2930/*31pdf_focused_widget: returns the currently focussed widget3233Widgets can become focussed as a result of passing in ui events.34NULL is returned if there is no currently focussed widget. An35app may wish to create a native representative of the focussed36widget, e.g., to collect the text for a text widget, rather than37routing key strokes through pdf_pass_event.38*/39pdf_widget *pdf_focused_widget(fz_context *ctx, pdf_document *doc);4041/*42pdf_first_widget: get first widget when enumerating43*/44pdf_widget *pdf_first_widget(fz_context *ctx, pdf_document *doc, pdf_page *page);4546/*47pdf_next_widget: get next widget when enumerating48*/49pdf_widget *pdf_next_widget(fz_context *ctx, pdf_widget *previous);5051/*52pdf_create_widget: create a new widget of a specific type53*/54pdf_widget *pdf_create_widget(fz_context *ctx, pdf_document *doc, pdf_page *page, int type, char *fieldname);5556/*57pdf_widget_get_type: find out the type of a widget.5859The type determines what widget subclass the widget60can safely be cast to.61*/62int pdf_widget_get_type(fz_context *ctx, pdf_widget *widget);6364/*65pdf_bound_widget: get the bounding box of a widget.66*/67fz_rect *pdf_bound_widget(fz_context *ctx, pdf_widget *widget, fz_rect *);6869/*70pdf_text_widget_text: Get the text currently displayed in71a text widget.72*/73char *pdf_text_widget_text(fz_context *ctx, pdf_document *doc, pdf_widget *tw);7475/*76pdf_widget_text_max_len: get the maximum number of77characters permitted in a text widget78*/79int pdf_text_widget_max_len(fz_context *ctx, pdf_document *doc, pdf_widget *tw);8081/*82pdf_text_widget_content_type: get the type of content83required by a text widget84*/85int pdf_text_widget_content_type(fz_context *ctx, pdf_document *doc, pdf_widget *tw);8687/*88pdf_text_widget_set_text: Update the text of a text widget.89The text is first validated and accepted only if it passes. The90function returns whether validation passed.91*/92int pdf_text_widget_set_text(fz_context *ctx, pdf_document *doc, pdf_widget *tw, char *text);9394/*95pdf_choice_widget_options: get the list of options for a list96box or combo box. Returns the number of options and fills in their97names within the supplied array. Should first be called with a98NULL array to find out how big the array should be.99*/100int pdf_choice_widget_options(fz_context *ctx, pdf_document *doc, pdf_widget *tw, char *opts[]);101102/*103pdf_choice_widget_is_multiselect: returns whether a list box or104combo box supports selection of multiple options105*/106int pdf_choice_widget_is_multiselect(fz_context *ctx, pdf_document *doc, pdf_widget *tw);107108/*109pdf_choice_widget_value: get the value of a choice widget.110Returns the number of options curently selected and fills in111the supplied array with their strings. Should first be called112with NULL as the array to find out how big the array need to113be. The filled in elements should not be freed by the caller.114*/115int pdf_choice_widget_value(fz_context *ctx, pdf_document *doc, pdf_widget *tw, char *opts[]);116117/*118pdf_widget_set_value: set the value of a choice widget. The119caller should pass the number of options selected and an120array of their names121*/122void pdf_choice_widget_set_value(fz_context *ctx, pdf_document *doc, pdf_widget *tw, int n, char *opts[]);123124#endif125126127