Commit 747b7253 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

Add "use_align" to give people the option to just make a cell visible.

Fri Aug 24 16:03:45 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
	"use_align" to give people the option to just make a cell visible.

	* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
	we were scrolling past the end of the tree.

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
	rename gtk_tree_view_column_pack_start_cell_renderer to
	gtk_tree_view_column_pack_start.  Same for pack_end, and clear.
parent c1e4eac7
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
Fri Aug 24 16:03:45 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_cell): Add
"use_align" to give people the option to just make a cell visible.
* gtk/gtktreeview.c (gtk_tree_view_scroll_to_point): fix bug where
we were scrolling past the end of the tree.
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_pack_start):
rename gtk_tree_view_column_pack_start_cell_renderer to
gtk_tree_view_column_pack_start. Same for pack_end, and clear.
Fri Aug 24 12:02:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextbuffer.c (gtk_text_buffer_new): Remove
......
......@@ -203,7 +203,7 @@ add_dll_suffix (gchar *module_name)
static gboolean
check_setugid (void)
{
/* this isn't at all relevant on Windoze and doesn't compile ... --hb */
/* this isn't at all relevant on MS Windows and doesn't compile ... --hb */
#ifndef G_OS_WIN32
uid_t ruid, euid, suid; /* Real, effective and saved user ID's */
gid_t rgid, egid, sgid; /* Real, effective and saved group ID's */
......
......@@ -510,7 +510,7 @@ gtk_tree_path_up (GtkTreePath *path)
{
g_return_val_if_fail (path != NULL, FALSE);
if (path->depth == 1)
if (path->depth == 0)
return FALSE;
path->depth--;
......
......@@ -165,6 +165,7 @@ struct _GtkTreeViewPrivate
GtkTreeViewColumn *scroll_to_column;
gfloat scroll_to_row_align;
gfloat scroll_to_col_align;
guint scroll_to_use_align : 1;
guint reorderable : 1;
guint header_has_focus : 1;
......
......@@ -1211,6 +1211,7 @@ gtk_tree_view_realize (GtkWidget *widget)
gtk_tree_view_scroll_to_cell (tree_view,
tree_view->priv->scroll_to_path,
tree_view->priv->scroll_to_column,
tree_view->priv->scroll_to_use_align,
tree_view->priv->scroll_to_row_align,
tree_view->priv->scroll_to_col_align);
if (tree_view->priv->scroll_to_path)
......@@ -3136,6 +3137,7 @@ drag_scan_timeout (gpointer data)
gtk_tree_view_scroll_to_cell (tree_view,
path,
column,
TRUE,
0.5, 0.5);
gtk_tree_path_free (path);
......@@ -6985,8 +6987,8 @@ gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
hadj = tree_view->priv->hadjustment;
vadj = tree_view->priv->vadjustment;
gtk_adjustment_set_value (hadj, CLAMP (tree_x, hadj->lower, hadj->upper));
gtk_adjustment_set_value (vadj, CLAMP (tree_y, vadj->lower, vadj->upper));
gtk_adjustment_set_value (hadj, CLAMP (tree_x, hadj->lower, hadj->upper - hadj->page_size));
gtk_adjustment_set_value (vadj, CLAMP (tree_y, vadj->lower, vadj->upper - vadj->page_size));
}
/**
......@@ -6994,21 +6996,24 @@ gtk_tree_view_scroll_to_point (GtkTreeView *tree_view,
* @tree_view: A #GtkTreeView.
* @path: The path of the row to move to.
* @column: The #GtkTreeViewColumn to move horizontally to.
* @use_align: whether to use alignment arguments, or %FALSE.
* @row_align: The vertical alignment of the row specified by @path.
* @col_align: The horizontal alignment of the column specified by @column.
*
* Moves the alignments of @tree_view to the position specified by
* @column and @path. If @column is NULL, then no horizontal
* scrolling occurs. Likewise, if @path is NULL no vertical scrolling
* occurs. @row_align determines where the row is placed, and
* @col_align determines where @column is placed. Both are expected
* to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means
* right/bottom alignment, 0.5 means center.
* Moves the alignments of @tree_view to the position specified by @column and
* @path. If @column is NULL, then no horizontal scrolling occurs. Likewise,
* if @path is NULL no vertical scrolling occurs. @row_align determines where
* the row is placed, and @col_align determines where @column is placed. Both
* are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0
* means right/bottom alignment, 0.5 means center. If @use_align is %TRUE, then
* the alignment arguments are ignored, and the tree does the minimum amount of
* work to scroll the cell onto the screen.
**/
void
gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
gboolean use_align,
gfloat row_align,
gfloat col_align)
{
......@@ -7034,6 +7039,7 @@ gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
tree_view->priv->scroll_to_path = gtk_tree_path_copy (path);
if (column)
tree_view->priv->scroll_to_column = column;
tree_view->priv->scroll_to_use_align = use_align;
tree_view->priv->scroll_to_row_align = row_align;
tree_view->priv->scroll_to_col_align = col_align;
......@@ -7046,18 +7052,34 @@ gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
dest_x = vis_rect.x;
dest_y = vis_rect.y;
if (path)
if (column)
{
dest_x = cell_rect.x +
cell_rect.width * row_align -
vis_rect.width * row_align;
if (use_align)
{
dest_x = cell_rect.x + cell_rect.width * row_align - vis_rect.width * row_align;
}
else
{
if (dest_x < vis_rect.x)
dest_x = vis_rect.x;
else if (dest_x + cell_rect.width > vis_rect.x + vis_rect.width)
dest_x = vis_rect.x + vis_rect.width - cell_rect.width;
}
}
if (column)
if (path)
{
dest_y = cell_rect.y +
cell_rect.height * col_align -
vis_rect.height * col_align;
if (use_align)
{
dest_y = cell_rect.y + cell_rect.height * col_align - vis_rect.height * col_align;
}
else
{
if (dest_y < vis_rect.y)
dest_y = vis_rect.y;
else if (dest_y + cell_rect.height > vis_rect.y + vis_rect.height)
dest_y = vis_rect.y + vis_rect.height - cell_rect.height;
}
}
gtk_tree_view_scroll_to_point (tree_view, dest_x, dest_y);
......@@ -8886,7 +8908,7 @@ gtk_tree_view_search_iter (GtkTreeModel *model,
gtk_tree_selection_select_iter (selection, iter);
path = gtk_tree_model_get_path (model, iter);
gtk_tree_view_scroll_to_cell (tree_view, path, column, 0.5, 0.5);
gtk_tree_view_scroll_to_cell (tree_view, path, column, TRUE, 0.5, 0.5);
gtk_tree_view_real_set_cursor (tree_view, path, FALSE);
gtk_tree_path_free (path);
......@@ -8920,7 +8942,7 @@ gtk_tree_view_search_iter (GtkTreeModel *model,
gtk_tree_selection_select_iter (selection, iter);
path = gtk_tree_model_get_path (model, iter);
gtk_tree_view_scroll_to_cell (tree_view, path, column, 0.5, 0.5);
gtk_tree_view_scroll_to_cell (tree_view, path, column, TRUE, 0.5, 0.5);
gtk_tree_view_real_set_cursor (tree_view, path, FALSE);
gtk_tree_path_free (path);
......
......@@ -189,6 +189,7 @@ void gtk_tree_view_scroll_to_point (GtkTreeView
void gtk_tree_view_scroll_to_cell (GtkTreeView *tree_view,
GtkTreePath *path,
GtkTreeViewColumn *column,
gboolean use_align,
gfloat row_align,
gfloat col_align);
void gtk_tree_view_row_activated (GtkTreeView *tree_view,
......
......@@ -1053,7 +1053,7 @@ void
gtk_tree_view_column_set_cell_renderer (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell)
{
gtk_tree_view_column_pack_start_cell_renderer (tree_column, cell, TRUE, TRUE, 0);
gtk_tree_view_column_pack_start (tree_column, cell, TRUE, TRUE, 0);
}
static GtkTreeViewColumnCellInfo *
......@@ -1068,7 +1068,7 @@ gtk_tree_view_column_get_cell_info (GtkTreeViewColumn *tree_column,
}
/**
* gtk_tree_view_column_pack_start_cell_renderer:
* gtk_tree_view_column_pack_start:
* @tree_column: A #GtkTreeViewColumn.
* @cell: The #GtkCellRenderer,
* @expand: TRUE if @cell is to be given extra space allocated to box.
......@@ -1078,11 +1078,11 @@ gtk_tree_view_column_get_cell_info (GtkTreeViewColumn *tree_column,
* Packs a cell into
**/
void
gtk_tree_view_column_pack_start_cell_renderer (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding)
gtk_tree_view_column_pack_start (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding)
{
GtkTreeViewColumnCellInfo *cell_info;
......@@ -1104,11 +1104,11 @@ gtk_tree_view_column_pack_start_cell_renderer (GtkTreeViewColumn *tree_column,
}
void
gtk_tree_view_column_pack_end_cell_renderer (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding)
gtk_tree_view_column_pack_end (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding)
{
GtkTreeViewColumnCellInfo *cell_info;
......@@ -1131,7 +1131,7 @@ gtk_tree_view_column_pack_end_cell_renderer (GtkTreeViewColumn *tree_column,
void
gtk_tree_view_column_clear_cell_renderers (GtkTreeViewColumn *tree_column)
gtk_tree_view_column_clear (GtkTreeViewColumn *tree_column)
{
GList *list;
g_return_if_fail (tree_column != NULL);
......@@ -1502,7 +1502,8 @@ gtk_tree_view_column_set_width (GtkTreeViewColumn *tree_column,
* gtk_tree_view_column_get_width:
* @tree_column: a #GtkTreeViewColumn
*
* Gets the value set by gtk_tree_view_column_set_width().
* Gets the value set by gtk_tree_view_column_set_width(). This may not be the
* actual width of the column on the screen, just what is requested.
*
* Return value: the width of the column
**/
......@@ -1587,7 +1588,9 @@ gtk_tree_view_column_get_min_width (GtkTreeViewColumn *tree_column)
* @max_width: The maximum width of the column in pixels, or -1.
*
* Sets the maximum width of the @tree_column. If @max_width is -1, then the
* maximum width is unset.
* maximum width is unset. Note, the column can actually be wider than max
* width if it's the last column in a view. In this case, the column expands to
* fill the view.
**/
void
gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
......
......@@ -110,18 +110,18 @@ GtkTreeViewColumn *gtk_tree_view_column_new_with_attributes (const gchar
...);
void gtk_tree_view_column_set_cell_renderer (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell);
void gtk_tree_view_column_pack_start_cell_renderer (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding);
void gtk_tree_view_column_pack_end_cell_renderer (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding);
void gtk_tree_view_column_clear_cell_renderers (GtkTreeViewColumn *tree_column);
GList *gtk_tree_view_column_get_cell_renderers (GtkTreeViewColumn *tree_column);
void gtk_tree_view_column_pack_start (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding);
void gtk_tree_view_column_pack_end (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
gboolean expand,
gboolean fill,
guint padding);
void gtk_tree_view_column_clear (GtkTreeViewColumn *tree_column);
GList *gtk_tree_view_column_get_cell_renderers (GtkTreeViewColumn *tree_column);
void gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell_renderer,
const gchar *attribute,
......
Markdown is supported
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