sizerequest: Split out size request cache code into separate header

This commit is contained in:
Benjamin Otte 2012-11-13 13:41:05 +01:00
parent aa989a637a
commit 0a1a2ac148
5 changed files with 72 additions and 35 deletions

View File

@ -519,6 +519,7 @@ gtk_private_h_sources = \
gtkselectionprivate.h \
gtksettingsprivate.h \
gtksizegroup-private.h \
gtksizerequestcacheprivate.h \
gtksocketprivate.h \
gtkstyleanimationprivate.h \
gtkstylecascadeprivate.h \

View File

@ -27,6 +27,7 @@
#include "gtkintl.h"
#include "gtkprivate.h"
#include "gtksizegroup-private.h"
#include "gtksizerequestcacheprivate.h"
#include "gtkwidgetprivate.h"
#include "deprecated/gtkstyle.h"

View File

@ -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__ */

View File

@ -41,6 +41,7 @@
#include "gtkselectionprivate.h"
#include "gtksettingsprivate.h"
#include "gtksizegroup-private.h"
#include "gtksizerequestcacheprivate.h"
#include "gtkwidget.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"

View File

@ -31,41 +31,6 @@
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;
void _gtk_widget_set_visible_flag (GtkWidget *widget,
gboolean visible);
gboolean _gtk_widget_get_in_reparent (GtkWidget *widget);