e354bd39cd689e8eb4d298771fbfca1ec71c3731
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 * Navigation.
88 */
89 void
90 gtk_tpdfv_page_up(GtkWidget *widget);
91 void
92 gtk_tpdfv_page_down(GtkWidget *widget);
93 void
94 gtk_tpdfv_first_page(GtkWidget *widget);
95 void
96 gtk_tpdfv_last_page(GtkWidget *widget);
98 /*
99 * gtk_tpdfv_zoom_in, gtk_tpdfv_zoom_out,
100 * gtk_tpdfv_zoom_1:
101 * Zooming.
102 */
103 void
104 gtk_tpdfv_zoom_in(GtkWidget *widget);
105 void
106 gtk_tpdfv_zoom_out(GtkWidget *widget);
107 void
108 gtk_tpdfv_zoom_1(GtkWidget *widget);
109 void
110 gtk_tpdfv_zoom_width(GtkWidget *widget);
111 void
112 gtk_tpdfv_zoom_height(GtkWidget *widget);
113 void
114 gtk_tpdfv_zoom_fit(GtkWidget *widget);
116 /*
117 * gtk_tpdfv_scroll_up, gtk_tpdfv_scroll_down,
118 * gtk_tpdfv_scroll_left, gtk_tpdfv_scroll_right:
119 * Scrolling.
120 */
121 void
122 gtk_tpdfv_scroll_up(GtkWidget *widget);
123 void
124 gtk_tpdfv_scroll_down(GtkWidget *widget);
125 void
126 gtk_tpdfv_scroll_left(GtkWidget *widget);
127 void
128 gtk_tpdfv_scroll_right(GtkWidget *widget);
130 /*
131 * Screen handling.
132 */
134 struct gtk_tpdfv_screens;
135 typedef struct gtk_tpdfv_screens gtk_tpdfv_screens_t;
137 /*
138 * gtk_tpdfv_get_screens:
139 * Get a list of available screens.
140 */
141 gtk_tpdfv_screens_t *
142 gtk_tpdfv_screens_init(const gchar *display_name);
143 void
144 gtk_tpdfv_screens_destroy(gtk_tpdfv_screens_t *screens);
146 /*
147 * gtk_tpdfv_screens_number:
148 * Get the number of screens.
149 */
150 gint
151 gtk_tpdfv_screens_number(const gtk_tpdfv_screens_t *screens);
153 /*
154 * gtk_tpdfv_screens_window_set, gtk_tpdfv_screens_window_get:
155 * Set or get the screen of a window.
156 */
157 void
158 gtk_tpdfv_screens_window_set(const gtk_tpdfv_screens_t *screens,
159 GtkWindow *window, gint screen);
160 gint
161 gtk_tpdfv_screens_window_get(const gtk_tpdfv_screens_t *screens,
162 GtkWindow *window);
164 #ifdef __cplusplus
165 } /* extern "C" */
166 #endif
168 #endif /* ! GTK_TPDFV_H */
170 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */