]> Pileus Git - ~andy/gtk/blob - gtk/gtkwidgetprivate.h
Reduce memory consumption of the size request cache.
[~andy/gtk] / gtk / gtkwidgetprivate.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 Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser 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
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #ifndef __GTK_WIDGET_PRIVATE_H__
28 #define __GTK_WIDGET_PRIVATE_H__
29
30 G_BEGIN_DECLS
31
32 /* With GtkWidget, a widget may be requested
33  * its width for 2 or maximum 3 heights in one resize
34  * (Note this define is limited by the bitfield sizes
35  * defined on the SizeRequestCache structure).
36  */
37 #define GTK_SIZE_REQUEST_CACHED_SIZES   (2)
38
39 typedef struct {
40   gint minimum_size;
41   gint natural_size;
42 } CachedSize;
43
44 typedef struct
45 {
46   /* the size this request is for */
47   gint       for_size;
48   CachedSize cached_size;
49 } SizeRequest;
50
51 typedef struct {
52   SizeRequest widths[GTK_SIZE_REQUEST_CACHED_SIZES];
53   SizeRequest heights[GTK_SIZE_REQUEST_CACHED_SIZES];
54
55   guint       cached_widths      : 2;
56   guint       cached_heights     : 2;
57   guint       last_cached_width  : 2;
58   guint       last_cached_height : 2;
59 } ContextualSizes;
60
61 typedef struct {
62   ContextualSizes *sizes;
63
64   CachedSize cached_width;
65   CachedSize cached_height;
66 } SizeRequestCache;
67
68 void         _gtk_widget_set_visible_flag   (GtkWidget *widget,
69                                              gboolean   visible);
70 gboolean     _gtk_widget_get_resize_pending (GtkWidget *widget);
71 void         _gtk_widget_set_resize_pending (GtkWidget *widget,
72                                              gboolean   resize_pending);
73 gboolean     _gtk_widget_get_in_reparent    (GtkWidget *widget);
74 void         _gtk_widget_set_in_reparent    (GtkWidget *widget,
75                                              gboolean   in_reparent);
76 gboolean     _gtk_widget_get_anchored       (GtkWidget *widget);
77 void         _gtk_widget_set_anchored       (GtkWidget *widget,
78                                              gboolean   anchored);
79 gboolean     _gtk_widget_get_shadowed       (GtkWidget *widget);
80 void         _gtk_widget_set_shadowed       (GtkWidget *widget,
81                                              gboolean   shadowed);
82 gboolean     _gtk_widget_get_alloc_needed   (GtkWidget *widget);
83 void         _gtk_widget_set_alloc_needed   (GtkWidget *widget,
84                                              gboolean   alloc_needed);
85 gboolean     _gtk_widget_get_width_request_needed  (GtkWidget *widget);
86 void         _gtk_widget_set_width_request_needed  (GtkWidget *widget,
87                                                     gboolean   width_request_needed);
88 gboolean     _gtk_widget_get_height_request_needed (GtkWidget *widget);
89 void         _gtk_widget_set_height_request_needed (GtkWidget *widget,
90                                                     gboolean   height_request_needed);
91
92 gboolean     _gtk_widget_get_sizegroup_visited (GtkWidget    *widget);
93 void         _gtk_widget_set_sizegroup_visited (GtkWidget    *widget,
94                                                 gboolean      visited);
95 gboolean     _gtk_widget_get_sizegroup_bumping (GtkWidget    *widget);
96 void         _gtk_widget_set_sizegroup_bumping (GtkWidget    *widget,
97                                                 gboolean      bumping);
98 void         _gtk_widget_add_sizegroup         (GtkWidget    *widget,
99                                                 gpointer      group);
100 void         _gtk_widget_remove_sizegroup      (GtkWidget    *widget,
101                                                 gpointer      group);
102 GSList      *_gtk_widget_get_sizegroups        (GtkWidget    *widget);
103
104 void _gtk_widget_override_size_request (GtkWidget *widget,
105                                         int        width,
106                                         int        height,
107                                         int       *old_width,
108                                         int       *old_height);
109 void _gtk_widget_restore_size_request  (GtkWidget *widget,
110                                         int        old_width,
111                                         int        old_height);
112
113 gboolean _gtk_widget_get_translation_to_window (GtkWidget      *widget,
114                                                 GdkWindow      *window,
115                                                 int            *x,
116                                                 int            *y);
117
118 G_END_DECLS
119
120 #endif /* __GTK_WIDGET_PRIVATE_H__ */