GtkListTile *tile, *start;
GArray *heights;
int min_row_height, unknown_row_height, row_height, col_min, col_nat;
- GtkOrientation orientation, opposite_orientation;
+ GtkOrientation orientation;
GtkScrollablePolicy scroll_policy;
- GdkRectangle bounds;
- int x, y;
+ int y;
guint i;
orientation = gtk_list_base_get_orientation (GTK_LIST_BASE (self));
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), orientation);
- opposite_orientation = OPPOSITE_ORIENTATION (orientation);
min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
/* step 0: exit early if list is empty */
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
{
- gtk_list_base_update_adjustments (GTK_LIST_BASE (self), 0, 0, 0, 0, &x, &y);
+ gtk_list_base_allocate (GTK_LIST_BASE (self));
return;
}
}
}
- gtk_list_item_manager_get_tile_bounds (self->item_manager, &bounds);
-
- /* step 4: update the adjustments */
- gtk_list_base_update_adjustments (GTK_LIST_BASE (self),
- bounds.width,
- bounds.height,
- gtk_widget_get_size (widget, opposite_orientation),
- gtk_widget_get_size (widget, orientation),
- &x, &y);
-
- gtk_list_base_allocate_children (GTK_LIST_BASE (widget));
-
- gtk_list_base_allocate_rubberband (GTK_LIST_BASE (widget));
+ /* step 4: allocate the rest */
+ gtk_list_base_allocate (GTK_LIST_BASE (self));
}
static void
remove_autoscroll (self);
}
-/**
+/*
* gtk_list_base_size_allocate_child:
* @self: The listbase
* @child: The child
* but with the coordinates already offset by the scroll
* offset.
**/
-void
+static void
gtk_list_base_size_allocate_child (GtkListBase *self,
GtkWidget *child,
int x,
gtk_widget_size_allocate (child, &child_allocation, -1);
}
-void
+static void
gtk_list_base_allocate_children (GtkListBase *self)
{
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
return TRUE;
}
-void
+static void
gtk_list_base_allocate_rubberband (GtkListBase *self)
{
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
}
-static int
+static void
gtk_list_base_set_adjustment_values (GtkListBase *self,
GtkOrientation orientation,
int value,
g_signal_handlers_unblock_by_func (priv->adjustment[orientation],
gtk_list_base_adjustment_value_changed_cb,
self);
-
- return value;
}
-void
-gtk_list_base_update_adjustments (GtkListBase *self,
- int total_across,
- int total_along,
- int page_across,
- int page_along,
- int *across,
- int *along)
+static void
+gtk_list_base_update_adjustments (GtkListBase *self)
{
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
+ GdkRectangle bounds;
int value_along, value_across, size;
+ int page_along, page_across;
guint pos;
+ gtk_list_item_manager_get_tile_bounds (priv->item_manager, &bounds);
+ g_assert (bounds.x == 0);
+ g_assert (bounds.y == 0);
+
+ page_across = gtk_widget_get_size (GTK_WIDGET (self), OPPOSITE_ORIENTATION (priv->orientation));
+ page_along = gtk_widget_get_size (GTK_WIDGET (self), priv->orientation);
+
pos = gtk_list_item_tracker_get_position (priv->item_manager, priv->anchor);
if (pos == GTK_INVALID_LIST_POSITION)
{
}
}
- *across = gtk_list_base_set_adjustment_values (self,
- OPPOSITE_ORIENTATION (priv->orientation),
- value_across,
- total_across,
- page_across);
- *along = gtk_list_base_set_adjustment_values (self,
- priv->orientation,
- value_along,
- total_along,
- page_along);
+ gtk_list_base_set_adjustment_values (self,
+ OPPOSITE_ORIENTATION (priv->orientation),
+ value_across,
+ bounds.width,
+ page_across);
+ gtk_list_base_set_adjustment_values (self,
+ priv->orientation,
+ value_along,
+ bounds.height,
+ page_along);
+}
+
+void
+gtk_list_base_allocate (GtkListBase *self)
+{
+ gtk_list_base_update_adjustments (self);
+
+ gtk_list_base_allocate_children (self);
+ gtk_list_base_allocate_rubberband (self);
}
GtkScrollablePolicy
GtkSelectionModel * gtk_list_base_get_model (GtkListBase *self);
gboolean gtk_list_base_set_model (GtkListBase *self,
GtkSelectionModel *model);
-void gtk_list_base_update_adjustments (GtkListBase *self,
- int total_across,
- int total_along,
- int page_across,
- int page_along,
- int *across,
- int *along);
guint gtk_list_base_get_anchor (GtkListBase *self);
void gtk_list_base_set_anchor (GtkListBase *self,
void gtk_list_base_set_enable_rubberband (GtkListBase *self,
gboolean enable);
gboolean gtk_list_base_get_enable_rubberband (GtkListBase *self);
-void gtk_list_base_allocate_rubberband (GtkListBase *self);
-void gtk_list_base_allocate_children (GtkListBase *self);
-void gtk_list_base_size_allocate_child (GtkListBase *self,
- GtkWidget *child,
- int x,
- int y,
- int width,
- int height);
+void gtk_list_base_allocate (GtkListBase *self);
#endif /* __GTK_LIST_BASE_PRIVATE_H__ */
GtkListView *self = GTK_LIST_VIEW (widget);
GtkListTile *tile;
GArray *heights;
- int min, nat, row_height;
- int x, y;
+ int min, nat, row_height, y;
GtkOrientation orientation, opposite_orientation;
GtkScrollablePolicy scroll_policy, opposite_scroll_policy;
/* step 0: exit early if list is empty */
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
{
- gtk_list_base_update_adjustments (GTK_LIST_BASE (self), 0, 0, 0, 0, &x, &y);
+ gtk_list_base_allocate (GTK_LIST_BASE (self));
return;
}
y += tile->area.height;
}
- /* step 4: update the adjustments */
- gtk_list_base_update_adjustments (GTK_LIST_BASE (self),
- self->list_width,
- gtk_list_view_get_list_height (self),
- gtk_widget_get_size (widget, opposite_orientation),
- gtk_widget_get_size (widget, orientation),
- &x, &y);
-
- gtk_list_base_allocate_children (GTK_LIST_BASE (self));
- gtk_list_base_allocate_rubberband (GTK_LIST_BASE (self));
+ /* step 4: allocate the rest */
+ gtk_list_base_allocate (GTK_LIST_BASE (self));
}
static void