1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * gimpview.h
5  * Copyright (C) 2001-2006 Michael Natterer <mitch@gimp.org>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __GIMP_VIEW_H__
22 #define __GIMP_VIEW_H__
23 
24 
25 #define GIMP_TYPE_VIEW            (gimp_view_get_type ())
26 #define GIMP_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_VIEW, GimpView))
27 #define GIMP_VIEW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_VIEW, GimpViewClass))
28 #define GIMP_IS_VIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_VIEW))
29 #define GIMP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_VIEW))
30 #define GIMP_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_VIEW, GimpViewClass))
31 
32 
33 typedef struct _GimpViewClass  GimpViewClass;
34 
35 struct _GimpView
36 {
37   GtkWidget         parent_instance;
38 
39   GdkWindow        *event_window;
40 
41   GimpViewable     *viewable;
42   GimpViewRenderer *renderer;
43 
44   guint             clickable : 1;
45   guint             eat_button_events : 1;
46   guint             show_popup : 1;
47   guint             expand : 1;
48 
49   /*< private >*/
50   guint             in_button : 1;
51   guint             has_grab : 1;
52   GdkModifierType   press_state;
53 };
54 
55 struct _GimpViewClass
56 {
57   GtkWidgetClass  parent_class;
58 
59   /*  signals  */
60   void        (* set_viewable)   (GimpView        *view,
61                                   GimpViewable    *old_viewable,
62                                   GimpViewable    *new_viewable);
63   void        (* clicked)        (GimpView        *view,
64                                   GdkModifierType  modifier_state);
65   void        (* double_clicked) (GimpView        *view);
66   void        (* context)        (GimpView        *view);
67 };
68 
69 
70 GType          gimp_view_get_type          (void) G_GNUC_CONST;
71 
72 GtkWidget    * gimp_view_new               (GimpContext   *context,
73                                             GimpViewable  *viewable,
74                                             gint           size,
75                                             gint           border_width,
76                                             gboolean       is_popup);
77 GtkWidget    * gimp_view_new_full          (GimpContext   *context,
78                                             GimpViewable  *viewable,
79                                             gint           width,
80                                             gint           height,
81                                             gint           border_width,
82                                             gboolean       is_popup,
83                                             gboolean       clickable,
84                                             gboolean       show_popup);
85 GtkWidget    * gimp_view_new_by_types      (GimpContext   *context,
86                                             GType          view_type,
87                                             GType          viewable_type,
88                                             gint           size,
89                                             gint           border_width,
90                                             gboolean       is_popup);
91 GtkWidget    * gimp_view_new_full_by_types (GimpContext   *context,
92                                             GType          view_type,
93                                             GType          viewable_type,
94                                             gint           width,
95                                             gint           height,
96                                             gint           border_width,
97                                             gboolean       is_popup,
98                                             gboolean       clickable,
99                                             gboolean       show_popup);
100 
101 GimpViewable * gimp_view_get_viewable      (GimpView      *view);
102 void           gimp_view_set_viewable      (GimpView      *view,
103                                             GimpViewable  *viewable);
104 void           gimp_view_set_expand        (GimpView      *view,
105                                             gboolean       expand);
106 
107 
108 #endif /* __GIMP_VIEW_H__ */
109