2000-10-05 01:04:57 +00:00
|
|
|
/* gtkcellrenderertoggle.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 <stdlib.h>
|
|
|
|
#include <gtk/gtkcellrenderertoggle.h>
|
|
|
|
#include <gtk/gtksignal.h>
|
2001-01-04 21:33:24 +00:00
|
|
|
#include "gtkintl.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
|
2000-12-12 07:32:32 +00:00
|
|
|
static void gtk_cell_renderer_toggle_get_property (GObject *object,
|
|
|
|
guint param_id,
|
|
|
|
GValue *value,
|
2001-03-07 14:49:21 +00:00
|
|
|
GParamSpec *pspec);
|
2000-12-12 07:32:32 +00:00
|
|
|
static void gtk_cell_renderer_toggle_set_property (GObject *object,
|
|
|
|
guint param_id,
|
|
|
|
const GValue *value,
|
2001-03-07 14:49:21 +00:00
|
|
|
GParamSpec *pspec);
|
2000-10-05 01:04:57 +00:00
|
|
|
static void gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltext);
|
|
|
|
static void gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class);
|
|
|
|
static void gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|
|
|
GtkWidget *widget,
|
2001-03-15 23:21:39 +00:00
|
|
|
GdkRectangle *cell_area,
|
|
|
|
gint *x_offset,
|
|
|
|
gint *y_offset,
|
2000-10-05 01:04:57 +00:00
|
|
|
gint *width,
|
|
|
|
gint *height);
|
|
|
|
static void gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkRectangle *background_area,
|
|
|
|
GdkRectangle *cell_area,
|
|
|
|
GdkRectangle *expose_area,
|
|
|
|
guint flags);
|
2001-09-17 21:44:20 +00:00
|
|
|
static gboolean gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
|
|
|
GdkEvent *event,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *path,
|
|
|
|
GdkRectangle *background_area,
|
|
|
|
GdkRectangle *cell_area,
|
|
|
|
guint flags);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TOGGLED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_ZERO,
|
2001-09-25 16:44:39 +00:00
|
|
|
PROP_ACTIVATABLE,
|
2001-01-04 21:33:24 +00:00
|
|
|
PROP_ACTIVE,
|
2000-10-05 01:04:57 +00:00
|
|
|
PROP_RADIO
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define TOGGLE_WIDTH 12
|
|
|
|
|
|
|
|
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
|
|
|
|
GtkType
|
|
|
|
gtk_cell_renderer_toggle_get_type (void)
|
|
|
|
{
|
|
|
|
static GtkType cell_toggle_type = 0;
|
|
|
|
|
|
|
|
if (!cell_toggle_type)
|
|
|
|
{
|
|
|
|
static const GTypeInfo cell_toggle_info =
|
|
|
|
{
|
|
|
|
sizeof (GtkCellRendererToggleClass),
|
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gtk_cell_renderer_toggle_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GtkCellRendererToggle),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gtk_cell_renderer_toggle_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
|
|
|
cell_toggle_type = g_type_register_static (GTK_TYPE_CELL_RENDERER, "GtkCellRendererToggle", &cell_toggle_info, 0);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return cell_toggle_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle)
|
|
|
|
{
|
2001-09-25 16:44:39 +00:00
|
|
|
celltoggle->activatable = TRUE;
|
2001-01-04 21:33:24 +00:00
|
|
|
celltoggle->active = FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
celltoggle->radio = FALSE;
|
2001-09-18 17:52:42 +00:00
|
|
|
GTK_CELL_RENDERER (celltoggle)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
|
2000-10-05 01:04:57 +00:00
|
|
|
GTK_CELL_RENDERER (celltoggle)->xpad = 2;
|
|
|
|
GTK_CELL_RENDERER (celltoggle)->ypad = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
|
|
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
|
|
|
|
|
2000-12-12 07:32:32 +00:00
|
|
|
object_class->get_property = gtk_cell_renderer_toggle_get_property;
|
|
|
|
object_class->set_property = gtk_cell_renderer_toggle_set_property;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
cell_class->get_size = gtk_cell_renderer_toggle_get_size;
|
|
|
|
cell_class->render = gtk_cell_renderer_toggle_render;
|
2001-09-17 21:44:20 +00:00
|
|
|
cell_class->activate = gtk_cell_renderer_toggle_activate;
|
2000-12-12 07:32:32 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
2001-01-04 21:33:24 +00:00
|
|
|
PROP_ACTIVE,
|
|
|
|
g_param_spec_boolean ("active",
|
2000-12-12 07:32:32 +00:00
|
|
|
_("Toggle state"),
|
2001-01-04 21:33:24 +00:00
|
|
|
_("The toggle state of the button"),
|
2000-12-12 07:32:32 +00:00
|
|
|
FALSE,
|
|
|
|
G_PARAM_READABLE |
|
|
|
|
G_PARAM_WRITABLE));
|
|
|
|
|
2001-09-25 16:44:39 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ACTIVATABLE,
|
|
|
|
g_param_spec_boolean ("activatable",
|
|
|
|
_("Activatable"),
|
|
|
|
_("The toggle button can be activated"),
|
|
|
|
TRUE,
|
|
|
|
G_PARAM_READABLE |
|
|
|
|
G_PARAM_WRITABLE));
|
|
|
|
|
2000-12-12 07:32:32 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_RADIO,
|
|
|
|
g_param_spec_boolean ("radio",
|
|
|
|
_("Radio state"),
|
2001-01-04 21:33:24 +00:00
|
|
|
_("Draw the toggle button as a radio button"),
|
2000-12-12 07:32:32 +00:00
|
|
|
FALSE,
|
|
|
|
G_PARAM_READABLE |
|
|
|
|
G_PARAM_WRITABLE));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
toggle_cell_signals[TOGGLED] =
|
|
|
|
gtk_signal_new ("toggled",
|
|
|
|
GTK_RUN_LAST,
|
|
|
|
GTK_CLASS_TYPE (object_class),
|
|
|
|
GTK_SIGNAL_OFFSET (GtkCellRendererToggleClass, toggled),
|
2001-04-12 16:11:54 +00:00
|
|
|
gtk_marshal_VOID__STRING,
|
2000-10-05 01:04:57 +00:00
|
|
|
GTK_TYPE_NONE, 1,
|
2001-04-12 16:11:54 +00:00
|
|
|
GTK_TYPE_STRING);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-12-12 07:32:32 +00:00
|
|
|
gtk_cell_renderer_toggle_get_property (GObject *object,
|
|
|
|
guint param_id,
|
|
|
|
GValue *value,
|
2001-03-07 14:49:21 +00:00
|
|
|
GParamSpec *pspec)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (object);
|
2000-12-12 07:32:32 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
switch (param_id)
|
|
|
|
{
|
2001-01-04 21:33:24 +00:00
|
|
|
case PROP_ACTIVE:
|
|
|
|
g_value_set_boolean (value, celltoggle->active);
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
2001-09-25 16:44:39 +00:00
|
|
|
case PROP_ACTIVATABLE:
|
|
|
|
g_value_set_boolean (value, celltoggle->activatable);
|
|
|
|
break;
|
2000-10-05 01:04:57 +00:00
|
|
|
case PROP_RADIO:
|
|
|
|
g_value_set_boolean (value, celltoggle->radio);
|
|
|
|
break;
|
|
|
|
default:
|
2000-12-12 07:32:32 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2000-12-12 07:32:32 +00:00
|
|
|
gtk_cell_renderer_toggle_set_property (GObject *object,
|
|
|
|
guint param_id,
|
|
|
|
const GValue *value,
|
2001-03-07 14:49:21 +00:00
|
|
|
GParamSpec *pspec)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
|
|
|
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (object);
|
2000-12-12 07:32:32 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
switch (param_id)
|
|
|
|
{
|
2001-01-04 21:33:24 +00:00
|
|
|
case PROP_ACTIVE:
|
2001-02-03 01:09:41 +00:00
|
|
|
celltoggle->active = g_value_get_boolean (value);
|
2001-03-05 19:55:30 +00:00
|
|
|
g_object_notify (G_OBJECT(object), "active");
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
2001-09-25 16:44:39 +00:00
|
|
|
case PROP_ACTIVATABLE:
|
|
|
|
celltoggle->activatable = g_value_get_boolean (value);
|
|
|
|
g_object_notify (G_OBJECT(object), "activatable");
|
|
|
|
break;
|
2000-10-05 01:04:57 +00:00
|
|
|
case PROP_RADIO:
|
|
|
|
celltoggle->radio = g_value_get_boolean (value);
|
2001-03-05 19:55:30 +00:00
|
|
|
g_object_notify (G_OBJECT(object), "radio");
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
|
|
|
default:
|
2000-12-12 07:32:32 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
2000-10-05 01:04:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_cell_renderer_toggle_new:
|
|
|
|
*
|
|
|
|
* Creates a new #GtkCellRendererToggle. Adjust rendering
|
|
|
|
* parameters using object properties. Object properties can be set
|
|
|
|
* globally (with g_object_set()). Also, with #GtkTreeViewColumn, you
|
|
|
|
* can bind a property to a value in a #GtkTreeModel. For example, you
|
|
|
|
* can bind the "active" property on the cell renderer to a boolean value
|
|
|
|
* in the model, thus causing the check button to reflect the state of
|
|
|
|
* the model.
|
|
|
|
*
|
|
|
|
* Return value: the new cell renderer
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
GtkCellRenderer *
|
|
|
|
gtk_cell_renderer_toggle_new (void)
|
|
|
|
{
|
|
|
|
return GTK_CELL_RENDERER (gtk_type_new (gtk_cell_renderer_toggle_get_type ()));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|
|
|
GtkWidget *widget,
|
2001-03-15 23:21:39 +00:00
|
|
|
GdkRectangle *cell_area,
|
|
|
|
gint *x_offset,
|
|
|
|
gint *y_offset,
|
2000-10-05 01:04:57 +00:00
|
|
|
gint *width,
|
|
|
|
gint *height)
|
|
|
|
{
|
2001-03-15 23:21:39 +00:00
|
|
|
gint calc_width;
|
|
|
|
gint calc_height;
|
|
|
|
|
|
|
|
calc_width = (gint) cell->xpad * 2 + TOGGLE_WIDTH;
|
|
|
|
calc_height = (gint) cell->ypad * 2 + TOGGLE_WIDTH;
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (width)
|
2001-03-15 23:21:39 +00:00
|
|
|
*width = calc_width;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
if (height)
|
2001-03-15 23:21:39 +00:00
|
|
|
*height = calc_height;
|
2001-03-20 20:07:35 +00:00
|
|
|
|
2001-03-15 23:21:39 +00:00
|
|
|
if (cell_area)
|
|
|
|
{
|
|
|
|
if (x_offset)
|
|
|
|
{
|
2001-09-25 16:44:39 +00:00
|
|
|
*x_offset = cell->xalign * (cell_area->width - calc_width);
|
|
|
|
*x_offset = MAX (*x_offset, 0);
|
2001-03-15 23:21:39 +00:00
|
|
|
}
|
|
|
|
if (y_offset)
|
|
|
|
{
|
2001-09-25 16:44:39 +00:00
|
|
|
*y_offset = cell->yalign * (cell_area->height - calc_height);
|
|
|
|
*y_offset = MAX (*y_offset, 0);
|
2001-03-15 23:21:39 +00:00
|
|
|
}
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|
|
|
GdkWindow *window,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkRectangle *background_area,
|
|
|
|
GdkRectangle *cell_area,
|
|
|
|
GdkRectangle *expose_area,
|
|
|
|
guint flags)
|
|
|
|
{
|
|
|
|
GtkCellRendererToggle *celltoggle = (GtkCellRendererToggle *) cell;
|
|
|
|
gint width, height;
|
2001-03-15 23:21:39 +00:00
|
|
|
gint x_offset, y_offset;
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
GtkShadowType shadow;
|
|
|
|
GtkStateType state;
|
|
|
|
|
2001-03-15 23:21:39 +00:00
|
|
|
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
|
|
|
|
&x_offset, &y_offset,
|
|
|
|
&width, &height);
|
2001-03-20 20:01:27 +00:00
|
|
|
width -= cell->xpad*2;
|
|
|
|
height -= cell->ypad*2;
|
2001-03-15 23:21:39 +00:00
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
return;
|
|
|
|
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
|
2001-08-29 21:30:20 +00:00
|
|
|
{
|
|
|
|
if (GTK_WIDGET_HAS_FOCUS (widget))
|
2001-09-25 16:44:39 +00:00
|
|
|
state = GTK_STATE_SELECTED;
|
2001-08-29 21:30:20 +00:00
|
|
|
else
|
2001-09-25 16:44:39 +00:00
|
|
|
state = GTK_STATE_ACTIVE;
|
2001-08-29 21:30:20 +00:00
|
|
|
}
|
2001-09-27 20:49:34 +00:00
|
|
|
if (celltoggle->activatable)
|
2001-08-29 21:30:20 +00:00
|
|
|
{
|
2001-09-25 16:44:39 +00:00
|
|
|
state = GTK_STATE_NORMAL;
|
2001-08-29 21:30:20 +00:00
|
|
|
}
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
else
|
2001-08-29 21:30:20 +00:00
|
|
|
{
|
2001-09-25 16:44:39 +00:00
|
|
|
state = GTK_STATE_INSENSITIVE;
|
2001-08-29 21:30:20 +00:00
|
|
|
}
|
2001-03-28 03:09:03 +00:00
|
|
|
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
if (celltoggle->radio)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
gtk_paint_option (widget->style,
|
|
|
|
window,
|
|
|
|
state, shadow,
|
|
|
|
cell_area, widget, "cellradio",
|
2001-03-23 00:35:19 +00:00
|
|
|
cell_area->x + x_offset + cell->xpad,
|
|
|
|
cell_area->y + y_offset + cell->ypad,
|
2001-09-25 16:44:39 +00:00
|
|
|
width - 1, height - 1);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
adapt to handle PangoColor
2001-01-26 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor
* gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to
not offset by TREE_VIEW_HEADER_HEIGHT
(gtk_tree_view_tree_to_widget_coords): fix to not offset by
TREE_VIEW_HEADER_HEIGHT
* configure.in (included_loaders): for me, --with-included-loaders
generates the error "the specified loader yes does not exist",
i.e. the arg defaults to "yes", so change test for value ""
to test for value "yes", and include all loaders in that case.
* gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function
* gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly
handle TREE_VIEW_VERTICAL_SEPARATOR
(gtk_tree_view_bin_expose): fix to consider the row offset as
pointing halfway into vertical separator.
(gtk_tree_view_draw_node_focus_rect): ditto
* gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add
--gtk-debug=updates, which causes gdk_window_set_debug_updates
(TRUE) to be called.
* gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a
debug mode where the invalid region is colored in on invalidate,
so you can see the flicker and know whether your redraw code is
doing a good job.
* gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in
tree window coordinates (clip rect is in tree window coords)
* gtk/Makefile.am: add gtktreednd.[hc]
* gtk/gtkliststore.c: implement gtktreednd interfaces.
* gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support
drag-and-drop data operations on a model (so we can set up tree
drag-and-drop automatically)
* gtk/testgtk.c: Add a window to change sensitivity in the
GtkLabel test; add a way to change the entry frame in GtkEntry
test
* gtk/gtkentry.c (gtk_entry_set_has_frame):
(gtk_entry_get_has_frame): new functions to remove the frame
around an entry
(gtk_entry_size_request): shrink requisition if no frame
(gtk_entry_draw_focus): don't draw frame if no frame
* gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for
checks inside a cell renderer
(gtk_default_draw_option): ditto for options
* gtk/gtktreeviewcolumn.c (update_button_contents): add/remove
children from the alignment, not the button
(gtk_tree_view_column_init): ref/sink the column, to emulate
GObject refcounting.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render):
Use theme functions to draw the toggles
* gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors
* gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and
GdkPangoAttrEmbossed to use in rendering insensitive text
* gdk/gdkpango.c (gdk_draw_layout_line): render new properties
* gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity
using new GDK features
2001-01-26 21:12:05 +00:00
|
|
|
gtk_paint_check (widget->style,
|
|
|
|
window,
|
|
|
|
state, shadow,
|
|
|
|
cell_area, widget, "cellcheck",
|
2001-03-23 00:35:19 +00:00
|
|
|
cell_area->x + x_offset + cell->xpad,
|
|
|
|
cell_area->y + y_offset + cell->ypad,
|
2001-09-25 16:44:39 +00:00
|
|
|
width - 1, height - 1);
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2001-09-17 21:44:20 +00:00
|
|
|
gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
|
|
|
GdkEvent *event,
|
|
|
|
GtkWidget *widget,
|
|
|
|
gchar *path,
|
|
|
|
GdkRectangle *background_area,
|
|
|
|
GdkRectangle *cell_area,
|
|
|
|
guint flags)
|
2000-10-05 01:04:57 +00:00
|
|
|
{
|
2001-01-16 03:49:24 +00:00
|
|
|
GtkCellRendererToggle *celltoggle;
|
|
|
|
|
|
|
|
celltoggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
2001-09-25 16:44:39 +00:00
|
|
|
if (celltoggle->activatable)
|
2001-01-16 03:49:24 +00:00
|
|
|
{
|
2001-09-25 16:44:39 +00:00
|
|
|
gtk_signal_emit (GTK_OBJECT (cell), toggle_cell_signals[TOGGLED], path);
|
|
|
|
return TRUE;
|
2001-01-16 03:49:24 +00:00
|
|
|
}
|
2001-09-25 16:44:39 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
}
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_cell_renderer_toggle_set_radio:
|
|
|
|
* @toggle: a #GtkCellRendererToggle
|
|
|
|
* @radio: %TRUE to make the toggle look like a radio button
|
|
|
|
*
|
|
|
|
* If @radio is %TRUE, the cell renderer renders a radio toggle
|
|
|
|
* (i.e. a toggle in a group of mutually-exclusive toggles).
|
|
|
|
* If %FALSE, it renders a check toggle (a standalone boolean option).
|
|
|
|
* This can be set globally for the cell renderer, or changed just
|
|
|
|
* before rendering each cell in the model (for #GtkTreeView, you set
|
|
|
|
* up a per-row setting using #GtkTreeViewColumn to associate model
|
|
|
|
* columns with cell renderer properties).
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
void
|
|
|
|
gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle,
|
|
|
|
gboolean radio)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
|
|
|
|
|
|
|
toggle->radio = radio;
|
|
|
|
}
|
2001-01-04 21:33:24 +00:00
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
/**
|
|
|
|
* gtk_cell_renderer_toggle_get_radio:
|
|
|
|
* @toggle: a #GtkCellRendererToggle
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if we're rendering radio toggles rather than checkboxes
|
|
|
|
**/
|
2001-01-04 21:33:24 +00:00
|
|
|
gboolean
|
2001-02-03 01:09:41 +00:00
|
|
|
gtk_cell_renderer_toggle_get_radio (GtkCellRendererToggle *toggle)
|
2001-01-04 21:33:24 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
return toggle->radio;
|
2001-01-04 21:33:24 +00:00
|
|
|
}
|
2001-03-02 00:49:32 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
|
|
|
|
|
|
|
|
return toggle->active;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle,
|
|
|
|
gboolean setting)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
|
|
|
|
2001-05-25 23:10:49 +00:00
|
|
|
g_object_set (G_OBJECT (toggle), "active", setting?TRUE:FALSE, NULL);
|
2001-03-02 00:49:32 +00:00
|
|
|
}
|