changed new_with_types to just plain new, fixing the number of columns,
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types to just plain new, fixing the number of columns, and column types at creation time. * gtk/gtkliststore.c (gtk_list_store_new): ditto. * gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_set_fixed_height_from_font): FIX the height to a specific font. * gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness. * tests/*c: change to work with new store models.
This commit is contained in:
parent
49c1e6dc89
commit
ee5ff7ddc2
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
Fri Jun 29 22:13:28 2001 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/gtktreestore.c (gtk_tree_store_new): changed new_with_types
|
||||||
|
to just plain new, fixing the number of columns, and column types
|
||||||
|
at creation time.
|
||||||
|
|
||||||
|
* gtk/gtkliststore.c (gtk_list_store_new): ditto.
|
||||||
|
|
||||||
|
* gtk/gtkcellrenderertext.c
|
||||||
|
(gtk_cell_renderer_text_set_fixed_height_from_font): FIX the
|
||||||
|
height to a specific font.
|
||||||
|
|
||||||
|
* gtk/gtktreeview.c (gtk_tree_view_is_expander_column): fix brokenness.
|
||||||
|
|
||||||
|
* tests/*c: change to work with new store models.
|
||||||
|
|
||||||
2001-06-29 Havoc Pennington <hp@redhat.com>
|
2001-06-29 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
* Throughout: fixes to compile with G_DISABLE_COMPAT
|
||||||
|
@ -680,7 +680,7 @@ create_tree (void)
|
|||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ create_model (void)
|
|||||||
GSList *ids;
|
GSList *ids;
|
||||||
GSList *tmp_list;
|
GSList *tmp_list;
|
||||||
|
|
||||||
store = gtk_list_store_new_with_types (1, STOCK_ITEM_INFO_TYPE);
|
store = gtk_list_store_new (1, STOCK_ITEM_INFO_TYPE);
|
||||||
|
|
||||||
ids = gtk_stock_list_ids ();
|
ids = gtk_stock_list_ids ();
|
||||||
ids = g_slist_sort (ids, (GCompareFunc) strcmp);
|
ids = g_slist_sort (ids, (GCompareFunc) strcmp);
|
||||||
|
@ -40,6 +40,8 @@ enum {
|
|||||||
PROP_YALIGN,
|
PROP_YALIGN,
|
||||||
PROP_XPAD,
|
PROP_XPAD,
|
||||||
PROP_YPAD,
|
PROP_YPAD,
|
||||||
|
PROP_WIDTH,
|
||||||
|
PROP_HEIGHT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -78,6 +80,8 @@ gtk_cell_renderer_init (GtkCellRenderer *cell)
|
|||||||
|
|
||||||
cell->can_activate = FALSE;
|
cell->can_activate = FALSE;
|
||||||
cell->visible = TRUE;
|
cell->visible = TRUE;
|
||||||
|
cell->width = -1;
|
||||||
|
cell->height = -1;
|
||||||
cell->xalign = 0.5;
|
cell->xalign = 0.5;
|
||||||
cell->yalign = 0.5;
|
cell->yalign = 0.5;
|
||||||
cell->xpad = 0;
|
cell->xpad = 0;
|
||||||
@ -156,6 +160,28 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
|||||||
2,
|
2,
|
||||||
G_PARAM_READABLE |
|
G_PARAM_READABLE |
|
||||||
G_PARAM_WRITABLE));
|
G_PARAM_WRITABLE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_WIDTH,
|
||||||
|
g_param_spec_int ("width",
|
||||||
|
_("width"),
|
||||||
|
_("The fixed width."),
|
||||||
|
-1,
|
||||||
|
100,
|
||||||
|
-1,
|
||||||
|
G_PARAM_READABLE |
|
||||||
|
G_PARAM_WRITABLE));
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class,
|
||||||
|
PROP_HEIGHT,
|
||||||
|
g_param_spec_int ("height",
|
||||||
|
_("height"),
|
||||||
|
_("The fixed height."),
|
||||||
|
-1,
|
||||||
|
100,
|
||||||
|
-1,
|
||||||
|
G_PARAM_READABLE |
|
||||||
|
G_PARAM_WRITABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -186,6 +212,12 @@ gtk_cell_renderer_get_property (GObject *object,
|
|||||||
case PROP_YPAD:
|
case PROP_YPAD:
|
||||||
g_value_set_uint (value, cell->ypad);
|
g_value_set_uint (value, cell->ypad);
|
||||||
break;
|
break;
|
||||||
|
case PROP_WIDTH:
|
||||||
|
g_value_set_int (value, cell->width);
|
||||||
|
break;
|
||||||
|
case PROP_HEIGHT:
|
||||||
|
g_value_set_int (value, cell->height);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -227,6 +259,14 @@ gtk_cell_renderer_set_property (GObject *object,
|
|||||||
cell->ypad = g_value_get_uint (value);
|
cell->ypad = g_value_get_uint (value);
|
||||||
g_object_notify (object, "ypad");
|
g_object_notify (object, "ypad");
|
||||||
break;
|
break;
|
||||||
|
case PROP_WIDTH:
|
||||||
|
cell->width = g_value_get_int (value);
|
||||||
|
g_object_notify (object, "width");
|
||||||
|
break;
|
||||||
|
case PROP_HEIGHT:
|
||||||
|
cell->height = g_value_get_int (value);
|
||||||
|
g_object_notify (object, "height");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -257,10 +297,29 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
|||||||
gint *width,
|
gint *width,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
|
gint *real_width = NULL;
|
||||||
|
gint *real_height = NULL;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||||
|
|
||||||
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell, widget, cell_area, x_offset, y_offset, width, height);
|
if (width)
|
||||||
|
{
|
||||||
|
if (cell->width == -1)
|
||||||
|
real_width = width;
|
||||||
|
else
|
||||||
|
*width = cell->width;
|
||||||
|
}
|
||||||
|
if (height)
|
||||||
|
{
|
||||||
|
if (cell->height == -1)
|
||||||
|
real_height = height;
|
||||||
|
else
|
||||||
|
*height = cell->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (real_width || real_height)
|
||||||
|
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell, widget, cell_area, x_offset, y_offset, real_width, real_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,3 +412,52 @@ gtk_cell_renderer_event (GtkCellRenderer *cell,
|
|||||||
flags);
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_cell_renderer_set_fixed_size:
|
||||||
|
* @cell: A #GtkCellRenderer
|
||||||
|
* @width: the width of the cell renderer, or -1
|
||||||
|
* @height: the height of the cell renderer, or -1
|
||||||
|
*
|
||||||
|
* Sets the renderer size to be explicit, independent of the properties set.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||||
|
gint width,
|
||||||
|
gint height)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
g_return_if_fail (width >= -1 && height >= -1);
|
||||||
|
|
||||||
|
if (width != cell->width)
|
||||||
|
{
|
||||||
|
cell->width = width;
|
||||||
|
g_object_notify (G_OBJECT (cell), "width");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height != cell->height)
|
||||||
|
{
|
||||||
|
cell->height = height;
|
||||||
|
g_object_notify (G_OBJECT (cell), "height");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_cell_renderer_get_fixed_size:
|
||||||
|
* @cell: A #GtkCellRenderer
|
||||||
|
* @width: location to fill in with the fixed width of the widget, or %NULL
|
||||||
|
* @height: location to fill in with the fixed height of the widget, or %NULL
|
||||||
|
*
|
||||||
|
* Fills in @width and @height with the appropriate size of @cell.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||||
|
gint *width,
|
||||||
|
gint *height)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||||
|
|
||||||
|
if (width)
|
||||||
|
(* width) = cell->width;
|
||||||
|
if (height)
|
||||||
|
(* height) = cell->height;
|
||||||
|
}
|
||||||
|
@ -51,14 +51,17 @@ struct _GtkCellRenderer
|
|||||||
{
|
{
|
||||||
GtkObject parent;
|
GtkObject parent;
|
||||||
|
|
||||||
gboolean can_activate;
|
|
||||||
gboolean visible;
|
|
||||||
|
|
||||||
gfloat xalign;
|
gfloat xalign;
|
||||||
gfloat yalign;
|
gfloat yalign;
|
||||||
|
|
||||||
|
gint width;
|
||||||
|
gint height;
|
||||||
|
|
||||||
guint16 xpad;
|
guint16 xpad;
|
||||||
guint16 ypad;
|
guint16 ypad;
|
||||||
|
|
||||||
|
guint can_activate : 1;
|
||||||
|
guint visible : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCellRendererClass
|
struct _GtkCellRendererClass
|
||||||
@ -113,6 +116,13 @@ gboolean gtk_cell_renderer_event (GtkCellRenderer *cell,
|
|||||||
GdkRectangle *background_area,
|
GdkRectangle *background_area,
|
||||||
GdkRectangle *cell_area,
|
GdkRectangle *cell_area,
|
||||||
GtkCellRendererState flags);
|
GtkCellRendererState flags);
|
||||||
|
void gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||||
|
gint width,
|
||||||
|
gint height);
|
||||||
|
void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||||
|
gint *width,
|
||||||
|
gint *height);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,8 @@ gtk_cell_renderer_text_init (GtkCellRendererText *celltext)
|
|||||||
GTK_CELL_RENDERER (celltext)->yalign = 0.5;
|
GTK_CELL_RENDERER (celltext)->yalign = 0.5;
|
||||||
GTK_CELL_RENDERER (celltext)->xpad = 2;
|
GTK_CELL_RENDERER (celltext)->xpad = 2;
|
||||||
GTK_CELL_RENDERER (celltext)->ypad = 2;
|
GTK_CELL_RENDERER (celltext)->ypad = 2;
|
||||||
|
|
||||||
|
celltext->fixed_height_rows = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -785,11 +787,15 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
|
|
||||||
if (font_desc)
|
if (font_desc)
|
||||||
pango_font_description_free (font_desc);
|
pango_font_description_free (font_desc);
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_FONT_DESC:
|
case PROP_FONT_DESC:
|
||||||
set_font_description (celltext, g_value_get_boxed (value));
|
set_font_description (celltext, g_value_get_boxed (value));
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_FAMILY:
|
case PROP_FAMILY:
|
||||||
@ -801,6 +807,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "family_set");
|
g_object_notify (G_OBJECT (celltext), "family_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_STYLE:
|
case PROP_STYLE:
|
||||||
@ -810,6 +818,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "style_set");
|
g_object_notify (G_OBJECT (celltext), "style_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_VARIANT:
|
case PROP_VARIANT:
|
||||||
@ -819,6 +829,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "variant_set");
|
g_object_notify (G_OBJECT (celltext), "variant_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_WEIGHT:
|
case PROP_WEIGHT:
|
||||||
@ -828,6 +840,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "weight_set");
|
g_object_notify (G_OBJECT (celltext), "weight_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_STRETCH:
|
case PROP_STRETCH:
|
||||||
@ -837,6 +851,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "stretch_set");
|
g_object_notify (G_OBJECT (celltext), "stretch_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SIZE:
|
case PROP_SIZE:
|
||||||
@ -846,11 +862,15 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "size_set");
|
g_object_notify (G_OBJECT (celltext), "size_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SCALE:
|
case PROP_SCALE:
|
||||||
celltext->font_scale = g_value_get_double (value);
|
celltext->font_scale = g_value_get_double (value);
|
||||||
celltext->scale_set = TRUE;
|
celltext->scale_set = TRUE;
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_SIZE_POINTS:
|
case PROP_SIZE_POINTS:
|
||||||
@ -860,6 +880,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
g_object_notify (G_OBJECT (celltext), "size_set");
|
g_object_notify (G_OBJECT (celltext), "size_set");
|
||||||
g_object_notify (G_OBJECT (celltext), "font_desc");
|
g_object_notify (G_OBJECT (celltext), "font_desc");
|
||||||
g_object_notify (G_OBJECT (celltext), "font");
|
g_object_notify (G_OBJECT (celltext), "font");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_EDITABLE:
|
case PROP_EDITABLE:
|
||||||
@ -885,6 +907,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
|||||||
celltext->rise = g_value_get_int (value);
|
celltext->rise = g_value_get_int (value);
|
||||||
celltext->rise_set = TRUE;
|
celltext->rise_set = TRUE;
|
||||||
g_object_notify (G_OBJECT (celltext), "rise_set");
|
g_object_notify (G_OBJECT (celltext), "rise_set");
|
||||||
|
if (celltext->fixed_height_rows != -1)
|
||||||
|
celltext->calc_fixed_height = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_BACKGROUND_SET:
|
case PROP_BACKGROUND_SET:
|
||||||
@ -1087,16 +1111,50 @@ gtk_cell_renderer_text_get_size (GtkCellRenderer *cell,
|
|||||||
PangoRectangle rect;
|
PangoRectangle rect;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
|
|
||||||
if (celltext->fixed_size)
|
if (celltext->calc_fixed_height)
|
||||||
{
|
{
|
||||||
if (width)
|
PangoContext *context;
|
||||||
*width = celltext->width;
|
PangoFontMetrics metrics;
|
||||||
if (height)
|
PangoFontDescription font_desc;
|
||||||
*height = celltext->height;
|
|
||||||
|
|
||||||
|
font_desc = (* widget->style->font_desc);
|
||||||
|
|
||||||
|
if (celltext->family_set &&
|
||||||
|
celltext->font.family_name)
|
||||||
|
font_desc.family_name = celltext->font.family_name;
|
||||||
|
if (celltext->style_set)
|
||||||
|
font_desc.style = celltext->font.style;
|
||||||
|
|
||||||
|
if (celltext->variant_set)
|
||||||
|
font_desc.variant = celltext->font.variant;
|
||||||
|
|
||||||
|
if (celltext->weight_set)
|
||||||
|
font_desc.weight = celltext->font.weight;
|
||||||
|
|
||||||
|
if (celltext->stretch_set)
|
||||||
|
font_desc.stretch = celltext->font.stretch;
|
||||||
|
|
||||||
|
if (celltext->size_set &&
|
||||||
|
celltext->font.size >= 0)
|
||||||
|
font_desc.size = celltext->font.size;
|
||||||
|
|
||||||
|
context = gtk_widget_get_pango_context (widget);
|
||||||
|
pango_context_get_metrics (context,
|
||||||
|
&font_desc,
|
||||||
|
pango_context_get_language (context),
|
||||||
|
&metrics);
|
||||||
|
gtk_cell_renderer_set_fixed_size (cell,
|
||||||
|
cell->width, 2*cell->ypad +
|
||||||
|
celltext->fixed_height_rows*(metrics.ascent + metrics.descent)/PANGO_SCALE);
|
||||||
|
if (height)
|
||||||
|
{
|
||||||
|
*height = cell->height;
|
||||||
|
height = NULL;
|
||||||
|
}
|
||||||
|
celltext->calc_fixed_height = FALSE;
|
||||||
|
if (width == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layout = get_layout (celltext, widget, FALSE, 0);
|
layout = get_layout (celltext, widget, FALSE, 0);
|
||||||
pango_layout_get_pixel_extents (layout, NULL, &rect);
|
pango_layout_get_pixel_extents (layout, NULL, &rect);
|
||||||
|
|
||||||
@ -1187,29 +1245,33 @@ gtk_cell_renderer_text_render (GtkCellRenderer *cell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_cell_renderer_text_set_fixed_size:
|
* gtk_cell_renderer_text_set_fixed_height_from_font:
|
||||||
* @renderer: A #GtkCellRendererText
|
* @renderer: A #GtkCellRendererText
|
||||||
* @fixed_size: TRUE if the renderer should be a fixed height.
|
* @number_of_rows: Number of rows of text each cell renderer is allocated, or -1
|
||||||
* @width: The width of the cell
|
|
||||||
* @height: The height it of the cell, or -1
|
|
||||||
*
|
*
|
||||||
* Sets the height of a renderer to explicitly be a certain size. This
|
* Sets the height of a renderer to explicitly be determined by the "font" and
|
||||||
* function is unflexible, and should really only be used if calculating the
|
* "y_pad" property set on it. Further changes in these properties do not
|
||||||
* size of a cell is too slow.
|
* affect the height, so they must be accompanied by a subsequent call to this
|
||||||
|
* function. Using this function is unflexible, and should really only be used
|
||||||
|
* if calculating the size of a cell is too slow. If @no_rows is -1, then the
|
||||||
|
* fixed height is unset, and the height is determined by the properties again.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_cell_renderer_text_set_fixed_size (GtkCellRendererText *renderer,
|
gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer,
|
||||||
gboolean fixed_size,
|
gint number_of_rows)
|
||||||
gint width,
|
|
||||||
gint height)
|
|
||||||
{
|
{
|
||||||
g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (renderer));
|
g_return_if_fail (GTK_IS_CELL_RENDERER_TEXT (renderer));
|
||||||
|
g_return_if_fail (number_of_rows == -1 || number_of_rows > 0);
|
||||||
|
|
||||||
if (renderer->fixed_size == (fixed_size)?TRUE:FALSE)
|
if (number_of_rows == -1)
|
||||||
return;
|
{
|
||||||
|
gtk_cell_renderer_set_fixed_size (GTK_CELL_RENDERER (renderer),
|
||||||
renderer->fixed_size = (fixed_size)?TRUE:FALSE;
|
GTK_CELL_RENDERER (renderer)->width,
|
||||||
renderer->height = height;
|
-1);
|
||||||
renderer->width = width;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
renderer->fixed_height_rows = number_of_rows;
|
||||||
|
renderer->calc_fixed_height = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,10 +54,8 @@ struct _GtkCellRendererText
|
|||||||
PangoUnderline underline_style;
|
PangoUnderline underline_style;
|
||||||
|
|
||||||
gint rise;
|
gint rise;
|
||||||
gint width;
|
gint fixed_height_rows;
|
||||||
gint height;
|
|
||||||
|
|
||||||
guint fixed_size : 1;
|
|
||||||
guint strikethrough : 1;
|
guint strikethrough : 1;
|
||||||
|
|
||||||
/* editable feature doesn't work */
|
/* editable feature doesn't work */
|
||||||
@ -83,6 +81,7 @@ struct _GtkCellRendererText
|
|||||||
guint strikethrough_set : 1;
|
guint strikethrough_set : 1;
|
||||||
|
|
||||||
guint editable_set : 1;
|
guint editable_set : 1;
|
||||||
|
guint calc_fixed_height : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCellRendererTextClass
|
struct _GtkCellRendererTextClass
|
||||||
@ -93,10 +92,8 @@ struct _GtkCellRendererTextClass
|
|||||||
GtkType gtk_cell_renderer_text_get_type (void);
|
GtkType gtk_cell_renderer_text_get_type (void);
|
||||||
GtkCellRenderer *gtk_cell_renderer_text_new (void);
|
GtkCellRenderer *gtk_cell_renderer_text_new (void);
|
||||||
|
|
||||||
void gtk_cell_renderer_text_set_fixed_size (GtkCellRendererText *renderer,
|
void gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer,
|
||||||
gboolean fixed_size,
|
gint number_of_rows);
|
||||||
gint width,
|
|
||||||
gint height);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -65,6 +65,13 @@ static gboolean gtk_list_store_iter_parent (GtkTreeModel *tree_mode
|
|||||||
GtkTreeIter *child);
|
GtkTreeIter *child);
|
||||||
|
|
||||||
|
|
||||||
|
static void gtk_list_store_set_n_columns (GtkListStore *list_store,
|
||||||
|
gint n_columns);
|
||||||
|
static void gtk_list_store_set_column_type (GtkListStore *list_store,
|
||||||
|
gint column,
|
||||||
|
GType type);
|
||||||
|
|
||||||
|
|
||||||
/* Drag and Drop */
|
/* Drag and Drop */
|
||||||
static gboolean gtk_list_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
static gboolean gtk_list_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||||
GtkTreePath *path);
|
GtkTreePath *path);
|
||||||
@ -235,38 +242,18 @@ gtk_list_store_init (GtkListStore *list_store)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_list_store_new:
|
* gtk_list_store_new:
|
||||||
*
|
|
||||||
* Creates a new #GtkListStore. A #GtkListStore implements the
|
|
||||||
* #GtkTreeModel interface, and stores a linked list of
|
|
||||||
* rows; each row can have any number of columns. Columns are of uniform type,
|
|
||||||
* i.e. all cells in a column have the same type such as #G_TYPE_STRING or
|
|
||||||
* #GDK_TYPE_PIXBUF. Use #GtkListStore to store data to be displayed in a
|
|
||||||
* #GtkTreeView.
|
|
||||||
*
|
|
||||||
* Return value: a new #GtkListStore
|
|
||||||
**/
|
|
||||||
GtkListStore *
|
|
||||||
gtk_list_store_new (void)
|
|
||||||
{
|
|
||||||
return GTK_LIST_STORE (g_object_new (gtk_list_store_get_type (), NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_list_store_new_with_types:
|
|
||||||
* @n_columns: number of columns in the list store
|
* @n_columns: number of columns in the list store
|
||||||
* @Varargs: all #GType types for the columns, from first to last
|
* @Varargs: all #GType types for the columns, from first to last
|
||||||
*
|
*
|
||||||
* Creates a new list store as with gtk_list_store_new(), simultaneously setting
|
* Creates a new list store as with @n_columns columns each of the types passed
|
||||||
* up the columns and column types as with gtk_list_store_set_n_columns() and
|
* in. As an example, gtk_tree_store_new (3, G_TYPE_INT, G_TYPE_STRING,
|
||||||
* gtk_list_store_set_column_type(). As an example,
|
* GDK_TYPE_PIXBUF); will create a new GtkListStore with three columns, of type
|
||||||
* gtk_tree_store_new_with_types (3, G_TYPE_INT, G_TYPE_STRING,
|
* int, string and GDkPixbuf respectively.
|
||||||
* GTK_TYPE_PIXBUF); will create a new GtkListStore with three columns, of type
|
|
||||||
* int, string and GtkPixbuf respectively.
|
|
||||||
*
|
*
|
||||||
* Return value: a new #GtkListStore
|
* Return value: a new #GtkListStore
|
||||||
**/
|
**/
|
||||||
GtkListStore *
|
GtkListStore *
|
||||||
gtk_list_store_new_with_types (gint n_columns,
|
gtk_list_store_new (gint n_columns,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
GtkListStore *retval;
|
GtkListStore *retval;
|
||||||
@ -275,7 +262,7 @@ gtk_list_store_new_with_types (gint n_columns,
|
|||||||
|
|
||||||
g_return_val_if_fail (n_columns > 0, NULL);
|
g_return_val_if_fail (n_columns > 0, NULL);
|
||||||
|
|
||||||
retval = gtk_list_store_new ();
|
retval = GTK_LIST_STORE (g_object_new (gtk_list_store_get_type (), NULL));
|
||||||
gtk_list_store_set_n_columns (retval, n_columns);
|
gtk_list_store_set_n_columns (retval, n_columns);
|
||||||
|
|
||||||
va_start (args, n_columns);
|
va_start (args, n_columns);
|
||||||
@ -298,15 +285,7 @@ gtk_list_store_new_with_types (gint n_columns,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void
|
||||||
* gtk_list_store_set_n_columns:
|
|
||||||
* @store: a #GtkListStore
|
|
||||||
* @n_columns: number of columns
|
|
||||||
*
|
|
||||||
* Sets the number of columns in the #GtkListStore.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gtk_list_store_set_n_columns (GtkListStore *list_store,
|
gtk_list_store_set_n_columns (GtkListStore *list_store,
|
||||||
gint n_columns)
|
gint n_columns)
|
||||||
{
|
{
|
||||||
@ -340,19 +319,7 @@ gtk_list_store_set_n_columns (GtkListStore *list_store,
|
|||||||
list_store->n_columns = n_columns;
|
list_store->n_columns = n_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static void
|
||||||
* gtk_list_store_set_column_type:
|
|
||||||
* @store: a #GtkListStore
|
|
||||||
* @column: column number
|
|
||||||
* @type: type of the data stored in @column
|
|
||||||
*
|
|
||||||
* Supported types include: %G_TYPE_UINT, %G_TYPE_INT, %G_TYPE_UCHAR,
|
|
||||||
* %G_TYPE_CHAR, %G_TYPE_BOOLEAN, %G_TYPE_POINTER, %G_TYPE_FLOAT,
|
|
||||||
* %G_TYPE_DOUBLE, %G_TYPE_STRING, %G_TYPE_OBJECT, and %G_TYPE_BOXED, along with
|
|
||||||
* subclasses of those types such as %GDK_TYPE_PIXBUF.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gtk_list_store_set_column_type (GtkListStore *list_store,
|
gtk_list_store_set_column_type (GtkListStore *list_store,
|
||||||
gint column,
|
gint column,
|
||||||
GType type)
|
GType type)
|
||||||
|
@ -60,14 +60,8 @@ struct _GtkListStoreClass
|
|||||||
|
|
||||||
|
|
||||||
GtkType gtk_list_store_get_type (void);
|
GtkType gtk_list_store_get_type (void);
|
||||||
GtkListStore *gtk_list_store_new (void);
|
GtkListStore *gtk_list_store_new (gint n_columns,
|
||||||
GtkListStore *gtk_list_store_new_with_types (gint n_columns,
|
|
||||||
...);
|
...);
|
||||||
void gtk_list_store_set_n_columns (GtkListStore *store,
|
|
||||||
gint n_columns);
|
|
||||||
void gtk_list_store_set_column_type (GtkListStore *store,
|
|
||||||
gint column,
|
|
||||||
GType type);
|
|
||||||
void gtk_list_store_set_value (GtkListStore *store,
|
void gtk_list_store_set_value (GtkListStore *store,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
gint column,
|
gint column,
|
||||||
|
@ -64,6 +64,13 @@ static gboolean gtk_tree_store_iter_parent (GtkTreeModel *tree_mode
|
|||||||
GtkTreeIter *child);
|
GtkTreeIter *child);
|
||||||
|
|
||||||
|
|
||||||
|
static void gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
|
||||||
|
gint n_columns);
|
||||||
|
static void gtk_tree_store_set_column_type (GtkTreeStore *tree_store,
|
||||||
|
gint column,
|
||||||
|
GType type);
|
||||||
|
|
||||||
|
|
||||||
/* DND interfaces */
|
/* DND interfaces */
|
||||||
static gboolean gtk_tree_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
static gboolean gtk_tree_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||||
GtkTreePath *path);
|
GtkTreePath *path);
|
||||||
@ -236,13 +243,7 @@ gtk_tree_store_init (GtkTreeStore *tree_store)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkTreeStore *
|
GtkTreeStore *
|
||||||
gtk_tree_store_new (void)
|
gtk_tree_store_new (gint n_columns,
|
||||||
{
|
|
||||||
return GTK_TREE_STORE (g_object_new (GTK_TYPE_TREE_STORE, NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkTreeStore *
|
|
||||||
gtk_tree_store_new_with_types (gint n_columns,
|
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
GtkTreeStore *retval;
|
GtkTreeStore *retval;
|
||||||
@ -251,7 +252,7 @@ gtk_tree_store_new_with_types (gint n_columns,
|
|||||||
|
|
||||||
g_return_val_if_fail (n_columns > 0, NULL);
|
g_return_val_if_fail (n_columns > 0, NULL);
|
||||||
|
|
||||||
retval = gtk_tree_store_new ();
|
retval = GTK_TREE_STORE (g_object_new (GTK_TYPE_TREE_STORE, NULL));
|
||||||
gtk_tree_store_set_n_columns (retval, n_columns);
|
gtk_tree_store_set_n_columns (retval, n_columns);
|
||||||
|
|
||||||
va_start (args, n_columns);
|
va_start (args, n_columns);
|
||||||
|
@ -59,15 +59,8 @@ struct _GtkTreeStoreClass
|
|||||||
|
|
||||||
|
|
||||||
GtkType gtk_tree_store_get_type (void);
|
GtkType gtk_tree_store_get_type (void);
|
||||||
GtkTreeStore *gtk_tree_store_new (void);
|
GtkTreeStore *gtk_tree_store_new (gint n_columns,
|
||||||
|
|
||||||
GtkTreeStore *gtk_tree_store_new_with_types (gint n_columns,
|
|
||||||
...);
|
...);
|
||||||
void gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
|
|
||||||
gint n_columns);
|
|
||||||
void gtk_tree_store_set_column_type (GtkTreeStore *tree_store,
|
|
||||||
gint column,
|
|
||||||
GType type);
|
|
||||||
void gtk_tree_store_set_value (GtkTreeStore *tree_store,
|
void gtk_tree_store_set_value (GtkTreeStore *tree_store,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
gint column,
|
gint column,
|
||||||
|
@ -5147,17 +5147,20 @@ gtk_tree_view_is_expander_column (GtkTreeView *tree_view,
|
|||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
|
if (tree_view->priv->expander_column != NULL)
|
||||||
|
{
|
||||||
if (tree_view->priv->expander_column == column)
|
if (tree_view->priv->expander_column == column)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (column != NULL)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
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)
|
if (((GtkTreeViewColumn *)list->data)->visible)
|
||||||
break;
|
break;
|
||||||
if (list && list->data == column)
|
if (list && list->data == column)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8196,8 +8199,8 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
|
|||||||
* @destroy: Destroy notifier for @data, or NULL
|
* @destroy: Destroy notifier for @data, or NULL
|
||||||
*
|
*
|
||||||
* This function should almost never be used. It is meant for private use by
|
* This function should almost never be used. It is meant for private use by
|
||||||
* ATK for determining the number of visible rows that are removed when the user
|
* ATK for determining the number of visible children that are removed when the
|
||||||
* collapses a row, or a row is deleted.
|
* user collapses a row, or a row is deleted.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view,
|
gtk_tree_view_set_destroy_count_func (GtkTreeView *tree_view,
|
||||||
|
@ -60,6 +60,7 @@ struct _GtkTreeViewColumnCellInfo
|
|||||||
GtkTreeCellDataFunc func;
|
GtkTreeCellDataFunc func;
|
||||||
gpointer func_data;
|
gpointer func_data;
|
||||||
GtkDestroyNotify destroy;
|
GtkDestroyNotify destroy;
|
||||||
|
gint requested_width;
|
||||||
guint16 padding;
|
guint16 padding;
|
||||||
guint expand : 1;
|
guint expand : 1;
|
||||||
guint fill : 1;
|
guint fill : 1;
|
||||||
@ -1334,6 +1335,47 @@ gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_tree_view_column_set_spacing:
|
||||||
|
* @tree_column: A #GtkTreeViewColumn.
|
||||||
|
* @spacing: distance between cell renderers in pixels.
|
||||||
|
*
|
||||||
|
* Sets the spacing field of @tree_column, which is the number of pixels to
|
||||||
|
* place between cell renderers packed into it.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column,
|
||||||
|
gint spacing)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
||||||
|
g_return_if_fail (spacing >= 0);
|
||||||
|
|
||||||
|
if (tree_column->spacing == spacing)
|
||||||
|
return;
|
||||||
|
|
||||||
|
tree_column->spacing = spacing;
|
||||||
|
if (tree_column->tree_view)
|
||||||
|
{
|
||||||
|
tree_column->dirty = TRUE;
|
||||||
|
gtk_widget_queue_resize (tree_column->tree_view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_tree_view_column_get_spacing:
|
||||||
|
* @tree_column: A #GtkTreeViewColumn.
|
||||||
|
*
|
||||||
|
* Returns the spacing of @tree_column.
|
||||||
|
**/
|
||||||
|
gint
|
||||||
|
gtk_tree_view_column_get_spacing (GtkTreeViewColumn *tree_column)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
|
||||||
|
|
||||||
|
return tree_column->spacing;
|
||||||
|
}
|
||||||
|
|
||||||
/* Options for manipulating the columns */
|
/* Options for manipulating the columns */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1347,7 +1389,6 @@ void
|
|||||||
gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
|
gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
|
||||||
gboolean visible)
|
gboolean visible)
|
||||||
{
|
{
|
||||||
g_return_if_fail (tree_column != NULL);
|
|
||||||
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
||||||
|
|
||||||
visible = !! visible;
|
visible = !! visible;
|
||||||
|
@ -66,6 +66,7 @@ struct _GtkTreeViewColumn
|
|||||||
gfloat xalign;
|
gfloat xalign;
|
||||||
guint property_changed_signal;
|
guint property_changed_signal;
|
||||||
|
|
||||||
|
gint spacing;
|
||||||
gint width;
|
gint width;
|
||||||
gint requested_width;
|
gint requested_width;
|
||||||
gint min_width;
|
gint min_width;
|
||||||
@ -135,6 +136,9 @@ void gtk_tree_view_column_set_cell_data_func (GtkTreeViewCol
|
|||||||
GtkDestroyNotify destroy);
|
GtkDestroyNotify destroy);
|
||||||
void gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column,
|
void gtk_tree_view_column_clear_attributes (GtkTreeViewColumn *tree_column,
|
||||||
GtkCellRenderer *cell_renderer);
|
GtkCellRenderer *cell_renderer);
|
||||||
|
void gtk_tree_view_column_set_spacing (GtkTreeViewColumn *tree_column,
|
||||||
|
gint spacing);
|
||||||
|
gint gtk_tree_view_column_get_spacing (GtkTreeViewColumn *tree_column);
|
||||||
void gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
|
void gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
|
||||||
gboolean visible);
|
gboolean visible);
|
||||||
gboolean gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column);
|
gboolean gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column);
|
||||||
|
@ -549,8 +549,8 @@ main (int argc, char *argv[])
|
|||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
/* First initialize all the models for signal purposes */
|
/* First initialize all the models for signal purposes */
|
||||||
left_tree_model = (GtkTreeModel *) gtk_list_store_new_with_types (2, G_TYPE_STRING, GTK_TYPE_POINTER);
|
left_tree_model = (GtkTreeModel *) gtk_list_store_new (2, G_TYPE_STRING, GTK_TYPE_POINTER);
|
||||||
sample_model = (GtkTreeModel *) gtk_list_store_new_with_types (1, G_TYPE_STRING);
|
sample_model = (GtkTreeModel *) gtk_list_store_new (1, G_TYPE_STRING);
|
||||||
sample_tree_view_top = gtk_tree_view_new_with_model (sample_model);
|
sample_tree_view_top = gtk_tree_view_new_with_model (sample_model);
|
||||||
sample_tree_view_bottom = gtk_tree_view_new_with_model (sample_model);
|
sample_tree_view_bottom = gtk_tree_view_new_with_model (sample_model);
|
||||||
top_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_top));
|
top_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_top));
|
||||||
|
@ -154,7 +154,7 @@ make_model (void)
|
|||||||
TreeStruct *month = toplevel;
|
TreeStruct *month = toplevel;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS,
|
model = gtk_tree_store_new (NUM_COLUMNS,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_BOOLEAN,
|
G_TYPE_BOOLEAN,
|
||||||
G_TYPE_BOOLEAN,
|
G_TYPE_BOOLEAN,
|
||||||
|
@ -65,7 +65,7 @@ main (int argc, char *argv[])
|
|||||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
|
||||||
|
|
||||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
// gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 0, GTK_TREE_SORT_ASCENDING);
|
// gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model), 0, GTK_TREE_SORT_ASCENDING);
|
||||||
g_print ("start model\n");
|
g_print ("start model\n");
|
||||||
tree_view = gtk_tree_view_new_with_model (model);
|
tree_view = gtk_tree_view_new_with_model (model);
|
||||||
|
@ -291,6 +291,8 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
setup_column (col);
|
setup_column (col);
|
||||||
|
gtk_tree_view_set_expander_column (tree_view, col);
|
||||||
|
|
||||||
|
|
||||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), col);
|
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), col);
|
||||||
|
|
||||||
@ -438,8 +440,6 @@ set_columns_type (GtkTreeView *tree_view, ColumnsType type)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gtk_tree_view_set_expander_column (tree_view, 1);
|
|
||||||
|
|
||||||
/* FALL THRU */
|
/* FALL THRU */
|
||||||
|
|
||||||
case COLUMNS_ONE:
|
case COLUMNS_ONE:
|
||||||
@ -505,7 +505,7 @@ create_list_model (void)
|
|||||||
|
|
||||||
t = get_model_types ();
|
t = get_model_types ();
|
||||||
|
|
||||||
store = gtk_list_store_new_with_types (N_COLUMNS,
|
store = gtk_list_store_new (N_COLUMNS,
|
||||||
t[0], t[1], t[2],
|
t[0], t[1], t[2],
|
||||||
t[3], t[4], t[5],
|
t[3], t[4], t[5],
|
||||||
t[6], t[7], t[8]);
|
t[6], t[7], t[8]);
|
||||||
@ -589,7 +589,7 @@ create_tree_model (void)
|
|||||||
|
|
||||||
t = get_model_types ();
|
t = get_model_types ();
|
||||||
|
|
||||||
store = gtk_tree_store_new_with_types (N_COLUMNS,
|
store = gtk_tree_store_new (N_COLUMNS,
|
||||||
t[0], t[1], t[2],
|
t[0], t[1], t[2],
|
||||||
t[3], t[4], t[5],
|
t[3], t[4], t[5],
|
||||||
t[6], t[7], t[8]);
|
t[6], t[7], t[8]);
|
||||||
@ -675,8 +675,8 @@ main (int argc,
|
|||||||
models[MODEL_SORTED_TREE] = gtk_tree_model_sort_new_with_model (model);
|
models[MODEL_SORTED_TREE] = gtk_tree_model_sort_new_with_model (model);
|
||||||
g_object_unref (G_OBJECT (model));
|
g_object_unref (G_OBJECT (model));
|
||||||
|
|
||||||
models[MODEL_EMPTY_LIST] = GTK_TREE_MODEL (gtk_list_store_new ());
|
models[MODEL_EMPTY_LIST] = GTK_TREE_MODEL (gtk_list_store_new (0));
|
||||||
models[MODEL_EMPTY_TREE] = GTK_TREE_MODEL (gtk_tree_store_new ());
|
models[MODEL_EMPTY_TREE] = GTK_TREE_MODEL (gtk_tree_store_new (0));
|
||||||
|
|
||||||
models[MODEL_NULL] = NULL;
|
models[MODEL_NULL] = NULL;
|
||||||
|
|
||||||
@ -1374,7 +1374,7 @@ run_automated_tests (void)
|
|||||||
gint i;
|
gint i;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
store = gtk_list_store_new_with_types (1, G_TYPE_INT);
|
store = gtk_list_store_new (1, G_TYPE_INT);
|
||||||
|
|
||||||
model = GTK_TREE_MODEL (store);
|
model = GTK_TREE_MODEL (store);
|
||||||
|
|
||||||
@ -1443,7 +1443,7 @@ run_automated_tests (void)
|
|||||||
GtkTreeStore *store;
|
GtkTreeStore *store;
|
||||||
GtkTreeIter root;
|
GtkTreeIter root;
|
||||||
|
|
||||||
store = gtk_tree_store_new_with_types (1, G_TYPE_INT);
|
store = gtk_tree_store_new (1, G_TYPE_INT);
|
||||||
gtk_tree_model_get_iter_root (GTK_TREE_MODEL (store), &root);
|
gtk_tree_model_get_iter_root (GTK_TREE_MODEL (store), &root);
|
||||||
treestore_torture_recurse (store, &root, 0);
|
treestore_torture_recurse (store, &root, 0);
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
gtk_init (&argc, &argv);
|
gtk_init (&argc, &argv);
|
||||||
|
|
||||||
base_model = gtk_tree_store_new_with_types (2, G_TYPE_STRING, G_TYPE_STRING);
|
base_model = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||||
|
|
||||||
/* FIXME: reverse this */
|
/* FIXME: reverse this */
|
||||||
make_window (0);
|
make_window (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user