Code

tpdfv-ctl: Added controller module used to manage multiple GtkTPDFV widgets.
[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 GType
54 gtk_tpdfv_get_type(void);
56 typedef struct {
57         GtkDrawingArea graph;
58 } GtkTPDFV;
60 typedef struct {
61         GtkDrawingAreaClass parent_class;
62 } GtkTPDFVClass;
64 /*
65  * gtk_tpdfv_new:
66  * Creates a new GtkTPDFV widget to display the specified PDF file.
67  */
68 GtkWidget *
69 gtk_tpdfv_new(const char *filename);
71 /*
72  * gtk_tpdfv_reload:
73  * Reload the previously opened PDF file.
74  */
75 void
76 gtk_tpdfv_reload(GtkWidget *widget);
78 /*
79  * gtk_tpdfv_get_n_pages, gtk_tpdfv_get_current_page:
80  * Get the total number of pages or the current page number.
81  */
82 int
83 gtk_tpdfv_get_n_pages(GtkWidget *widget);
84 int
85 gtk_tpdfv_get_current_page(GtkWidget *widget);
87 /*
88  * gtk_tpdfv_page_up, gtk_tpdfv_page_down,
89  * gtk_tpdfv_first_page, gtk_tpdfv_last_page,
90  * gtk_tpdfv_goto_page:
91  * Navigation (none of these functions will go beyond the first or last page).
92  */
93 void
94 gtk_tpdfv_page_up(GtkWidget *widget);
95 void
96 gtk_tpdfv_page_down(GtkWidget *widget);
97 void
98 gtk_tpdfv_first_page(GtkWidget *widget);
99 void
100 gtk_tpdfv_last_page(GtkWidget *widget);
101 void
102 gtk_tpdfv_goto_page(GtkWidget *widget, int page);
104 /*
105  * gtk_tpdfv_zoom_in, gtk_tpdfv_zoom_out,
106  * gtk_tpdfv_zoom_1:
107  * Zooming.
108  */
109 void
110 gtk_tpdfv_zoom_in(GtkWidget *widget);
111 void
112 gtk_tpdfv_zoom_out(GtkWidget *widget);
113 void
114 gtk_tpdfv_zoom_1(GtkWidget *widget);
115 void
116 gtk_tpdfv_zoom_width(GtkWidget *widget);
117 void
118 gtk_tpdfv_zoom_height(GtkWidget *widget);
119 void
120 gtk_tpdfv_zoom_fit(GtkWidget *widget);
122 /*
123  * gtk_tpdfv_scroll_up, gtk_tpdfv_scroll_down,
124  * gtk_tpdfv_scroll_left, gtk_tpdfv_scroll_right:
125  * Scrolling.
126  */
127 void
128 gtk_tpdfv_scroll_up(GtkWidget *widget);
129 void
130 gtk_tpdfv_scroll_down(GtkWidget *widget);
131 void
132 gtk_tpdfv_scroll_left(GtkWidget *widget);
133 void
134 gtk_tpdfv_scroll_right(GtkWidget *widget);
136 /*
137  * Screen handling.
138  */
140 struct gtk_tpdfv_screens;
141 typedef struct gtk_tpdfv_screens gtk_tpdfv_screens_t;
143 /*
144  * gtk_tpdfv_get_screens:
145  * Get a list of available screens.
146  */
147 gtk_tpdfv_screens_t *
148 gtk_tpdfv_screens_init(const gchar *display_name);
149 void
150 gtk_tpdfv_screens_destroy(gtk_tpdfv_screens_t *screens);
152 /*
153  * gtk_tpdfv_screens_number:
154  * Get the number of screens.
155  */
156 gint
157 gtk_tpdfv_screens_number(const gtk_tpdfv_screens_t *screens);
159 /*
160  * gtk_tpdfv_screens_window_set, gtk_tpdfv_screens_window_get:
161  * Set or get the screen of a window.
162  */
163 void
164 gtk_tpdfv_screens_window_set(const gtk_tpdfv_screens_t *screens,
165                 GtkWindow *window, gint screen);
166 gint
167 gtk_tpdfv_screens_window_get(const gtk_tpdfv_screens_t *screens,
168                 GtkWindow *window);
170 #ifdef __cplusplus
171 } /* extern "C" */
172 #endif
174 #endif /* ! GTK_TPDFV_H */
176 /* vim: set tw=78 sw=4 ts=4 noexpandtab : */