summaryrefslogtreecommitdiff
path: root/gtk/gtkcellrenderertoggle.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2002-11-26 21:28:01 +0000
committerKristian Rietveld <kristian@src.gnome.org>2002-11-26 21:28:01 +0000
commita09f497c3694a96fa545249260f617a55f8a12bd (patch)
treef909a123a98e370a2bf848ef9f87d3387628f48e /gtk/gtkcellrenderertoggle.c
parent621ae3a60c074d1c91c20a866e2dcc1cbd015259 (diff)
downloadgtk+-a09f497c3694a96fa545249260f617a55f8a12bd.tar.gz
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.
Diffstat (limited to 'gtk/gtkcellrenderertoggle.c')
-rw-r--r--gtk/gtkcellrenderertoggle.c46
1 files changed, 42 insertions, 4 deletions
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index 617c69381f..330a2e54e7 100644
--- a/gtk/gtkcellrenderertoggle.c
+++ b/gtk/gtkcellrenderertoggle.c
@@ -21,6 +21,7 @@
#include <gtk/gtkcellrenderertoggle.h>
#include "gtkintl.h"
#include "gtkmarshalers.h"
+#include "gtktreeprivate.h"
static void gtk_cell_renderer_toggle_get_property (GObject *object,
guint param_id,
@@ -64,10 +65,10 @@ enum {
PROP_ZERO,
PROP_ACTIVATABLE,
PROP_ACTIVE,
- PROP_RADIO
+ PROP_RADIO,
+ PROP_INCONSISTENT
};
-
#define TOGGLE_WIDTH 12
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
@@ -133,6 +134,15 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
FALSE,
G_PARAM_READABLE |
G_PARAM_WRITABLE));
+
+ g_object_class_install_property (object_class,
+ PROP_INCONSISTENT,
+ g_param_spec_boolean ("inconsistent",
+ _("Inconsistent state"),
+ _("The inconsistent stae of the button"),
+ FALSE,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_ACTIVATABLE,
@@ -177,6 +187,18 @@ gtk_cell_renderer_toggle_get_property (GObject *object,
case PROP_ACTIVE:
g_value_set_boolean (value, celltoggle->active);
break;
+ case PROP_INCONSISTENT:
+ {
+ /* Move out of here when more properties start to use the info
+ * thing. I put it here to not affect performance, this property
+ * is not going to be used much.
+ */
+ GtkCellRendererInfo *cellinfo;
+ cellinfo = g_object_get_data (object, GTK_CELL_RENDERER_INFO_KEY);
+
+ g_value_set_boolean (value, cellinfo->inconsistent);
+ }
+ break;
case PROP_ACTIVATABLE:
g_value_set_boolean (value, celltoggle->activatable);
break;
@@ -204,6 +226,16 @@ gtk_cell_renderer_toggle_set_property (GObject *object,
celltoggle->active = g_value_get_boolean (value);
g_object_notify (G_OBJECT(object), "active");
break;
+ case PROP_INCONSISTENT:
+ {
+ /* read comment in _get_property */
+ GtkCellRendererInfo *cellinfo;
+ cellinfo = g_object_get_data (object, GTK_CELL_RENDERER_INFO_KEY);
+
+ cellinfo->inconsistent = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (object), "inconsistent");
+ }
+ break;
case PROP_ACTIVATABLE:
celltoggle->activatable = g_value_get_boolean (value);
g_object_notify (G_OBJECT(object), "activatable");
@@ -283,11 +315,12 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
GtkCellRendererState flags)
{
GtkCellRendererToggle *celltoggle = (GtkCellRendererToggle *) cell;
+ GtkCellRendererInfo *cellinfo;
gint width, height;
gint x_offset, y_offset;
GtkShadowType shadow;
GtkStateType state = 0;
-
+
gtk_cell_renderer_toggle_get_size (cell, widget, cell_area,
&x_offset, &y_offset,
&width, &height);
@@ -297,7 +330,12 @@ gtk_cell_renderer_toggle_render (GtkCellRenderer *cell,
if (width <= 0 || height <= 0)
return;
- shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
+ cellinfo = g_object_get_data (G_OBJECT (cell), GTK_CELL_RENDERER_INFO_KEY);
+
+ if (cellinfo->inconsistent)
+ shadow = GTK_SHADOW_ETCHED_IN;
+ else
+ shadow = celltoggle->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{