]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtksizerequestcacheprivate.h
sizerequest: Split out size request cache code into separate header
[~andy/gtk] / gtk / gtksizerequestcacheprivate.h
diff --git a/gtk/gtksizerequestcacheprivate.h b/gtk/gtksizerequestcacheprivate.h
new file mode 100644 (file)
index 0000000..143d2b0
--- /dev/null
@@ -0,0 +1,69 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_SIZE_REQUEST_CACHE_PRIVATE_H__
+#define __GTK_SIZE_REQUEST_CACHE_PRIVATE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* Cache as many ranges of height-for-width
+ * (or width-for-height) as can be rational
+ * for a said widget to have, if a label can
+ * only wrap to 3 lines, only 3 caches will
+ * ever be allocated for it.
+ */
+#define GTK_SIZE_REQUEST_CACHED_SIZES   (5)
+
+typedef struct {
+  gint minimum_size;
+  gint natural_size;
+} CachedSize;
+
+typedef struct
+{
+  gint       lower_for_size; /* The minimum for_size with the same result */
+  gint       upper_for_size; /* The maximum for_size with the same result */
+  CachedSize cached_size;
+} SizeRequest;
+
+typedef struct {
+  SizeRequest **widths;
+  SizeRequest **heights;
+
+  CachedSize  cached_width;
+  CachedSize  cached_height;
+
+  guint       cached_widths      : 3;
+  guint       cached_heights     : 3;
+  guint       last_cached_width  : 3;
+  guint       last_cached_height : 3;
+  guint       cached_base_width  : 1;
+  guint       cached_base_height : 1;
+} SizeRequestCache;
+
+G_END_DECLS
+
+#endif /* __GTK_SIZE_REQUEST_CACHE_PRIVATE_H__ */