2000-10-05 01:04:57 +00:00
|
|
|
/* gtktreeviewcolumn.c
|
|
|
|
* Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gtktreeviewcolumn.h"
|
|
|
|
#include "gtktreeprivate.h"
|
|
|
|
#include "gtksignal.h"
|
|
|
|
#include "gtkbutton.h"
|
|
|
|
#include "gtkalignment.h"
|
2000-10-16 17:50:15 +00:00
|
|
|
#include "gtklabel.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
CLICKED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void gtk_tree_view_column_init (GtkTreeViewColumn *tree_column);
|
|
|
|
static void gtk_tree_view_column_class_init (GtkTreeViewColumnClass *klass);
|
|
|
|
static void gtk_tree_view_column_set_attributesv (GtkTreeViewColumn *tree_column,
|
|
|
|
va_list args);
|
|
|
|
static void gtk_real_tree_column_clicked (GtkTreeViewColumn *tree_column);
|
|
|
|
|
|
|
|
|
|
|
|
static GtkObjectClass *parent_class = NULL;
|
|
|
|
static guint tree_column_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|
GtkType
|
|
|
|
gtk_tree_view_column_get_type (void)
|
|
|
|
{
|
|
|
|
static GtkType tree_column_type = 0;
|
|
|
|
|
|
|
|
if (!tree_column_type)
|
|
|
|
{
|
|
|
|
static const GTypeInfo tree_column_info =
|
|
|
|
{
|
|
|
|
sizeof (GtkTreeViewColumnClass),
|
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gtk_tree_view_column_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GtkTreeViewColumn),
|
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gtk_tree_view_column_init,
|
|
|
|
};
|
|
|
|
|
urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if
Wed Oct 25 20:47:41 2000 Tim Janik <timj@gtk.org>
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): urg, removed
implementation of gtk_marshal_VOID__INT_INT_INT_INT. if people do that,
couldn't they at least give it a non-standard name?
* gtk/gtktextlayout.c: arg! yet another implementation of
gtk_marshal_VOID__INT_INT_INT_INT(), is this a conspiracy?
* gtk/gtktextbuffer.c: gotcha! captured a vagabonding
gtk_marshal_VOID__INT_POINTER_INT() implementation, braught it back
home. now i know this _is_ a conspiracy.
* gtk/gtkwidget.c (gtk_widget_class_init): marshaller fixups for
::state-changed.
* gtk/gtkaccelgroup.c (gtk_accel_group_create_remove):
(gtk_accel_group_create_add): marshaller signature fixups.
* gtk/gtklistitem.c (gtk_list_item_class_init): signal creation fixups,
pass in GTK_TYPE_SCROLL_TYPE instead of GTK_TYPE_ENUM.
* gtk/gtkobject.[hc]: removed GTK_CONNECTED flag, it's not valid
anymore.
Tue Oct 24 23:59:21 2000 Tim Janik <timj@gtk.org>
* docs/reference/Makefile.am: disabled SUBDIRS for the moment, since
due to the signal system changes, it wouldn't build currently. to
be fixed soon.
* docs/Changes-2.0.txt: GtkSignal/GSignal updates.
* gtk/gtkwidget.c: ::direction_changed takes an enum as argument,
so it needs gtk_marshal_VOID__ENUM() instead of
gtk_marshal_NONE__UINT().
* gdk/gdk*.c: adapted type registration functions.
* gtk/gtkbindings.c:
* gtk/gtkaccelgroup.c: operate on GSignalQuery, GtkSignalQuery is
gone.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType.
* gtk/gtkobject.c:
(gtk_object_destroy):
(gtk_object_shutdown): fixed recursion guards. basically we have to
catch the case where any of GObject.shutdown() or gtk_object_destroy()
is called during ::destroy, and avoid recursion there.
* gtk/gtktypeutils.c:
* gtk/maketypes.awk: awk-script hackup to provide gtk_type_init() with
boxed_copy/boxed_free. this needs a more general solution based on a
publically installed code-generator utility.
* gtk/gtktypeutils.[hc]: compat aliased GTK_TYPE_BOXED to G_TYPE_BOXED,
glib's gobject has support for that now.
define GtkSignalMarshaller in terms of GSignalCMarshaller.
Mon Oct 23 09:36:42 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]:
* gtk/gtkmarshal.[hc]:
* gtk/Makefile.am: generate marshallers with glib-genmarshal and don't
compile gtkmarshal.c on its own anymore, just include it in gtksignal.c.
removed #include <gtkmarshal.h>s all over the place, gtksignal.h takes
care of that.
* *.c: marshaller name fixups.
* gtk/gtkmarshal.list: added a comment briefing the format.
Sun Oct 22 23:14:39 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]: nuked old implementation. we mostly have
compatibility macros here now. more specifically, most of
the API is preserved (yes, _most_, nonwithstanding the
following exceptions listed, the API is stil lHUGE ;)
things that got removed completely:
GtkSignalQuery, gtk_signal_query(), gtk_signal_n_emissions(),
gtk_signal_n_emissions_by_name(), gtk_signal_handlers_destroy(),
gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
gtk_signal_remove_emission_hook().
non-functional functions variants:
gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook().
the GtkCallbackMarshal argument to gtk_signal_connect_full() is
not supported anymore.
(gtk_signal_compat_matched): new internal function to aid
implementation of the compatibility macros, it provides
functionality to block/unblock/disconnect handlers based
on func/data.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType,
* *.c: adaptions to new type registration API signatures.
Fri Oct 20 15:26:33 2000 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.[hc]: removed G_TYPE_GTK_POINTER cludge.
2000-10-25 22:34:14 +00:00
|
|
|
tree_column_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkTreeViewColumn", &tree_column_info, 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return tree_column_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
|
|
|
|
{
|
|
|
|
GtkObjectClass *object_class;
|
|
|
|
|
|
|
|
object_class = (GtkObjectClass*) class;
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (class);
|
|
|
|
|
doh, this was broken beyond believe.
Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org>
* gtk/stock-icons/Makefile.am: doh, this was broken beyond believe.
* gtk/gtkbox.c: change property types from (u)long to (u)int for
::position and ::padding.
* gtk/gtkcontainer.c: make ::border_width an INT property.
* gtk/gtkpacker.c: make ::position an INT property.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed):
guard against NULL h/v scrollbars, since this is used at construction
time.
* gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented
internal gtk_clist_constructor().
* gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented
gtk_ctree_constructor().
* gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property
::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION.
* docs/reference/Makefile.am: fun stuff, disabled docs generation
again, gtk-scan.c needs to introspec paramspecs, not GtkAgs.
* gtk/gtkwidget.[hc]:
removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv()
and gtk_widget_get().
(gtk_widget_new): use g_object_new_valist().
(gtk_widget_set): use g_object_set_valist().
* gtk/gtkobject.[hc]:
removed gtk_object_arg_get_info(), gtk_object_getv(),
gtk_object_query_args(), gtk_object_newv(),
gtk_object_class_add_signals(),
gtk_object_class_user_signal_new(),
gtk_object_class_user_signal_newv(),
gtk_object_arg_set(), gtk_object_arg_get(),
gtk_object_args_collect(),
gtk_object_default_construct(),
gtk_object_constructed(),
GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED().
removed nsignals, signals and n_args members from GtkObjectClass.
(gtk_object_new): use g_object_new_valist().
(gtk_object_set): use g_object_set_valist().
(gtk_object_get): use g_object_get_valist().
* gtk/gtkcompat.h: define gtk_object_default_construct().
* gtk/gtktypeutils.c (gtk_type_new): create constructed objects via
g_object_new().
* gtk/*.c: removed gtk_object_class_add_signals() from class_init()
fucntions, cleaned up method assignments (make sure your structures
are setup properly before calling out). removed all GTK_CONSTRUCTED
hacks ;)
2000-12-13 01:34:41 +00:00
|
|
|
class->clicked = gtk_real_tree_column_clicked;
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
tree_column_signals[CLICKED] =
|
|
|
|
gtk_signal_new ("clicked",
|
|
|
|
GTK_RUN_FIRST,
|
|
|
|
GTK_CLASS_TYPE (object_class),
|
|
|
|
GTK_SIGNAL_OFFSET (GtkTreeViewColumnClass, clicked),
|
urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if
Wed Oct 25 20:47:41 2000 Tim Janik <timj@gtk.org>
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): urg, removed
implementation of gtk_marshal_VOID__INT_INT_INT_INT. if people do that,
couldn't they at least give it a non-standard name?
* gtk/gtktextlayout.c: arg! yet another implementation of
gtk_marshal_VOID__INT_INT_INT_INT(), is this a conspiracy?
* gtk/gtktextbuffer.c: gotcha! captured a vagabonding
gtk_marshal_VOID__INT_POINTER_INT() implementation, braught it back
home. now i know this _is_ a conspiracy.
* gtk/gtkwidget.c (gtk_widget_class_init): marshaller fixups for
::state-changed.
* gtk/gtkaccelgroup.c (gtk_accel_group_create_remove):
(gtk_accel_group_create_add): marshaller signature fixups.
* gtk/gtklistitem.c (gtk_list_item_class_init): signal creation fixups,
pass in GTK_TYPE_SCROLL_TYPE instead of GTK_TYPE_ENUM.
* gtk/gtkobject.[hc]: removed GTK_CONNECTED flag, it's not valid
anymore.
Tue Oct 24 23:59:21 2000 Tim Janik <timj@gtk.org>
* docs/reference/Makefile.am: disabled SUBDIRS for the moment, since
due to the signal system changes, it wouldn't build currently. to
be fixed soon.
* docs/Changes-2.0.txt: GtkSignal/GSignal updates.
* gtk/gtkwidget.c: ::direction_changed takes an enum as argument,
so it needs gtk_marshal_VOID__ENUM() instead of
gtk_marshal_NONE__UINT().
* gdk/gdk*.c: adapted type registration functions.
* gtk/gtkbindings.c:
* gtk/gtkaccelgroup.c: operate on GSignalQuery, GtkSignalQuery is
gone.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType.
* gtk/gtkobject.c:
(gtk_object_destroy):
(gtk_object_shutdown): fixed recursion guards. basically we have to
catch the case where any of GObject.shutdown() or gtk_object_destroy()
is called during ::destroy, and avoid recursion there.
* gtk/gtktypeutils.c:
* gtk/maketypes.awk: awk-script hackup to provide gtk_type_init() with
boxed_copy/boxed_free. this needs a more general solution based on a
publically installed code-generator utility.
* gtk/gtktypeutils.[hc]: compat aliased GTK_TYPE_BOXED to G_TYPE_BOXED,
glib's gobject has support for that now.
define GtkSignalMarshaller in terms of GSignalCMarshaller.
Mon Oct 23 09:36:42 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]:
* gtk/gtkmarshal.[hc]:
* gtk/Makefile.am: generate marshallers with glib-genmarshal and don't
compile gtkmarshal.c on its own anymore, just include it in gtksignal.c.
removed #include <gtkmarshal.h>s all over the place, gtksignal.h takes
care of that.
* *.c: marshaller name fixups.
* gtk/gtkmarshal.list: added a comment briefing the format.
Sun Oct 22 23:14:39 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]: nuked old implementation. we mostly have
compatibility macros here now. more specifically, most of
the API is preserved (yes, _most_, nonwithstanding the
following exceptions listed, the API is stil lHUGE ;)
things that got removed completely:
GtkSignalQuery, gtk_signal_query(), gtk_signal_n_emissions(),
gtk_signal_n_emissions_by_name(), gtk_signal_handlers_destroy(),
gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
gtk_signal_remove_emission_hook().
non-functional functions variants:
gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook().
the GtkCallbackMarshal argument to gtk_signal_connect_full() is
not supported anymore.
(gtk_signal_compat_matched): new internal function to aid
implementation of the compatibility macros, it provides
functionality to block/unblock/disconnect handlers based
on func/data.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType,
* *.c: adaptions to new type registration API signatures.
Fri Oct 20 15:26:33 2000 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.[hc]: removed G_TYPE_GTK_POINTER cludge.
2000-10-25 22:34:14 +00:00
|
|
|
gtk_marshal_VOID__VOID,
|
2000-10-05 01:04:57 +00:00
|
|
|
GTK_TYPE_NONE, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_view_column_init (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
tree_column->button = NULL;
|
|
|
|
tree_column->justification = GTK_JUSTIFY_LEFT;
|
2001-01-04 23:36:19 +00:00
|
|
|
tree_column->width = 0;
|
2000-10-05 01:04:57 +00:00
|
|
|
tree_column->min_width = -1;
|
|
|
|
tree_column->max_width = -1;
|
|
|
|
tree_column->cell = NULL;
|
|
|
|
tree_column->attributes = NULL;
|
|
|
|
tree_column->column_type = GTK_TREE_VIEW_COLUMN_AUTOSIZE;
|
|
|
|
tree_column->visible = TRUE;
|
|
|
|
tree_column->button_active = FALSE;
|
|
|
|
tree_column->dirty = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* used to make the buttons 'unclickable' */
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_tree_view_passive_func (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_real_tree_column_clicked (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Return value: A newly created #GtkTreeViewColumn.
|
|
|
|
**/
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeViewColumn *
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_view_column_new (void)
|
|
|
|
{
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeViewColumn *retval;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
retval = GTK_TREE_VIEW_COLUMN (gtk_type_new (GTK_TYPE_TREE_COLUMN));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_new_with_attributes:
|
|
|
|
* @title: The title to set the header to.
|
|
|
|
* @cell: The #GtkCellRenderer.
|
2000-10-30 23:21:38 +00:00
|
|
|
* @Varargs: A NULL terminated list of attributes.
|
2000-10-16 06:14:53 +00:00
|
|
|
*
|
|
|
|
* Creates a new #GtkTreeViewColumn with a number of default values. This is
|
|
|
|
* equivalent to calling @gtk_tree_view_column_set_title,
|
|
|
|
* @gtk_tree_view_column_set_cell_renderer, and
|
|
|
|
* @gtk_tree_view_column_set_attributes on the newly created #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Return value: A newly created #GtkTreeViewColumn.
|
|
|
|
**/
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeViewColumn *
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_tree_view_column_new_with_attributes (gchar *title,
|
|
|
|
GtkCellRenderer *cell,
|
|
|
|
...)
|
|
|
|
{
|
2000-11-09 16:52:17 +00:00
|
|
|
GtkTreeViewColumn *retval;
|
2000-10-05 01:04:57 +00:00
|
|
|
va_list args;
|
|
|
|
|
|
|
|
retval = gtk_tree_view_column_new ();
|
|
|
|
|
2000-11-09 16:52:17 +00:00
|
|
|
gtk_tree_view_column_set_title (retval, title);
|
|
|
|
gtk_tree_view_column_set_cell_renderer (retval, cell);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
va_start (args, cell);
|
2000-11-09 16:52:17 +00:00
|
|
|
gtk_tree_view_column_set_attributesv (retval, args);
|
2000-10-05 01:04:57 +00:00
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_cell_renderer:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @cell: The #GtkCellRenderer, or NULL.
|
|
|
|
*
|
|
|
|
* Sets the cell renderer of the @tree_column, and unsets the current
|
|
|
|
* attributes. If there is a cell renderer already set, then it is removed. If
|
|
|
|
* @cell is NULL, then the cell renderer is unset.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_cell_renderer (GtkTreeViewColumn *tree_column,
|
|
|
|
GtkCellRenderer *cell)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
if (cell)
|
|
|
|
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
|
|
|
|
|
|
|
if (cell)
|
|
|
|
g_object_ref (G_OBJECT (cell));
|
|
|
|
|
|
|
|
if (tree_column->cell)
|
|
|
|
g_object_unref (G_OBJECT (tree_column->cell));
|
|
|
|
|
|
|
|
tree_column->cell = cell;
|
2000-10-16 06:14:53 +00:00
|
|
|
|
|
|
|
gtk_tree_view_column_set_attributes (tree_column, NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_add_attribute:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @attribute: An attribute on the columns cell
|
|
|
|
* @column: The column position on the model to get the attribute from.
|
|
|
|
*
|
|
|
|
* Adds an attribute mapping to the list in @tree_column. The @column is the
|
|
|
|
* column position on the model to get a value from, and the @attribute is the
|
|
|
|
* parameter on the @tree_column's cell renderer to set that value to.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_add_attribute (GtkTreeViewColumn *tree_column,
|
|
|
|
gchar *attribute,
|
|
|
|
gint column)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
tree_column->attributes = g_slist_prepend (tree_column->attributes,
|
|
|
|
GINT_TO_POINTER (column));
|
|
|
|
tree_column->attributes = g_slist_prepend (tree_column->attributes,
|
|
|
|
g_strdup (attribute));
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_tree_view_column_set_attributesv (GtkTreeViewColumn *tree_column,
|
|
|
|
va_list args)
|
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
gchar *attribute;
|
|
|
|
gint column;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
attribute = va_arg (args, gchar *);
|
|
|
|
|
|
|
|
list = tree_column->attributes;
|
|
|
|
|
|
|
|
while (list && list->next)
|
|
|
|
{
|
|
|
|
g_free (list->data);
|
|
|
|
list = list->next->next;
|
|
|
|
}
|
|
|
|
g_slist_free (tree_column->attributes);
|
|
|
|
tree_column->attributes = NULL;
|
|
|
|
|
|
|
|
while (attribute != NULL)
|
|
|
|
{
|
|
|
|
column = va_arg (args, gint);
|
|
|
|
gtk_tree_view_column_add_attribute (tree_column,
|
|
|
|
attribute,
|
|
|
|
column);
|
|
|
|
attribute = va_arg (args, gchar *);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_attributes:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
* @Varargs: A NULL terminated listing of attributes.
|
2000-10-16 06:14:53 +00:00
|
|
|
*
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
* Sets the attributes in the list as the attributes of @tree_column.
|
|
|
|
* The attributes should be in attribute/column order, as in
|
|
|
|
* @gtk_tree_view_column_add_attribute. All existing attributes
|
|
|
|
* are removed, and replaced with the new attributes.
|
2000-10-16 06:14:53 +00:00
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_attributes (GtkTreeViewColumn *tree_column,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
va_start (args, tree_column);
|
|
|
|
|
|
|
|
gtk_tree_view_column_set_attributesv (tree_column, args);
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_cell_data:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @tree_model: The #GtkTreeModel to to get the cell renderers attributes from.
|
2000-10-30 23:21:38 +00:00
|
|
|
* @iter: The #GtkTreeIter to to get the cell renderer's attributes from.
|
2000-10-16 06:14:53 +00:00
|
|
|
*
|
|
|
|
* Sets the cell renderer based on the @tree_model and @tree_node. That is, for
|
|
|
|
* every attribute mapping in @tree_column, it will get a value from the set
|
|
|
|
* column on the @tree_node, and use that value to set the attribute on the cell
|
|
|
|
* renderer.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_cell_data (GtkTreeViewColumn *tree_column,
|
|
|
|
GtkTreeModel *tree_model,
|
2000-10-26 00:36:47 +00:00
|
|
|
GtkTreeIter *iter)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GSList *list;
|
|
|
|
GValue value = { 0, };
|
|
|
|
GObject *cell;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
g_return_if_fail (tree_column->cell != NULL);
|
|
|
|
|
2001-01-08 19:07:51 +00:00
|
|
|
if (tree_model == NULL)
|
|
|
|
return;
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (tree_column->func && (* tree_column->func) (tree_column,
|
|
|
|
tree_model,
|
2000-10-26 00:36:47 +00:00
|
|
|
iter,
|
2000-10-05 01:04:57 +00:00
|
|
|
tree_column->func_data))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cell = (GObject *) tree_column->cell;
|
|
|
|
list = tree_column->attributes;
|
|
|
|
|
|
|
|
while (list && list->next)
|
|
|
|
{
|
2000-10-27 23:34:58 +00:00
|
|
|
gtk_tree_model_get_value (tree_model, iter,
|
|
|
|
GPOINTER_TO_INT (list->next->data),
|
|
|
|
&value);
|
2000-12-12 07:32:32 +00:00
|
|
|
g_object_set_property (cell, (gchar *) list->data, &value);
|
2000-10-05 01:04:57 +00:00
|
|
|
g_value_unset (&value);
|
|
|
|
list = list->next->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Options for manipulating the columns */
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_visible:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @visible: TRUE if the @tree_column is visible.
|
|
|
|
*
|
|
|
|
* Sets the visibility of @tree_column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_visible (GtkTreeViewColumn *tree_column,
|
|
|
|
gboolean visible)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
visible = !! visible;
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (tree_column->visible == visible)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tree_column->visible = visible;
|
|
|
|
|
|
|
|
if (visible)
|
|
|
|
{
|
|
|
|
gtk_widget_show (tree_column->button);
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
|
|
|
|
gdk_window_show (tree_column->window);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_hide (tree_column->button);
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
|
|
|
|
gdk_window_hide (tree_column->window);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
_gtk_tree_view_set_size (GTK_TREE_VIEW (tree_column->tree_view), -1, -1);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_visible:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns TRUE if @tree_column is visible.
|
|
|
|
*
|
|
|
|
* Return value: whether the column is visible or not. If it is visible, then
|
|
|
|
* the tree will show the column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gboolean
|
|
|
|
gtk_tree_view_column_get_visible (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), FALSE);
|
|
|
|
|
|
|
|
return tree_column->visible;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
2001-01-04 21:33:24 +00:00
|
|
|
* gtk_tree_view_column_set_sizing:
|
2000-10-16 06:14:53 +00:00
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
2001-01-04 21:33:24 +00:00
|
|
|
* @type: The #GtkTreeViewColumnSizing.
|
2000-10-16 06:14:53 +00:00
|
|
|
*
|
|
|
|
* Sets the growth behavior of @tree_column to @type.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
2001-01-04 21:33:24 +00:00
|
|
|
gtk_tree_view_column_set_sizing (GtkTreeViewColumn *tree_column,
|
|
|
|
GtkTreeViewColumnSizing type)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
if (type == tree_column->column_type)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tree_column->column_type = type;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case GTK_TREE_VIEW_COLUMN_AUTOSIZE:
|
|
|
|
tree_column->dirty = TRUE;
|
|
|
|
case GTK_TREE_VIEW_COLUMN_FIXED:
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
|
|
|
|
gdk_window_hide (tree_column->window);
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
|
|
|
default:
|
Adapt to GtkTreeSelection changes
2001-01-01 Havoc Pennington <hp@redhat.com>
* gtk/gtktreeview.c: Adapt to GtkTreeSelection changes
* gtk/gtktreeselection.c (_gtk_tree_selection_set_tree_view):
don't fill in tree_view->priv->selection, kind of an unexpected
side effect
* gtk/gtkcellrenderertext.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderer.c: Remove definition of _ and include
gtkintl.h
(gtk_cell_renderer_get_property): remove calls to g_value_init
* gtk/gtkcellrendererpixbuf.c: Remove definition of _ and include
gtkintl.h
* gtk/gtkcellrenderertextpixbuf.c: Remove definition of _ macro
and include gtkintl.h
(gtk_cell_renderer_text_pixbuf_class_init): remove spaces from
property names
* gtk/gtktreeselection.c (_gtk_tree_selection_new): rename, return
GtkTreeSelection
(_gtk_tree_selection_new_from_with_view): rename, return
GtkTreeSelection
(_gtk_tree_selection_set_tree_view): rename with uscore
(gtk_tree_selection_get_selected): fill in the "model" out param
first, so it gets filled in even if we return at the top of the
function
(gtk_tree_selection_real_select_all): add a comment and an else{}
to clarify this a bit
(gtk_tree_selection_real_unselect_all): add the same else{}
* gtk/gtktreeselection.h: Rename new, new_with_tree_view, and
set_tree_view to have underscore prefixes, move them to the
private header, fix return type of new_with_tree_view
(struct _GtkTreeSelection): mark struct
fields private
* gtk/gtktreemodel.c (gtk_tree_model_get_flags): return
GtkTreeModelFlags, not a guint
(gtk_tree_path_prev): return gboolean not gint
(gtk_tree_path_up): return gboolean not gint
* gtk/gtktreemodel.h (struct _GtkTreeModelIface): make get_flags
return GtkTreeModelFlags, not a guint
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_finalize): check
that child model is non-null before unrefing it
(g_value_int_compare_func): make this a qsort compare func, not
a boolean predicate
* gtk/gtktreemodelsort.h: rename gtk_tree_model_set_sort_column,
(add -umn to the end), and mark it unimplemented
(gtk_tree_model_sort_resort): remove, this wasn't implemented, and
I don't see what it's for - doesn't the model always sort itself?
(gtk_tree_model_sort_set_compare): this had the wrong signature
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_attributes):
Fix the docs to say that it destructively replaces existing
attributes (previously said that it added attributes).
(gtk_tree_view_column_set_visible): canonicalize bool before
equality testing. Also, check for realization before
hiding/showing the tree_column->window; if this window could exist
before realization, then it's busted and needs fixing, we can't
create GDK resources pre-realization. Also, remove
superfluous queue_resize(), since set_size() does that for us.
(gtk_tree_view_column_set_col_type): check realization before
using tree_column->window
* gtk/gtktreedatalist.c: fix filename in copyright notice
2001-01-01 19:01:54 +00:00
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
|
|
|
|
{
|
|
|
|
gdk_window_show (tree_column->window);
|
|
|
|
gdk_window_raise (tree_column->window);
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_queue_resize (tree_column->tree_view);
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_col_type:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns the current type of @tree_column.
|
|
|
|
*
|
|
|
|
* Return value: The type of @tree_column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
|
|
|
gtk_tree_view_column_get_col_type (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, 0);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
|
|
|
|
|
|
|
|
return tree_column->column_type;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_size:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns the current size of the @tree_column in pixels.
|
|
|
|
*
|
|
|
|
* Return value: The current size of the @tree_column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
|
|
|
gtk_tree_view_column_get_size (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, 0);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), 0);
|
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
return tree_column->width;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
2001-01-04 21:33:24 +00:00
|
|
|
* gtk_tree_view_column_set_width:
|
2000-10-16 06:14:53 +00:00
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @size: The size to set the @tree_column to.
|
|
|
|
*
|
|
|
|
* Sets the size of the column in pixels, unless the the column type is
|
|
|
|
* #GTK_TREE_VIEW_COLUMN_AUTOSIZE. In this case, the value is discarded as the
|
|
|
|
* size of the column is based on the calculated width of the column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
2001-01-04 21:33:24 +00:00
|
|
|
gtk_tree_view_column_set_width (GtkTreeViewColumn *tree_column,
|
2000-10-05 01:04:57 +00:00
|
|
|
gint size)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
g_return_if_fail (size > 0);
|
|
|
|
|
|
|
|
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE ||
|
2001-01-04 23:36:19 +00:00
|
|
|
tree_column->width == size)
|
2000-10-05 01:04:57 +00:00
|
|
|
return;
|
|
|
|
|
2001-01-04 23:36:19 +00:00
|
|
|
tree_column->width = size;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view))
|
|
|
|
gtk_widget_queue_resize (tree_column->tree_view);
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_min_width:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @min_width: The minimum width of the column in pixels, or -1.
|
|
|
|
*
|
|
|
|
* Sets the minimum width of the @tree_column. If @min_width is -1, then the
|
|
|
|
* minimum width is unset.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
|
|
|
|
gint min_width)
|
|
|
|
{
|
|
|
|
gint real_min_width;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
g_return_if_fail (min_width >= -1);
|
|
|
|
|
|
|
|
if (min_width == tree_column->min_width)
|
|
|
|
return;
|
|
|
|
|
|
|
|
real_min_width = (tree_column->min_width == -1) ?
|
|
|
|
tree_column->button->requisition.width : tree_column->min_width;
|
|
|
|
|
|
|
|
/* We want to queue a resize if the either the old min_size or the
|
|
|
|
* new min_size determined the size of the column */
|
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view) &&
|
2001-01-04 23:36:19 +00:00
|
|
|
((tree_column->min_width > tree_column->width) ||
|
2000-10-05 01:04:57 +00:00
|
|
|
(tree_column->min_width == -1 &&
|
2001-01-04 23:36:19 +00:00
|
|
|
tree_column->button->requisition.width > tree_column->width) ||
|
|
|
|
(min_width > tree_column->width) ||
|
2000-10-05 01:04:57 +00:00
|
|
|
(min_width == -1 &&
|
2001-01-04 23:36:19 +00:00
|
|
|
tree_column->button->requisition.width > tree_column->width)))
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_widget_queue_resize (tree_column->tree_view);
|
|
|
|
|
|
|
|
if (tree_column->max_width != -1 &&
|
|
|
|
tree_column->max_width < real_min_width)
|
|
|
|
tree_column->max_width = real_min_width;
|
|
|
|
|
|
|
|
tree_column->min_width = min_width;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_min_width:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns the minimum width in pixels of the @tree_column, or -1 if no minimum
|
|
|
|
* width is set.
|
|
|
|
*
|
|
|
|
* Return value: The minimum width of the @tree_column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
|
|
|
gtk_tree_view_column_get_min_width (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, -1);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), -1);
|
|
|
|
|
|
|
|
return tree_column->min_width;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_max_width:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @max_width: The maximum width of the column in pixels, or -1.
|
|
|
|
*
|
|
|
|
* Sets the maximum width of the @tree_column. If @max_width is -1, then the
|
|
|
|
* maximum width is unset.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
|
|
|
|
gint max_width)
|
|
|
|
{
|
|
|
|
gint real_min_width;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
g_return_if_fail (max_width >= -1);
|
|
|
|
|
|
|
|
if (max_width == tree_column->max_width)
|
|
|
|
return;
|
|
|
|
|
|
|
|
real_min_width = tree_column->min_width == -1 ?
|
|
|
|
tree_column->button->requisition.width : tree_column->min_width;
|
|
|
|
|
|
|
|
if (GTK_WIDGET_REALIZED (tree_column->tree_view) &&
|
2001-01-04 23:36:19 +00:00
|
|
|
((tree_column->max_width < tree_column->width) ||
|
|
|
|
(max_width != -1 && max_width < tree_column->width)))
|
2000-10-05 01:04:57 +00:00
|
|
|
gtk_widget_queue_resize (tree_column->tree_view);
|
|
|
|
|
|
|
|
tree_column->max_width = max_width;
|
|
|
|
|
|
|
|
if (real_min_width > max_width)
|
|
|
|
tree_column->min_width = max_width;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_max_width:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns the maximum width in pixels of the @tree_column, or -1 if no maximum
|
|
|
|
* width is set.
|
|
|
|
*
|
|
|
|
* Return value: The maximum width of the @tree_column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gint
|
|
|
|
gtk_tree_view_column_get_max_width (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, -1);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), -1);
|
|
|
|
|
|
|
|
return tree_column->max_width;
|
|
|
|
}
|
|
|
|
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_clicked:
|
|
|
|
* @tree_column: a #GtkTreeViewColumn
|
|
|
|
*
|
|
|
|
* Emits the "clicked" signal on the column.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gtk_tree_view_column_clicked (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
gtk_signal_emit (GTK_OBJECT (tree_column), tree_column_signals[CLICKED]);
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_title:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @title: The title of the @tree_column.
|
|
|
|
*
|
|
|
|
* Sets the title of the @tree_column. If a custom widget has been set, then
|
|
|
|
* this value is ignored.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_title (GtkTreeViewColumn *tree_column,
|
|
|
|
gchar *title)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
g_free (tree_column->title);
|
|
|
|
if (title)
|
|
|
|
tree_column->title = g_strdup (title);
|
|
|
|
else
|
|
|
|
tree_column->title = NULL;
|
2000-10-16 06:14:53 +00:00
|
|
|
|
|
|
|
/* Hmmm. This is a little ugly... */
|
|
|
|
if (tree_column->button)
|
|
|
|
{
|
|
|
|
if (GTK_BIN (tree_column->button)->child &&
|
|
|
|
GTK_IS_ALIGNMENT (GTK_BIN (tree_column->button)->child))
|
|
|
|
{
|
|
|
|
if (GTK_BIN (GTK_BIN (tree_column->button)->child)->child &&
|
|
|
|
GTK_IS_LABEL (GTK_BIN (GTK_BIN (tree_column->button)->child)->child))
|
|
|
|
{
|
2000-10-16 17:50:15 +00:00
|
|
|
gtk_label_set_text (GTK_LABEL (GTK_BIN (GTK_BIN (tree_column->button)->child)->child),
|
|
|
|
tree_column->title);
|
2000-10-16 06:14:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_title:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns the title of the widget. This value should not be modified.
|
|
|
|
*
|
|
|
|
* Return value: the title of the column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
gchar *
|
|
|
|
gtk_tree_view_column_get_title (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
|
|
|
|
|
|
|
|
return tree_column->title;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
2001-01-04 21:33:24 +00:00
|
|
|
* gtk_tree_view_column_set_header_clickable:
|
2000-10-16 06:14:53 +00:00
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @active: TRUE if the header is active.
|
|
|
|
*
|
|
|
|
* Sets the header to be active if @active is TRUE. When the header is active,
|
|
|
|
* then it can take keyboard focus, and can be clicked.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
2001-01-04 21:33:24 +00:00
|
|
|
gtk_tree_view_column_set_header_clickable (GtkTreeViewColumn *tree_column,
|
2000-10-05 01:04:57 +00:00
|
|
|
gboolean active)
|
|
|
|
{
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
if (!tree_column->button)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (tree_column->button_active == active)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tree_column->button_active = active;
|
|
|
|
if (active)
|
|
|
|
{
|
|
|
|
gtk_signal_disconnect_by_func (GTK_OBJECT (tree_column->button),
|
|
|
|
(GtkSignalFunc) gtk_tree_view_passive_func,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
GTK_WIDGET_SET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (tree_column->tree_view))
|
|
|
|
gtk_widget_queue_draw (tree_column->button);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_signal_connect (GTK_OBJECT (tree_column->button),
|
|
|
|
"event",
|
|
|
|
(GtkSignalFunc) gtk_tree_view_passive_func,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
GTK_WIDGET_UNSET_FLAGS (tree_column->button, GTK_CAN_FOCUS);
|
|
|
|
|
|
|
|
if (GTK_WIDGET_VISIBLE (tree_column->tree_view))
|
|
|
|
gtk_widget_queue_draw (tree_column->button);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_widget:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @widget: A child #GtkWidget, or NULL.
|
|
|
|
*
|
|
|
|
* Sets the widget in the header to be @widget. If widget is NULL, then the
|
|
|
|
* header button is set with a #GtkLabel set to the title of @tree_column.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column,
|
|
|
|
GtkWidget *widget)
|
|
|
|
{
|
2000-10-16 06:14:53 +00:00
|
|
|
/* FIXME: Implement this function. */
|
2000-10-05 01:04:57 +00:00
|
|
|
#if 0
|
|
|
|
gint new_button = 0;
|
|
|
|
GtkWidget *old_widget;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_view != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
|
|
|
|
|
|
|
|
if (column < 0 || column >= tree_view->priv->columns)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* if the column button doesn't currently exist,
|
|
|
|
* it has to be created first */
|
|
|
|
if (!column->button)
|
|
|
|
{
|
|
|
|
column_button_create (tree_view, column);
|
|
|
|
new_button = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
column_title_new (clist, column, NULL);
|
|
|
|
|
|
|
|
/* remove and destroy the old widget */
|
|
|
|
old_widget = GTK_BIN (clist->column[column].button)->child;
|
|
|
|
if (old_widget)
|
|
|
|
gtk_container_remove (GTK_CONTAINER (clist->column[column].button),
|
|
|
|
old_widget);
|
|
|
|
|
|
|
|
/* add and show the widget */
|
|
|
|
if (widget)
|
|
|
|
{
|
|
|
|
gtk_container_add (GTK_CONTAINER (clist->column[column].button), widget);
|
|
|
|
gtk_widget_show (widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if this button didn't previously exist, then the
|
|
|
|
* column button positions have to be re-computed */
|
|
|
|
if (GTK_WIDGET_VISIBLE (clist) && new_button)
|
|
|
|
size_allocate_title_buttons (clist);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_get_widget:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
*
|
|
|
|
* Returns the #GtkWidget in the button in the column header. If a custom
|
|
|
|
* widget has not been set, then this will be a #GtkAlignment with a #GtkLabel
|
|
|
|
* in it.
|
|
|
|
*
|
|
|
|
* Return value: The #GtkWidget in the column header.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
GtkWidget *
|
|
|
|
gtk_tree_view_column_get_widget (GtkTreeViewColumn *tree_column)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (tree_column != NULL, NULL);
|
|
|
|
g_return_val_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column), NULL);
|
|
|
|
|
|
|
|
if (tree_column->button)
|
|
|
|
return GTK_BUTTON (tree_column->button)->child;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-10-16 06:14:53 +00:00
|
|
|
/**
|
|
|
|
* gtk_tree_view_column_set_justification:
|
|
|
|
* @tree_column: A #GtkTreeViewColumn.
|
|
|
|
* @justification: The justification of the title.
|
|
|
|
*
|
|
|
|
* Sets the justification of the title inside the column header. If a custom
|
|
|
|
* widget has been set, then this value is discarded.
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_tree_view_column_set_justification (GtkTreeViewColumn *tree_column,
|
|
|
|
GtkJustification justification)
|
|
|
|
{
|
|
|
|
GtkWidget *alignment;
|
|
|
|
|
|
|
|
g_return_if_fail (tree_column != NULL);
|
|
|
|
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
|
|
|
|
|
|
|
|
if (tree_column->justification == justification)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tree_column->justification = justification;
|
|
|
|
|
|
|
|
/* change the alignment of the button title if it's not a
|
|
|
|
* custom widget */
|
|
|
|
alignment = GTK_BIN (tree_column->button)->child;
|
|
|
|
|
|
|
|
if (GTK_IS_ALIGNMENT (alignment))
|
|
|
|
{
|
|
|
|
switch (tree_column->justification)
|
|
|
|
{
|
|
|
|
case GTK_JUSTIFY_LEFT:
|
|
|
|
gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.0, 0.5, 0.0, 0.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_JUSTIFY_RIGHT:
|
|
|
|
gtk_alignment_set (GTK_ALIGNMENT (alignment), 1.0, 0.5, 0.0, 0.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_JUSTIFY_CENTER:
|
|
|
|
gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.5, 0.5, 0.0, 0.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GTK_JUSTIFY_FILL:
|
|
|
|
gtk_alignment_set (GTK_ALIGNMENT (alignment), 0.5, 0.5, 0.0, 0.0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|