page.h 5.2 KB
Newer Older
Moritz Lipp's avatar
Moritz Lipp committed
1 2 3 4 5 6 7 8 9 10 11 12 13
/* See LICENSE file for license and copyright information */

#ifndef PAGE_H
#define PAGE_H

#include <girara/datastructures.h>

#include "document.h"

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

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

/**
 * 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
 */
45
unsigned int zathura_page_get_index(zathura_page_t* page);
Moritz Lipp's avatar
Moritz Lipp committed
46 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 120 121 122 123 124 125 126 127

/**
 * Returns the page widget of the page
 *
 * @param page The page object
 * @return The page widget of the page
 * @return NULL if an error occured
 */
GtkWidget* zathura_page_get_widget(zathura_page_t* page);

/**
 * 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
128
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
129 130 131
 *   error occured
 * @return List of results
 */
132
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
133 134 135 136 137

/**
 * Get page links
 *
 * @param page The page object
138
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
139 140 141
 *   error occured
 * @return List of links
 */
142
girara_list_t* zathura_page_links_get(zathura_page_t* page, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
143 144 145 146 147

/**
 * Free page links
 *
 * @param list List of links
148 149
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
150
 */
151
zathura_error_t zathura_page_links_free(girara_list_t* list);
Moritz Lipp's avatar
Moritz Lipp committed
152 153 154 155 156

/**
 * Get list of form fields
 *
 * @param page The page object
157
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
158 159 160
 *   error occured
 * @return List of form fields
 */
161
girara_list_t* zathura_page_form_fields_get(zathura_page_t* page, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
162 163 164 165 166

/**
 * Free list of form fields
 *
 * @param list List of form fields
167 168
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
169
 */
170
zathura_error_t zathura_page_form_fields_free(girara_list_t* list);
Moritz Lipp's avatar
Moritz Lipp committed
171 172 173 174 175

/**
 * Get list of images
 *
 * @param page Page
176
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
177 178 179
 *   error occured
 * @return List of images or NULL if an error occured
 */
180
girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
181 182 183 184 185 186

/**
 * Get image
 *
 * @param page Page
 * @param image Image identifier
187
 * @param error Set to an error value (see \ref zathura_error_t) if an
Moritz Lipp's avatar
Moritz Lipp committed
188 189 190
 *   error occured
 * @return The cairo image surface or NULL if an error occured
 */
191
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
192 193 194 195 196

/**
 * Get text for selection
 * @param page Page
 * @param rectangle Selection
197
 * @param error Set to an error value (see \ref zathura_error_t) if an error
Moritz Lipp's avatar
Moritz Lipp committed
198 199 200
 * occured
 * @return The selected text (needs to be deallocated with g_free)
 */
201
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error);
Moritz Lipp's avatar
Moritz Lipp committed
202 203 204 205 206 207 208

/**
 * Render page
 *
 * @param page The page object
 * @param cairo Cairo object
 * @param printing render for printing
209 210
 * @return ZATHURA_ERROR_OK when no error occured, otherwise see
 *    zathura_error_t
Moritz Lipp's avatar
Moritz Lipp committed
211
 */
212
zathura_error_t zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing);
Moritz Lipp's avatar
Moritz Lipp committed
213 214

#endif // PAGE_H