forked from AuroraMiddleware/gtk
listbase: Move orientable implementation here
This commit is contained in:
parent
9d6aa7d88e
commit
2541037ec2
@ -26,10 +26,8 @@
|
|||||||
#include "gtklistitemfactory.h"
|
#include "gtklistitemfactory.h"
|
||||||
#include "gtklistitemmanagerprivate.h"
|
#include "gtklistitemmanagerprivate.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkorientableprivate.h"
|
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtksingleselection.h"
|
#include "gtksingleselection.h"
|
||||||
#include "gtktypebuiltins.h"
|
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
/* Maximum number of list items created by the gridview.
|
/* Maximum number of list items created by the gridview.
|
||||||
@ -61,7 +59,6 @@ struct _GtkGridView
|
|||||||
|
|
||||||
GListModel *model;
|
GListModel *model;
|
||||||
GtkListItemManager *item_manager;
|
GtkListItemManager *item_manager;
|
||||||
GtkOrientation orientation;
|
|
||||||
guint min_columns;
|
guint min_columns;
|
||||||
guint max_columns;
|
guint max_columns;
|
||||||
/* set in size_allocate */
|
/* set in size_allocate */
|
||||||
@ -102,7 +99,6 @@ enum
|
|||||||
PROP_MAX_COLUMNS,
|
PROP_MAX_COLUMNS,
|
||||||
PROP_MIN_COLUMNS,
|
PROP_MIN_COLUMNS,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_ORIENTATION,
|
|
||||||
|
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -112,8 +108,7 @@ enum {
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkGridView, gtk_grid_view, GTK_TYPE_LIST_BASE,
|
G_DEFINE_TYPE (GtkGridView, gtk_grid_view, GTK_TYPE_LIST_BASE)
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
|
||||||
|
|
||||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
@ -479,7 +474,7 @@ gtk_grid_view_adjustment_value_changed (GtkListBase *base,
|
|||||||
anchor_pos = gtk_list_item_tracker_get_position (self->item_manager, self->anchor);
|
anchor_pos = gtk_list_item_tracker_get_position (self->item_manager, self->anchor);
|
||||||
n_items = g_list_model_get_n_items (self->model);
|
n_items = g_list_model_get_n_items (self->model);
|
||||||
|
|
||||||
if (orientation == self->orientation)
|
if (orientation == gtk_list_base_get_orientation (GTK_LIST_BASE (self)))
|
||||||
{
|
{
|
||||||
/* Compute how far down we've scrolled. That's the height
|
/* Compute how far down we've scrolled. That's the height
|
||||||
* we want to align to. */
|
* we want to align to. */
|
||||||
@ -577,7 +572,7 @@ gtk_grid_view_adjustment_value_changed (GtkListBase *base,
|
|||||||
* to fill the row.
|
* to fill the row.
|
||||||
* Do it the hard way then... */
|
* Do it the hard way then... */
|
||||||
gtk_list_base_get_adjustment_values (base,
|
gtk_list_base_get_adjustment_values (base,
|
||||||
OPPOSITE_ORIENTATION (self->orientation),
|
gtk_list_base_get_opposite_orientation (base),
|
||||||
&value, &total_size, &page_size);
|
&value, &total_size, &page_size);
|
||||||
|
|
||||||
pos = n_items - 1;
|
pos = n_items - 1;
|
||||||
@ -603,7 +598,7 @@ gtk_grid_view_update_adjustment (GtkGridView *self,
|
|||||||
|
|
||||||
page_size = gtk_widget_get_size (GTK_WIDGET (self), orientation);
|
page_size = gtk_widget_get_size (GTK_WIDGET (self), orientation);
|
||||||
|
|
||||||
if (self->orientation == orientation)
|
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == orientation)
|
||||||
{
|
{
|
||||||
Cell *cell;
|
Cell *cell;
|
||||||
CellAugment *aug;
|
CellAugment *aug;
|
||||||
@ -622,7 +617,7 @@ gtk_grid_view_update_adjustment (GtkGridView *self,
|
|||||||
value += cell_size;
|
value += cell_size;
|
||||||
|
|
||||||
value = gtk_list_base_set_adjustment_values (GTK_LIST_BASE (self),
|
value = gtk_list_base_set_adjustment_values (GTK_LIST_BASE (self),
|
||||||
self->orientation,
|
orientation,
|
||||||
value - self->anchor_yalign * page_size,
|
value - self->anchor_yalign * page_size,
|
||||||
aug->size,
|
aug->size,
|
||||||
page_size);
|
page_size);
|
||||||
@ -638,7 +633,7 @@ gtk_grid_view_update_adjustment (GtkGridView *self,
|
|||||||
total_size = round (self->n_columns * self->column_width);
|
total_size = round (self->n_columns * self->column_width);
|
||||||
|
|
||||||
value = gtk_list_base_set_adjustment_values (GTK_LIST_BASE (self),
|
value = gtk_list_base_set_adjustment_values (GTK_LIST_BASE (self),
|
||||||
OPPOSITE_ORIENTATION (self->orientation),
|
orientation,
|
||||||
value - self->anchor_xalign * page_size,
|
value - self->anchor_xalign * page_size,
|
||||||
total_size,
|
total_size,
|
||||||
page_size);
|
page_size);
|
||||||
@ -677,7 +672,7 @@ gtk_grid_view_measure_column_size (GtkGridView *self,
|
|||||||
|
|
||||||
min = 0;
|
min = 0;
|
||||||
nat = 0;
|
nat = 0;
|
||||||
opposite = OPPOSITE_ORIENTATION (self->orientation);
|
opposite = gtk_list_base_get_opposite_orientation (GTK_LIST_BASE (self));
|
||||||
|
|
||||||
for (cell = gtk_list_item_manager_get_first (self->item_manager);
|
for (cell = gtk_list_item_manager_get_first (self->item_manager);
|
||||||
cell != NULL;
|
cell != NULL;
|
||||||
@ -721,7 +716,8 @@ gtk_grid_view_compute_n_columns (GtkGridView *self,
|
|||||||
guint n_columns;
|
guint n_columns;
|
||||||
|
|
||||||
/* rounding down is exactly what we want here, so int division works */
|
/* rounding down is exactly what we want here, so int division works */
|
||||||
if (gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), OPPOSITE_ORIENTATION (self->orientation)) == GTK_SCROLL_MINIMUM)
|
if (gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self),
|
||||||
|
gtk_list_base_get_opposite_orientation (GTK_LIST_BASE (self))) == GTK_SCROLL_MINIMUM)
|
||||||
n_columns = for_size / MAX (1, min);
|
n_columns = for_size / MAX (1, min);
|
||||||
else
|
else
|
||||||
n_columns = for_size / MAX (1, nat);
|
n_columns = for_size / MAX (1, nat);
|
||||||
@ -746,7 +742,7 @@ gtk_grid_view_measure_list (GtkWidget *widget,
|
|||||||
guint n_unknown, n_columns;
|
guint n_unknown, n_columns;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), self->orientation);
|
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), gtk_list_base_get_orientation (GTK_LIST_BASE (self)));
|
||||||
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
||||||
n_unknown = 0;
|
n_unknown = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
@ -766,7 +762,8 @@ gtk_grid_view_measure_list (GtkWidget *widget,
|
|||||||
if (cell->parent.widget)
|
if (cell->parent.widget)
|
||||||
{
|
{
|
||||||
gtk_widget_measure (cell->parent.widget,
|
gtk_widget_measure (cell->parent.widget,
|
||||||
self->orientation, column_size,
|
gtk_list_base_get_orientation (GTK_LIST_BASE (self)),
|
||||||
|
column_size,
|
||||||
&child_min, &child_nat, NULL, NULL);
|
&child_min, &child_nat, NULL, NULL);
|
||||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||||
row_height = MAX (row_height, child_min);
|
row_height = MAX (row_height, child_min);
|
||||||
@ -823,7 +820,7 @@ gtk_grid_view_measure (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkGridView *self = GTK_GRID_VIEW (widget);
|
GtkGridView *self = GTK_GRID_VIEW (widget);
|
||||||
|
|
||||||
if (orientation == self->orientation)
|
if (orientation == gtk_list_base_get_orientation (GTK_LIST_BASE (self)))
|
||||||
gtk_grid_view_measure_list (widget, for_size, minimum, natural);
|
gtk_grid_view_measure_list (widget, for_size, minimum, natural);
|
||||||
else
|
else
|
||||||
gtk_grid_view_measure_across (widget, for_size, minimum, natural);
|
gtk_grid_view_measure_across (widget, for_size, minimum, natural);
|
||||||
@ -850,7 +847,7 @@ gtk_grid_view_size_allocate_child (GtkGridView *self,
|
|||||||
{
|
{
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
|
|
||||||
if (self->orientation == GTK_ORIENTATION_VERTICAL)
|
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == GTK_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
child_allocation.x = x;
|
child_allocation.x = x;
|
||||||
child_allocation.y = y;
|
child_allocation.y = y;
|
||||||
@ -887,14 +884,15 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
Cell *cell, *start;
|
Cell *cell, *start;
|
||||||
GArray *heights;
|
GArray *heights;
|
||||||
int min_row_height, row_height, col_min, col_nat;
|
int min_row_height, row_height, col_min, col_nat;
|
||||||
GtkOrientation opposite_orientation;
|
GtkOrientation orientation, opposite_orientation;
|
||||||
GtkScrollablePolicy scroll_policy;
|
GtkScrollablePolicy scroll_policy;
|
||||||
gboolean known;
|
gboolean known;
|
||||||
int x, y;
|
int x, y;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), self->orientation);
|
orientation = gtk_list_base_get_orientation (GTK_LIST_BASE (self));
|
||||||
opposite_orientation = OPPOSITE_ORIENTATION (self->orientation);
|
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);
|
min_row_height = ceil ((double) height / GTK_GRID_VIEW_MAX_VISIBLE_ROWS);
|
||||||
|
|
||||||
/* step 0: exit early if list is empty */
|
/* step 0: exit early if list is empty */
|
||||||
@ -904,9 +902,9 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
/* step 1: determine width of the list */
|
/* step 1: determine width of the list */
|
||||||
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
||||||
self->n_columns = gtk_grid_view_compute_n_columns (self,
|
self->n_columns = gtk_grid_view_compute_n_columns (self,
|
||||||
self->orientation == GTK_ORIENTATION_VERTICAL ? width : height,
|
orientation == GTK_ORIENTATION_VERTICAL ? width : height,
|
||||||
col_min, col_nat);
|
col_min, col_nat);
|
||||||
self->column_width = (self->orientation == GTK_ORIENTATION_VERTICAL ? width : height) / self->n_columns;
|
self->column_width = (orientation == GTK_ORIENTATION_VERTICAL ? width : height) / self->n_columns;
|
||||||
self->column_width = MAX (self->column_width, col_min);
|
self->column_width = MAX (self->column_width, col_min);
|
||||||
|
|
||||||
/* step 2: determine height of known rows */
|
/* step 2: determine height of known rows */
|
||||||
@ -925,7 +923,8 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
if (cell->parent.widget)
|
if (cell->parent.widget)
|
||||||
{
|
{
|
||||||
int min, nat, size;
|
int min, nat, size;
|
||||||
gtk_widget_measure (cell->parent.widget, self->orientation,
|
gtk_widget_measure (cell->parent.widget,
|
||||||
|
gtk_list_base_get_orientation (GTK_LIST_BASE (self)),
|
||||||
self->column_width,
|
self->column_width,
|
||||||
&min, &nat, NULL, NULL);
|
&min, &nat, NULL, NULL);
|
||||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||||
@ -989,7 +988,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
/* step 4: update the adjustments */
|
/* step 4: update the adjustments */
|
||||||
x = - gtk_grid_view_update_adjustment (self, opposite_orientation);
|
x = - gtk_grid_view_update_adjustment (self, opposite_orientation);
|
||||||
y = - gtk_grid_view_update_adjustment (self, self->orientation);
|
y = - gtk_grid_view_update_adjustment (self, orientation);
|
||||||
|
|
||||||
/* step 5: run the size_allocate loop */
|
/* step 5: run the size_allocate loop */
|
||||||
x = -x;
|
x = -x;
|
||||||
@ -1096,10 +1095,6 @@ gtk_grid_view_get_property (GObject *object,
|
|||||||
g_value_set_object (value, self->model);
|
g_value_set_object (value, self->model);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ORIENTATION:
|
|
||||||
g_value_set_enum (value, self->orientation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1128,19 +1123,6 @@ gtk_grid_view_set_property (GObject *object,
|
|||||||
gtk_grid_view_set_min_columns (self, g_value_get_uint (value));
|
gtk_grid_view_set_min_columns (self, g_value_get_uint (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ORIENTATION:
|
|
||||||
{
|
|
||||||
GtkOrientation orientation = g_value_get_enum (value);
|
|
||||||
if (self->orientation != orientation)
|
|
||||||
{
|
|
||||||
self->orientation = orientation;
|
|
||||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (self));
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ORIENTATION]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_MODEL:
|
case PROP_MODEL:
|
||||||
gtk_grid_view_set_model (self, g_value_get_object (value));
|
gtk_grid_view_set_model (self, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
@ -1254,7 +1236,7 @@ gtk_grid_view_scroll_to_item (GtkWidget *widget,
|
|||||||
|
|
||||||
end += start;
|
end += start;
|
||||||
gtk_grid_view_compute_scroll_align (self,
|
gtk_grid_view_compute_scroll_align (self,
|
||||||
self->orientation,
|
gtk_list_base_get_orientation (GTK_LIST_BASE (self)),
|
||||||
start, end,
|
start, end,
|
||||||
self->anchor_yalign, self->anchor_ystart,
|
self->anchor_yalign, self->anchor_ystart,
|
||||||
&yalign, &ystart);
|
&yalign, &ystart);
|
||||||
@ -1263,7 +1245,7 @@ gtk_grid_view_scroll_to_item (GtkWidget *widget,
|
|||||||
start = floor (self->column_width * (pos % self->n_columns));
|
start = floor (self->column_width * (pos % self->n_columns));
|
||||||
end = floor (self->column_width * ((pos % self->n_columns) + 1));
|
end = floor (self->column_width * ((pos % self->n_columns) + 1));
|
||||||
gtk_grid_view_compute_scroll_align (self,
|
gtk_grid_view_compute_scroll_align (self,
|
||||||
OPPOSITE_ORIENTATION (self->orientation),
|
gtk_list_base_get_opposite_orientation (GTK_LIST_BASE (self)),
|
||||||
start, end,
|
start, end,
|
||||||
self->anchor_xalign, self->anchor_xstart,
|
self->anchor_xalign, self->anchor_xstart,
|
||||||
&xalign, &xstart);
|
&xalign, &xstart);
|
||||||
@ -1310,7 +1292,7 @@ gtk_grid_view_move_cursor (GtkWidget *widget,
|
|||||||
|
|
||||||
g_variant_get (args, "(ubbbi)", &orientation, &select, &modify, &extend, &amount);
|
g_variant_get (args, "(ubbbi)", &orientation, &select, &modify, &extend, &amount);
|
||||||
|
|
||||||
if (self->orientation == orientation)
|
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == orientation)
|
||||||
amount *= self->n_columns;
|
amount *= self->n_columns;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||||
@ -1394,7 +1376,7 @@ gtk_grid_view_move_cursor_page_up (GtkWidget *widget,
|
|||||||
if (!gtk_grid_view_get_size_at_position (self, pos, &start, &size))
|
if (!gtk_grid_view_get_size_at_position (self, pos, &start, &size))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
gtk_list_base_get_adjustment_values (GTK_LIST_BASE (self),
|
gtk_list_base_get_adjustment_values (GTK_LIST_BASE (self),
|
||||||
self->orientation,
|
gtk_list_base_get_orientation (GTK_LIST_BASE (self)),
|
||||||
NULL, NULL, &page_size);
|
NULL, NULL, &page_size);
|
||||||
if (!gtk_grid_view_get_cell_at_y (self,
|
if (!gtk_grid_view_get_cell_at_y (self,
|
||||||
MAX (0, start + size - page_size),
|
MAX (0, start + size - page_size),
|
||||||
@ -1433,7 +1415,7 @@ gtk_grid_view_move_cursor_page_down (GtkWidget *widget,
|
|||||||
if (!gtk_grid_view_get_size_at_position (self, pos, &start, NULL))
|
if (!gtk_grid_view_get_size_at_position (self, pos, &start, NULL))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
gtk_list_base_get_adjustment_values (GTK_LIST_BASE (self),
|
gtk_list_base_get_adjustment_values (GTK_LIST_BASE (self),
|
||||||
self->orientation,
|
gtk_list_base_get_orientation (GTK_LIST_BASE (self)),
|
||||||
NULL, NULL, &page_size);
|
NULL, NULL, &page_size);
|
||||||
if (gtk_grid_view_get_cell_at_y (self,
|
if (gtk_grid_view_get_cell_at_y (self,
|
||||||
start + page_size,
|
start + page_size,
|
||||||
@ -1592,20 +1574,6 @@ gtk_grid_view_class_init (GtkGridViewClass *klass)
|
|||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkGridView:orientation:
|
|
||||||
*
|
|
||||||
* The orientation of the gridview. See GtkOrientable:orientation
|
|
||||||
* for details.
|
|
||||||
*/
|
|
||||||
properties[PROP_ORIENTATION] =
|
|
||||||
g_param_spec_enum ("orientation",
|
|
||||||
P_("Orientation"),
|
|
||||||
P_("The orientation of the orientable"),
|
|
||||||
GTK_TYPE_ORIENTATION,
|
|
||||||
GTK_ORIENTATION_VERTICAL,
|
|
||||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1694,7 +1662,6 @@ gtk_grid_view_init (GtkGridView *self)
|
|||||||
|
|
||||||
self->min_columns = 1;
|
self->min_columns = 1;
|
||||||
self->max_columns = DEFAULT_MAX_COLUMNS;
|
self->max_columns = DEFAULT_MAX_COLUMNS;
|
||||||
self->orientation = GTK_ORIENTATION_VERTICAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,13 +22,17 @@
|
|||||||
#include "gtklistbaseprivate.h"
|
#include "gtklistbaseprivate.h"
|
||||||
|
|
||||||
#include "gtkadjustment.h"
|
#include "gtkadjustment.h"
|
||||||
|
#include "gtkintl.h"
|
||||||
|
#include "gtkorientableprivate.h"
|
||||||
#include "gtkscrollable.h"
|
#include "gtkscrollable.h"
|
||||||
|
#include "gtktypebuiltins.h"
|
||||||
|
|
||||||
typedef struct _GtkListBasePrivate GtkListBasePrivate;
|
typedef struct _GtkListBasePrivate GtkListBasePrivate;
|
||||||
|
|
||||||
struct _GtkListBasePrivate
|
struct _GtkListBasePrivate
|
||||||
{
|
{
|
||||||
GtkListItemManager *item_manager;
|
GtkListItemManager *item_manager;
|
||||||
|
GtkOrientation orientation;
|
||||||
GtkAdjustment *adjustment[2];
|
GtkAdjustment *adjustment[2];
|
||||||
GtkScrollablePolicy scroll_policy[2];
|
GtkScrollablePolicy scroll_policy[2];
|
||||||
|
|
||||||
@ -41,6 +45,7 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_HADJUSTMENT,
|
PROP_HADJUSTMENT,
|
||||||
PROP_HSCROLL_POLICY,
|
PROP_HSCROLL_POLICY,
|
||||||
|
PROP_ORIENTATION,
|
||||||
PROP_VADJUSTMENT,
|
PROP_VADJUSTMENT,
|
||||||
PROP_VSCROLL_POLICY,
|
PROP_VSCROLL_POLICY,
|
||||||
|
|
||||||
@ -52,6 +57,7 @@ static void gtk_list_base_init_real (GtkListBase *self, GtkListBaseClass *g_clas
|
|||||||
#define g_type_register_static_simple(a,b,c,d,e,evil,f) g_type_register_static_simple(a,b,c,d,e, (GInstanceInitFunc) gtk_list_base_init_real, f);
|
#define g_type_register_static_simple(a,b,c,d,e,evil,f) g_type_register_static_simple(a,b,c,d,e, (GInstanceInitFunc) gtk_list_base_init_real, f);
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkListBase, gtk_list_base, GTK_TYPE_WIDGET,
|
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkListBase, gtk_list_base, GTK_TYPE_WIDGET,
|
||||||
G_ADD_PRIVATE (GtkListBase)
|
G_ADD_PRIVATE (GtkListBase)
|
||||||
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||||
#undef g_type_register_static_simple
|
#undef g_type_register_static_simple
|
||||||
G_GNUC_UNUSED static void gtk_list_base_init (GtkListBase *self) { }
|
G_GNUC_UNUSED static void gtk_list_base_init (GtkListBase *self) { }
|
||||||
@ -166,6 +172,10 @@ gtk_list_base_get_property (GObject *object,
|
|||||||
g_value_set_enum (value, priv->scroll_policy[GTK_ORIENTATION_HORIZONTAL]);
|
g_value_set_enum (value, priv->scroll_policy[GTK_ORIENTATION_HORIZONTAL]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ORIENTATION:
|
||||||
|
g_value_set_enum (value, priv->orientation);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_VADJUSTMENT:
|
case PROP_VADJUSTMENT:
|
||||||
g_value_set_object (value, priv->adjustment[GTK_ORIENTATION_VERTICAL]);
|
g_value_set_object (value, priv->adjustment[GTK_ORIENTATION_VERTICAL]);
|
||||||
break;
|
break;
|
||||||
@ -232,6 +242,7 @@ gtk_list_base_set_property (GObject *object,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
GtkListBase *self = GTK_LIST_BASE (object);
|
GtkListBase *self = GTK_LIST_BASE (object);
|
||||||
|
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
|
||||||
|
|
||||||
switch (property_id)
|
switch (property_id)
|
||||||
{
|
{
|
||||||
@ -243,6 +254,19 @@ gtk_list_base_set_property (GObject *object,
|
|||||||
gtk_list_base_set_scroll_policy (self, GTK_ORIENTATION_HORIZONTAL, g_value_get_enum (value));
|
gtk_list_base_set_scroll_policy (self, GTK_ORIENTATION_HORIZONTAL, g_value_get_enum (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ORIENTATION:
|
||||||
|
{
|
||||||
|
GtkOrientation orientation = g_value_get_enum (value);
|
||||||
|
if (priv->orientation != orientation)
|
||||||
|
{
|
||||||
|
priv->orientation = orientation;
|
||||||
|
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (self));
|
||||||
|
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ORIENTATION]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_VADJUSTMENT:
|
case PROP_VADJUSTMENT:
|
||||||
gtk_list_base_set_adjustment (self, GTK_ORIENTATION_VERTICAL, g_value_get_object (value));
|
gtk_list_base_set_adjustment (self, GTK_ORIENTATION_VERTICAL, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
@ -329,6 +353,20 @@ gtk_list_base_class_init (GtkListBaseClass *klass)
|
|||||||
g_param_spec_override ("vscroll-policy",
|
g_param_spec_override ("vscroll-policy",
|
||||||
g_object_interface_find_property (iface, "vscroll-policy"));
|
g_object_interface_find_property (iface, "vscroll-policy"));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkListBase:orientation:
|
||||||
|
*
|
||||||
|
* The orientation of the list. See GtkOrientable:orientation
|
||||||
|
* for details.
|
||||||
|
*/
|
||||||
|
properties[PROP_ORIENTATION] =
|
||||||
|
g_param_spec_enum ("orientation",
|
||||||
|
P_("Orientation"),
|
||||||
|
P_("The orientation of the orientable"),
|
||||||
|
GTK_TYPE_ORIENTATION,
|
||||||
|
GTK_ORIENTATION_VERTICAL,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -389,12 +427,13 @@ gtk_list_base_init_real (GtkListBase *self,
|
|||||||
g_class->list_item_size,
|
g_class->list_item_size,
|
||||||
g_class->list_item_augment_size,
|
g_class->list_item_augment_size,
|
||||||
g_class->list_item_augment_func);
|
g_class->list_item_augment_func);
|
||||||
|
|
||||||
priv->selected = gtk_list_item_tracker_new (priv->item_manager);
|
priv->selected = gtk_list_item_tracker_new (priv->item_manager);
|
||||||
|
|
||||||
priv->adjustment[GTK_ORIENTATION_HORIZONTAL] = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
priv->adjustment[GTK_ORIENTATION_HORIZONTAL] = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||||
priv->adjustment[GTK_ORIENTATION_VERTICAL] = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
priv->adjustment[GTK_ORIENTATION_VERTICAL] = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||||
|
|
||||||
|
priv->orientation = GTK_ORIENTATION_VERTICAL;
|
||||||
|
|
||||||
gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN);
|
gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN);
|
||||||
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
|
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
|
||||||
}
|
}
|
||||||
@ -474,6 +513,14 @@ gtk_list_base_get_scroll_policy (GtkListBase *self,
|
|||||||
return priv->scroll_policy[orientation];
|
return priv->scroll_policy[orientation];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkOrientation
|
||||||
|
gtk_list_base_get_orientation (GtkListBase *self)
|
||||||
|
{
|
||||||
|
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
|
||||||
|
|
||||||
|
return priv->orientation;
|
||||||
|
}
|
||||||
|
|
||||||
GtkListItemManager *
|
GtkListItemManager *
|
||||||
gtk_list_base_get_manager (GtkListBase *self)
|
gtk_list_base_get_manager (GtkListBase *self)
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "gtklistbase.h"
|
#include "gtklistbase.h"
|
||||||
|
|
||||||
#include "gtklistitemmanagerprivate.h"
|
#include "gtklistitemmanagerprivate.h"
|
||||||
|
#include "gtkprivate.h"
|
||||||
|
|
||||||
struct _GtkListBase
|
struct _GtkListBase
|
||||||
{
|
{
|
||||||
@ -42,6 +43,8 @@ struct _GtkListBaseClass
|
|||||||
GtkOrientation orientation);
|
GtkOrientation orientation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GtkOrientation gtk_list_base_get_orientation (GtkListBase *self);
|
||||||
|
#define gtk_list_base_get_opposite_orientation(self) OPPOSITE_ORIENTATION(gtk_list_base_get_orientation(self))
|
||||||
GtkListItemManager * gtk_list_base_get_manager (GtkListBase *self);
|
GtkListItemManager * gtk_list_base_get_manager (GtkListBase *self);
|
||||||
GtkScrollablePolicy gtk_list_base_get_scroll_policy (GtkListBase *self,
|
GtkScrollablePolicy gtk_list_base_get_scroll_policy (GtkListBase *self,
|
||||||
GtkOrientation orientation);
|
GtkOrientation orientation);
|
||||||
|
@ -25,13 +25,11 @@
|
|||||||
#include "gtklistbaseprivate.h"
|
#include "gtklistbaseprivate.h"
|
||||||
#include "gtklistitemmanagerprivate.h"
|
#include "gtklistitemmanagerprivate.h"
|
||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkorientableprivate.h"
|
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkrbtreeprivate.h"
|
#include "gtkrbtreeprivate.h"
|
||||||
#include "gtkselectionmodel.h"
|
#include "gtkselectionmodel.h"
|
||||||
#include "gtksingleselection.h"
|
#include "gtksingleselection.h"
|
||||||
#include "gtkstylecontext.h"
|
#include "gtkstylecontext.h"
|
||||||
#include "gtktypebuiltins.h"
|
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
/* Maximum number of list items created by the listview.
|
/* Maximum number of list items created by the listview.
|
||||||
@ -62,7 +60,6 @@ struct _GtkListView
|
|||||||
GListModel *model;
|
GListModel *model;
|
||||||
GtkListItemManager *item_manager;
|
GtkListItemManager *item_manager;
|
||||||
gboolean show_separators;
|
gboolean show_separators;
|
||||||
GtkOrientation orientation;
|
|
||||||
|
|
||||||
int list_width;
|
int list_width;
|
||||||
|
|
||||||
@ -95,7 +92,6 @@ enum
|
|||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_FACTORY,
|
PROP_FACTORY,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_ORIENTATION,
|
|
||||||
PROP_SHOW_SEPARATORS,
|
PROP_SHOW_SEPARATORS,
|
||||||
|
|
||||||
N_PROPS
|
N_PROPS
|
||||||
@ -106,8 +102,7 @@ enum {
|
|||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GtkListView, gtk_list_view, GTK_TYPE_LIST_BASE,
|
G_DEFINE_TYPE (GtkListView, gtk_list_view, GTK_TYPE_LIST_BASE)
|
||||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
|
||||||
|
|
||||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
static guint signals[LAST_SIGNAL] = { 0 };
|
||||||
@ -338,7 +333,7 @@ gtk_list_view_adjustment_value_changed (GtkListBase *base,
|
|||||||
{
|
{
|
||||||
GtkListView *self = GTK_LIST_VIEW (base);
|
GtkListView *self = GTK_LIST_VIEW (base);
|
||||||
|
|
||||||
if (orientation == self->orientation)
|
if (orientation == gtk_list_base_get_orientation (GTK_LIST_BASE (self)))
|
||||||
{
|
{
|
||||||
int page_size, total_size, value, from_start;
|
int page_size, total_size, value, from_start;
|
||||||
int row_start, row_end;
|
int row_start, row_end;
|
||||||
@ -405,7 +400,7 @@ gtk_list_view_update_adjustments (GtkListView *self,
|
|||||||
|
|
||||||
page_size = gtk_widget_get_size (GTK_WIDGET (self), orientation);
|
page_size = gtk_widget_get_size (GTK_WIDGET (self), orientation);
|
||||||
|
|
||||||
if (orientation == self->orientation)
|
if (orientation == gtk_list_base_get_orientation (GTK_LIST_BASE (self)))
|
||||||
{
|
{
|
||||||
int offset, size;
|
int offset, size;
|
||||||
guint anchor_pos;
|
guint anchor_pos;
|
||||||
@ -551,7 +546,7 @@ gtk_list_view_measure (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkListView *self = GTK_LIST_VIEW (widget);
|
GtkListView *self = GTK_LIST_VIEW (widget);
|
||||||
|
|
||||||
if (orientation == self->orientation)
|
if (orientation == gtk_list_base_get_orientation (GTK_LIST_BASE (self)))
|
||||||
gtk_list_view_measure_list (widget, orientation, for_size, minimum, natural);
|
gtk_list_view_measure_list (widget, orientation, for_size, minimum, natural);
|
||||||
else
|
else
|
||||||
gtk_list_view_measure_across (widget, orientation, for_size, minimum, natural);
|
gtk_list_view_measure_across (widget, orientation, for_size, minimum, natural);
|
||||||
@ -567,7 +562,7 @@ gtk_list_view_size_allocate_child (GtkListView *self,
|
|||||||
{
|
{
|
||||||
GtkAllocation child_allocation;
|
GtkAllocation child_allocation;
|
||||||
|
|
||||||
if (self->orientation == GTK_ORIENTATION_VERTICAL)
|
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == GTK_ORIENTATION_VERTICAL)
|
||||||
{
|
{
|
||||||
child_allocation.x = x;
|
child_allocation.x = x;
|
||||||
child_allocation.y = y;
|
child_allocation.y = y;
|
||||||
@ -605,11 +600,12 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
GArray *heights;
|
GArray *heights;
|
||||||
int min, nat, row_height;
|
int min, nat, row_height;
|
||||||
int x, y;
|
int x, y;
|
||||||
GtkOrientation opposite_orientation;
|
GtkOrientation orientation, opposite_orientation;
|
||||||
GtkScrollablePolicy scroll_policy;
|
GtkScrollablePolicy scroll_policy;
|
||||||
|
|
||||||
opposite_orientation = OPPOSITE_ORIENTATION (self->orientation);
|
orientation = gtk_list_base_get_orientation (GTK_LIST_BASE (self));
|
||||||
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), self->orientation);
|
opposite_orientation = OPPOSITE_ORIENTATION (orientation);
|
||||||
|
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), orientation);
|
||||||
|
|
||||||
/* step 0: exit early if list is empty */
|
/* step 0: exit early if list is empty */
|
||||||
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
|
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
|
||||||
@ -619,7 +615,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
gtk_widget_measure (widget, opposite_orientation,
|
gtk_widget_measure (widget, opposite_orientation,
|
||||||
-1,
|
-1,
|
||||||
&min, &nat, NULL, NULL);
|
&min, &nat, NULL, NULL);
|
||||||
self->list_width = self->orientation == GTK_ORIENTATION_VERTICAL ? width : height;
|
self->list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height;
|
||||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||||
self->list_width = MAX (min, self->list_width);
|
self->list_width = MAX (min, self->list_width);
|
||||||
else
|
else
|
||||||
@ -635,7 +631,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
if (row->parent.widget == NULL)
|
if (row->parent.widget == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gtk_widget_measure (row->parent.widget, self->orientation,
|
gtk_widget_measure (row->parent.widget, orientation,
|
||||||
self->list_width,
|
self->list_width,
|
||||||
&min, &nat, NULL, NULL);
|
&min, &nat, NULL, NULL);
|
||||||
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
if (scroll_policy == GTK_SCROLL_MINIMUM)
|
||||||
@ -670,7 +666,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
/* step 3: update the adjustments */
|
/* step 3: update the adjustments */
|
||||||
x = - gtk_list_view_update_adjustments (self, opposite_orientation);
|
x = - gtk_list_view_update_adjustments (self, opposite_orientation);
|
||||||
y = - gtk_list_view_update_adjustments (self, self->orientation);
|
y = - gtk_list_view_update_adjustments (self, orientation);
|
||||||
|
|
||||||
/* step 4: actually allocate the widgets */
|
/* step 4: actually allocate the widgets */
|
||||||
|
|
||||||
@ -792,10 +788,6 @@ gtk_list_view_get_property (GObject *object,
|
|||||||
g_value_set_object (value, self->model);
|
g_value_set_object (value, self->model);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ORIENTATION:
|
|
||||||
g_value_set_enum (value, self->orientation);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SHOW_SEPARATORS:
|
case PROP_SHOW_SEPARATORS:
|
||||||
g_value_set_boolean (value, self->show_separators);
|
g_value_set_boolean (value, self->show_separators);
|
||||||
break;
|
break;
|
||||||
@ -824,19 +816,6 @@ gtk_list_view_set_property (GObject *object,
|
|||||||
gtk_list_view_set_model (self, g_value_get_object (value));
|
gtk_list_view_set_model (self, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ORIENTATION:
|
|
||||||
{
|
|
||||||
GtkOrientation orientation = g_value_get_enum (value);
|
|
||||||
if (self->orientation != orientation)
|
|
||||||
{
|
|
||||||
self->orientation = orientation;
|
|
||||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (self));
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ORIENTATION]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SHOW_SEPARATORS:
|
case PROP_SHOW_SEPARATORS:
|
||||||
gtk_list_view_set_show_separators (self, g_value_get_boolean (value));
|
gtk_list_view_set_show_separators (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
@ -952,7 +931,7 @@ gtk_list_view_scroll_to_item (GtkWidget *widget,
|
|||||||
|
|
||||||
end += start;
|
end += start;
|
||||||
gtk_list_view_compute_scroll_align (self,
|
gtk_list_view_compute_scroll_align (self,
|
||||||
self->orientation,
|
gtk_list_base_get_orientation (GTK_LIST_BASE (self)),
|
||||||
start, end,
|
start, end,
|
||||||
self->anchor_align, self->anchor_start,
|
self->anchor_align, self->anchor_start,
|
||||||
&align, &top);
|
&align, &top);
|
||||||
@ -999,7 +978,7 @@ gtk_list_view_move_cursor (GtkWidget *widget,
|
|||||||
|
|
||||||
g_variant_get (args, "(ubbbi)", &orientation, &select, &modify, &extend, &amount);
|
g_variant_get (args, "(ubbbi)", &orientation, &select, &modify, &extend, &amount);
|
||||||
|
|
||||||
if (self->orientation != orientation)
|
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) != orientation)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
if (orientation == GTK_ORIENTATION_HORIZONTAL &&
|
||||||
@ -1082,10 +1061,7 @@ gtk_list_view_move_cursor_page_up (GtkWidget *widget,
|
|||||||
if (n_items == 0 || start == 0)
|
if (n_items == 0 || start == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
pixels = gtk_widget_get_size (widget, gtk_list_base_get_orientation (GTK_LIST_BASE (self)));
|
||||||
pixels = gtk_widget_get_width (widget);
|
|
||||||
else
|
|
||||||
pixels = gtk_widget_get_height (widget);
|
|
||||||
pixels -= row->height;
|
pixels -= row->height;
|
||||||
|
|
||||||
pos = gtk_list_view_get_position_at_y (self,
|
pos = gtk_list_view_get_position_at_y (self,
|
||||||
@ -1128,10 +1104,7 @@ gtk_list_view_move_cursor_page_down (GtkWidget *widget,
|
|||||||
if (n_items == 0 || start >= n_items - 1)
|
if (n_items == 0 || start >= n_items - 1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
|
pixels = gtk_widget_get_size (widget, gtk_list_base_get_orientation (GTK_LIST_BASE (self)));
|
||||||
pixels = gtk_widget_get_width (widget);
|
|
||||||
else
|
|
||||||
pixels = gtk_widget_get_height (widget);
|
|
||||||
|
|
||||||
pos = gtk_list_view_get_position_at_y (self,
|
pos = gtk_list_view_get_position_at_y (self,
|
||||||
list_row_get_y (self, row) + pixels,
|
list_row_get_y (self, row) + pixels,
|
||||||
@ -1248,20 +1221,6 @@ gtk_list_view_class_init (GtkListViewClass *klass)
|
|||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
/**
|
|
||||||
* GtkListView:orientation:
|
|
||||||
*
|
|
||||||
* The orientation of the orientable. See GtkOrientable:orientation
|
|
||||||
* for details.
|
|
||||||
*/
|
|
||||||
properties[PROP_ORIENTATION] =
|
|
||||||
g_param_spec_enum ("orientation",
|
|
||||||
P_("Orientation"),
|
|
||||||
P_("The orientation of the orientable"),
|
|
||||||
GTK_TYPE_ORIENTATION,
|
|
||||||
GTK_ORIENTATION_VERTICAL,
|
|
||||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkListView:show-separators:
|
* GtkListView:show-separators:
|
||||||
*
|
*
|
||||||
@ -1357,7 +1316,6 @@ gtk_list_view_init (GtkListView *self)
|
|||||||
self->item_manager = gtk_list_base_get_manager (GTK_LIST_BASE (self));
|
self->item_manager = gtk_list_base_get_manager (GTK_LIST_BASE (self));
|
||||||
self->focus = gtk_list_item_tracker_new (self->item_manager);
|
self->focus = gtk_list_item_tracker_new (self->item_manager);
|
||||||
self->anchor = gtk_list_item_tracker_new (self->item_manager);
|
self->anchor = gtk_list_item_tracker_new (self->item_manager);
|
||||||
self->orientation = GTK_ORIENTATION_VERTICAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user