Commit f724f836 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford
Browse files

Add put for use with editable widgets. This function is private, and

Tue Sep 18 12:12:43 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
	editable widgets.  This function is private, and should only be
	used by GtkTreeView.
parent cbae2794
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
Tue Sep 18 12:12:43 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_put): Add put for use with
editable widgets. This function is private, and should only be
used by GtkTreeView.
2001-09-18 Matt Wilson <msw@redhat.com>
 
* docs/Makefile.am (EXTRA_DIST): don't use += before =
......
......@@ -1011,7 +1011,6 @@ gtk_tree_model_row_changed (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter)
{
gint i;
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_return_if_fail (iter != NULL);
......
......@@ -279,6 +279,13 @@ void _gtk_tree_view_column_set_width (GtkTreeViewColumn *column,
gint width);
void _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GtkTreeViewColumn *column);
gboolean _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
GtkCellEditable **editable_widget,
GdkEvent *event,
gchar *path_string,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags);
GtkTreeSelection* _gtk_tree_selection_new (void);
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
......
......@@ -73,6 +73,8 @@ struct _GtkTreeViewChild
GtkWidget *widget;
gint x;
gint y;
gint width;
gint height;
};
......@@ -374,7 +376,13 @@ static void gtk_tree_view_search_init (GtkWidget *entry
GtkTreeView *tree_view);
static void gtk_tree_view_interactive_search (GtkTreeView *tree_view,
GdkEventKey *key);
static void gtk_tree_view_put (GtkTreeView *tree_view,
GtkWidget *child_widget,
gint x,
gint y,
gint width,
gint height);
static GtkContainerClass *parent_class = NULL;
static guint tree_view_signals[LAST_SIGNAL] = { 0 };
......@@ -1410,16 +1418,15 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
while (tmp_list)
{
GtkAllocation allocation;
GtkRequisition requisition;
GtkTreeViewChild *child = tmp_list->data;
tmp_list = tmp_list->next;
/* totally ignore our childs allocation <-: */
allocation.x = child->x;
allocation.y = child->y;
gtk_widget_get_child_requisition (child->widget, &requisition);
allocation.width = requisition.width;
allocation.height = requisition.height;
allocation.width = child->width;
allocation.height = child->height;
gtk_widget_size_allocate (child->widget, &allocation);
}
......@@ -1539,6 +1546,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
for (list = tree_view->priv->columns; list; list = list->next)
{
GtkTreeIter iter;
GtkCellEditable *cell_editable = NULL;
column = list->data;
......@@ -1576,12 +1584,21 @@ gtk_tree_view_button_press (GtkWidget *widget,
path_string = gtk_tree_path_to_string (path);
if (gtk_tree_view_column_cell_event (column,
(GdkEvent *)event,
path_string,
&background_area,
&cell_area, 0))
if (_gtk_tree_view_column_cell_event (column,
&cell_editable,
(GdkEvent *)event,
path_string,
&background_area,
&cell_area, 0))
{
if (cell_editable != NULL)
{
gtk_tree_view_put (tree_view,
GTK_WIDGET (cell_editable),
cell_area.x, cell_area.y, cell_area.width, cell_area.height);
gtk_cell_editable_start_editing (cell_editable,
(GdkEvent *)event);
}
g_free (path_string);
gtk_tree_path_free (path);
return TRUE;
......@@ -4197,6 +4214,36 @@ gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
}
}
static void
gtk_tree_view_put (GtkTreeView *tree_view,
GtkWidget *child_widget,
gint x,
gint y,
gint width,
gint height)
{
GtkTreeViewChild *child;
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
g_return_if_fail (GTK_IS_WIDGET (child_widget));
child = g_new (GtkTreeViewChild, 1);
child->widget = child_widget;
child->x = x;
child->y = y;
child->width = width;
child->height = height;
tree_view->priv->children = g_list_append (tree_view->priv->children, child);
if (GTK_WIDGET_REALIZED (tree_view))
gtk_widget_set_parent_window (child->widget, tree_view->priv->bin_window);
gtk_widget_set_parent (child_widget, GTK_WIDGET (tree_view));
}
/* TreeModel Callbacks
*/
......@@ -9054,3 +9101,4 @@ gtk_tree_view_search_init (GtkWidget *entry,
selected_iter);
}
}
......@@ -2229,34 +2229,23 @@ gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
}
}
/**
* gtk_tree_view_column_cell_event:
* @tree_column: A #GtkTreeViewColumn.
* @event: a #GdkEvent
* @path_string: widget-dependent string representation of the event location; e.g. for #GtkTreeView, a string representation of #GtkTreePath
* @background_area: background area as passed to gtk_cell_renderer_render()
* @cell_area: cell area as passed to gtk_cell_renderer_render()
* @flags: render flags
*
* Handles an event. This is used primarily by the GtkTreeView.
*
* Return value: %TRUE if the event was consumed/handled
**/
gboolean
gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
GdkEvent *event,
gchar *path_string,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags)
_gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
GtkCellEditable **editable_widget,
GdkEvent *event,
gchar *path_string,
GdkRectangle *background_area,
GdkRectangle *cell_area,
guint flags)
{
gboolean visible, can_activate;
gboolean visible, can_activate, can_edit;
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
g_object_get (G_OBJECT (((GtkTreeViewColumnCellInfo *) tree_column->cell_list->data)->cell),
"visible", &visible,
"can_activate", &can_activate,
"can_edit", &can_edit,
NULL);
if (visible && can_activate)
{
......@@ -2268,7 +2257,17 @@ gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
cell_area,
flags))
return TRUE;
}
else if (visible && can_edit)
{
*editable_widget = gtk_cell_renderer_start_editing (((GtkTreeViewColumnCellInfo *) tree_column->cell_list->data)->cell,
event,
tree_column->tree_view,
path_string,
background_area,
cell_area,
flags);
return (*editable_widget != NULL);
}
return FALSE;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment