Code

gtk-tpdfv.h: Documented behavior of navigation functions.
[tpdfview.git] / src / gtk-tpdfv.h
1 /*
2  * tpdfview - src/gtk-tpdfv.h
3  * Copyright (C) 2011 Sebastian 'tokkee' Harl <sh@tokkee.org>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
28 /*
29  * This module provides a Gtk widget to display PDF files.
30  */
32 #ifndef GTK_TPDFV_H
33 #define GTK_TPDFV_H 1
35 #include <gtk/gtk.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 #define GTK_TYPE_TPDFV (gtk_tpdfv_get_type())
42 #define GTK_TPDFV(obj) \
43         (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_TPDFV, GtkTPDFV))
44 #define GTK_TPDFV_CLASS(obj) \
45         (G_TYPE_CHECK_CLASS_CAST((obj), GTK_TYPE_TPDFV, GtkTPDFVClass))
46 #define GTK_IS_TPDFV(obj) \
47         (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_TPDFV))
48 #define GTK_IS_TPDFV_CLASS(obj) \
49         (G_TYPE_CHECK_CLASS_TYPE((obj), GTK_TYPE_TPDFV))
50 #define GTK_TPDFV_GET_CLASS(obj) \
51         (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_TPDFV, GtkTPDFVClass))
53 typedef struct {
54         GtkDrawingArea graph;
55 } GtkTPDFV;
57 typedef struct {
58         GtkDrawingAreaClass parent_class;
59 } GtkTPDFVClass;
61 /*
62  * gtk_tpdfv_new:
63  * Creates a new GtkTPDFV widget to display the specified PDF file.
64  */
65 GtkWidget *
66 gtk_tpdfv_new(const char *filename);
68 /*
69  * gtk_tpdfv_reload:
70  * Reload the previously opened PDF file.
71  */
72 void
73 gtk_tpdfv_reload(GtkWidget *widget);
75 /*
76  * gtk_tpdfv_get_n_pages, gtk_tpdfv_get_current_page:
77  * Get the total number of pages or the current page number.
78  */
79 int
80 gtk_tpdfv_get_n_pages(GtkWidget *widget);
81 int
82 gtk_tpdfv_get_current_page(GtkWidget *widget);
84 /*
85  * gtk_tpdfv_page_up, gtk_tpdfv_page_down,
86  * gtk_tpdfv_first_page, gtk_tpdfv_last_page,
87  * gtk_tpdfv_goto_page:
88  * Navigation (none of these functions will go beyond the first or last page).
89  */
90 void
91 gtk_tpdfv_page_up(GtkWidget *widget);
92 void
93 gtk_tpdfv_page_down(GtkWidget *widget);
94 void
95 gtk_tpdfv_first_page(GtkWidget *widget);
96 void
97 gtk_tpdfv_last_page(GtkWidget *widget);
98 void
99 gtk_tpdfv_goto_page(GtkWidget *widget, int page);
101 /*
102  * gtk_tpdfv_zoom_in, gtk_tpdfv_zoom_out,
103  * gtk_tpdfv_zoom_1:
104  * Zooming.
105  */
106 void
107 gtk_tpdfv_zoom_in(GtkWidget *widget);
108 void
109 gtk_tpdfv_zoom_out(GtkWidget *widget);
110 void
111 gtk_tpdfv_zoom_1(GtkWidget *widget);
112 void
113 gtk_tpdfv_zoom_width(GtkWidget *widget);
114 void
115 gtk_tpdfv_zoom_height(GtkWidget *widget);
116 void
117 gtk_tpdfv_zoom_fit(GtkWidget *widget);
119 /*
120  * gtk_tpdfv_scroll_up, gtk_tpdfv_scroll_down,
121  * gtk_tpdfv_scroll_left, gtk_tpdfv_scroll_right:
122  * Scrolling.
123  */
124 void
125 gtk_tpdfv_scroll_up(GtkWidget *widget);
126 void
127 gtk_tpdfv_scroll_down(GtkWidget *widget);
128 void
129 gtk_tpdfv_scroll_left(GtkWidget *widget);
130 void
131 gtk_tpdfv_scroll_right(GtkWidget *widget);
133 /*
134  * Screen handling.
135  */
137 struct gtk_tpdfv_screens;
138 typedef struct gtk_tpdfv_screens gtk_tpdfv_screens_t;
140 /*
141  * gtk_tpdfv_get_screens:
142  * Get a list of available screens.
143  */
144 gtk_tpdfv_screens_t *
145 gtk_tpdfv_screens_init(const gchar *display_name);
146 void
147 gtk_tpdfv_screens_destroy(gtk_tpdfv_screens_t *screens);
149 /*
150  * gtk_tpdfv_screens_number:
151  * Get the number of screens.
152  */
153 gint
154 gtk_tpdfv_screens_number(const gtk_tpdfv_screens_t *screens);
156 /*
157  * gtk_tpdfv_screens_window_set, gtk_tpdfv_screens_window_get:
158  * Set or get the screen of a window.
159  */
160 void
161 gtk_tpdfv_screens_window_set(const gtk_tpdfv_screens_t *screens,
162                 GtkWindow *window, gint screen);
163 gint
164 gtk_tpdfv_screens_window_get(const gtk_tpdfv_screens_t *screens,
165                 GtkWindow *window);
167 #ifdef __cplusplus
168 } /* extern "C" */
169 #endif
171 #endif /* ! GTK_TPDFV_H */
173 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */