page.h 5.01 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1 2 3 4 5 6
/* See LICENSE file for license and copyright information */

#ifndef PAGE_H
#define PAGE_H

#include <girara/datastructures.h>
7
#include <cairo.h>
Moritz Lipp's avatar
Moritz Lipp committed
8

9
#include "types.h"
Moritz Lipp's avatar
Moritz Lipp committed
10 11 12 13 14

/**
 * Get the page object
 *
 * @param document The document
15
 * @param index Page number
16
 * @param error Optional error
Moritz Lipp's avatar
Moritz Lipp committed
17 18
 * @return Page object or NULL if an error occured
 */
19
zathura_page_t* zathura_page_new(zathura_document_t* document, unsigned int
20
    index, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
21 22 23 24 25

/**
 * Frees the page object
 *
 * @param page The page object
26 27
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
28
 */
29
zathura_error_t zathura_page_free(zathura_page_t* page);
Moritz Lipp's avatar
Moritz Lipp committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

/**
 * Returns the associated document
 *
 * @param page The page object
 * @return The associated document
 * @return NULL if an error occured
 */
zathura_document_t* zathura_page_get_document(zathura_page_t* page);

/**
 * Returns the set id of the page
 *
 * @param page The page object
 * @return The id of the page
 */
46
unsigned int zathura_page_get_index(zathura_page_t* page);
Moritz Lipp's avatar
Moritz Lipp committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119

/**
 * Returns the width of the page
 *
 * @param page The page object
 * @return Width of the page
 * @return -1 If an error occured
 */
double zathura_page_get_width(zathura_page_t* page);

/**
 * Sets the new width of the page
 *
 * @param page The page object
 * @param width The new width of the page
 */
void zathura_page_set_width(zathura_page_t* page, double width);

/**
 * Returns the height of the page
 *
 * @param page The page object
 * @return Height of the page
 * @return -1 If an error occured
 */
double zathura_page_get_height(zathura_page_t* page);

/**
 * Sets the new height of the page
 *
 * @param page The page object
 * @param height The new height of the page
 */
void zathura_page_set_height(zathura_page_t* page, double height);

/**
 * Returns the visibility of the page
 *
 * @param page The page object
 * @return true if the page is visible
 * @return false if the page is hidden
 */
bool zathura_page_get_visibility(zathura_page_t* page);

/**
 * Sets the visibility of the page
 *
 * @param page The page object
 * @param visibility The new visibility value
 */
void zathura_page_set_visibility(zathura_page_t* page, bool visibility);

/**
 * Returns the custom data
 *
 * @param page The page object
 * @return The custom data or NULL
 */
void* zathura_page_get_data(zathura_page_t* page);

/**
 * Sets the custom data
 *
 * @param page The page object
 * @param data The custom data
 */
void zathura_page_set_data(zathura_page_t* page, void* data);

/**
 * Search page
 *
 * @param page The page object
 * @param text Search item
120
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
121 122 123
 *   error occured
 * @return List of results
 */
124
girara_list_t* zathura_page_search_text(zathura_page_t* page, const char* text, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
125 126 127 128 129

/**
 * Get page links
 *
 * @param page The page object
130
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
131 132 133
 *   error occured
 * @return List of links
 */
134
girara_list_t* zathura_page_links_get(zathura_page_t* page, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
135 136 137 138 139

/**
 * Free page links
 *
 * @param list List of links
140 141
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
142
 */
143
zathura_error_t zathura_page_links_free(girara_list_t* list);
Moritz Lipp's avatar
Moritz Lipp committed
144 145 146 147 148

/**
 * Get list of form fields
 *
 * @param page The page object
149
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
150 151 152
 *   error occured
 * @return List of form fields
 */
153
girara_list_t* zathura_page_form_fields_get(zathura_page_t* page, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
154 155 156 157 158

/**
 * Free list of form fields
 *
 * @param list List of form fields
159 160
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
161
 */
162
zathura_error_t zathura_page_form_fields_free(girara_list_t* list);
Moritz Lipp's avatar
Moritz Lipp committed
163 164 165 166 167

/**
 * Get list of images
 *
 * @param page Page
168
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
169 170 171
 *   error occured
 * @return List of images or NULL if an error occured
 */
172
girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
173 174 175 176 177 178

/**
 * Get image
 *
 * @param page Page
 * @param image Image identifier
179
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
180 181 182
 *   error occured
 * @return The cairo image surface or NULL if an error occured
 */
183
cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
184 185 186 187 188

/**
 * Get text for selection
 * @param page Page
 * @param rectangle Selection
189
 * @param error Set to an error value (see \ref zathura_error_t) if an error
Moritz Lipp's avatar
Moritz Lipp committed
190 191 192
 * occured
 * @return The selected text (needs to be deallocated with g_free)
 */
193
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
194 195 196 197 198 199 200

/**
 * Render page
 *
 * @param page The page object
 * @param cairo Cairo object
 * @param printing render for printing
201 202
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
203
 */
204
zathura_error_t zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing);
Moritz Lipp's avatar
Moritz Lipp committed
205 206

#endif // PAGE_H