forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
770996f949
commit
0d93b6432d
40
ChangeLog
40
ChangeLog
@ -1,3 +1,43 @@
|
||||
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
|
||||
|
@ -1,3 +1,43 @@
|
||||
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
|
||||
|
@ -1,3 +1,43 @@
|
||||
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
|
||||
|
@ -1,3 +1,43 @@
|
||||
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
|
||||
|
@ -1,3 +1,43 @@
|
||||
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)
|
||||
{
|
||||
column->width += extra;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (column), "width");
|
||||
@ -1781,8 +1849,26 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
gboolean has_expand_column = FALSE;
|
||||
for (tmp_list = tree_view->priv->columns; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
if (gtk_tree_view_column_get_expand (GTK_TREE_VIEW_COLUMN (tmp_list->data)))
|
||||
{
|
||||
has_expand_column = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* This little hack only works if we have an LTR locale, and no column has the */
|
||||
if (width_changed)
|
||||
invalidate_last_column (tree_view);
|
||||
{
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_LTR &&
|
||||
! has_expand_column)
|
||||
invalidate_last_column (tree_view);
|
||||
else
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
if (dy_changed)
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
@ -1827,6 +1913,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
GtkCellRenderer *focus_cell = NULL;
|
||||
gint column_handled_click = FALSE;
|
||||
gboolean emit_row_activated = FALSE;
|
||||
gboolean rtl;
|
||||
|
||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
@ -1869,7 +1956,9 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
background_area.x = 0;
|
||||
|
||||
/* Let the column have a chance at selecting it. */
|
||||
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))
|
||||
{
|
||||
column = list->data;
|
||||
|
||||
@ -2115,9 +2204,11 @@ gtk_tree_view_button_release_drag_column (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkTreeView *tree_view;
|
||||
gboolean rtl;
|
||||
|
||||
tree_view = GTK_TREE_VIEW (widget);
|
||||
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
gdk_display_pointer_ungrab (gtk_widget_get_display (widget), GDK_CURRENT_TIME);
|
||||
gdk_display_keyboard_ungrab (gtk_widget_get_display (widget), GDK_CURRENT_TIME);
|
||||
|
||||
@ -2138,10 +2229,20 @@ gtk_tree_view_button_release_drag_column (GtkWidget *widget,
|
||||
|
||||
gtk_widget_grab_focus (tree_view->priv->drag_column->button);
|
||||
|
||||
if (tree_view->priv->cur_reorder &&
|
||||
tree_view->priv->cur_reorder->left_column != tree_view->priv->drag_column)
|
||||
gtk_tree_view_move_column_after (tree_view, tree_view->priv->drag_column,
|
||||
tree_view->priv->cur_reorder->left_column);
|
||||
if (rtl)
|
||||
{
|
||||
if (tree_view->priv->cur_reorder &&
|
||||
tree_view->priv->cur_reorder->right_column != tree_view->priv->drag_column)
|
||||
gtk_tree_view_move_column_after (tree_view, tree_view->priv->drag_column,
|
||||
tree_view->priv->cur_reorder->right_column);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tree_view->priv->cur_reorder &&
|
||||
tree_view->priv->cur_reorder->left_column != tree_view->priv->drag_column)
|
||||
gtk_tree_view_move_column_after (tree_view, tree_view->priv->drag_column,
|
||||
tree_view->priv->cur_reorder->left_column);
|
||||
}
|
||||
tree_view->priv->drag_column = NULL;
|
||||
gdk_window_hide (tree_view->priv->drag_window);
|
||||
|
||||
@ -2643,7 +2744,6 @@ gtk_tree_view_update_current_reorder (GtkTreeView *tree_view)
|
||||
gint mouse_x;
|
||||
|
||||
gdk_window_get_pointer (tree_view->priv->header_window, &mouse_x, NULL, NULL);
|
||||
|
||||
for (list = tree_view->priv->column_drag_info; list; list = list->next)
|
||||
{
|
||||
reorder = (GtkTreeViewColumnReorder *) list->data;
|
||||
@ -2734,7 +2834,7 @@ gtk_tree_view_motion_drag_column (GtkWidget *widget,
|
||||
x = CLAMP (x + (gint)event->x - column->drag_x, 0,
|
||||
MAX (tree_view->priv->width, GTK_WIDGET (tree_view)->allocation.width) - column->button->allocation.width);
|
||||
gdk_window_move (tree_view->priv->drag_window, x, y);
|
||||
|
||||
|
||||
/* autoscroll, if needed */
|
||||
gtk_tree_view_horizontal_autoscroll (tree_view);
|
||||
/* Update the current reorder position and arrow; */
|
||||
@ -2873,9 +2973,12 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
gint focus_line_width;
|
||||
gboolean allow_rules;
|
||||
gboolean has_special_cell;
|
||||
gboolean rtl;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), FALSE);
|
||||
|
||||
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
tree_view = GTK_TREE_VIEW (widget);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
@ -2933,11 +3036,11 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
gdk_drawable_get_size (tree_view->priv->bin_window,
|
||||
&bin_window_width, NULL);
|
||||
|
||||
for (last_column = g_list_last (tree_view->priv->columns);
|
||||
for (last_column = rtl ? g_list_first (tree_view->priv->columns) : g_list_last (tree_view->priv->columns);
|
||||
last_column &&
|
||||
!(GTK_TREE_VIEW_COLUMN (last_column->data)->visible) &&
|
||||
GTK_WIDGET_CAN_FOCUS (GTK_TREE_VIEW_COLUMN (last_column->data)->button);
|
||||
last_column = last_column->prev)
|
||||
last_column = rtl ? last_column->next : last_column->prev)
|
||||
;
|
||||
|
||||
/* Actually process the expose event. To do this, we want to
|
||||
@ -2970,7 +3073,9 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
|
||||
has_special_cell = gtk_tree_view_has_special_cell (tree_view);
|
||||
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
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 *column = list->data;
|
||||
const gchar *detail = NULL;
|
||||
@ -3074,7 +3179,8 @@ gtk_tree_view_bin_expose (GtkWidget *widget,
|
||||
if (gtk_tree_view_is_expander_column (tree_view, column) &&
|
||||
TREE_VIEW_DRAW_EXPANDERS(tree_view))
|
||||
{
|
||||
cell_area.x += depth * tree_view->priv->expander_size;
|
||||
if (!rtl)
|
||||
cell_area.x += depth * tree_view->priv->expander_size;
|
||||
cell_area.width -= depth * tree_view->priv->expander_size;
|
||||
|
||||
/* If we have an expander column, the highlight underline
|
||||
@ -3531,6 +3637,9 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
{
|
||||
GtkTreeView *tree_view = (GtkTreeView *) widget;
|
||||
GList *list;
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
if (GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_IN_COLUMN_DRAG))
|
||||
{
|
||||
@ -3542,7 +3651,6 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* FIXME: this is prolly broken when we go bidi */
|
||||
if (tree_view->priv->columns && (event->state & GDK_SHIFT_MASK)
|
||||
&& (event->keyval == GDK_Left || event->keyval == GDK_Right))
|
||||
{
|
||||
@ -3593,7 +3701,6 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: broken when we go bidi? */
|
||||
if (tree_view->priv->columns && (event->state & GDK_CONTROL_MASK) &&
|
||||
(event->keyval == GDK_Left || event->keyval == GDK_Right
|
||||
|| event->keyval == GDK_Home || event->keyval == GDK_End))
|
||||
@ -3604,7 +3711,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data);
|
||||
if (GTK_WIDGET_HAS_FOCUS (column->button))
|
||||
{
|
||||
if (event->keyval == GDK_Left)
|
||||
if (event->keyval == (rtl ? GDK_Right : GDK_Left))
|
||||
{
|
||||
GtkTreeViewColumn *col;
|
||||
col = gtk_tree_view_get_drop_column (tree_view, column, DROP_LEFT);
|
||||
@ -3612,7 +3719,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
gtk_tree_view_move_column_after (tree_view, column, col);
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->keyval == GDK_Right)
|
||||
else if (event->keyval == (rtl ? GDK_Left : GDK_Right))
|
||||
{
|
||||
GtkTreeViewColumn *col;
|
||||
col = gtk_tree_view_get_drop_column (tree_view, column, DROP_RIGHT);
|
||||
@ -3641,7 +3748,6 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: this is prolly broken when we go bidi */
|
||||
if (tree_view->priv->columns &&
|
||||
GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE) &&
|
||||
(event->keyval == GDK_Left || event->keyval == GDK_Right))
|
||||
@ -3653,7 +3759,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN (list->data);
|
||||
if (GTK_WIDGET_HAS_FOCUS (column->button))
|
||||
{
|
||||
if (event->keyval == GDK_Left && list->prev)
|
||||
if (event->keyval == (rtl ? GDK_Right : GDK_Left) && list->prev)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
@ -3670,7 +3776,7 @@ gtk_tree_view_key_press (GtkWidget *widget,
|
||||
gtk_adjustment_set_value (tree_view->priv->hadjustment, CLAMP (width, tree_view->priv->hadjustment->lower, tree_view->priv->hadjustment->upper - tree_view->priv->hadjustment->page_size));
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->keyval == GDK_Right && list->next)
|
||||
else if (event->keyval == (rtl ? GDK_Left : GDK_Right) && list->next)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
@ -5509,6 +5615,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
|
||||
|
||||
GList *last_column, *first_column;
|
||||
GList *tmp_list;
|
||||
gboolean rtl;
|
||||
|
||||
if (! GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_HEADERS_VISIBLE))
|
||||
return FALSE;
|
||||
@ -5544,6 +5651,13 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
|
||||
}
|
||||
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
if (rtl) {
|
||||
GList *temp = first_column;
|
||||
first_column = last_column;
|
||||
last_column = temp;
|
||||
}
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case GTK_DIR_TAB_BACKWARD:
|
||||
@ -6366,6 +6480,7 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
|
||||
GtkTreeViewColumn *tmp_column = NULL;
|
||||
gint total_width;
|
||||
GList *list;
|
||||
gboolean rtl;
|
||||
|
||||
if (x1)
|
||||
*x1 = 0;
|
||||
@ -6373,8 +6488,12 @@ gtk_tree_view_get_background_xrange (GtkTreeView *tree_view,
|
||||
if (x2)
|
||||
*x2 = 0;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
total_width = 0;
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list;
|
||||
list = (rtl ? list->prev : list->next))
|
||||
{
|
||||
tmp_column = list->data;
|
||||
|
||||
@ -6413,15 +6532,23 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
|
||||
GtkTreeViewColumn *tmp_column = NULL;
|
||||
gint total_width;
|
||||
gboolean indent_expanders;
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
total_width = 0;
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list;
|
||||
list = (rtl ? list->prev : list->next))
|
||||
{
|
||||
tmp_column = list->data;
|
||||
|
||||
if (gtk_tree_view_is_expander_column (tree_view, tmp_column))
|
||||
{
|
||||
x_offset = total_width;
|
||||
if (rtl)
|
||||
x_offset = total_width + tmp_column->width - tree_view->priv->expander_size;
|
||||
else
|
||||
x_offset = total_width;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6434,22 +6561,28 @@ gtk_tree_view_get_arrow_xrange (GtkTreeView *tree_view,
|
||||
NULL);
|
||||
|
||||
if (indent_expanders)
|
||||
x_offset += tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
|
||||
|
||||
{
|
||||
if (rtl)
|
||||
x_offset -= tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
|
||||
else
|
||||
x_offset += tree_view->priv->expander_size * _gtk_rbtree_get_depth (tree);
|
||||
}
|
||||
if (x1)
|
||||
*x1 = x_offset;
|
||||
{
|
||||
*x1 = x_offset;
|
||||
}
|
||||
|
||||
if (tmp_column && tmp_column->visible)
|
||||
{
|
||||
/* +1 because x2 isn't included in the range. */
|
||||
if (x2)
|
||||
*x2 = x_offset + tree_view->priv->expander_size + 1;
|
||||
*x2 = *x1 + tree_view->priv->expander_size + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* return an empty range, the expander column is hidden */
|
||||
if (x2)
|
||||
*x2 = x_offset;
|
||||
*x2 = *x1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6755,7 +6888,9 @@ gtk_tree_view_is_expander_column (GtkTreeView *tree_view,
|
||||
}
|
||||
else
|
||||
{
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
for (list = tree_view->priv->columns;
|
||||
list;
|
||||
list = list->next)
|
||||
if (((GtkTreeViewColumn *)list->data)->visible)
|
||||
break;
|
||||
if (list && list->data == column)
|
||||
@ -6868,7 +7003,7 @@ gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
|
||||
GtkTreeViewColumn *left_column;
|
||||
GtkTreeViewColumn *cur_column = NULL;
|
||||
GtkTreeViewColumnReorder *reorder;
|
||||
|
||||
gboolean rtl;
|
||||
GList *tmp_list;
|
||||
gint left;
|
||||
|
||||
@ -6876,16 +7011,18 @@ gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
|
||||
* are available.
|
||||
*/
|
||||
left_column = NULL;
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
/* First, identify all possible drop spots */
|
||||
tmp_list = tree_view->priv->columns;
|
||||
if (rtl)
|
||||
tmp_list = g_list_last (tree_view->priv->columns);
|
||||
else
|
||||
tmp_list = g_list_first (tree_view->priv->columns);
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
g_assert (tmp_list);
|
||||
|
||||
cur_column = GTK_TREE_VIEW_COLUMN (tmp_list->data);
|
||||
tmp_list = tmp_list->next;
|
||||
tmp_list = rtl?g_list_previous (tmp_list):g_list_next (tmp_list);
|
||||
|
||||
if (cur_column->visible == FALSE)
|
||||
continue;
|
||||
@ -7365,6 +7502,9 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
|
||||
GtkTreeIter iter;
|
||||
GList *list;
|
||||
gboolean found_column = FALSE;
|
||||
gboolean rtl;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
if (! GTK_WIDGET_HAS_FOCUS (tree_view))
|
||||
return;
|
||||
@ -7415,9 +7555,9 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
|
||||
}
|
||||
loop_end:
|
||||
if (count == 1)
|
||||
list = list->next;
|
||||
list = rtl ? list->prev : list->next;
|
||||
else
|
||||
list = list->prev;
|
||||
list = rtl ? list->next : list->prev;
|
||||
}
|
||||
|
||||
if (found_column)
|
||||
|
@ -40,6 +40,7 @@ enum
|
||||
PROP_MIN_WIDTH,
|
||||
PROP_MAX_WIDTH,
|
||||
PROP_TITLE,
|
||||
PROP_EXPAND,
|
||||
PROP_CLICKABLE,
|
||||
PROP_WIDGET,
|
||||
PROP_ALIGNMENT,
|
||||
@ -251,6 +252,14 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
|
||||
"",
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_EXPAND,
|
||||
g_param_spec_boolean ("expand",
|
||||
_("Expand"),
|
||||
_("Column gets share of extra width allocated to the widget"),
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_CLICKABLE,
|
||||
g_param_spec_boolean ("clickable",
|
||||
@ -409,6 +418,11 @@ gtk_tree_view_column_set_property (GObject *object,
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
|
||||
case PROP_EXPAND:
|
||||
gtk_tree_view_column_set_expand (tree_column,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_CLICKABLE:
|
||||
gtk_tree_view_column_set_clickable (tree_column,
|
||||
g_value_get_boolean (value));
|
||||
@ -497,6 +511,11 @@ gtk_tree_view_column_get_property (GObject *object,
|
||||
gtk_tree_view_column_get_title (tree_column));
|
||||
break;
|
||||
|
||||
case PROP_EXPAND:
|
||||
g_value_set_boolean (value,
|
||||
gtk_tree_view_column_get_expand (tree_column));
|
||||
break;
|
||||
|
||||
case PROP_CLICKABLE:
|
||||
g_value_set_boolean (value,
|
||||
gtk_tree_view_column_get_clickable (tree_column));
|
||||
@ -1928,6 +1947,53 @@ gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column)
|
||||
return tree_column->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_view_column_set_expand:
|
||||
* @tree_column: A #GtkTreeViewColumn
|
||||
* @expand:
|
||||
*
|
||||
* Sets the column to take available extra space. This space is shared equally
|
||||
* amongst all columns that have the expand set to %TRUE. If no column has this
|
||||
* option set, then the last column gets all extra space. By default, every
|
||||
* column is created with this %FALSE.
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_column_set_expand (GtkTreeViewColumn *tree_column,
|
||||
gboolean expand)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
||||
|
||||
expand = expand?TRUE:FALSE;
|
||||
if (tree_column->expand == expand)
|
||||
return;
|
||||
tree_column->expand = expand;
|
||||
|
||||
if (tree_column->visible &&
|
||||
tree_column->tree_view != NULL &&
|
||||
GTK_WIDGET_REALIZED (tree_column->tree_view))
|
||||
{
|
||||
gtk_widget_queue_resize (tree_column->tree_view);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (tree_column), "expand");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_view_column_get_expand:
|
||||
* @tree_column:
|
||||
*
|
||||
* Return %TRUE if the column expands to take any available space.
|
||||
*
|
||||
* Return value: %TRUE, if the column expands
|
||||
**/
|
||||
gboolean
|
||||
gtk_tree_view_column_get_expand (GtkTreeViewColumn *tree_column)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
|
||||
|
||||
return tree_column->expand;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_view_column_set_clickable:
|
||||
* @tree_column: A #GtkTreeViewColumn.
|
||||
@ -2381,9 +2447,9 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
|
||||
}
|
||||
}
|
||||
|
||||
/* both rendering and rendering focus are somewhat complicated, and a bit of
|
||||
* code. Rather than duplicate them, we put them together to keep the code in
|
||||
* one place
|
||||
/* rendering, event handling and rendering focus are somewhat complicated, and
|
||||
* quite a bit of code. Rather than duplicate them, we put them together to
|
||||
* keep the code in one place.
|
||||
*/
|
||||
enum {
|
||||
CELL_ACTION_RENDER,
|
||||
@ -2414,12 +2480,17 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
gint focus_line_width;
|
||||
gint dx;
|
||||
gint special_cells;
|
||||
gboolean rtl;
|
||||
/* If we have rtl text, we need to transform our areas */
|
||||
GdkRectangle rtl_cell_area;
|
||||
GdkRectangle rtl_background_area;
|
||||
|
||||
min_x = G_MAXINT;
|
||||
min_y = G_MAXINT;
|
||||
max_x = 0;
|
||||
max_y = 0;
|
||||
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_column->tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
special_cells = _gtk_tree_view_column_count_special_cells (tree_column);
|
||||
|
||||
if (special_cells > 1 && action == CELL_ACTION_FOCUS)
|
||||
@ -2452,7 +2523,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
|
||||
real_cell_area = *cell_area;
|
||||
real_background_area = *background_area;
|
||||
dx = real_cell_area.x - real_background_area.x - focus_line_width;
|
||||
/* HUH? dx = real_cell_area.x - real_background_area.x - focus_line_width; */
|
||||
|
||||
real_cell_area.x += focus_line_width;
|
||||
|
||||
@ -2469,7 +2540,8 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
full_requested_width += info->requested_width;
|
||||
}
|
||||
|
||||
extra_space = background_area->width - full_requested_width - dx;
|
||||
extra_space = cell_area->width - full_requested_width;
|
||||
|
||||
if (extra_space < 0)
|
||||
extra_space = 0;
|
||||
else if (extra_space > 0 && expand_cell_count > 0)
|
||||
@ -2496,23 +2568,34 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
real_cell_area.width = real_background_area.width;
|
||||
real_cell_area.width -= 2 * focus_line_width;
|
||||
|
||||
rtl_cell_area = real_cell_area;
|
||||
rtl_background_area = real_background_area;
|
||||
if (rtl)
|
||||
{
|
||||
rtl_cell_area.x = cell_area->x + cell_area->width - (real_cell_area.x - cell_area->x) - real_cell_area.width;
|
||||
rtl_background_area.x = background_area->x + background_area->width - (real_background_area.x - background_area->x) - real_background_area.width;
|
||||
}
|
||||
|
||||
/* RENDER */
|
||||
if (action == CELL_ACTION_RENDER)
|
||||
{
|
||||
gtk_cell_renderer_render (info->cell,
|
||||
window,
|
||||
tree_column->tree_view,
|
||||
&real_background_area,
|
||||
&real_cell_area,
|
||||
&rtl_background_area,
|
||||
&rtl_cell_area,
|
||||
expose_area,
|
||||
flags);
|
||||
}
|
||||
|
||||
/* FOCUS */
|
||||
else if (action == CELL_ACTION_FOCUS)
|
||||
{
|
||||
gint x_offset, y_offset, width, height;
|
||||
|
||||
gtk_cell_renderer_get_size (info->cell,
|
||||
tree_column->tree_view,
|
||||
&real_cell_area,
|
||||
&rtl_cell_area,
|
||||
&x_offset, &y_offset,
|
||||
&width, &height);
|
||||
|
||||
@ -2520,24 +2603,25 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
{
|
||||
if (info->has_focus)
|
||||
{
|
||||
min_x = real_cell_area.x + x_offset;
|
||||
min_x = rtl_cell_area.x + x_offset;
|
||||
max_x = min_x + width;
|
||||
min_y = real_cell_area.y + y_offset;
|
||||
min_y = rtl_cell_area.y + y_offset;
|
||||
max_y = min_y + height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (min_x > (real_cell_area.x + x_offset))
|
||||
min_x = real_cell_area.x + x_offset;
|
||||
if (max_x < real_cell_area.x + x_offset + width)
|
||||
max_x = real_cell_area.x + x_offset + width;
|
||||
if (min_y > (real_cell_area.y + y_offset))
|
||||
min_y = real_cell_area.y + y_offset;
|
||||
if (max_y < real_cell_area.y + y_offset + height)
|
||||
max_y = real_cell_area.y + y_offset + height;
|
||||
if (min_x > (rtl_cell_area.x + x_offset))
|
||||
min_x = rtl_cell_area.x + x_offset;
|
||||
if (max_x < rtl_cell_area.x + x_offset + width)
|
||||
max_x = rtl_cell_area.x + x_offset + width;
|
||||
if (min_y > (rtl_cell_area.y + y_offset))
|
||||
min_y = rtl_cell_area.y + y_offset;
|
||||
if (max_y < rtl_cell_area.y + y_offset + height)
|
||||
max_y = rtl_cell_area.y + y_offset + height;
|
||||
}
|
||||
}
|
||||
/* EVENT */
|
||||
else if (action == CELL_ACTION_EVENT)
|
||||
{
|
||||
gboolean try_event = FALSE;
|
||||
@ -2551,8 +2635,8 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
cell_area->x + cell_area->width > ((GdkEventButton *)event)->x)
|
||||
try_event = TRUE;
|
||||
}
|
||||
else if (real_cell_area.x <= ((GdkEventButton *)event)->x &&
|
||||
real_cell_area.x + real_cell_area.width > ((GdkEventButton *)event)->x)
|
||||
else if (rtl_cell_area.x <= ((GdkEventButton *)event)->x &&
|
||||
rtl_cell_area.x + rtl_cell_area.width > ((GdkEventButton *)event)->x)
|
||||
/* only activate cell if the user clicked on an individual
|
||||
* cell
|
||||
*/
|
||||
@ -2637,23 +2721,33 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
real_cell_area.width = real_background_area.width;
|
||||
real_cell_area.width -= 2 * focus_line_width;
|
||||
|
||||
rtl_cell_area = real_cell_area;
|
||||
rtl_background_area = real_background_area;
|
||||
if (rtl)
|
||||
{
|
||||
rtl_cell_area.x = cell_area->x + cell_area->width - (real_cell_area.x - cell_area->x) - real_cell_area.width;
|
||||
rtl_background_area.x = background_area->x + background_area->width - (real_background_area.x - background_area->x) - real_background_area.width;
|
||||
}
|
||||
|
||||
/* RENDER */
|
||||
if (action == CELL_ACTION_RENDER)
|
||||
{
|
||||
gtk_cell_renderer_render (info->cell,
|
||||
window,
|
||||
tree_column->tree_view,
|
||||
&real_background_area,
|
||||
&real_cell_area,
|
||||
&rtl_background_area,
|
||||
&rtl_cell_area,
|
||||
expose_area,
|
||||
flags);
|
||||
}
|
||||
/* FOCUS */
|
||||
else if (action == CELL_ACTION_FOCUS)
|
||||
{
|
||||
gint x_offset, y_offset, width, height;
|
||||
|
||||
gtk_cell_renderer_get_size (info->cell,
|
||||
tree_column->tree_view,
|
||||
&real_cell_area,
|
||||
&rtl_cell_area,
|
||||
&x_offset, &y_offset,
|
||||
&width, &height);
|
||||
|
||||
@ -2661,24 +2755,25 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
{
|
||||
if (info->has_focus)
|
||||
{
|
||||
min_x = real_cell_area.x + x_offset;
|
||||
min_x = rtl_cell_area.x + x_offset;
|
||||
max_x = min_x + width;
|
||||
min_y = real_cell_area.y + y_offset;
|
||||
min_y = rtl_cell_area.y + y_offset;
|
||||
max_y = min_y + height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (min_x > (real_cell_area.x + x_offset))
|
||||
min_x = real_cell_area.x + x_offset;
|
||||
if (max_x < real_cell_area.x + x_offset + width)
|
||||
max_x = real_cell_area.x + x_offset + width;
|
||||
if (min_y > (real_cell_area.y + y_offset))
|
||||
min_y = real_cell_area.y + y_offset;
|
||||
if (max_y < real_cell_area.y + y_offset + height)
|
||||
max_y = real_cell_area.y + y_offset + height;
|
||||
if (min_x > (rtl_cell_area.x + x_offset))
|
||||
min_x = rtl_cell_area.x + x_offset;
|
||||
if (max_x < rtl_cell_area.x + x_offset + width)
|
||||
max_x = rtl_cell_area.x + x_offset + width;
|
||||
if (min_y > (rtl_cell_area.y + y_offset))
|
||||
min_y = rtl_cell_area.y + y_offset;
|
||||
if (max_y < rtl_cell_area.y + y_offset + height)
|
||||
max_y = rtl_cell_area.y + y_offset + height;
|
||||
}
|
||||
}
|
||||
/* EVENT */
|
||||
else if (action == CELL_ACTION_EVENT)
|
||||
{
|
||||
gboolean try_event = FALSE;
|
||||
|
@ -104,6 +104,7 @@ struct _GtkTreeViewColumn
|
||||
guint maybe_reordered : 1;
|
||||
guint reorderable : 1;
|
||||
guint use_resized_width : 1;
|
||||
guint expand : 1;
|
||||
};
|
||||
|
||||
struct _GtkTreeViewColumnClass
|
||||
@ -177,6 +178,9 @@ void gtk_tree_view_column_clicked (GtkTreeViewCol
|
||||
void gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column,
|
||||
const gchar *title);
|
||||
G_CONST_RETURN gchar *gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column);
|
||||
void gtk_tree_view_column_set_expand (GtkTreeViewColumn *tree_column,
|
||||
gboolean expand);
|
||||
gboolean gtk_tree_view_column_get_expand (GtkTreeViewColumn *tree_column);
|
||||
void gtk_tree_view_column_set_clickable (GtkTreeViewColumn *tree_column,
|
||||
gboolean clickable);
|
||||
gboolean gtk_tree_view_column_get_clickable (GtkTreeViewColumn *tree_column);
|
||||
|
Loading…
Reference in New Issue
Block a user