mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 03:10:09 +00:00
Add rubberband api
Add an ::enable-rubberband property to GtkListView, GtkGridView and GtkColumnView.
This commit is contained in:
parent
b3a97cb755
commit
03c2202942
@ -489,6 +489,8 @@ gtk_list_view_set_show_separators
|
|||||||
gtk_list_view_get_show_separators
|
gtk_list_view_get_show_separators
|
||||||
gtk_list_view_set_single_click_activate
|
gtk_list_view_set_single_click_activate
|
||||||
gtk_list_view_get_single_click_activate
|
gtk_list_view_get_single_click_activate
|
||||||
|
gtk_list_view_set_enable_rubberband
|
||||||
|
gtk_list_view_get_enable_rubberband
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GTK_LIST_VIEW
|
GTK_LIST_VIEW
|
||||||
GTK_LIST_VIEW_CLASS
|
GTK_LIST_VIEW_CLASS
|
||||||
@ -519,6 +521,8 @@ gtk_column_view_set_single_click_activate
|
|||||||
gtk_column_view_get_single_click_activate
|
gtk_column_view_get_single_click_activate
|
||||||
gtk_column_view_set_reorderable
|
gtk_column_view_set_reorderable
|
||||||
gtk_column_view_get_reorderable
|
gtk_column_view_get_reorderable
|
||||||
|
gtk_column_view_set_enable_rubberband
|
||||||
|
gtk_column_view_get_enable_rubberband
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GTK_COLUMN_VIEW
|
GTK_COLUMN_VIEW
|
||||||
GTK_COLUMN_VIEW_CLASS
|
GTK_COLUMN_VIEW_CLASS
|
||||||
@ -578,6 +582,8 @@ gtk_grid_view_set_min_columns
|
|||||||
gtk_grid_view_get_min_columns
|
gtk_grid_view_get_min_columns
|
||||||
gtk_grid_view_set_single_click_activate
|
gtk_grid_view_set_single_click_activate
|
||||||
gtk_grid_view_get_single_click_activate
|
gtk_grid_view_get_single_click_activate
|
||||||
|
gtk_grid_view_set_enable_rubberband
|
||||||
|
gtk_grid_view_get_enable_rubberband
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GTK_GRID_VIEW
|
GTK_GRID_VIEW
|
||||||
GTK_GRID_VIEW_CLASS
|
GTK_GRID_VIEW_CLASS
|
||||||
|
@ -106,6 +106,7 @@ enum
|
|||||||
PROP_VSCROLL_POLICY,
|
PROP_VSCROLL_POLICY,
|
||||||
PROP_SINGLE_CLICK_ACTIVATE,
|
PROP_SINGLE_CLICK_ACTIVATE,
|
||||||
PROP_REORDERABLE,
|
PROP_REORDERABLE,
|
||||||
|
PROP_ENABLE_RUBBERBAND,
|
||||||
|
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -401,6 +402,10 @@ gtk_column_view_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, gtk_column_view_get_reorderable (self));
|
g_value_set_boolean (value, gtk_column_view_get_reorderable (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ENABLE_RUBBERBAND:
|
||||||
|
g_value_set_boolean (value, gtk_column_view_get_enable_rubberband (self));
|
||||||
|
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;
|
||||||
@ -476,6 +481,10 @@ gtk_column_view_set_property (GObject *object,
|
|||||||
gtk_column_view_set_reorderable (self, g_value_get_boolean (value));
|
gtk_column_view_set_reorderable (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ENABLE_RUBBERBAND:
|
||||||
|
gtk_column_view_set_enable_rubberband (self, g_value_get_boolean (value));
|
||||||
|
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;
|
||||||
@ -584,6 +593,18 @@ gtk_column_view_class_init (GtkColumnViewClass *klass)
|
|||||||
TRUE,
|
TRUE,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkColumnView:enable-rubberband:
|
||||||
|
*
|
||||||
|
* Allow rubberband selection
|
||||||
|
*/
|
||||||
|
properties[PROP_ENABLE_RUBBERBAND] =
|
||||||
|
g_param_spec_boolean ("enable-rubberband",
|
||||||
|
P_("Enable rubberband selection"),
|
||||||
|
P_("Allow selecting items by dragging with the mouse"),
|
||||||
|
FALSE,
|
||||||
|
G_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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1404,3 +1425,40 @@ gtk_column_view_get_reorderable (GtkColumnView *self)
|
|||||||
|
|
||||||
return self->reorderable;
|
return self->reorderable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_column_view_set_enable_rubberband:
|
||||||
|
* @self: a #GtkColumnView
|
||||||
|
* @enable_rubberband: %TRUE to enable rubberband selection
|
||||||
|
*
|
||||||
|
* Sets whether selections can be changed by dragging with the mouse.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_column_view_set_enable_rubberband (GtkColumnView *self,
|
||||||
|
gboolean enable_rubberband)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
||||||
|
|
||||||
|
if (enable_rubberband == gtk_list_view_get_enable_rubberband (self->listview))
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_list_view_set_enable_rubberband (self->listview, enable_rubberband);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ENABLE_RUBBERBAND]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_column_view_get_enable_rubberband:
|
||||||
|
* @self: a #GtkColumnView
|
||||||
|
*
|
||||||
|
* Returns whether rows can be selected by dragging with the mouse.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if rubberband selection is enabled
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_column_view_get_enable_rubberband (GtkColumnView *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_COLUMN_VIEW (self), FALSE);
|
||||||
|
|
||||||
|
return gtk_list_view_get_enable_rubberband (self->listview);
|
||||||
|
}
|
||||||
|
@ -93,11 +93,16 @@ GDK_AVAILABLE_IN_ALL
|
|||||||
gboolean gtk_column_view_get_single_click_activate (GtkColumnView *self);
|
gboolean gtk_column_view_get_single_click_activate (GtkColumnView *self);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
|
||||||
void gtk_column_view_set_reorderable (GtkColumnView *self,
|
void gtk_column_view_set_reorderable (GtkColumnView *self,
|
||||||
gboolean reorderable);
|
gboolean reorderable);
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_column_view_get_reorderable (GtkColumnView *self);
|
gboolean gtk_column_view_get_reorderable (GtkColumnView *self);
|
||||||
|
|
||||||
|
void gtk_column_view_set_enable_rubberband (GtkColumnView *self,
|
||||||
|
gboolean enable_rubberband);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
gboolean gtk_column_view_get_enable_rubberband (GtkColumnView *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ enum
|
|||||||
PROP_MIN_COLUMNS,
|
PROP_MIN_COLUMNS,
|
||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_SINGLE_CLICK_ACTIVATE,
|
PROP_SINGLE_CLICK_ACTIVATE,
|
||||||
|
PROP_ENABLE_RUBBERBAND,
|
||||||
|
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -916,6 +917,10 @@ gtk_grid_view_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, gtk_list_item_manager_get_single_click_activate (self->item_manager));
|
g_value_set_boolean (value, gtk_list_item_manager_get_single_click_activate (self->item_manager));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ENABLE_RUBBERBAND:
|
||||||
|
g_value_set_boolean (value, gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (self)));
|
||||||
|
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;
|
||||||
@ -952,6 +957,10 @@ gtk_grid_view_set_property (GObject *object,
|
|||||||
gtk_grid_view_set_single_click_activate (self, g_value_get_boolean (value));
|
gtk_grid_view_set_single_click_activate (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ENABLE_RUBBERBAND:
|
||||||
|
gtk_grid_view_set_enable_rubberband (self, g_value_get_boolean (value));
|
||||||
|
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;
|
||||||
@ -1064,6 +1073,18 @@ gtk_grid_view_class_init (GtkGridViewClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkGridView:enable-rubberband:
|
||||||
|
*
|
||||||
|
* Allow rubberband selection
|
||||||
|
*/
|
||||||
|
properties[PROP_ENABLE_RUBBERBAND] =
|
||||||
|
g_param_spec_boolean ("enable-rubberband",
|
||||||
|
P_("Enable rubberband selection"),
|
||||||
|
P_("Allow selecting items by dragging with the mouse"),
|
||||||
|
FALSE,
|
||||||
|
G_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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1372,3 +1393,40 @@ gtk_grid_view_get_single_click_activate (GtkGridView *self)
|
|||||||
|
|
||||||
return gtk_list_item_manager_get_single_click_activate (self->item_manager);
|
return gtk_list_item_manager_get_single_click_activate (self->item_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_grid_view_set_enable_rubberband:
|
||||||
|
* @self: a #GtkGridView
|
||||||
|
* @enable_rubberband: %TRUE to enable rubberband selection
|
||||||
|
*
|
||||||
|
* Sets whether selections can be changed by dragging with the mouse.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_grid_view_set_enable_rubberband (GtkGridView *self,
|
||||||
|
gboolean enable_rubberband)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_GRID_VIEW (self));
|
||||||
|
|
||||||
|
if (enable_rubberband == gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (self)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_list_base_set_enable_rubberband (GTK_LIST_BASE (self), enable_rubberband);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ENABLE_RUBBERBAND]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_grid_view_get_enable_rubberband:
|
||||||
|
* @self: a #GtkGridView
|
||||||
|
*
|
||||||
|
* Returns whether rows can be selected by dragging with the mouse.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if rubberband selection is enabled
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_grid_view_get_enable_rubberband (GtkGridView *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_GRID_VIEW (self), FALSE);
|
||||||
|
|
||||||
|
return gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (self));
|
||||||
|
}
|
||||||
|
@ -73,6 +73,11 @@ guint gtk_grid_view_get_max_columns (GtkGridView
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_grid_view_set_max_columns (GtkGridView *self,
|
void gtk_grid_view_set_max_columns (GtkGridView *self,
|
||||||
guint max_columns);
|
guint max_columns);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_grid_view_set_enable_rubberband (GtkGridView *self,
|
||||||
|
gboolean enable_rubberband);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
gboolean gtk_grid_view_get_enable_rubberband (GtkGridView *self);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_grid_view_set_single_click_activate (GtkGridView *self,
|
void gtk_grid_view_set_single_click_activate (GtkGridView *self,
|
||||||
|
@ -85,6 +85,7 @@ enum
|
|||||||
PROP_MODEL,
|
PROP_MODEL,
|
||||||
PROP_SHOW_SEPARATORS,
|
PROP_SHOW_SEPARATORS,
|
||||||
PROP_SINGLE_CLICK_ACTIVATE,
|
PROP_SINGLE_CLICK_ACTIVATE,
|
||||||
|
PROP_ENABLE_RUBBERBAND,
|
||||||
|
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -645,6 +646,10 @@ gtk_list_view_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, gtk_list_item_manager_get_single_click_activate (self->item_manager));
|
g_value_set_boolean (value, gtk_list_item_manager_get_single_click_activate (self->item_manager));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ENABLE_RUBBERBAND:
|
||||||
|
g_value_set_boolean (value, gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (self)));
|
||||||
|
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;
|
||||||
@ -677,6 +682,10 @@ gtk_list_view_set_property (GObject *object,
|
|||||||
gtk_list_view_set_single_click_activate (self, g_value_get_boolean (value));
|
gtk_list_view_set_single_click_activate (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_ENABLE_RUBBERBAND:
|
||||||
|
gtk_list_view_set_enable_rubberband (self, g_value_get_boolean (value));
|
||||||
|
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;
|
||||||
@ -773,6 +782,18 @@ gtk_list_view_class_init (GtkListViewClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkListView:enable-rubberband:
|
||||||
|
*
|
||||||
|
* Allow rubberband selection
|
||||||
|
*/
|
||||||
|
properties[PROP_ENABLE_RUBBERBAND] =
|
||||||
|
g_param_spec_boolean ("enable-rubberband",
|
||||||
|
P_("Enable rubberband selection"),
|
||||||
|
P_("Allow selecting items by dragging with the mouse"),
|
||||||
|
FALSE,
|
||||||
|
G_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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1035,3 +1056,40 @@ gtk_list_view_get_single_click_activate (GtkListView *self)
|
|||||||
|
|
||||||
return gtk_list_item_manager_get_single_click_activate (self->item_manager);
|
return gtk_list_item_manager_get_single_click_activate (self->item_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_list_view_set_enable_rubberband:
|
||||||
|
* @self: a #GtkListView
|
||||||
|
* @enable_rubberband: %TRUE to enable rubberband selection
|
||||||
|
*
|
||||||
|
* Sets whether selections can be changed by dragging with the mouse.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gtk_list_view_set_enable_rubberband (GtkListView *self,
|
||||||
|
gboolean enable_rubberband)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_LIST_VIEW (self));
|
||||||
|
|
||||||
|
if (enable_rubberband == gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (self)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_list_base_set_enable_rubberband (GTK_LIST_BASE (self), enable_rubberband);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ENABLE_RUBBERBAND]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_list_view_get_enable_rubberband:
|
||||||
|
* @self: a #GtkListView
|
||||||
|
*
|
||||||
|
* Returns whether rows can be selected by dragging with the mouse.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if rubberband selection is enabled
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gtk_list_view_get_enable_rubberband (GtkListView *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_LIST_VIEW (self), FALSE);
|
||||||
|
|
||||||
|
return gtk_list_base_get_enable_rubberband (GTK_LIST_BASE (self));
|
||||||
|
}
|
||||||
|
@ -75,6 +75,12 @@ void gtk_list_view_set_single_click_activate (GtkListView
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
gboolean gtk_list_view_get_single_click_activate (GtkListView *self);
|
gboolean gtk_list_view_get_single_click_activate (GtkListView *self);
|
||||||
|
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
void gtk_list_view_set_enable_rubberband (GtkListView *self,
|
||||||
|
gboolean enable_rubberband);
|
||||||
|
GDK_AVAILABLE_IN_ALL
|
||||||
|
gboolean gtk_list_view_get_enable_rubberband (GtkListView *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_LIST_VIEW_H__ */
|
#endif /* __GTK_LIST_VIEW_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user