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
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2000-10-05 01:04:57 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2000-10-05 01:04:57 +00:00
|
|
|
|
#include <stdlib.h>
|
2003-10-23 18:25:53 +00:00
|
|
|
|
#include "gtkcellrenderertoggle.h"
|
2001-01-04 21:33:24 +00:00
|
|
|
|
#include "gtkintl.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2016-12-23 08:31:54 +00:00
|
|
|
|
#include "gtkrendericonprivate.h"
|
2016-02-15 03:40:03 +00:00
|
|
|
|
#include "gtkstylecontextprivate.h"
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
#include "gtktreeprivate.h"
|
2011-12-15 22:02:54 +00:00
|
|
|
|
#include "a11y/gtkbooleancellaccessible.h"
|
2010-07-09 17:22:23 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2011-04-11 01:42:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtkcellrenderertoggle
|
|
|
|
|
* @Short_description: Renders a toggle button in a cell
|
|
|
|
|
* @Title: GtkCellRendererToggle
|
|
|
|
|
*
|
|
|
|
|
* #GtkCellRendererToggle renders a toggle button in a cell. The
|
|
|
|
|
* button is drawn as a radio or a checkbutton, depending on the
|
|
|
|
|
* #GtkCellRendererToggle:radio property.
|
|
|
|
|
* When activated, it emits the #GtkCellRendererToggle::toggled signal.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
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_get_size (GtkCellRenderer *cell,
|
|
|
|
|
GtkWidget *widget,
|
2010-10-04 14:22:09 +00:00
|
|
|
|
const GdkRectangle *cell_area,
|
2001-03-15 23:21:39 +00:00
|
|
|
|
gint *x_offset,
|
|
|
|
|
gint *y_offset,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint *width,
|
|
|
|
|
gint *height);
|
2016-12-23 08:31:54 +00:00
|
|
|
|
static void gtk_cell_renderer_toggle_snapshot (GtkCellRenderer *cell,
|
|
|
|
|
GtkSnapshot *snapshot,
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkWidget *widget,
|
2010-08-21 11:18:14 +00:00
|
|
|
|
const GdkRectangle *background_area,
|
|
|
|
|
const GdkRectangle *cell_area,
|
Behaviour change, apply changes if the entry of the editable gets a focus
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
2002-10-14 22:50:18 +00:00
|
|
|
|
GtkCellRendererState flags);
|
2001-09-17 21:44:20 +00:00
|
|
|
|
static gboolean gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
|
|
|
|
GdkEvent *event,
|
|
|
|
|
GtkWidget *widget,
|
2001-10-31 20:20:12 +00:00
|
|
|
|
const gchar *path,
|
2010-10-04 14:22:09 +00:00
|
|
|
|
const GdkRectangle *background_area,
|
|
|
|
|
const GdkRectangle *cell_area,
|
Behaviour change, apply changes if the entry of the editable gets a focus
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
2002-10-14 22:50:18 +00:00
|
|
|
|
GtkCellRendererState flags);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
TOGGLED,
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
2008-05-19 14:15:34 +00:00
|
|
|
|
PROP_0,
|
2001-09-25 16:44:39 +00:00
|
|
|
|
PROP_ACTIVATABLE,
|
2001-01-04 21:33:24 +00:00
|
|
|
|
PROP_ACTIVE,
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
PROP_RADIO,
|
2016-10-23 15:39:31 +00:00
|
|
|
|
PROP_INCONSISTENT
|
2000-10-05 01:04:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
2011-03-02 03:31:13 +00:00
|
|
|
|
#define TOGGLE_WIDTH 16
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
|
|
|
|
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
2010-08-26 17:15:37 +00:00
|
|
|
|
struct _GtkCellRendererTogglePrivate
|
Migrating all cell renderers to use the new instance private data
Thu Dec 18 00:57:18 2003 Kristian Rietveld <kris@gtk.org>
Migrating all cell renderers to use the new instance private data
construction.
* gtk/gtktreeprivate.h: remove GtkCellRendererInfo, as it is no
longer being used.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init),
(gtk_cell_renderer_class_init), (gtk_cell_renderer_get_property),
(set_cell_bg_color), (gtk_cell_renderer_render): remove old
GtkCellRendererInfo handling, migrate to instance private data.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): moved focus_out_id
from GtkCellRendererInfo to text renderer private data.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_init),
(gtk_cell_renderer_pixbuf_class_init),
(gtk_cell_renderer_pixbuf_finalize),
(gtk_cell_renderer_pixbuf_get_property),
(gtk_cell_renderer_pixbuf_set_property),
(gtk_cell_renderer_pixbuf_create_stock_pixbuf),
(gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render):
migrate to instance private data.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_render): migrate to instance private data.
2003-12-18 00:06:43 +00:00
|
|
|
|
{
|
2010-06-01 21:20:14 +00:00
|
|
|
|
guint active : 1;
|
|
|
|
|
guint activatable : 1;
|
Migrating all cell renderers to use the new instance private data
Thu Dec 18 00:57:18 2003 Kristian Rietveld <kris@gtk.org>
Migrating all cell renderers to use the new instance private data
construction.
* gtk/gtktreeprivate.h: remove GtkCellRendererInfo, as it is no
longer being used.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init),
(gtk_cell_renderer_class_init), (gtk_cell_renderer_get_property),
(set_cell_bg_color), (gtk_cell_renderer_render): remove old
GtkCellRendererInfo handling, migrate to instance private data.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): moved focus_out_id
from GtkCellRendererInfo to text renderer private data.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_init),
(gtk_cell_renderer_pixbuf_class_init),
(gtk_cell_renderer_pixbuf_finalize),
(gtk_cell_renderer_pixbuf_get_property),
(gtk_cell_renderer_pixbuf_set_property),
(gtk_cell_renderer_pixbuf_create_stock_pixbuf),
(gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render):
migrate to instance private data.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_render): migrate to instance private data.
2003-12-18 00:06:43 +00:00
|
|
|
|
guint inconsistent : 1;
|
2010-06-01 21:20:14 +00:00
|
|
|
|
guint radio : 1;
|
Migrating all cell renderers to use the new instance private data
Thu Dec 18 00:57:18 2003 Kristian Rietveld <kris@gtk.org>
Migrating all cell renderers to use the new instance private data
construction.
* gtk/gtktreeprivate.h: remove GtkCellRendererInfo, as it is no
longer being used.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init),
(gtk_cell_renderer_class_init), (gtk_cell_renderer_get_property),
(set_cell_bg_color), (gtk_cell_renderer_render): remove old
GtkCellRendererInfo handling, migrate to instance private data.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): moved focus_out_id
from GtkCellRendererInfo to text renderer private data.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_init),
(gtk_cell_renderer_pixbuf_class_init),
(gtk_cell_renderer_pixbuf_finalize),
(gtk_cell_renderer_pixbuf_get_property),
(gtk_cell_renderer_pixbuf_set_property),
(gtk_cell_renderer_pixbuf_create_stock_pixbuf),
(gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render):
migrate to instance private data.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_render): migrate to instance private data.
2003-12-18 00:06:43 +00:00
|
|
|
|
};
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkCellRendererToggle, gtk_cell_renderer_toggle, GTK_TYPE_CELL_RENDERER)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_cell_renderer_toggle_init (GtkCellRendererToggle *celltoggle)
|
|
|
|
|
{
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv;
|
2006-01-13 13:09:14 +00:00
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
celltoggle->priv = gtk_cell_renderer_toggle_get_instance_private (celltoggle);
|
2010-06-01 21:20:14 +00:00
|
|
|
|
priv = celltoggle->priv;
|
2006-01-13 13:09:14 +00:00
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
priv->activatable = TRUE;
|
|
|
|
|
priv->active = FALSE;
|
|
|
|
|
priv->radio = FALSE;
|
2006-01-13 13:09:14 +00:00
|
|
|
|
|
2010-05-30 20:38:33 +00:00
|
|
|
|
g_object_set (celltoggle, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
|
|
|
|
|
gtk_cell_renderer_set_padding (GTK_CELL_RENDERER (celltoggle), 2, 2);
|
2006-01-13 13:09:14 +00:00
|
|
|
|
|
|
|
|
|
priv->inconsistent = FALSE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
2016-12-23 08:31:54 +00:00
|
|
|
|
cell_class->snapshot = gtk_cell_renderer_toggle_snapshot;
|
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",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Toggle state"),
|
|
|
|
|
P_("The toggle state of the button"),
|
2000-12-12 07:32:32 +00:00
|
|
|
|
FALSE,
|
2014-06-08 15:28:28 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_INCONSISTENT,
|
|
|
|
|
g_param_spec_boolean ("inconsistent",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Inconsistent state"),
|
|
|
|
|
P_("The inconsistent state of the button"),
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
FALSE,
|
2014-06-08 15:28:28 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
2000-12-12 07:32:32 +00:00
|
|
|
|
|
2001-09-25 16:44:39 +00:00
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_ACTIVATABLE,
|
|
|
|
|
g_param_spec_boolean ("activatable",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Activatable"),
|
|
|
|
|
P_("The toggle button can be activated"),
|
2001-09-25 16:44:39 +00:00
|
|
|
|
TRUE,
|
2014-06-08 15:28:28 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
2001-09-25 16:44:39 +00:00
|
|
|
|
|
2000-12-12 07:32:32 +00:00
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
|
PROP_RADIO,
|
|
|
|
|
g_param_spec_boolean ("radio",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Radio state"),
|
|
|
|
|
P_("Draw the toggle button as a radio button"),
|
2000-12-12 07:32:32 +00:00
|
|
|
|
FALSE,
|
2014-06-08 15:28:28 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2004-05-11 04:39:57 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkCellRendererToggle::toggled:
|
|
|
|
|
* @cell_renderer: the object which received the signal
|
|
|
|
|
* @path: string representation of #GtkTreePath describing the
|
|
|
|
|
* event location
|
|
|
|
|
*
|
|
|
|
|
* The ::toggled signal is emitted when the cell is toggled.
|
2013-10-10 20:33:36 +00:00
|
|
|
|
*
|
|
|
|
|
* It is the responsibility of the application to update the model
|
2013-10-10 21:31:44 +00:00
|
|
|
|
* with the correct value to store at @path. Often this is simply the
|
|
|
|
|
* opposite of the value currently stored at @path.
|
2004-05-11 04:39:57 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
toggle_cell_signals[TOGGLED] =
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_signal_new (I_("toggled"),
|
2002-10-07 01:38:40 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (object_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkCellRendererToggleClass, toggled),
|
|
|
|
|
NULL, NULL,
|
2016-08-29 14:00:17 +00:00
|
|
|
|
NULL,
|
2002-10-07 01:38:40 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
G_TYPE_STRING);
|
Migrating all cell renderers to use the new instance private data
Thu Dec 18 00:57:18 2003 Kristian Rietveld <kris@gtk.org>
Migrating all cell renderers to use the new instance private data
construction.
* gtk/gtktreeprivate.h: remove GtkCellRendererInfo, as it is no
longer being used.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init),
(gtk_cell_renderer_class_init), (gtk_cell_renderer_get_property),
(set_cell_bg_color), (gtk_cell_renderer_render): remove old
GtkCellRendererInfo handling, migrate to instance private data.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): moved focus_out_id
from GtkCellRendererInfo to text renderer private data.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_init),
(gtk_cell_renderer_pixbuf_class_init),
(gtk_cell_renderer_pixbuf_finalize),
(gtk_cell_renderer_pixbuf_get_property),
(gtk_cell_renderer_pixbuf_set_property),
(gtk_cell_renderer_pixbuf_create_stock_pixbuf),
(gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render):
migrate to instance private data.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_render): migrate to instance private data.
2003-12-18 00:06:43 +00:00
|
|
|
|
|
2013-02-25 20:41:30 +00:00
|
|
|
|
gtk_cell_renderer_class_set_accessible_type (cell_class, GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE);
|
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);
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv = celltoggle->priv;
|
Migrating all cell renderers to use the new instance private data
Thu Dec 18 00:57:18 2003 Kristian Rietveld <kris@gtk.org>
Migrating all cell renderers to use the new instance private data
construction.
* gtk/gtktreeprivate.h: remove GtkCellRendererInfo, as it is no
longer being used.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init),
(gtk_cell_renderer_class_init), (gtk_cell_renderer_get_property),
(set_cell_bg_color), (gtk_cell_renderer_render): remove old
GtkCellRendererInfo handling, migrate to instance private data.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): moved focus_out_id
from GtkCellRendererInfo to text renderer private data.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_init),
(gtk_cell_renderer_pixbuf_class_init),
(gtk_cell_renderer_pixbuf_finalize),
(gtk_cell_renderer_pixbuf_get_property),
(gtk_cell_renderer_pixbuf_set_property),
(gtk_cell_renderer_pixbuf_create_stock_pixbuf),
(gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render):
migrate to instance private data.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_render): migrate to instance private data.
2003-12-18 00:06:43 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
switch (param_id)
|
|
|
|
|
{
|
2001-01-04 21:33:24 +00:00
|
|
|
|
case PROP_ACTIVE:
|
2010-06-01 21:20:14 +00:00
|
|
|
|
g_value_set_boolean (value, priv->active);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
break;
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
case PROP_INCONSISTENT:
|
Migrating all cell renderers to use the new instance private data
Thu Dec 18 00:57:18 2003 Kristian Rietveld <kris@gtk.org>
Migrating all cell renderers to use the new instance private data
construction.
* gtk/gtktreeprivate.h: remove GtkCellRendererInfo, as it is no
longer being used.
* gtk/gtkcellrenderer.c (gtk_cell_renderer_init),
(gtk_cell_renderer_class_init), (gtk_cell_renderer_get_property),
(set_cell_bg_color), (gtk_cell_renderer_render): remove old
GtkCellRendererInfo handling, migrate to instance private data.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): moved focus_out_id
from GtkCellRendererInfo to text renderer private data.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_init),
(gtk_cell_renderer_pixbuf_class_init),
(gtk_cell_renderer_pixbuf_finalize),
(gtk_cell_renderer_pixbuf_get_property),
(gtk_cell_renderer_pixbuf_set_property),
(gtk_cell_renderer_pixbuf_create_stock_pixbuf),
(gtk_cell_renderer_pixbuf_get_size), (gtk_cell_renderer_pixbuf_render):
migrate to instance private data.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_render): migrate to instance private data.
2003-12-18 00:06:43 +00:00
|
|
|
|
g_value_set_boolean (value, priv->inconsistent);
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
break;
|
2001-09-25 16:44:39 +00:00
|
|
|
|
case PROP_ACTIVATABLE:
|
2010-06-01 21:20:14 +00:00
|
|
|
|
g_value_set_boolean (value, priv->activatable);
|
2001-09-25 16:44:39 +00:00
|
|
|
|
break;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
case PROP_RADIO:
|
2010-06-01 21:20:14 +00:00
|
|
|
|
g_value_set_boolean (value, priv->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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv = celltoggle->priv;
|
2005-11-14 11:28:33 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
switch (param_id)
|
|
|
|
|
{
|
2001-01-04 21:33:24 +00:00
|
|
|
|
case PROP_ACTIVE:
|
2014-06-08 15:28:28 +00:00
|
|
|
|
if (priv->active != g_value_get_boolean (value))
|
|
|
|
|
{
|
|
|
|
|
priv->active = g_value_get_boolean (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
break;
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
case PROP_INCONSISTENT:
|
2014-06-08 15:28:28 +00:00
|
|
|
|
if (priv->inconsistent != g_value_get_boolean (value))
|
|
|
|
|
{
|
|
|
|
|
priv->inconsistent = g_value_get_boolean (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
break;
|
2001-09-25 16:44:39 +00:00
|
|
|
|
case PROP_ACTIVATABLE:
|
2014-06-08 15:28:28 +00:00
|
|
|
|
if (priv->activatable != g_value_get_boolean (value))
|
|
|
|
|
{
|
|
|
|
|
priv->activatable = g_value_get_boolean (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
2001-09-25 16:44:39 +00:00
|
|
|
|
break;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
case PROP_RADIO:
|
2014-06-08 15:28:28 +00:00
|
|
|
|
if (priv->radio != g_value_get_boolean (value))
|
|
|
|
|
{
|
|
|
|
|
priv->radio = g_value_get_boolean (value);
|
|
|
|
|
g_object_notify_by_pspec (object, pspec);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-03 01:09:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_cell_renderer_toggle_new:
|
2005-11-14 11:28:33 +00:00
|
|
|
|
*
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* 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
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* can bind the “active” property on the cell renderer to a boolean value
|
2001-02-03 01:09:41 +00:00
|
|
|
|
* in the model, thus causing the check button to reflect the state of
|
|
|
|
|
* the model.
|
2005-11-14 11:28:33 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the new cell renderer
|
2001-02-03 01:09:41 +00:00
|
|
|
|
**/
|
2000-10-05 01:04:57 +00:00
|
|
|
|
GtkCellRenderer *
|
|
|
|
|
gtk_cell_renderer_toggle_new (void)
|
|
|
|
|
{
|
2002-10-07 01:38:40 +00:00
|
|
|
|
return g_object_new (GTK_TYPE_CELL_RENDERER_TOGGLE, NULL);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-15 17:08:14 +00:00
|
|
|
|
static GtkStyleContext *
|
|
|
|
|
gtk_cell_renderer_toggle_save_context (GtkCellRenderer *cell,
|
|
|
|
|
GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkCellRendererTogglePrivate *priv = GTK_CELL_RENDERER_TOGGLE (cell)->priv;
|
|
|
|
|
|
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
|
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
|
|
|
|
|
|
|
|
|
if (priv->radio)
|
|
|
|
|
gtk_style_context_save_named (context, "radio");
|
|
|
|
|
else
|
|
|
|
|
gtk_style_context_save_named (context, "check");
|
|
|
|
|
|
|
|
|
|
return context;
|
|
|
|
|
}
|
2016-02-16 01:41:44 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
calc_indicator_size (GtkStyleContext *context,
|
|
|
|
|
gint *width,
|
|
|
|
|
gint *height)
|
|
|
|
|
{
|
2016-10-08 03:07:23 +00:00
|
|
|
|
gtk_style_context_get (context,
|
2016-02-16 01:41:44 +00:00
|
|
|
|
"min-width", width,
|
|
|
|
|
"min-height", height,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
if (*width == 0)
|
|
|
|
|
*width = TOGGLE_WIDTH;
|
|
|
|
|
if (*height == 0)
|
|
|
|
|
*height = TOGGLE_WIDTH;
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
static void
|
2010-10-04 14:22:09 +00:00
|
|
|
|
gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
const GdkRectangle *cell_area,
|
|
|
|
|
gint *x_offset,
|
|
|
|
|
gint *y_offset,
|
|
|
|
|
gint *width,
|
|
|
|
|
gint *height)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2001-03-15 23:21:39 +00:00
|
|
|
|
gint calc_width;
|
|
|
|
|
gint calc_height;
|
2010-05-30 20:38:33 +00:00
|
|
|
|
gint xpad, ypad;
|
2016-02-15 17:16:32 +00:00
|
|
|
|
GtkStyleContext *context;
|
|
|
|
|
GtkBorder border, padding;
|
2006-01-13 13:09:14 +00:00
|
|
|
|
|
2010-05-30 20:38:33 +00:00
|
|
|
|
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
2016-02-15 17:16:32 +00:00
|
|
|
|
|
|
|
|
|
context = gtk_cell_renderer_toggle_save_context (cell, widget);
|
2016-10-08 03:07:23 +00:00
|
|
|
|
gtk_style_context_get_padding (context, &padding);
|
|
|
|
|
gtk_style_context_get_border (context, &border);
|
2016-02-15 17:16:32 +00:00
|
|
|
|
|
2016-10-23 15:39:31 +00:00
|
|
|
|
calc_indicator_size (context, &calc_width, &calc_height);
|
2016-02-16 01:41:44 +00:00
|
|
|
|
calc_width += xpad * 2 + padding.left + padding.right + border.left + border.right;
|
|
|
|
|
calc_height += ypad * 2 + padding.top + padding.bottom + border.top + border.bottom;
|
2016-02-15 17:16:32 +00:00
|
|
|
|
|
|
|
|
|
gtk_style_context_restore (context);
|
2001-03-15 23:21:39 +00:00
|
|
|
|
|
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)
|
|
|
|
|
{
|
2010-05-30 20:38:33 +00:00
|
|
|
|
gfloat xalign, yalign;
|
|
|
|
|
|
|
|
|
|
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
|
|
|
|
|
2001-03-15 23:21:39 +00:00
|
|
|
|
if (x_offset)
|
|
|
|
|
{
|
handle rtl code.
Sun Mar 2 23:35:57 2003 Jonathan Blandford <jrb@gnome.org>
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_get_size):
handle rtl code.
* gtk/gtkcellrendererpixbuf.c (gtk_cell_renderer_pixbuf_get_size): ditto
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_get_size): ditto
* gtk/gtktreeview.c: (invalidate_column),
(invalidate_last_column),
(gtk_tree_view_get_real_requested_width_from_column),
(gtk_tree_view_size_allocate_columns),
(gtk_tree_view_size_allocate), (gtk_tree_view_button_press),
(gtk_tree_view_button_release_drag_column),
(gtk_tree_view_update_current_reorder),
(gtk_tree_view_motion_drag_column), (gtk_tree_view_bin_expose),
(gtk_tree_view_key_press), (gtk_tree_view_header_focus),
(gtk_tree_view_get_background_xrange),
(gtk_tree_view_get_arrow_xrange),
(gtk_tree_view_is_expander_column),
(gtk_tree_view_set_column_drag_info),
(gtk_tree_view_move_cursor_left_right):
Add RTL support.
* gtk/gtktreeviewcolumn.h (struct _GtkTreeViewColumn): add an
expand flag.
* gtk/gtktreeviewcolumn.c:
(gtk_tree_view_column_class_init),
(gtk_tree_view_column_set_property),
(gtk_tree_view_column_get_property),
(gtk_tree_view_column_set_expand),
(gtk_tree_view_column_get_expand),
(gtk_tree_view_column_cell_process_action):
Add support for expand flag
2003-03-03 04:51:42 +00:00
|
|
|
|
*x_offset = ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
2010-05-30 20:38:33 +00:00
|
|
|
|
(1.0 - xalign) : xalign) * (cell_area->width - calc_width);
|
2001-09-25 16:44:39 +00:00
|
|
|
|
*x_offset = MAX (*x_offset, 0);
|
2001-03-15 23:21:39 +00:00
|
|
|
|
}
|
|
|
|
|
if (y_offset)
|
|
|
|
|
{
|
2010-05-30 20:38:33 +00:00
|
|
|
|
*y_offset = yalign * (cell_area->height - calc_height);
|
2001-09-25 16:44:39 +00:00
|
|
|
|
*y_offset = MAX (*y_offset, 0);
|
2001-03-15 23:21:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2006-12-03 20:02:04 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (x_offset) *x_offset = 0;
|
|
|
|
|
if (y_offset) *y_offset = 0;
|
|
|
|
|
}
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2016-12-23 08:31:54 +00:00
|
|
|
|
gtk_cell_renderer_toggle_snapshot (GtkCellRenderer *cell,
|
|
|
|
|
GtkSnapshot *snapshot,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
const GdkRectangle *background_area,
|
|
|
|
|
const GdkRectangle *cell_area,
|
|
|
|
|
GtkCellRendererState flags)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2010-06-01 21:20:14 +00:00
|
|
|
|
GtkCellRendererToggle *celltoggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv = celltoggle->priv;
|
2011-01-12 20:27:25 +00:00
|
|
|
|
GtkStyleContext *context;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
gint width, height;
|
2001-03-15 23:21:39 +00:00
|
|
|
|
gint x_offset, y_offset;
|
2010-05-30 20:38:33 +00:00
|
|
|
|
gint xpad, ypad;
|
2011-01-12 20:27:25 +00:00
|
|
|
|
GtkStateFlags state;
|
2016-02-15 17:16:32 +00:00
|
|
|
|
GtkBorder padding, border;
|
2016-12-23 08:31:54 +00:00
|
|
|
|
GtkCssImageBuiltinType image_type;
|
add a gtk_list_store_sort_iter_changed line for some special case ...
Tue Nov 26 22:26:04 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtk{tree,list}store.c (gtk_{tree,list}_store_real_set_value):
add a gtk_list_store_sort_iter_changed line for some special
case ... (#96647 (issue 1), testcases from Soeren Sandmann and
Daniel Elstner).
Tue Nov 26 22:18:06 2002 Kristian Rietveld <kris@gtk.org>
Inconsistent state for toggle renderers, requested by Paolo Bacchilega
in #88130.
* gtk/gtktreeprivate.h: move GtkCellRendererInfo here.
* gtk/gtkcellrenderer.c: moved GtkCellRendererInfo away,
fix some indentation issues.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_class_init),
(gtk_cell_renderer_toggle_set_property),
(gtk_cell_renderer_toggle_get_property),
(gtk_cell_renderer_toggle_render): add an inconsistent property.
* gtk/gtkstyle.c (gtk_default_draw_check),
(gtk_default_draw_option): support drawing inconsistent
options/checks for cells.
Tue Nov 26 22:14:14 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_editing_done),
(gtk_cell_renderer_text_start_editing): add a focus_out_id to avoid
calling _editing_done twice (which has nasty side-effects). (#96647,
(issue 2) testcase from Soeren Sandmann).
Tue Nov 26 22:12:21 2002 Kristian Rietveld <kris@gtk.org>
#82739, patch from Padraig O'Briain.
* gtk/gtktreeviewcolumn.[ch]: add
gtk_tree_view_column_cell_get_position()
Tue Nov 26 22:06:29 2002 Kristian Rietveld <kris@gtk.org>
Yes, this chunk breaks ABI compatibility. Owen knows about it and
agreed with it. It doesn't break ABI that bad though, things will
still work. Please keep it silent :P.
This patch fixes some keynav issues reported by Narayana Pattipati
in #81633. (Also mentioned in #92037 (Sun tracking bug)).
* gtk/gtkmarshalers.list: add two silly marshalers
* gtk/gtktreeview.[ch] (gtk_tree_view_real_select_all),
(gtk_tree_view_real_unselect_all),
(gtk_tree_view_real_select_cursor_row),
(gtk_tree_view_real_toggle_cursor_row),
(gtk_tree_view_real_expand_collapse_cursor_row),
(gtk_tree_view_real_start_interactive_search): change the return
type from void to gboolean, update prototypes, functions, signals and
entries in GtkTreeViewClass,
(gtk_tree_view_class_init): add select_cursor_row binding for
enter key,
(gtk_tree_view_key_press): only navigate the header button if the
header is also visible ...
Tue Nov 26 22:05:48 2002 Kristian Rietveld <kris@gtk.org>
API bit of #75745, reported by Richard Hult.
* gtk/gtkcellrenderer.h (GtkCellRendererState): add
GTK_CELL_RENDERER_FOCUSED, rest of this bug fix will follow later.
2002-11-26 21:28:01 +00:00
|
|
|
|
|
2011-01-12 20:27:25 +00:00
|
|
|
|
context = gtk_widget_get_style_context (widget);
|
2010-10-04 14:22:09 +00:00
|
|
|
|
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
|
2001-03-15 23:21:39 +00:00
|
|
|
|
&x_offset, &y_offset,
|
|
|
|
|
&width, &height);
|
2010-05-30 20:38:33 +00:00
|
|
|
|
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
|
|
|
|
width -= xpad * 2;
|
|
|
|
|
height -= ypad * 2;
|
2001-03-15 23:21:39 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2011-12-16 19:49:31 +00:00
|
|
|
|
state = gtk_cell_renderer_get_state (cell, widget, flags);
|
|
|
|
|
|
2011-01-12 20:27:25 +00:00
|
|
|
|
if (!priv->activatable)
|
2011-12-16 19:49:31 +00:00
|
|
|
|
state |= GTK_STATE_FLAG_INSENSITIVE;
|
|
|
|
|
|
2014-08-14 02:34:30 +00:00
|
|
|
|
state &= ~(GTK_STATE_FLAG_INCONSISTENT | GTK_STATE_FLAG_CHECKED);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
|
2011-01-12 20:27:25 +00:00
|
|
|
|
if (priv->inconsistent)
|
|
|
|
|
state |= GTK_STATE_FLAG_INCONSISTENT;
|
2014-08-14 03:14:36 +00:00
|
|
|
|
|
|
|
|
|
if (priv->active)
|
2014-08-14 02:34:30 +00:00
|
|
|
|
state |= GTK_STATE_FLAG_CHECKED;
|
2001-03-28 03:09:03 +00:00
|
|
|
|
|
2016-12-23 08:31:54 +00:00
|
|
|
|
gtk_snapshot_push_clip (snapshot,
|
|
|
|
|
&GRAPHENE_RECT_INIT (
|
|
|
|
|
cell_area->x, cell_area->y,
|
|
|
|
|
cell_area->width, cell_area->height
|
|
|
|
|
),
|
|
|
|
|
"CellToggleClip");
|
2010-12-15 23:07:08 +00:00
|
|
|
|
|
2016-02-15 17:08:14 +00:00
|
|
|
|
context = gtk_cell_renderer_toggle_save_context (cell, widget);
|
|
|
|
|
gtk_style_context_set_state (context, state);
|
2011-01-12 20:27:25 +00:00
|
|
|
|
|
2016-12-23 08:31:54 +00:00
|
|
|
|
gtk_snapshot_render_background (snapshot, context,
|
|
|
|
|
cell_area->x + x_offset + xpad,
|
|
|
|
|
cell_area->y + y_offset + ypad,
|
|
|
|
|
width, height);
|
|
|
|
|
gtk_snapshot_render_frame (snapshot, context,
|
|
|
|
|
cell_area->x + x_offset + xpad,
|
|
|
|
|
cell_area->y + y_offset + ypad,
|
|
|
|
|
width, height);
|
2016-02-15 17:16:32 +00:00
|
|
|
|
|
2016-10-08 03:07:23 +00:00
|
|
|
|
gtk_style_context_get_padding (context, &padding);
|
|
|
|
|
gtk_style_context_get_border (context, &border);
|
2016-02-15 17:16:32 +00:00
|
|
|
|
|
|
|
|
|
if (priv->radio)
|
|
|
|
|
{
|
2016-12-23 08:31:54 +00:00
|
|
|
|
if (state & GTK_STATE_FLAG_INCONSISTENT)
|
|
|
|
|
image_type = GTK_CSS_IMAGE_BUILTIN_OPTION_INCONSISTENT;
|
|
|
|
|
else if (state & GTK_STATE_FLAG_CHECKED)
|
|
|
|
|
image_type = GTK_CSS_IMAGE_BUILTIN_OPTION;
|
|
|
|
|
else
|
|
|
|
|
image_type = GTK_CSS_IMAGE_BUILTIN_NONE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-12-23 08:31:54 +00:00
|
|
|
|
if (state & GTK_STATE_FLAG_INCONSISTENT)
|
|
|
|
|
image_type = GTK_CSS_IMAGE_BUILTIN_CHECK_INCONSISTENT;
|
|
|
|
|
else if (state & GTK_STATE_FLAG_CHECKED)
|
|
|
|
|
image_type = GTK_CSS_IMAGE_BUILTIN_CHECK;
|
|
|
|
|
else
|
|
|
|
|
image_type = GTK_CSS_IMAGE_BUILTIN_NONE;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
2010-12-15 23:07:08 +00:00
|
|
|
|
|
2017-01-13 13:36:56 +00:00
|
|
|
|
gtk_snapshot_offset (snapshot,
|
|
|
|
|
cell_area->x + x_offset + xpad + padding.left + border.left,
|
|
|
|
|
cell_area->y + y_offset + ypad + padding.top + border.top);
|
2016-12-23 08:31:54 +00:00
|
|
|
|
gtk_css_style_snapshot_icon (gtk_style_context_lookup_style (context), snapshot,
|
|
|
|
|
width - padding.left - padding.right - border.left - border.right,
|
|
|
|
|
height - padding.top - padding.bottom - border.top - border.bottom,
|
|
|
|
|
image_type);
|
|
|
|
|
|
2016-02-15 17:08:14 +00:00
|
|
|
|
gtk_style_context_restore (context);
|
2017-01-12 23:39:59 +00:00
|
|
|
|
gtk_snapshot_pop (snapshot);
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
Behaviour change, apply changes if the entry of the editable gets a focus
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
2002-10-14 22:50:18 +00:00
|
|
|
|
gtk_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
|
|
|
|
GdkEvent *event,
|
|
|
|
|
GtkWidget *widget,
|
|
|
|
|
const gchar *path,
|
2010-10-04 14:22:09 +00:00
|
|
|
|
const GdkRectangle *background_area,
|
|
|
|
|
const GdkRectangle *cell_area,
|
Behaviour change, apply changes if the entry of the editable gets a focus
Tue Oct 15 00:53:14 2002 Kristian Rietveld <kris@gtk.org>
Behaviour change, apply changes if the entry of the editable gets
a focus out event (#82405).
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_focus_out_event):
new function,
(gtk_cell_renderer_text_start_editing): stop editing and apply
changes on focus-out.
Tue Oct 15 00:47:35 2002 Kristian Rietveld <kris@gtk.org>
Fixes an *evil* GtkTreeModelSort bug, #93629.
* gtk/gtktreemodel.c (release_row_references): return if the
refs->list is NULL.
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_row_changed): if we
are swapping two rows (re-insertion on row_changed), also *emit*
a rows_reordered signal. oops.
Tue Oct 15 00:45:03 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtkliststore.c (gtk_list_store_remove_silently): free
the actual link after the node has been removed (#92014).
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_column_finalize):
free the cell_list and the child if the exists (#92014).
Tue Oct 15 00:40:25 2002 Kristian Rietveld <kris@gtk.org>
Don't accept drops if the model has been sorted, #93758)
* gtk/gtkliststore.c (gtk_list_store_row_drop_possible): return
FALSE if the list has been sorted.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible): check
if drag_dest is a TreeStore, return FALSE if the tree has been
sorted.
Tue Oct 15 00:33:59 2002 Kristian Rietveld <kris@gtk.org>
Compiler warning fixage, (#85858, #85859, #85860, #85872)
* gtk/gtkcellrendererpixbuf (gtk_cell_renderer_pixbuf_render):
s/guint/GtkCellRendererState/.
* gtk/gtkcellrenderertext.c (gtk_cell_renderer_text_render):
ditto.
* gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render),
(gtk_cell_renderer_toggle_activate): ditto.
* gtk/gtkliststore.c (gtk_list_store_get_flags): a
s/guint/GtkTreeModelFlags/ on the return type.
2002-10-14 22:50:18 +00:00
|
|
|
|
GtkCellRendererState flags)
|
2000-10-05 01:04:57 +00:00
|
|
|
|
{
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv;
|
2001-01-16 03:49:24 +00:00
|
|
|
|
GtkCellRendererToggle *celltoggle;
|
2010-06-01 21:20:14 +00:00
|
|
|
|
|
2001-01-16 03:49:24 +00:00
|
|
|
|
celltoggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
2010-06-01 21:20:14 +00:00
|
|
|
|
priv = celltoggle->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->activatable)
|
2001-01-16 03:49:24 +00:00
|
|
|
|
{
|
2002-10-07 01:38:40 +00:00
|
|
|
|
g_signal_emit (cell, toggle_cell_signals[TOGGLED], 0, path);
|
2001-09-25 16:44:39 +00:00
|
|
|
|
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)
|
|
|
|
|
{
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv;
|
2010-06-01 21:20:14 +00:00
|
|
|
|
|
2000-10-05 01:04:57 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
priv = toggle->priv;
|
|
|
|
|
|
|
|
|
|
priv->radio = radio;
|
2000-10-05 01:04:57 +00:00
|
|
|
|
}
|
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
|
2001-10-28 21:15:36 +00:00
|
|
|
|
*
|
2014-02-07 18:37:09 +00:00
|
|
|
|
* Returns whether we’re rendering radio toggles rather than checkboxes.
|
2001-02-03 01:09:41 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if we’re rendering radio toggles rather than checkboxes
|
2001-02-03 01:09:41 +00:00
|
|
|
|
**/
|
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);
|
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
return toggle->priv->radio;
|
2001-01-04 21:33:24 +00:00
|
|
|
|
}
|
2001-03-02 00:49:32 +00:00
|
|
|
|
|
2001-10-28 21:15:36 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_cell_renderer_toggle_get_active:
|
2001-11-21 21:44:08 +00:00
|
|
|
|
* @toggle: a #GtkCellRendererToggle
|
2001-10-28 21:15:36 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns whether the cell renderer is active. See
|
|
|
|
|
* gtk_cell_renderer_toggle_set_active().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the cell renderer is active.
|
2001-10-31 10:27:17 +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);
|
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
return toggle->priv->active;
|
2001-03-02 00:49:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-28 21:15:36 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_cell_renderer_toggle_set_active:
|
|
|
|
|
* @toggle: a #GtkCellRendererToggle.
|
|
|
|
|
* @setting: the value to set.
|
|
|
|
|
*
|
|
|
|
|
* Activates or deactivates a cell renderer.
|
|
|
|
|
**/
|
2001-03-02 00:49:32 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle,
|
|
|
|
|
gboolean setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
|
|
|
|
|
2003-02-28 01:45:51 +00:00
|
|
|
|
g_object_set (toggle, "active", setting ? TRUE : FALSE, NULL);
|
2001-03-02 00:49:32 +00:00
|
|
|
|
}
|
2005-03-20 07:01:23 +00:00
|
|
|
|
|
2009-07-13 23:53:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_cell_renderer_toggle_get_activatable:
|
|
|
|
|
* @toggle: a #GtkCellRendererToggle
|
|
|
|
|
*
|
|
|
|
|
* Returns whether the cell renderer is activatable. See
|
|
|
|
|
* gtk_cell_renderer_toggle_set_activatable().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the cell renderer is activatable.
|
2009-07-13 23:53:56 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_cell_renderer_toggle_get_activatable (GtkCellRendererToggle *toggle)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle), FALSE);
|
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
return toggle->priv->activatable;
|
2009-07-13 23:53:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_cell_renderer_toggle_set_activatable:
|
|
|
|
|
* @toggle: a #GtkCellRendererToggle.
|
|
|
|
|
* @setting: the value to set.
|
|
|
|
|
*
|
|
|
|
|
* Makes the cell renderer activatable.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gtk_cell_renderer_toggle_set_activatable (GtkCellRendererToggle *toggle,
|
|
|
|
|
gboolean setting)
|
|
|
|
|
{
|
2010-08-26 17:15:37 +00:00
|
|
|
|
GtkCellRendererTogglePrivate *priv;
|
2010-06-01 21:20:14 +00:00
|
|
|
|
|
2009-07-13 23:53:56 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (toggle));
|
|
|
|
|
|
2010-06-01 21:20:14 +00:00
|
|
|
|
priv = toggle->priv;
|
|
|
|
|
|
|
|
|
|
if (priv->activatable != setting)
|
2009-07-13 23:53:56 +00:00
|
|
|
|
{
|
2010-06-01 21:20:14 +00:00
|
|
|
|
priv->activatable = setting ? TRUE : FALSE;
|
2009-07-13 23:53:56 +00:00
|
|
|
|
g_object_notify (G_OBJECT (toggle), "activatable");
|
|
|
|
|
}
|
|
|
|
|
}
|