gtk/gtkiconview.c: use accessor functions to access GtkWidget
This commit is contained in:
parent
a48d28848e
commit
89e8f79f07
@ -1325,20 +1325,22 @@ gtk_icon_view_get_property (GObject *object,
|
|||||||
static void
|
static void
|
||||||
gtk_icon_view_realize (GtkWidget *widget)
|
gtk_icon_view_realize (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkIconView *icon_view;
|
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GdkWindow *window;
|
||||||
GdkWindowAttr attributes;
|
GdkWindowAttr attributes;
|
||||||
gint attributes_mask;
|
gint attributes_mask;
|
||||||
|
|
||||||
icon_view = GTK_ICON_VIEW (widget);
|
|
||||||
|
|
||||||
gtk_widget_set_realized (widget, TRUE);
|
gtk_widget_set_realized (widget, TRUE);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
/* Make the main, clipping window */
|
/* Make the main, clipping window */
|
||||||
attributes.window_type = GDK_WINDOW_CHILD;
|
attributes.window_type = GDK_WINDOW_CHILD;
|
||||||
attributes.x = widget->allocation.x;
|
attributes.x = allocation.x;
|
||||||
attributes.y = widget->allocation.y;
|
attributes.y = allocation.y;
|
||||||
attributes.width = widget->allocation.width;
|
attributes.width = allocation.width;
|
||||||
attributes.height = widget->allocation.height;
|
attributes.height = allocation.height;
|
||||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||||
attributes.visual = gtk_widget_get_visual (widget);
|
attributes.visual = gtk_widget_get_visual (widget);
|
||||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||||
@ -1346,16 +1348,19 @@ gtk_icon_view_realize (GtkWidget *widget)
|
|||||||
|
|
||||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||||
|
|
||||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||||
&attributes, attributes_mask);
|
&attributes, attributes_mask);
|
||||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
gtk_widget_set_window (widget, window);
|
||||||
gdk_window_set_user_data (widget->window, widget);
|
gdk_window_set_back_pixmap (window, NULL, FALSE);
|
||||||
|
gdk_window_set_user_data (window, widget);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
/* Make the window for the icon view */
|
/* Make the window for the icon view */
|
||||||
attributes.x = 0;
|
attributes.x = 0;
|
||||||
attributes.y = 0;
|
attributes.y = 0;
|
||||||
attributes.width = MAX (icon_view->priv->width, widget->allocation.width);
|
attributes.width = MAX (icon_view->priv->width, allocation.width);
|
||||||
attributes.height = MAX (icon_view->priv->height, widget->allocation.height);
|
attributes.height = MAX (icon_view->priv->height, allocation.height);
|
||||||
attributes.event_mask = (GDK_EXPOSURE_MASK |
|
attributes.event_mask = (GDK_EXPOSURE_MASK |
|
||||||
GDK_SCROLL_MASK |
|
GDK_SCROLL_MASK |
|
||||||
GDK_POINTER_MOTION_MASK |
|
GDK_POINTER_MOTION_MASK |
|
||||||
@ -1365,12 +1370,13 @@ gtk_icon_view_realize (GtkWidget *widget)
|
|||||||
GDK_KEY_RELEASE_MASK) |
|
GDK_KEY_RELEASE_MASK) |
|
||||||
gtk_widget_get_events (widget);
|
gtk_widget_get_events (widget);
|
||||||
|
|
||||||
icon_view->priv->bin_window = gdk_window_new (widget->window,
|
icon_view->priv->bin_window = gdk_window_new (window,
|
||||||
&attributes, attributes_mask);
|
&attributes, attributes_mask);
|
||||||
gdk_window_set_user_data (icon_view->priv->bin_window, widget);
|
gdk_window_set_user_data (icon_view->priv->bin_window, widget);
|
||||||
|
|
||||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
gtk_widget_style_attach (widget);
|
||||||
gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
|
gdk_window_set_background (icon_view->priv->bin_window,
|
||||||
|
>k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
|
||||||
|
|
||||||
gdk_window_show (icon_view->priv->bin_window);
|
gdk_window_show (icon_view->priv->bin_window);
|
||||||
}
|
}
|
||||||
@ -1394,11 +1400,16 @@ gtk_icon_view_state_changed (GtkWidget *widget,
|
|||||||
GtkStateType previous_state)
|
GtkStateType previous_state)
|
||||||
{
|
{
|
||||||
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
||||||
|
GtkStateType state;
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
{
|
{
|
||||||
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
|
style = gtk_widget_get_style (widget);
|
||||||
gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
|
state = gtk_widget_get_state (widget);
|
||||||
|
|
||||||
|
gdk_window_set_background (gtk_widget_get_window (widget), &style->base[state]);
|
||||||
|
gdk_window_set_background (icon_view->priv->bin_window, &style->base[state]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_queue_draw (widget);
|
gtk_widget_queue_draw (widget);
|
||||||
@ -1409,11 +1420,16 @@ gtk_icon_view_style_set (GtkWidget *widget,
|
|||||||
GtkStyle *previous_style)
|
GtkStyle *previous_style)
|
||||||
{
|
{
|
||||||
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
GtkIconView *icon_view = GTK_ICON_VIEW (widget);
|
||||||
|
GtkStateType state;
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
{
|
{
|
||||||
gdk_window_set_background (widget->window, &widget->style->base[widget->state]);
|
style = gtk_widget_get_style (widget);
|
||||||
gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
|
state = gtk_widget_get_state (widget);
|
||||||
|
|
||||||
|
gdk_window_set_background (gtk_widget_get_window (widget), &style->base[state]);
|
||||||
|
gdk_window_set_background (icon_view->priv->bin_window, &style->base[state]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_queue_resize (widget);
|
gtk_widget_queue_resize (widget);
|
||||||
@ -1483,11 +1499,11 @@ gtk_icon_view_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
GtkAdjustment *hadjustment, *vadjustment;
|
GtkAdjustment *hadjustment, *vadjustment;
|
||||||
|
|
||||||
widget->allocation = *allocation;
|
gtk_widget_set_allocation (widget, allocation);
|
||||||
|
|
||||||
if (gtk_widget_get_realized (widget))
|
if (gtk_widget_get_realized (widget))
|
||||||
{
|
{
|
||||||
gdk_window_move_resize (widget->window,
|
gdk_window_move_resize (gtk_widget_get_window (widget),
|
||||||
allocation->x, allocation->y,
|
allocation->x, allocation->y,
|
||||||
allocation->width, allocation->height);
|
allocation->width, allocation->height);
|
||||||
gdk_window_resize (icon_view->priv->bin_window,
|
gdk_window_resize (icon_view->priv->bin_window,
|
||||||
@ -1600,53 +1616,49 @@ gtk_icon_view_expose (GtkWidget *widget,
|
|||||||
|
|
||||||
if (dest_item)
|
if (dest_item)
|
||||||
{
|
{
|
||||||
|
GtkStateType state;
|
||||||
|
GtkStyle *style;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
|
state = gtk_widget_get_state (widget);
|
||||||
|
|
||||||
switch (dest_pos)
|
switch (dest_pos)
|
||||||
{
|
{
|
||||||
case GTK_ICON_VIEW_DROP_INTO:
|
case GTK_ICON_VIEW_DROP_INTO:
|
||||||
gtk_paint_focus (widget->style,
|
gtk_paint_focus (style, icon_view->priv->bin_window,
|
||||||
icon_view->priv->bin_window,
|
state, NULL,
|
||||||
gtk_widget_get_state (widget),
|
|
||||||
NULL,
|
|
||||||
widget,
|
widget,
|
||||||
"iconview-drop-indicator",
|
"iconview-drop-indicator",
|
||||||
dest_item->x, dest_item->y,
|
dest_item->x, dest_item->y,
|
||||||
dest_item->width, dest_item->height);
|
dest_item->width, dest_item->height);
|
||||||
break;
|
break;
|
||||||
case GTK_ICON_VIEW_DROP_ABOVE:
|
case GTK_ICON_VIEW_DROP_ABOVE:
|
||||||
gtk_paint_focus (widget->style,
|
gtk_paint_focus (style, icon_view->priv->bin_window,
|
||||||
icon_view->priv->bin_window,
|
state, NULL,
|
||||||
gtk_widget_get_state (widget),
|
|
||||||
NULL,
|
|
||||||
widget,
|
widget,
|
||||||
"iconview-drop-indicator",
|
"iconview-drop-indicator",
|
||||||
dest_item->x, dest_item->y - 1,
|
dest_item->x, dest_item->y - 1,
|
||||||
dest_item->width, 2);
|
dest_item->width, 2);
|
||||||
break;
|
break;
|
||||||
case GTK_ICON_VIEW_DROP_LEFT:
|
case GTK_ICON_VIEW_DROP_LEFT:
|
||||||
gtk_paint_focus (widget->style,
|
gtk_paint_focus (style, icon_view->priv->bin_window,
|
||||||
icon_view->priv->bin_window,
|
state, NULL,
|
||||||
gtk_widget_get_state (widget),
|
|
||||||
NULL,
|
|
||||||
widget,
|
widget,
|
||||||
"iconview-drop-indicator",
|
"iconview-drop-indicator",
|
||||||
dest_item->x - 1, dest_item->y,
|
dest_item->x - 1, dest_item->y,
|
||||||
2, dest_item->height);
|
2, dest_item->height);
|
||||||
break;
|
break;
|
||||||
case GTK_ICON_VIEW_DROP_BELOW:
|
case GTK_ICON_VIEW_DROP_BELOW:
|
||||||
gtk_paint_focus (widget->style,
|
gtk_paint_focus (style, icon_view->priv->bin_window,
|
||||||
icon_view->priv->bin_window,
|
state, NULL,
|
||||||
gtk_widget_get_state (widget),
|
|
||||||
NULL,
|
|
||||||
widget,
|
widget,
|
||||||
"iconview-drop-indicator",
|
"iconview-drop-indicator",
|
||||||
dest_item->x, dest_item->y + dest_item->height - 1,
|
dest_item->x, dest_item->y + dest_item->height - 1,
|
||||||
dest_item->width, 2);
|
dest_item->width, 2);
|
||||||
break;
|
break;
|
||||||
case GTK_ICON_VIEW_DROP_RIGHT:
|
case GTK_ICON_VIEW_DROP_RIGHT:
|
||||||
gtk_paint_focus (widget->style,
|
gtk_paint_focus (style, icon_view->priv->bin_window,
|
||||||
icon_view->priv->bin_window,
|
state, NULL,
|
||||||
gtk_widget_get_state (widget),
|
|
||||||
NULL,
|
|
||||||
widget,
|
widget,
|
||||||
"iconview-drop-indicator",
|
"iconview-drop-indicator",
|
||||||
dest_item->x + dest_item->width - 1, dest_item->y,
|
dest_item->x + dest_item->width - 1, dest_item->y,
|
||||||
@ -1695,6 +1707,7 @@ static gboolean
|
|||||||
gtk_icon_view_motion (GtkWidget *widget,
|
gtk_icon_view_motion (GtkWidget *widget,
|
||||||
GdkEventMotion *event)
|
GdkEventMotion *event)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkIconView *icon_view;
|
GtkIconView *icon_view;
|
||||||
gint abs_y;
|
gint abs_y;
|
||||||
|
|
||||||
@ -1711,12 +1724,14 @@ gtk_icon_view_motion (GtkWidget *widget,
|
|||||||
(icon_view->priv->vadjustment->upper -
|
(icon_view->priv->vadjustment->upper -
|
||||||
icon_view->priv->vadjustment->lower));
|
icon_view->priv->vadjustment->lower));
|
||||||
|
|
||||||
if (abs_y < 0 || abs_y > widget->allocation.height)
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
|
if (abs_y < 0 || abs_y > allocation.height)
|
||||||
{
|
{
|
||||||
if (abs_y < 0)
|
if (abs_y < 0)
|
||||||
icon_view->priv->scroll_value_diff = abs_y;
|
icon_view->priv->scroll_value_diff = abs_y;
|
||||||
else
|
else
|
||||||
icon_view->priv->scroll_value_diff = abs_y - widget->allocation.height;
|
icon_view->priv->scroll_value_diff = abs_y - allocation.height;
|
||||||
|
|
||||||
icon_view->priv->event_last_x = event->x;
|
icon_view->priv->event_last_x = event->x;
|
||||||
icon_view->priv->event_last_y = event->y;
|
icon_view->priv->event_last_y = event->y;
|
||||||
@ -2686,6 +2701,8 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
|||||||
gint *y,
|
gint *y,
|
||||||
gint *maximum_width)
|
gint *maximum_width)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GtkWidget *widget = GTK_WIDGET (icon_view);
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gint x, current_width;
|
gint x, current_width;
|
||||||
GList *items, *last_item;
|
GList *items, *last_item;
|
||||||
@ -2695,7 +2712,7 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
|||||||
gint i;
|
gint i;
|
||||||
gboolean rtl;
|
gboolean rtl;
|
||||||
|
|
||||||
rtl = gtk_widget_get_direction (GTK_WIDGET (icon_view)) == GTK_TEXT_DIR_RTL;
|
rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||||
max_height = g_new0 (gint, icon_view->priv->n_cells);
|
max_height = g_new0 (gint, icon_view->priv->n_cells);
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
@ -2703,7 +2720,7 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
|||||||
items = first_item;
|
items = first_item;
|
||||||
current_width = 0;
|
current_width = 0;
|
||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (icon_view),
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -2724,7 +2741,9 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
|||||||
|
|
||||||
if (items != first_item)
|
if (items != first_item)
|
||||||
{
|
{
|
||||||
if ((icon_view->priv->columns <= 0 && current_width > GTK_WIDGET (icon_view)->allocation.width) ||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
|
if ((icon_view->priv->columns <= 0 && current_width > allocation.width) ||
|
||||||
(icon_view->priv->columns > 0 && col >= icon_view->priv->columns))
|
(icon_view->priv->columns > 0 && col >= icon_view->priv->columns))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2801,10 +2820,11 @@ gtk_icon_view_set_adjustment_upper (GtkAdjustment *adj,
|
|||||||
static void
|
static void
|
||||||
gtk_icon_view_layout (GtkIconView *icon_view)
|
gtk_icon_view_layout (GtkIconView *icon_view)
|
||||||
{
|
{
|
||||||
gint y = 0, maximum_width = 0;
|
GtkAllocation allocation;
|
||||||
GList *icons;
|
|
||||||
GtkWidget *widget;
|
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
|
GtkWidget *widget;
|
||||||
|
GList *icons;
|
||||||
|
gint y = 0, maximum_width = 0;
|
||||||
gint row;
|
gint row;
|
||||||
gint item_width;
|
gint item_width;
|
||||||
|
|
||||||
@ -2870,10 +2890,11 @@ gtk_icon_view_layout (GtkIconView *icon_view)
|
|||||||
icon_view->priv->height != requisition.height)
|
icon_view->priv->height != requisition.height)
|
||||||
gtk_widget_queue_resize_no_redraw (widget);
|
gtk_widget_queue_resize_no_redraw (widget);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
|
if (gtk_widget_get_realized (GTK_WIDGET (icon_view)))
|
||||||
gdk_window_resize (icon_view->priv->bin_window,
|
gdk_window_resize (icon_view->priv->bin_window,
|
||||||
MAX (icon_view->priv->width, widget->allocation.width),
|
MAX (icon_view->priv->width, allocation.width),
|
||||||
MAX (icon_view->priv->height, widget->allocation.height));
|
MAX (icon_view->priv->height, allocation.height));
|
||||||
|
|
||||||
if (icon_view->priv->scroll_to_path)
|
if (icon_view->priv->scroll_to_path)
|
||||||
{
|
{
|
||||||
@ -3163,13 +3184,16 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
gint i;
|
gint i;
|
||||||
GtkStateType state;
|
GtkStateType state;
|
||||||
GtkCellRendererState flags;
|
GtkCellRendererState flags;
|
||||||
|
GtkStyle *style;
|
||||||
|
GtkWidget *widget = GTK_WIDGET (icon_view);
|
||||||
|
|
||||||
if (icon_view->priv->model == NULL)
|
if (icon_view->priv->model == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gtk_icon_view_set_cell_data (icon_view, item);
|
gtk_icon_view_set_cell_data (icon_view, item);
|
||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (icon_view),
|
style = gtk_widget_get_style (widget);
|
||||||
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -3178,7 +3202,7 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
if (item->selected)
|
if (item->selected)
|
||||||
{
|
{
|
||||||
flags = GTK_CELL_RENDERER_SELECTED;
|
flags = GTK_CELL_RENDERER_SELECTED;
|
||||||
if (gtk_widget_has_focus (GTK_WIDGET (icon_view)))
|
if (gtk_widget_has_focus (widget))
|
||||||
state = GTK_STATE_SELECTED;
|
state = GTK_STATE_SELECTED;
|
||||||
else
|
else
|
||||||
state = GTK_STATE_ACTIVE;
|
state = GTK_STATE_ACTIVE;
|
||||||
@ -3191,12 +3215,12 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
|
|
||||||
if (item->selected)
|
if (item->selected)
|
||||||
{
|
{
|
||||||
gtk_paint_flat_box (GTK_WIDGET (icon_view)->style,
|
gtk_paint_flat_box (style,
|
||||||
(GdkWindow *) drawable,
|
GDK_WINDOW (drawable),
|
||||||
GTK_STATE_SELECTED,
|
GTK_STATE_SELECTED,
|
||||||
GTK_SHADOW_NONE,
|
GTK_SHADOW_NONE,
|
||||||
area,
|
area,
|
||||||
GTK_WIDGET (icon_view),
|
widget,
|
||||||
"icon_view_item",
|
"icon_view_item",
|
||||||
x, y,
|
x, y,
|
||||||
item->width, item->height);
|
item->width, item->height);
|
||||||
@ -3216,12 +3240,12 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
|
|
||||||
gtk_cell_renderer_render (info->cell,
|
gtk_cell_renderer_render (info->cell,
|
||||||
drawable,
|
drawable,
|
||||||
GTK_WIDGET (icon_view),
|
widget,
|
||||||
&cell_area, &cell_area, area, flags);
|
&cell_area, &cell_area, area, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draw_focus &&
|
if (draw_focus &&
|
||||||
gtk_widget_has_focus (GTK_WIDGET (icon_view)) &&
|
gtk_widget_has_focus (widget) &&
|
||||||
item == icon_view->priv->cursor_item)
|
item == icon_view->priv->cursor_item)
|
||||||
{
|
{
|
||||||
for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
|
for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++)
|
||||||
@ -3242,11 +3266,11 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
|
|
||||||
if (i == icon_view->priv->cursor_cell)
|
if (i == icon_view->priv->cursor_cell)
|
||||||
{
|
{
|
||||||
gtk_paint_focus (GTK_WIDGET (icon_view)->style,
|
gtk_paint_focus (style,
|
||||||
drawable,
|
drawable,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
area,
|
area,
|
||||||
GTK_WIDGET (icon_view),
|
widget,
|
||||||
"icon_view",
|
"icon_view",
|
||||||
x - item->x + box.x - padding,
|
x - item->x + box.x - padding,
|
||||||
y - item->y + box.y - padding,
|
y - item->y + box.y - padding,
|
||||||
@ -3260,11 +3284,11 @@ gtk_icon_view_paint_item (GtkIconView *icon_view,
|
|||||||
* around the whole item.
|
* around the whole item.
|
||||||
*/
|
*/
|
||||||
if (icon_view->priv->cursor_cell < 0)
|
if (icon_view->priv->cursor_cell < 0)
|
||||||
gtk_paint_focus (GTK_WIDGET (icon_view)->style,
|
gtk_paint_focus (style,
|
||||||
drawable,
|
drawable,
|
||||||
GTK_STATE_NORMAL,
|
GTK_STATE_NORMAL,
|
||||||
area,
|
area,
|
||||||
GTK_WIDGET (icon_view),
|
widget,
|
||||||
"icon_view",
|
"icon_view",
|
||||||
x - padding,
|
x - padding,
|
||||||
y - padding,
|
y - padding,
|
||||||
@ -3297,7 +3321,7 @@ gtk_icon_view_paint_rubberband (GtkIconView *icon_view,
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!fill_color_gdk)
|
if (!fill_color_gdk)
|
||||||
fill_color_gdk = gdk_color_copy (>K_WIDGET (icon_view)->style->base[GTK_STATE_SELECTED]);
|
fill_color_gdk = gdk_color_copy (>k_widget_get_style (GTK_WIDGET (icon_view))->base[GTK_STATE_SELECTED]);
|
||||||
|
|
||||||
cairo_set_source_rgba (cr,
|
cairo_set_source_rgba (cr,
|
||||||
fill_color_gdk->red / 65535.,
|
fill_color_gdk->red / 65535.,
|
||||||
@ -4366,18 +4390,21 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
|
|||||||
gfloat col_align)
|
gfloat col_align)
|
||||||
{
|
{
|
||||||
GtkIconViewItem *item = NULL;
|
GtkIconViewItem *item = NULL;
|
||||||
|
GtkWidget *widget;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (row_align >= 0.0 && row_align <= 1.0);
|
g_return_if_fail (row_align >= 0.0 && row_align <= 1.0);
|
||||||
g_return_if_fail (col_align >= 0.0 && col_align <= 1.0);
|
g_return_if_fail (col_align >= 0.0 && col_align <= 1.0);
|
||||||
|
|
||||||
|
widget = GTK_WIDGET (icon_view);
|
||||||
|
|
||||||
if (gtk_tree_path_get_depth (path) > 0)
|
if (gtk_tree_path_get_depth (path) > 0)
|
||||||
item = g_list_nth_data (icon_view->priv->items,
|
item = g_list_nth_data (icon_view->priv->items,
|
||||||
gtk_tree_path_get_indices(path)[0]);
|
gtk_tree_path_get_indices(path)[0]);
|
||||||
|
|
||||||
if (!item || item->width < 0 ||
|
if (!item || item->width < 0 ||
|
||||||
!gtk_widget_get_realized (GTK_WIDGET (icon_view)))
|
!gtk_widget_get_realized (widget))
|
||||||
{
|
{
|
||||||
if (icon_view->priv->scroll_to_path)
|
if (icon_view->priv->scroll_to_path)
|
||||||
gtk_tree_row_reference_free (icon_view->priv->scroll_to_path);
|
gtk_tree_row_reference_free (icon_view->priv->scroll_to_path);
|
||||||
@ -4396,24 +4423,25 @@ gtk_icon_view_scroll_to_path (GtkIconView *icon_view,
|
|||||||
|
|
||||||
if (use_align)
|
if (use_align)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
gfloat offset;
|
gfloat offset;
|
||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (icon_view),
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
|
gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
|
||||||
|
|
||||||
offset = y + item->y - focus_width -
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
row_align * (GTK_WIDGET (icon_view)->allocation.height - item->height);
|
|
||||||
|
offset = y + item->y - focus_width - row_align * (allocation.height - item->height);
|
||||||
|
|
||||||
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
||||||
icon_view->priv->vadjustment->value + offset);
|
icon_view->priv->vadjustment->value + offset);
|
||||||
|
|
||||||
offset = x + item->x - focus_width -
|
offset = x + item->x - focus_width - col_align * (allocation.width - item->width);
|
||||||
col_align * (GTK_WIDGET (icon_view)->allocation.width - item->width);
|
|
||||||
|
|
||||||
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
||||||
icon_view->priv->hadjustment->value + offset);
|
icon_view->priv->hadjustment->value + offset);
|
||||||
@ -4430,10 +4458,12 @@ static void
|
|||||||
gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
|
gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
|
||||||
GtkIconViewItem *item)
|
GtkIconViewItem *item)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
|
GtkWidget *widget = GTK_WIDGET (icon_view);
|
||||||
gint x, y, width, height;
|
gint x, y, width, height;
|
||||||
gint focus_width;
|
gint focus_width;
|
||||||
|
|
||||||
gtk_widget_style_get (GTK_WIDGET (icon_view),
|
gtk_widget_style_get (widget,
|
||||||
"focus-line-width", &focus_width,
|
"focus-line-width", &focus_width,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -4441,21 +4471,23 @@ gtk_icon_view_scroll_to_item (GtkIconView *icon_view,
|
|||||||
&width, &height);
|
&width, &height);
|
||||||
gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
|
gdk_window_get_position (icon_view->priv->bin_window, &x, &y);
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
if (y + item->y - focus_width < 0)
|
if (y + item->y - focus_width < 0)
|
||||||
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
||||||
icon_view->priv->vadjustment->value + y + item->y - focus_width);
|
icon_view->priv->vadjustment->value + y + item->y - focus_width);
|
||||||
else if (y + item->y + item->height + focus_width > GTK_WIDGET (icon_view)->allocation.height)
|
else if (y + item->y + item->height + focus_width > allocation.height)
|
||||||
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
gtk_adjustment_set_value (icon_view->priv->vadjustment,
|
||||||
icon_view->priv->vadjustment->value + y + item->y + item->height
|
icon_view->priv->vadjustment->value + y + item->y + item->height
|
||||||
+ focus_width - GTK_WIDGET (icon_view)->allocation.height);
|
+ focus_width - allocation.height);
|
||||||
|
|
||||||
if (x + item->x - focus_width < 0)
|
if (x + item->x - focus_width < 0)
|
||||||
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
||||||
icon_view->priv->hadjustment->value + x + item->x - focus_width);
|
icon_view->priv->hadjustment->value + x + item->x - focus_width);
|
||||||
else if (x + item->x + item->width + focus_width > GTK_WIDGET (icon_view)->allocation.width)
|
else if (x + item->x + item->width + focus_width > allocation.width)
|
||||||
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
gtk_adjustment_set_value (icon_view->priv->hadjustment,
|
||||||
icon_view->priv->hadjustment->value + x + item->x + item->width
|
icon_view->priv->hadjustment->value + x + item->x + item->width
|
||||||
+ focus_width - GTK_WIDGET (icon_view)->allocation.width);
|
+ focus_width - allocation.width);
|
||||||
|
|
||||||
gtk_adjustment_changed (icon_view->priv->hadjustment);
|
gtk_adjustment_changed (icon_view->priv->hadjustment);
|
||||||
gtk_adjustment_changed (icon_view->priv->vadjustment);
|
gtk_adjustment_changed (icon_view->priv->vadjustment);
|
||||||
@ -6561,11 +6593,14 @@ remove_scroll_timeout (GtkIconView *icon_view)
|
|||||||
static void
|
static void
|
||||||
gtk_icon_view_autoscroll (GtkIconView *icon_view)
|
gtk_icon_view_autoscroll (GtkIconView *icon_view)
|
||||||
{
|
{
|
||||||
|
GdkWindow *window;
|
||||||
gint px, py, x, y, width, height;
|
gint px, py, x, y, width, height;
|
||||||
gint hoffset, voffset;
|
gint hoffset, voffset;
|
||||||
|
|
||||||
gdk_window_get_pointer (GTK_WIDGET (icon_view)->window, &px, &py, NULL);
|
window = gtk_widget_get_window (GTK_WIDGET (icon_view));
|
||||||
gdk_window_get_geometry (GTK_WIDGET (icon_view)->window, &x, &y, &width, &height, NULL);
|
|
||||||
|
gdk_window_get_pointer (window, &px, &py, NULL);
|
||||||
|
gdk_window_get_geometry (window, &x, &y, &width, &height, NULL);
|
||||||
|
|
||||||
/* see if we are near the edge. */
|
/* see if we are near the edge. */
|
||||||
voffset = py - (y + 2 * SCROLL_EDGE_SIZE);
|
voffset = py - (y + 2 * SCROLL_EDGE_SIZE);
|
||||||
@ -7466,8 +7501,7 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view,
|
|||||||
cr = gdk_cairo_create (drawable);
|
cr = gdk_cairo_create (drawable);
|
||||||
cairo_set_line_width (cr, 1.);
|
cairo_set_line_width (cr, 1.);
|
||||||
|
|
||||||
gdk_cairo_set_source_color
|
gdk_cairo_set_source_color (cr, >k_widget_get_style (widget)->base[gtk_widget_get_state (widget)]);
|
||||||
(cr, &widget->style->base[gtk_widget_get_state (widget)]);
|
|
||||||
cairo_rectangle (cr, 0, 0, item->width + 2, item->height + 2);
|
cairo_rectangle (cr, 0, 0, item->width + 2, item->height + 2);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
|
|
||||||
@ -8629,6 +8663,7 @@ gtk_icon_view_item_accessible_remove_state (GtkIconViewItemAccessible *item,
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item)
|
gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item)
|
||||||
{
|
{
|
||||||
|
GtkAllocation allocation;
|
||||||
GtkIconView *icon_view;
|
GtkIconView *icon_view;
|
||||||
GdkRectangle visible_rect;
|
GdkRectangle visible_rect;
|
||||||
gboolean is_showing;
|
gboolean is_showing;
|
||||||
@ -8644,6 +8679,8 @@ gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item)
|
|||||||
if (item->item == NULL)
|
if (item->item == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
gtk_widget_get_allocation (item->widget, &allocation);
|
||||||
|
|
||||||
icon_view = GTK_ICON_VIEW (item->widget);
|
icon_view = GTK_ICON_VIEW (item->widget);
|
||||||
visible_rect.x = 0;
|
visible_rect.x = 0;
|
||||||
if (icon_view->priv->hadjustment)
|
if (icon_view->priv->hadjustment)
|
||||||
@ -8651,8 +8688,8 @@ gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item)
|
|||||||
visible_rect.y = 0;
|
visible_rect.y = 0;
|
||||||
if (icon_view->priv->hadjustment)
|
if (icon_view->priv->hadjustment)
|
||||||
visible_rect.y += icon_view->priv->vadjustment->value;
|
visible_rect.y += icon_view->priv->vadjustment->value;
|
||||||
visible_rect.width = item->widget->allocation.width;
|
visible_rect.width = allocation.width;
|
||||||
visible_rect.height = item->widget->allocation.height;
|
visible_rect.height = allocation.height;
|
||||||
|
|
||||||
if (((item->item->x + item->item->width) < visible_rect.x) ||
|
if (((item->item->x + item->item->width) < visible_rect.x) ||
|
||||||
((item->item->y + item->item->height) < (visible_rect.y)) ||
|
((item->item->y + item->item->height) < (visible_rect.y)) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user