Commit 0d93b643 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

handle rtl code.

Sun Mar  2 23:35:57 2003  Jonathan Blandford  <jrb@gnome.org>

	* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
	handle rtl code.

	* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto

	* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto

	* gtk/gtktreeview.c: (invalidate_column),
	(invalidate_last_column),
	(gtk_tree_view_get_real_requested_width_from_column),
	(gtk_tree_view_size_allocate_columns),
	(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
	(gtk_tree_view_button_release_drag_column),
	(gtk_tree_view_update_current_reorder),
	(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
	(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
	(gtk_tree_view_get_background_xrange),
	(gtk_tree_view_get_arrow_xrange),
	(gtk_tree_view_is_expander_column),
	(gtk_tree_view_set_column_drag_info),
	(gtk_tree_view_move_cursor_left_right):
	Add RTL support.

	* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
	expand flag.

	* gtk/gtktreeviewcolumn.c:
	(gtk_tree_view_column_class_init),
	(gtk_tree_view_column_set_property),
	(gtk_tree_view_column_get_property),
	(gtk_tree_view_column_set_expand),
	(gtk_tree_view_column_get_expand),
	(gtk_tree_view_column_cell_process_action):
	Add support for expand flag
parent 770996f9
Sun Mar 2 23:35:57 2003 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
handle rtl code.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto
* gtk/gtktreeview.c: (invalidate_column),
(invalidate_last_column),
(gtk_tree_view_get_real_requested_width_from_column),
(gtk_tree_view_size_allocate_columns),
(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
(gtk_tree_view_button_release_drag_column),
(gtk_tree_view_update_current_reorder),
(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
(gtk_tree_view_get_background_xrange),
(gtk_tree_view_get_arrow_xrange),
(gtk_tree_view_is_expander_column),
(gtk_tree_view_set_column_drag_info),
(gtk_tree_view_move_cursor_left_right):
Add RTL support.
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
expand flag.
* gtk/gtktreeviewcolumn.c:
(gtk_tree_view_column_class_init),
(gtk_tree_view_column_set_property),
(gtk_tree_view_column_get_property),
(gtk_tree_view_column_set_expand),
(gtk_tree_view_column_get_expand),
(gtk_tree_view_column_cell_process_action):
Add support for expand flag
Fri Feb 28 02:06:17 2003 Jonathan Blandford <jrb@gnome.org>
2003-03-02 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def
......
Sun Mar 2 23:35:57 2003 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
handle rtl code.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto
* gtk/gtktreeview.c: (invalidate_column),
(invalidate_last_column),
(gtk_tree_view_get_real_requested_width_from_column),
(gtk_tree_view_size_allocate_columns),
(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
(gtk_tree_view_button_release_drag_column),
(gtk_tree_view_update_current_reorder),
(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
(gtk_tree_view_get_background_xrange),
(gtk_tree_view_get_arrow_xrange),
(gtk_tree_view_is_expander_column),
(gtk_tree_view_set_column_drag_info),
(gtk_tree_view_move_cursor_left_right):
Add RTL support.
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
expand flag.
* gtk/gtktreeviewcolumn.c:
(gtk_tree_view_column_class_init),
(gtk_tree_view_column_set_property),
(gtk_tree_view_column_get_property),
(gtk_tree_view_column_set_expand),
(gtk_tree_view_column_get_expand),
(gtk_tree_view_column_cell_process_action):
Add support for expand flag
Fri Feb 28 02:06:17 2003 Jonathan Blandford <jrb@gnome.org>
2003-03-02 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def
......
Sun Mar 2 23:35:57 2003 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
handle rtl code.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto
* gtk/gtktreeview.c: (invalidate_column),
(invalidate_last_column),
(gtk_tree_view_get_real_requested_width_from_column),
(gtk_tree_view_size_allocate_columns),
(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
(gtk_tree_view_button_release_drag_column),
(gtk_tree_view_update_current_reorder),
(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
(gtk_tree_view_get_background_xrange),
(gtk_tree_view_get_arrow_xrange),
(gtk_tree_view_is_expander_column),
(gtk_tree_view_set_column_drag_info),
(gtk_tree_view_move_cursor_left_right):
Add RTL support.
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
expand flag.
* gtk/gtktreeviewcolumn.c:
(gtk_tree_view_column_class_init),
(gtk_tree_view_column_set_property),
(gtk_tree_view_column_get_property),
(gtk_tree_view_column_set_expand),
(gtk_tree_view_column_get_expand),
(gtk_tree_view_column_cell_process_action):
Add support for expand flag
Fri Feb 28 02:06:17 2003 Jonathan Blandford <jrb@gnome.org>
2003-03-02 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def
......
Sun Mar 2 23:35:57 2003 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
handle rtl code.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto
* gtk/gtktreeview.c: (invalidate_column),
(invalidate_last_column),
(gtk_tree_view_get_real_requested_width_from_column),
(gtk_tree_view_size_allocate_columns),
(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
(gtk_tree_view_button_release_drag_column),
(gtk_tree_view_update_current_reorder),
(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
(gtk_tree_view_get_background_xrange),
(gtk_tree_view_get_arrow_xrange),
(gtk_tree_view_is_expander_column),
(gtk_tree_view_set_column_drag_info),
(gtk_tree_view_move_cursor_left_right):
Add RTL support.
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
expand flag.
* gtk/gtktreeviewcolumn.c:
(gtk_tree_view_column_class_init),
(gtk_tree_view_column_set_property),
(gtk_tree_view_column_get_property),
(gtk_tree_view_column_set_expand),
(gtk_tree_view_column_get_expand),
(gtk_tree_view_column_cell_process_action):
Add support for expand flag
Fri Feb 28 02:06:17 2003 Jonathan Blandford <jrb@gnome.org>
2003-03-02 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def
......
Sun Mar 2 23:35:57 2003 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
handle rtl code.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto
* gtk/gtktreeview.c: (invalidate_column),
(invalidate_last_column),
(gtk_tree_view_get_real_requested_width_from_column),
(gtk_tree_view_size_allocate_columns),
(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
(gtk_tree_view_button_release_drag_column),
(gtk_tree_view_update_current_reorder),
(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
(gtk_tree_view_get_background_xrange),
(gtk_tree_view_get_arrow_xrange),
(gtk_tree_view_is_expander_column),
(gtk_tree_view_set_column_drag_info),
(gtk_tree_view_move_cursor_left_right):
Add RTL support.
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
expand flag.
* gtk/gtktreeviewcolumn.c:
(gtk_tree_view_column_class_init),
(gtk_tree_view_column_set_property),
(gtk_tree_view_column_get_property),
(gtk_tree_view_column_set_expand),
(gtk_tree_view_column_get_expand),
(gtk_tree_view_column_cell_process_action):
Add support for expand flag
Fri Feb 28 02:06:17 2003 Jonathan Blandford <jrb@gnome.org>
2003-03-02 Tor Lillqvist <tml@iki.fi>
* gdk/gdk.def
......
......@@ -284,6 +284,7 @@ Modules supporting animations must derive a type from
virtual functions.
</para>
@parent_class:
@is_static_image: returns whether the given animation is just a static image.
@get_static_image: returns a static image representing the given animation.
@get_size: fills @width and @height with the frame size of the animation.
......@@ -296,6 +297,7 @@ Modules supporting animations must derive a type from
virtual functions.
</para>
@parent_class:
@get_delay_time: returns the time in milliseconds that the current frame
should be shown.
@get_pixbuf: returns the current frame.
......
......@@ -204,6 +204,7 @@ Used for justifying the text inside a #GtkLabel widget. (See also
@GTK_MOVEMENT_PARAGRAPH_ENDS:
@GTK_MOVEMENT_PAGES:
@GTK_MOVEMENT_BUFFER_ENDS:
@GTK_MOVEMENT_HORIZONTAL_PAGES:
<!-- ##### ENUM GtkOrientation ##### -->
<para>
......
......@@ -118,6 +118,26 @@ The #GtkFileSelection struct contains the following #GtkWidget fields:
</para>
@dir_list:
@file_list:
@selection_entry:
@selection_text:
@main_vbox:
@ok_button:
@cancel_button:
@help_button:
@history_pulldown:
@history_menu:
@history_list:
@fileop_dialog:
@fileop_entry:
@fileop_file:
@cmpl_state:
@fileop_c_dir:
@fileop_del_file:
@fileop_ren_file:
@button_area:
@action_area:
<!-- ##### FUNCTION gtk_file_selection_new ##### -->
<para>
......
......@@ -458,6 +458,7 @@ point the timeout is destroyed and will not be called again.
@Returns: A unique id for the event source.
@Deprecated: Use g_timeout_add_full() instead.
<!-- ##### FUNCTION gtk_timeout_add ##### -->
<para>
Registers a function to be called periodically. The function will be called
......@@ -472,6 +473,7 @@ point the timeout is destroyed and will not be called again.
@Returns: A unique id for the event source.
@Deprecated: Use g_timeout_add() instead.
<!-- ##### FUNCTION gtk_timeout_remove ##### -->
<para>
Removes the given timeout destroying all information about it.
......@@ -509,6 +511,7 @@ Note that you will interfere with GTK+ if you use a priority above
@Returns: A unique id for the event source.
@Deprecated: Use g_idle_add_full() instead.
<!-- ##### FUNCTION gtk_idle_add_full ##### -->
<para>
Like gtk_idle_add() this function allows you to have a function called
......@@ -561,6 +564,7 @@ on a file descriptor.
@Returns: A unique id for the event source; to be used with gtk_input_remove().
@Deprecated: Use g_io_watch_full() instead.
<!-- ##### FUNCTION gtk_input_remove ##### -->
<para>
Removes the function with the given id.
......
......@@ -587,6 +587,82 @@ types related to the text widget and how they work together.
@Returns:
<!-- ##### FUNCTION gtk_text_iter_forward_visible_word_ends ##### -->
<para>
</para>
@iter:
@count:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_backward_visible_word_starts ##### -->
<para>
</para>
@iter:
@count:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_forward_visible_word_end ##### -->
<para>
</para>
@iter:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_backward_visible_word_start ##### -->
<para>
</para>
@iter:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_forward_visible_cursor_position ##### -->
<para>
</para>
@iter:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_backward_visible_cursor_position ##### -->
<para>
</para>
@iter:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_forward_visible_cursor_positions ##### -->
<para>
</para>
@iter:
@count:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_backward_visible_cursor_positions ##### -->
<para>
</para>
@iter:
@count:
@Returns:
<!-- ##### FUNCTION gtk_text_iter_set_offset ##### -->
<para>
......
......@@ -497,6 +497,11 @@ calling gtk_tree_view_column_set_cell_data_func()
</para>
<!-- ##### ARG GtkTreeViewColumn:expand ##### -->
<para>
</para>
<!-- ##### ARG GtkTreeViewColumn:fixed-width ##### -->
<para>
......
......@@ -49,6 +49,7 @@ handles the emission.
Implementation of this signal is optional.
</para>
@parent_class:
@activate_signal:
@set_scroll_adjustments_signal:
......
......@@ -382,7 +382,8 @@ gtk_cell_renderer_pixbuf_get_size (GtkCellRenderer *cell,
{
if (x_offset)
{
*x_offset = GTK_CELL_RENDERER (cellpixbuf)->xalign * (cell_area->width - calc_width - (2 * GTK_CELL_RENDERER (cellpixbuf)->xpad));
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - GTK_CELL_RENDERER (cellpixbuf)->xalign) : GTK_CELL_RENDERER (cellpixbuf)->xalign) * (cell_area->width - calc_width - (2 * GTK_CELL_RENDERER (cellpixbuf)->xpad));
*x_offset = MAX (*x_offset, 0) + GTK_CELL_RENDERER (cellpixbuf)->xpad;
}
if (y_offset)
......
......@@ -1237,7 +1237,8 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
{
if (x_offset)
{
*x_offset = cell->xalign * (cell_area->width - rect.width - (2 * cell->xpad));
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign) * (cell_area->width - rect.width - (2 * cell->xpad));
*x_offset = MAX (*x_offset, 0);
}
if (y_offset)
......
......@@ -294,7 +294,8 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
{
if (x_offset)
{
*x_offset = cell->xalign * (cell_area->width - calc_width);
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
(1.0 - cell->xalign) : cell->xalign) * (cell_area->width - calc_width);
*x_offset = MAX (*x_offset, 0);
}
if (y_offset)
......
......@@ -1462,6 +1462,7 @@ gtk_tree_view_size_request_columns (GtkTreeView *tree_view)
}
/* Called only by ::size_request */
static void
gtk_tree_view_update_size (GtkTreeView *tree_view)
{
......@@ -1558,11 +1559,15 @@ invalidate_column (GtkTreeView *tree_view,
gint column_offset = 0;
GList *list;
GtkWidget *widget = GTK_WIDGET (tree_view);
gboolean rtl;
if (!GTK_WIDGET_REALIZED (widget))
return;
for (list = tree_view->priv->columns; list; list = list->next)
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
list;
list = (rtl ? list->prev : list->next))
{
GtkTreeViewColumn *tmpcolumn = list->data;
if (tmpcolumn == column)
......@@ -1586,9 +1591,13 @@ static void
invalidate_last_column (GtkTreeView *tree_view)
{
GList *last_column;
gboolean rtl;
for (last_column = g_list_last (tree_view->priv->columns);
last_column; last_column = last_column->prev)
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
for (last_column = (rtl ? g_list_first (tree_view->priv->columns) : g_list_last (tree_view->priv->columns));
last_column;
last_column = (rtl ? last_column->next : last_column->prev))
{
if (GTK_TREE_VIEW_COLUMN (last_column->data)->visible)
{
......@@ -1598,16 +1607,53 @@ invalidate_last_column (GtkTreeView *tree_view)
}
}
static gint
gtk_tree_view_get_real_requested_width_from_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column)
{
gint real_requested_width;
if (column->use_resized_width)
{
real_requested_width = column->resized_width;
}
else if (column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
{
real_requested_width = column->fixed_width;
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
real_requested_width = MAX (column->requested_width, column->button_request);
}
else
{
real_requested_width = column->requested_width;
if (real_requested_width < 0)
real_requested_width = 0;
}
if (column->min_width != -1)
real_requested_width = MAX (real_requested_width, column->min_width);
if (column->max_width != -1)
real_requested_width = MIN (real_requested_width, column->max_width);
return real_requested_width;
}
/* GtkWidget::size_allocate helper */
static void
gtk_tree_view_size_allocate_columns (GtkWidget *widget)
{
GtkTreeView *tree_view;
GList *list, *last_column;
GList *list, *first_column, *last_column;
GtkTreeViewColumn *column;
GtkAllocation allocation;
gint width = 0;
gint extra, extra_per_column;
gint full_requested_width = 0;
gint number_of_expand_columns = 0;
gboolean rtl;
tree_view = GTK_TREE_VIEW (widget);
for (last_column = g_list_last (tree_view->priv->columns);
......@@ -1617,10 +1663,39 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget)
if (last_column == NULL)
return;
for (first_column = g_list_first (tree_view->priv->columns);
first_column && !(GTK_TREE_VIEW_COLUMN (first_column->data)->visible);
first_column = first_column->next)
;
allocation.y = 0;
allocation.height = tree_view->priv->header_height;
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
/* find out how many extra space and expandable columns we have */
for (list = tree_view->priv->columns; list != last_column->next; list = list->next)
{
column = (GtkTreeViewColumn *)list->data;
if (!column->visible)
continue;
full_requested_width += gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
if (column->expand)
number_of_expand_columns++;
}
extra = MAX (widget->allocation.width - full_requested_width, 0);
if (number_of_expand_columns > 0)
extra_per_column = extra/number_of_expand_columns;
else
extra_per_column = 0;
for (list = (rtl ? last_column : first_column);
list != (rtl ? first_column->prev : last_column->next);
list = (rtl ? list->prev : list->next))
{
gint real_requested_width = 0;
gint old_width;
......@@ -1647,37 +1722,30 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget)
continue;
}
if (column->use_resized_width)
{
real_requested_width = column->resized_width;
}
else if (column->column_type == GTK_TREE_VIEW_COLUMN_FIXED)
{
real_requested_width = column->fixed_width;
}
else if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
{
real_requested_width = MAX (column->requested_width, column->button_request);
}
else
{
real_requested_width = column->requested_width;
if (real_requested_width < 0)
real_requested_width = 0;
}
if (column->min_width != -1)
real_requested_width = MAX (real_requested_width, column->min_width);
if (column->max_width != -1)
real_requested_width = MIN (real_requested_width, column->max_width);
real_requested_width = gtk_tree_view_get_real_requested_width_from_column (tree_view, column);
allocation.x = width;
column->width = real_requested_width;
if (list == last_column &&
width + real_requested_width < widget->allocation.width)
if (column->expand)
{
column->width += (widget->allocation.width - column->width - width);
if (number_of_expand_columns == 1)
{
/* We add the remander to the last column as
* */
column->width += extra;
}
else
{
column->width += extra_per_column;
extra -= extra_per_column;
number_of_expand_columns --;
}
}
else if (number_of_expand_columns == 0 &&
list == last_column)
{