]> Pileus Git - ~andy/gtk/blob - gtk/gtklayout.h
Use floor() instead of truncating to integer values so we get translation
[~andy/gtk] / gtk / gtklayout.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * GtkLayout: Widget for scrolling of arbitrary-sized areas.
20  *
21  * Copyright Owen Taylor, 1998
22  */
23
24 #ifndef __GTK_LAYOUT_H
25 #define __GTK_LAYOUT_H
26
27 #include <gdk/gdk.h>
28 #include <gtk/gtkcontainer.h>
29 #include <gtk/gtkadjustment.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35 #define GTK_TYPE_LAYOUT            (gtk_layout_get_type ())
36 #define GTK_LAYOUT(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_LAYOUT, GtkLayout))
37 #define GTK_LAYOUT_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_LAYOUT, GtkLayoutClass))
38 #define GTK_IS_LAYOUT(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_LAYOUT))
39 #define GTK_IS_LAYOUT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LAYOUT))
40
41 typedef struct _GtkLayout        GtkLayout;
42 typedef struct _GtkLayoutClass   GtkLayoutClass;
43
44 struct _GtkLayout {
45   GtkContainer container;
46
47   GList *children;
48
49   guint width;
50   guint height;
51
52   guint xoffset;
53   guint yoffset;
54
55   GtkAdjustment *hadjustment;
56   GtkAdjustment *vadjustment;
57   
58   GdkWindow *bin_window;
59
60   GdkVisibilityState visibility;
61   gulong configure_serial;
62   gint scroll_x;
63   gint scroll_y;
64
65   guint freeze_count;
66
67   guint gravity_works : 1;
68 };
69
70 struct _GtkLayoutClass {
71   GtkContainerClass parent_class;
72
73   void  (*set_scroll_adjustments)   (GtkLayout      *layout,
74                                      GtkAdjustment  *hadjustment,
75                                      GtkAdjustment  *vadjustment);
76 };
77
78 GtkType        gtk_layout_get_type        (void);
79 GtkWidget*     gtk_layout_new             (GtkAdjustment *hadjustment,
80                                            GtkAdjustment *vadjustment);
81 void           gtk_layout_put             (GtkLayout     *layout, 
82                                            GtkWidget     *widget, 
83                                            gint           x, 
84                                            gint           y);
85   
86 void           gtk_layout_move            (GtkLayout     *layout, 
87                                            GtkWidget     *widget, 
88                                            gint           x, 
89                                            gint           y);
90   
91 void           gtk_layout_set_size        (GtkLayout     *layout, 
92                                            guint          width,
93                                            guint          height);
94
95 GtkAdjustment* gtk_layout_get_hadjustment (GtkLayout     *layout);
96 GtkAdjustment* gtk_layout_get_vadjustment (GtkLayout     *layout);
97 void           gtk_layout_set_hadjustment (GtkLayout     *layout,
98                                            GtkAdjustment *adjustment);
99 void           gtk_layout_set_vadjustment (GtkLayout     *layout,
100                                            GtkAdjustment *adjustment);
101
102 /* These disable and enable moving and repainting the scrolling window
103  * of the GtkLayout, respectively.  If you want to update the layout's
104  * offsets but do not want it to repaint itself, you should use these
105  * functions.
106  *
107  * - I don't understand these are supposed to work, so I suspect
108  * - they don't now.                    OWT 1/20/98
109  */
110 void           gtk_layout_freeze          (GtkLayout     *layout);
111 void           gtk_layout_thaw            (GtkLayout     *layout);
112
113 #ifdef __cplusplus
114 }
115 #endif /* __cplusplus */
116
117 #endif /* __GTK_LAYOUT_H */