gtk/gtk/gtksizerequest.h
Benjamin Otte d9c9259861 Move GtkSizeRequest into GtkWidget
It doesn't make sense to keep them separate as GtkSizeRequest requires a
GtkWidget and GtkWidget implements GtkSizeRequest, so you can never have
one without the other.
It also makes the code a lot easier because no casts are required when
calling functions.

Also, the names would translate to gtk_widget_get_width() and people
agreed that this would be a too generic name, so a "preferred" was added
to the names.

So this patch moves the functions:
gtk_size_request_get_request_mode() => gtk_widget_get_request_mode()
gtk_size_request_get_width() => gtk_widget_get_preferred_width()
gtk_size_request_get_height() => gtk_widget_get_preferred_height()
gtk_size_request_get_size() => gtk_widget_get_preferred_size()
gtk_size_request_get_width_for_height() =>
  gtk_widget_get_preferred_width_for_height()
gtk_size_request_get_height_for_width() =>
  gtk_widget_get_preferred_height_for_width()
... and moves the corresponding vfuncs to the GtkWidgetClass.

The patch also renames the implementations of the vfuncs in widgets to
include the word "preferrred".
2010-09-26 15:11:45 +02:00

60 lines
2.0 KiB
C

/* GTK - The GIMP Toolkit
* Copyright (C) 2007-2010 Openismus GmbH
*
* Authors:
* Mathias Hasselmann <mathias@openismus.com>
* Tristan Van Berkom <tristan.van.berkom@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_SIZE_REQUEST_H__
#define __GTK_SIZE_REQUEST_H__
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
typedef struct _GtkRequestedSize GtkRequestedSize;
/**
* GtkRequestedSize:
* @data: A client pointer
* @minimum_size: The minimum size needed for allocation in a given orientation
* @natural_size: The natural size for allocation in a given orientation
*
* Represents a request of a screen object in a given orientation. These
* are primarily used in container implementations when allocating a natural
* size for children calling. See gtk_distribute_natural_allocation().
*/
struct _GtkRequestedSize
{
gpointer data;
gint minimum_size;
gint natural_size;
};
/* General convenience function to aid in allocating natural sizes */
gint gtk_distribute_natural_allocation (gint extra_space,
guint n_requested_sizes,
GtkRequestedSize *sizes);
G_END_DECLS
#endif /* __GTK_SIZE_REQUEST_H__ */