static guint tree_column_signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE_WITH_CODE (PsppSheetViewColumn, pspp_sheet_view_column, GTK_TYPE_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (PsppSheetViewColumn, pspp_sheet_view_column, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT,
pspp_sheet_view_column_cell_layout_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
GTK_PARAM_READWRITE));
}
+
+static void _cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ gpointer *data);
+
+
+static void _cell_layout_buildable_add_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type);
+
+
+static gboolean _cell_layout_buildable_custom_tag_start (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *tagname,
+ GMarkupParser *parser,
+ gpointer *data);
+
+
static void
pspp_sheet_view_column_buildable_init (GtkBuildableIface *iface)
{
- iface->add_child = _gtk_cell_layout_buildable_add_child;
- iface->custom_tag_start = _gtk_cell_layout_buildable_custom_tag_start;
- iface->custom_tag_end = _gtk_cell_layout_buildable_custom_tag_end;
+ iface->add_child = _cell_layout_buildable_add_child;
+ iface->custom_tag_start = _cell_layout_buildable_custom_tag_start;
+ iface->custom_tag_end = _cell_layout_buildable_custom_tag_end;
}
static void
if (! tree_column->button)
return;
- hbox = GTK_BIN (tree_column->button)->child;
+ hbox = gtk_bin_get_child (GTK_BIN (tree_column->button));
alignment = tree_column->alignment;
arrow = tree_column->arrow;
- current_child = GTK_BIN (alignment)->child;
+ current_child = gtk_bin_get_child (GTK_BIN (alignment));
/* Set up the actual button */
gtk_alignment_set (GTK_ALIGNMENT (alignment), tree_column->xalign,
((GdkEventButton *)event)->button == 1)
{
column->maybe_reordered = TRUE;
- gdk_window_get_pointer (GTK_BUTTON (widget)->event_window,
+ gdk_window_get_pointer (gtk_button_get_event_window (GTK_BUTTON (widget)),
&column->drag_x,
&column->drag_y,
NULL);
void
_pspp_sheet_view_column_realize_button (PsppSheetViewColumn *column)
{
+ GtkAllocation allocation;
PsppSheetView *tree_view;
GdkWindowAttr attr;
guint attributes_mask;
attr.window_type = GDK_WINDOW_CHILD;
attr.wclass = GDK_INPUT_ONLY;
attr.visual = gtk_widget_get_visual (GTK_WIDGET (tree_view));
- attr.colormap = gtk_widget_get_colormap (GTK_WIDGET (tree_view));
attr.event_mask = gtk_widget_get_events (GTK_WIDGET (tree_view)) |
(GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_KEY_PRESS_MASK);
attributes_mask = GDK_WA_CURSOR | GDK_WA_X | GDK_WA_Y;
- attr.cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (tree_view->priv->header_window),
+ attr.cursor = gdk_cursor_new_for_display (gdk_window_get_display (tree_view->priv->header_window),
GDK_SB_H_DOUBLE_ARROW);
attr.y = 0;
attr.width = TREE_VIEW_DRAG_WIDTH;
attr.height = tree_view->priv->header_height;
-
- attr.x = (column->button->allocation.x + (rtl ? 0 : column->button->allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2;
+ gtk_widget_get_allocation (column->button, &allocation);
+ attr.x = (allocation.x + (rtl ? 0 : allocation.width)) - TREE_VIEW_DRAG_WIDTH / 2;
column->window = gdk_window_new (tree_view->priv->header_window,
&attr, attributes_mask);
gdk_window_set_user_data (column->window, tree_view);
GList *list;
for (list = column->cell_list; list; list = list->next)
- if (((PsppSheetViewColumnCellInfo *)list->data)->cell->mode ==
- GTK_CELL_RENDERER_MODE_EDITABLE)
- return TRUE;
+ {
+ GtkCellRendererMode mode;
+ g_object_get (((PsppSheetViewColumnCellInfo *)list->data)->cell, "mode", &mode, NULL);
+ if (mode == GTK_CELL_RENDERER_MODE_EDITABLE)
+ return TRUE;
+ }
return FALSE;
}
{
PsppSheetViewColumnCellInfo *cellinfo = list->data;
- if ((cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
- cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
- cellinfo->cell->visible)
+ GtkCellRendererMode mode;
+ g_object_get (cellinfo->cell, "mode", &mode, NULL);
+
+ if ((mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
+ mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) &&
+ gtk_cell_renderer_get_visible (cellinfo->cell))
i++;
}
* Return value: the title of the column. This string should not be
* modified or freed.
**/
-G_CONST_RETURN gchar *
+const gchar *
pspp_sheet_view_column_get_title (PsppSheetViewColumn *tree_column)
{
g_return_val_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column), NULL);
static gboolean
pspp_sheet_view_column_cell_process_action (PsppSheetViewColumn *tree_column,
- GdkWindow *window,
+ cairo_t *cr,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
guint flags,
gint action,
- const GdkRectangle *expose_area, /* RENDER */
GdkRectangle *focus_rectangle, /* FOCUS */
GtkCellEditable **editable_widget, /* EVENT */
GdkEvent *event, /* EVENT */
GList *list;
GdkRectangle real_cell_area;
GdkRectangle real_background_area;
- GdkRectangle real_expose_area = *cell_area;
gint depth = 0;
gint expand_cell_count = 0;
gint full_requested_width = 0;
{
PsppSheetViewColumnCellInfo *info = (PsppSheetViewColumnCellInfo *)list->data;
- if (! info->cell->visible)
+ if (! gtk_cell_renderer_get_visible (info->cell))
continue;
if (info->expand == TRUE)
if (info->pack == GTK_PACK_END)
continue;
- if (! info->cell->visible)
+ if (! gtk_cell_renderer_get_visible (info->cell))
continue;
if ((info->has_focus || special_cells == 1) && cursor_row)
if (action == CELL_ACTION_RENDER)
{
gtk_cell_renderer_render (info->cell,
- window,
+ cr,
tree_column->tree_view,
&rtl_background_area,
&rtl_cell_area,
- &real_expose_area,
flags);
}
/* FOCUS */
if (info->pack == GTK_PACK_START)
continue;
- if (! info->cell->visible)
+ if (! gtk_cell_renderer_get_visible (info->cell))
continue;
if ((info->has_focus || special_cells == 1) && cursor_row)
if (action == CELL_ACTION_RENDER)
{
gtk_cell_renderer_render (info->cell,
- window,
+ cr,
tree_column->tree_view,
&rtl_background_area,
&rtl_cell_area,
- &real_expose_area,
flags);
}
/* FOCUS */
* @window: a #GdkDrawable to draw to
* @background_area: entire cell area (including tree expanders and maybe padding on the sides)
* @cell_area: area normally rendered by a cell renderer
- * @expose_area: area that actually needs updating
* @flags: flags that affect rendering
*
* Renders the cell contained by #tree_column. This is used primarily by the
**/
void
_pspp_sheet_view_column_cell_render (PsppSheetViewColumn *tree_column,
- GdkWindow *window,
+ cairo_t *cr,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
- const GdkRectangle *expose_area,
guint flags)
{
g_return_if_fail (PSPP_IS_SHEET_VIEW_COLUMN (tree_column));
g_return_if_fail (background_area != NULL);
g_return_if_fail (cell_area != NULL);
- g_return_if_fail (expose_area != NULL);
pspp_sheet_view_column_cell_process_action (tree_column,
- window,
+ cr,
background_area,
cell_area,
flags,
CELL_ACTION_RENDER,
- expose_area,
NULL, NULL, NULL, NULL);
}
cell_area,
flags,
CELL_ACTION_EVENT,
- NULL, NULL,
+ NULL,
editable_widget,
event,
path_string);
cell_area,
0,
CELL_ACTION_FOCUS,
- NULL,
focus_area,
NULL, NULL, NULL);
}
void
_pspp_sheet_view_column_cell_draw_focus (PsppSheetViewColumn *tree_column,
- GdkWindow *window,
+ cairo_t *cr,
const GdkRectangle *background_area,
const GdkRectangle *cell_area,
- const GdkRectangle *expose_area,
guint flags)
{
gint focus_line_width;
{
GdkRectangle focus_rectangle;
pspp_sheet_view_column_cell_process_action (tree_column,
- window,
+ cr,
background_area,
cell_area,
flags,
CELL_ACTION_FOCUS,
- expose_area,
&focus_rectangle,
NULL, NULL, NULL);
cell_state = flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED :
(flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT :
(flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL));
- gtk_paint_focus (tree_column->tree_view->style,
- window,
+
+ gtk_paint_focus (gtk_widget_get_style (GTK_WIDGET (tree_column->tree_view)),
+ cr,
cell_state,
- cell_area,
tree_column->tree_view,
"treeview",
focus_rectangle.x,
{
PsppSheetViewColumnCellInfo *info = (PsppSheetViewColumnCellInfo *) list->data;
- if (info->cell->visible)
+ if (gtk_cell_renderer_get_visible (info->cell))
return TRUE;
}
if (info->cell == cell)
break;
- if (info->cell->visible)
+ if (gtk_cell_renderer_get_visible (info->cell))
l += info->real_width + column->spacing;
}
list = pspp_sheet_view_column_cell_next (column, list);
- if (info->cell->visible)
+ if (gtk_cell_renderer_get_visible (info->cell))
r += info->real_width + column->spacing;
}
break;
}
- if (cellinfo->cell->visible)
+ if (gtk_cell_renderer_get_visible (cellinfo->cell))
current_x += cellinfo->real_width;
}
attributes_text_element,
};
-gboolean
-_gtk_cell_layout_buildable_custom_tag_start (GtkBuildable *buildable,
+static gboolean
+_cell_layout_buildable_custom_tag_start (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *tagname,
return FALSE;
}
-void
-_gtk_cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
+static void
+_cell_layout_buildable_custom_tag_end (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *tagname,
g_slice_free (AttributesSubParserData, parser_data);
}
-void
-_gtk_cell_layout_buildable_add_child (GtkBuildable *buildable,
+static void
+_cell_layout_buildable_add_child (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *type)