aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-click-to-add.c
diff options
context:
space:
mode:
authorLi Yuan <li.yuan@sun.com>2005-01-27 13:16:19 +0800
committerHarry Lu <haip@src.gnome.org>2005-01-27 13:16:19 +0800
commitd8d481373ff47bc77432b2f8d8de91afd1bd02a0 (patch)
tree8e8965a9867437704b2a317f2a52ff1a0880f71d /widgets/table/e-table-click-to-add.c
parent7b6ba9e828c68f9229bcb8ad41a550119260aef6 (diff)
downloadgsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.gz
gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.tar.zst
gsoc2013-evolution-d8d481373ff47bc77432b2f8d8de91afd1bd02a0.zip
add an a11y name for the popup list. make shortcut key ALT+Arrow work.
2005-01-27 Li Yuan <li.yuan@sun.com> * e-cell-combo.c: (e_cell_combo_init), (e_cell_combo_do_popup), (e_cell_combo_list_button_press), (e_cell_combo_button_press), (e_cell_combo_button_release), (e_cell_combo_key_press): add an a11y name for the popup list. make shortcut key ALT+Arrow work. Fixes #70261 * e-cell-text.c: (e_cell_text_class_init), (_delete_selection), (_insert): add "text_inserted" and "text_deleted" signals to notify the text has been changed. (e_cell_text_get_text_by_view): new helper function to get the text being editted. * e-cell-text.h: add signal declaration. * e-cell-toggle.c: (etog_draw): add range check for negative values. * e-cell-vbox.c: (e_cell_vbox_class_init): * e-cell-vbox.h: make ECellVboxView public since it will be used in a11y part. * e-table-click-to-add.c: (etcta_style_set), (create_rect_and_text), (etcta_realize), (etcta_class_init), (e_table_click_to_add_commit): add "style_set" signal to click_to_add and implement the style_set function. (etcta_init): add a11y name to click to add. * e-table-click-to-add.h: add "style_set" signal to click_to_add and implement the style_set function. * e-table-config.c: (config_button_up), (config_button_down): check whether the columns are empty. * e-table-group-container.c: * e-table-group-container.h: make ETableGroupContainerChildNode public since it will be used in a11y part. * e-table-item.c: (eti_init): init eti->cols. (eti_event): at GDK_KEY_PRESS event and GDK_Down key pressed, we check view_col value before we pass it to eti_e_cell_event. (eti_class_init): call the new initialize function * e-table.c: (table_canvas_focus_event_cb): if canvas has a focused item but the etable does not have a cursor row, just focus the first item after check whether the click_to_add should get the focus. svn path=/trunk/; revision=28571
Diffstat (limited to 'widgets/table/e-table-click-to-add.c')
-rw-r--r--widgets/table/e-table-click-to-add.c110
1 files changed, 71 insertions, 39 deletions
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index c02e3b8869..69095c28d3 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -29,7 +29,8 @@
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <atk/atkregistry.h>
-
+#include <atk/atkutil.h>
+#include <atk/atkgobjectaccessible.h>
#include "e-table-header.h"
#include "e-table-click-to-add.h"
#include "e-table-defines.h"
@@ -44,6 +45,7 @@
enum {
CURSOR_CHANGE,
+ STYLE_SET,
LAST_SIGNAL
};
@@ -73,6 +75,26 @@ etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *et
}
static void
+etcta_style_set (ETableClickToAdd *etcta, GtkStyle *previous_style)
+{
+ GtkWidget *widget = GTK_WIDGET(GNOME_CANVAS_ITEM(etcta)->canvas);
+
+ if (etcta->rect) {
+ gnome_canvas_item_set (etcta->rect,
+ "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL],
+ NULL );
+
+ }
+
+ if (etcta->text)
+ gnome_canvas_item_set (etcta->text,
+ "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
+ NULL);
+
+}
+
+static void
etcta_add_table_header (ETableClickToAdd *etcta, ETableHeader *header)
{
etcta->eth = header;
@@ -215,6 +237,33 @@ etcta_set_property (GObject *object, guint prop_id, const GValue *value, GParamS
}
static void
+create_rect_and_text (ETableClickToAdd *etcta)
+{
+ GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM(etcta)->canvas);
+
+ if (!etcta->rect)
+ etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
+ gnome_canvas_rect_get_type(),
+ "x1", (double) 0,
+ "y1", (double) 0,
+ "x2", (double) etcta->width - 1,
+ "y2", (double) etcta->height - 1,
+ "outline_color_gdk", &widget->style->fg[GTK_STATE_NORMAL],
+ "fill_color_gdk", &widget->style->bg[GTK_STATE_NORMAL],
+ NULL);
+
+ if (!etcta->text)
+ etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
+ e_text_get_type(),
+ "text", etcta->message ? etcta->message : "",
+ "anchor", GTK_ANCHOR_NW,
+ "width", etcta->width - 4,
+ "draw_background", FALSE,
+ "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
+ NULL);
+}
+
+static void
etcta_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
ETableClickToAdd *etcta;
@@ -248,23 +297,7 @@ etcta_realize (GnomeCanvasItem *item)
{
ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) etcta->width - 1,
- "y2", (double) etcta->height - 1,
- "outline_color", "black",
- "fill_color", "white",
- NULL);
-
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- "draw_background", FALSE,
- NULL);
+ create_rect_and_text (etcta);
e_canvas_item_move_absolute (etcta->text, 2, 2);
if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize)
@@ -448,6 +481,7 @@ etcta_class_init (ETableClickToAddClass *klass)
etcta_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
klass->cursor_change = NULL;
+ klass->style_set = etcta_style_set;
object_class->dispose = etcta_dispose;
object_class->set_property = etcta_set_property;
@@ -501,6 +535,16 @@ etcta_class_init (ETableClickToAddClass *klass)
e_marshal_VOID__INT_INT,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+ etcta_signals [STYLE_SET] =
+ g_signal_new ("style_set",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETableClickToAddClass, style_set),
+ NULL, NULL,
+ e_marshal_NONE__OBJECT,
+ G_TYPE_NONE, 1, GTK_TYPE_STYLE);
+
+
atk_registry_set_factory_type (atk_get_default_registry (),
E_TABLE_CLICK_TO_ADD_TYPE,
gal_a11y_e_table_click_to_add_factory_get_type ());
@@ -511,6 +555,7 @@ static void
etcta_init (GnomeCanvasItem *item)
{
ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
+ AtkObject *a11y;
etcta->one = NULL;
etcta->model = NULL;
@@ -527,6 +572,12 @@ etcta_init (GnomeCanvasItem *item)
G_CALLBACK (etcta_cursor_change), etcta);
e_canvas_item_set_reflow_callback(item, etcta_reflow);
+
+ /* create its a11y object at this time if accessibility is enabled*/
+ if (atk_get_root () != NULL) {
+ a11y = atk_gobject_accessible_for_object (G_OBJECT (etcta));
+ atk_object_set_name (a11y, _("click to add"));
+ }
}
E_MAKE_TYPE(e_table_click_to_add, "ETableClickToAdd", ETableClickToAdd, etcta_class_init, etcta_init, PARENT_OBJECT_TYPE)
@@ -549,25 +600,6 @@ e_table_click_to_add_commit (ETableClickToAdd *etcta)
gtk_object_destroy(GTK_OBJECT (etcta->row));
etcta->row = NULL;
}
- if (!etcta->rect) {
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) etcta->width - 1,
- "y2", (double) etcta->height - 1,
- "outline_color", "black",
- "fill_color", "white",
- NULL);
- }
- if (!etcta->text) {
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- "draw_background", FALSE,
- NULL);
- e_canvas_item_move_absolute (etcta->text, 3, 3);
- }
+ create_rect_and_text (etcta);
+ e_canvas_item_move_absolute (etcta->text, 3, 3);
}