* 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.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkintl.h"
#include "gtkcellareabox.h"
-#include "gtkcellareaboxcontext.h"
+#include "gtkcellareaboxcontextprivate.h"
#include "gtkorientable.h"
/* GObjectClass */
-static void gtk_cell_area_box_context_finalize (GObject *object);
+static void _gtk_cell_area_box_context_finalize (GObject *object);
/* GtkCellAreaContextClass */
-static void gtk_cell_area_box_context_reset (GtkCellAreaContext *context);
-static void gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *context,
+static void _gtk_cell_area_box_context_reset (GtkCellAreaContext *context);
+static void _gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *context,
gint width,
gint *minimum_height,
gint *natural_height);
-static void gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *context,
+static void _gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *context,
gint height,
gint *minimum_width,
gint *natural_width);
/* Internal functions */
-static void gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context,
+static void _gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context,
GtkOrientation orientation,
gint for_size,
gint *minimum_size,
gboolean *align;
};
-G_DEFINE_TYPE (GtkCellAreaBoxContext, gtk_cell_area_box_context, GTK_TYPE_CELL_AREA_CONTEXT);
+G_DEFINE_TYPE (GtkCellAreaBoxContext, _gtk_cell_area_box_context, GTK_TYPE_CELL_AREA_CONTEXT);
static void
free_cache_array (GArray *array)
}
static void
-gtk_cell_area_box_context_init (GtkCellAreaBoxContext *box_context)
+_gtk_cell_area_box_context_init (GtkCellAreaBoxContext *box_context)
{
GtkCellAreaBoxContextPrivate *priv;
}
static void
-gtk_cell_area_box_context_class_init (GtkCellAreaBoxContextClass *class)
+_gtk_cell_area_box_context_class_init (GtkCellAreaBoxContextClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkCellAreaContextClass *context_class = GTK_CELL_AREA_CONTEXT_CLASS (class);
/* GObjectClass */
- object_class->finalize = gtk_cell_area_box_context_finalize;
+ object_class->finalize = _gtk_cell_area_box_context_finalize;
- context_class->reset = gtk_cell_area_box_context_reset;
- context_class->get_preferred_height_for_width = gtk_cell_area_box_context_get_preferred_height_for_width;
- context_class->get_preferred_width_for_height = gtk_cell_area_box_context_get_preferred_width_for_height;
+ context_class->reset = _gtk_cell_area_box_context_reset;
+ context_class->get_preferred_height_for_width = _gtk_cell_area_box_context_get_preferred_height_for_width;
+ context_class->get_preferred_width_for_height = _gtk_cell_area_box_context_get_preferred_width_for_height;
g_type_class_add_private (object_class, sizeof (GtkCellAreaBoxContextPrivate));
}
* GObjectClass *
*************************************************************/
static void
-gtk_cell_area_box_context_finalize (GObject *object)
+_gtk_cell_area_box_context_finalize (GObject *object)
{
GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (object);
GtkCellAreaBoxContextPrivate *priv = box_context->priv;
g_free (priv->expand);
g_free (priv->align);
- G_OBJECT_CLASS (gtk_cell_area_box_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (_gtk_cell_area_box_context_parent_class)->finalize (object);
}
/*************************************************************
* GtkCellAreaContextClass *
*************************************************************/
static void
-gtk_cell_area_box_context_reset (GtkCellAreaContext *context)
+_gtk_cell_area_box_context_reset (GtkCellAreaContext *context)
{
GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context);
GtkCellAreaBoxContextPrivate *priv = box_context->priv;
g_hash_table_remove_all (priv->heights);
GTK_CELL_AREA_CONTEXT_CLASS
- (gtk_cell_area_box_context_parent_class)->reset (context);
+ (_gtk_cell_area_box_context_parent_class)->reset (context);
}
static void
-gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context,
+_gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context,
GtkOrientation orientation,
gint for_size,
gint *minimum_size,
for (i = array->len - 1; i >= 0; i--)
{
if (priv->align[i] &&
- _gtk_cell_area_box_group_visible (area, i))
- break;
+ _gtk_cell_area_box_group_visible (area, i))
+ break;
}
last_aligned_group_idx = i >= 0 ? i : 0;
if (box_orientation == orientation)
{
- if (i > last_aligned_group_idx &&
- !_gtk_cell_area_box_group_visible (area, i))
- continue;
+ if (i > last_aligned_group_idx &&
+ !_gtk_cell_area_box_group_visible (area, i))
+ continue;
/* Dont add spacing for 0 size groups, they can be 0 size because
* they contain only invisible cells for this round of requests
}
static void
-gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *context,
+_gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *context,
gint width,
gint *minimum_height,
gint *natural_height)
{
- gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_VERTICAL,
+ _gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_VERTICAL,
width, minimum_height, natural_height);
}
static void
-gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *context,
+_gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *context,
gint height,
gint *minimum_width,
gint *natural_width)
{
- gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_HORIZONTAL,
+ _gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_HORIZONTAL,
height, minimum_width, natural_width);
}
}
GtkCellAreaBoxContext *
-gtk_cell_area_box_context_copy (GtkCellAreaBox *box,
+_gtk_cell_area_box_context_copy (GtkCellAreaBox *box,
GtkCellAreaBoxContext *context)
{
GtkCellAreaBoxContext *copy;
copy = g_object_new (GTK_TYPE_CELL_AREA_BOX_CONTEXT,
"area", box, NULL);
- gtk_cell_area_box_init_groups (copy,
- context->priv->base_widths->len,
- context->priv->expand,
- context->priv->align);
+ _gtk_cell_area_box_init_groups (copy,
+ context->priv->base_widths->len,
+ context->priv->expand,
+ context->priv->align);
/* Copy the base arrays */
copy_size_array (context->priv->base_widths,
}
void
-gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context,
- guint n_groups,
- gboolean *expand_groups,
- gboolean *align_groups)
+_gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context,
+ guint n_groups,
+ gboolean *expand_groups,
+ gboolean *align_groups)
{
GtkCellAreaBoxContextPrivate *priv;
}
void
-gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint minimum_width,
gint natural_width)
}
if (grew)
- gtk_cell_area_box_context_sum (box_context, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL);
+ _gtk_cell_area_box_context_sum (box_context, GTK_ORIENTATION_HORIZONTAL, -1, NULL, NULL);
}
void
-gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_width,
gint minimum_height,
}
void
-gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint minimum_height,
gint natural_height)
}
if (grew)
- gtk_cell_area_box_context_sum (box_context, GTK_ORIENTATION_VERTICAL, -1, NULL, NULL);
+ _gtk_cell_area_box_context_sum (box_context, GTK_ORIENTATION_VERTICAL, -1, NULL, NULL);
}
void
-gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_height,
gint minimum_width,
}
void
-gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint *minimum_width,
gint *natural_width)
}
void
-gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_width,
gint *minimum_height,
}
void
-gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint *minimum_height,
gint *natural_height)
}
void
-gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context,
gint group_idx,
gint for_height,
gint *minimum_width,
}
static GtkRequestedSize *
-gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context,
- GtkCellAreaBox *area,
+_gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context,
+ GtkCellAreaBox *area,
GtkOrientation orientation,
gint for_size,
gint *n_requests)
for (i = priv->base_widths->len - 1; i >= 0; i--)
{
if (priv->align[i] &&
- _gtk_cell_area_box_group_visible (area, i))
- break;
+ _gtk_cell_area_box_group_visible (area, i))
+ break;
}
last_aligned_group_idx = i >= 0 ? i : 0;
size = &g_array_index (array, CachedSize, i);
if (size->nat_size > 0 &&
- (i <= last_aligned_group_idx ||
- _gtk_cell_area_box_group_visible (area, i)))
- visible_groups++;
+ (i <= last_aligned_group_idx ||
+ _gtk_cell_area_box_group_visible (area, i)))
+ visible_groups++;
}
requests = g_new (GtkRequestedSize, visible_groups);
size = &g_array_index (array, CachedSize, i);
if (size->nat_size > 0 &&
- (i <= last_aligned_group_idx ||
- _gtk_cell_area_box_group_visible (area, i)))
+ (i <= last_aligned_group_idx ||
+ _gtk_cell_area_box_group_visible (area, i)))
{
requests[j].data = GINT_TO_POINTER (i);
requests[j].minimum_size = size->min_size;
static GtkCellAreaBoxAllocation *
allocate_for_orientation (GtkCellAreaBoxContext *context,
- GtkCellAreaBox *area,
+ GtkCellAreaBox *area,
GtkOrientation orientation,
gint spacing,
gint size,
GtkCellAreaBoxContextPrivate *priv = context->priv;
GtkCellAreaBoxAllocation *allocs;
GtkRequestedSize *sizes;
- GArray *array;
gint n_expand_groups = 0;
gint i, n_groups, position, vis_position;
gint extra_size, extra_extra;
gint avail_size = size;
- sizes = gtk_cell_area_box_context_get_requests (context, area, orientation, for_size, &n_groups);
- array = get_array (context, orientation, for_size);
+ sizes = _gtk_cell_area_box_context_get_requests (context, area, orientation, for_size, &n_groups);
n_expand_groups = count_expand_groups (context);
/* First start by naturally allocating space among groups */
allocs[i].group_idx = GPOINTER_TO_INT (sizes[i].data);
if (priv->align[allocs[i].group_idx])
- vis_position = position;
+ vis_position = position;
allocs[i].position = vis_position;
allocs[i].size = sizes[i].minimum_size;
position += spacing;
if (_gtk_cell_area_box_group_visible (area, allocs[i].group_idx))
- {
- vis_position += allocs[i].size;
- vis_position += spacing;
- }
+ {
+ vis_position += allocs[i].size;
+ vis_position += spacing;
+ }
}
if (n_allocs)
}
GtkRequestedSize *
-gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context,
gint *n_widths)
{
GtkCellAreaBox *area = (GtkCellAreaBox *)gtk_cell_area_context_get_area (GTK_CELL_AREA_CONTEXT (box_context));
- return gtk_cell_area_box_context_get_requests (box_context, area, GTK_ORIENTATION_HORIZONTAL, -1, n_widths);
+ return _gtk_cell_area_box_context_get_requests (box_context, area, GTK_ORIENTATION_HORIZONTAL, -1, n_widths);
}
GtkRequestedSize *
-gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context,
+_gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context,
gint *n_heights)
{
GtkCellAreaBox *area = (GtkCellAreaBox *)gtk_cell_area_context_get_area (GTK_CELL_AREA_CONTEXT (box_context));
- return gtk_cell_area_box_context_get_requests (box_context, area, GTK_ORIENTATION_VERTICAL, -1, n_heights);
+ return _gtk_cell_area_box_context_get_requests (box_context, area, GTK_ORIENTATION_VERTICAL, -1, n_heights);
}
GtkCellAreaBoxAllocation *
-gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *context,
+_gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *context,
gint *n_allocs)
{
GtkCellAreaContext *ctx = GTK_CELL_AREA_CONTEXT (context);
if (orientation == GTK_ORIENTATION_HORIZONTAL && width > 0)
allocs = allocate_for_orientation (context, area, orientation,
- spacing, width, height,
- &alloc_count);
+ spacing, width, height,
+ &alloc_count);
else if (orientation == GTK_ORIENTATION_VERTICAL && height > 0)
allocs = allocate_for_orientation (context, area, orientation,
- spacing, height, width,
- &alloc_count);
+ spacing, height, width,
+ &alloc_count);
*n_allocs = alloc_count;