1 /*
2  * Copyright © 2009-2018 Siyan Panayotov <contact@siyanpanayotov.com>
3  *
4  * Based on code by (see README for details):
5  * - Björn Lindqvist <bjourne@gmail.com>
6  *
7  * This file is part of Viewnior.
8  *
9  * Viewnior is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * Viewnior is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Viewnior.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef __UNI_SCROLL_WIN_H__
24 #define __UNI_SCROLL_WIN_H__
25 /**
26  * UniScrollWin is a class that implements a type of
27  * GtkScrolledWindow which is more integrated with UniImageView.
28  **/
29 
30 #include <gdk/gdk.h>
31 #include <gtk/gtk.h>
32 
33 #include "uni-nav.h"
34 
35 G_BEGIN_DECLS
36 #define UNI_TYPE_SCROLL_WIN                 (uni_scroll_win_get_type ())
37 #define UNI_SCROLL_WIN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNI_TYPE_SCROLL_WIN, UniScrollWin))
38 #define UNI_SCROLL_WIN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), UNI_TYPE_SCROLL_WIN, UniScrollWinClass))
39 #define UNI_IS_SCROLL_WIN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNI_TYPE_SCROLL_WIN))
40 #define UNI_IS_SCROLL_WIN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), UNI_TYPE_SCROLL_WIN))
41 #define UNI_SCROLL_WIN_GET_CLASS(obj)       (G_TYPE_CHECK_INSTANCE_GET_CLASS ((obj), UNI_TYPE_SCROLL_WIN, UniScrollWinClass))
42 
43 typedef struct _UniScrollWin UniScrollWin;
44 typedef struct _UniScrollWinClass UniScrollWinClass;
45 
46 struct _UniScrollWin {
47     GtkTable parent;
48 
49     GtkWidget *hscroll;
50     GtkWidget *vscroll;
51     GtkWidget *nav_box;
52     GtkWidget *nav;
53 
54     /* The GtkImage that shows the nav_button icon. */
55     GtkWidget *nav_image;
56 
57     /* The normal and the highlighted nav_button pixbuf. */
58     GdkPixbuf *nav_button;
59 
60     gboolean show_scrollbar;
61 };
62 
63 struct _UniScrollWinClass {
64     GtkTableClass parent_class;
65 };
66 
67 GType       uni_scroll_win_get_type (void) G_GNUC_CONST;
68 
69 /* Constructors */
70 GtkWidget*   uni_scroll_win_new     (UniImageView * view);
71 
72 gboolean uni_scroll_win_image_fits         (UniScrollWin * window);
73 void     uni_scroll_win_set_show_scrollbar (UniScrollWin * window, gboolean show);
74 
75 G_END_DECLS
76 #endif /* __UNI_SCROLL_WIN_H__ */
77