I suggest changing week_view->jump_buttons[i] = gnome_canvas_item_new (canvas_group, gnome_canvas_pixbuf_get_type (), "GnomeCanvasPixbuf::pixbuf", pixbuf, NULL); to week_view->jump_buttons[i] = gnome_canvas_item_new (canvas_group, gnome_canvas_action_pixbuf_get_type (), "GnomeCanvasPixbuf::pixbuf", pixbuf, NULL);See attachment for definition of GnomeCanvasActionPixbuf. Note that the files in the attachment have not been run through acompiler so they may contain errors.
How do you distinguish betwenen a jump button and other types of GnomeCanvasPixbuf.
I have had a look at the code in gail and there is no specific support for GnomeCanvasPixbuf. Do you need additions to gail?
Padraig Bolian Yin wrote:
Hi Bill and Padraig,Please see the attached picture. The "jump button" (the little yellow rectangle) is the gnome-canvas-item in question, more accurately, it is a gnome-canvas-item-pixbuf. The "jump button" is used to indicate that there are more events that are not displayed in the day. Now I have make it focusable, can jump to the day on receving a Enter Key, then all the events of the day can be displayed. This is the action that I want to export through the atk action interface.In the current implementation of the jump button in evolution, there are no new subclass to GnomeCanvasPixbuf, see the code below:-- code snip begins -----------------------------------------------------------------------------------/* Create the buttons to jump to each days. */ pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) jump_xpm); for (i = 0; i < E_WEEK_VIEW_MAX_WEEKS * 7; i++) { week_view->jump_buttons[i] = gnome_canvas_item_new (canvas_group, gnome_canvas_pixbuf_get_type (), "GnomeCanvasPixbuf::pixbuf", pixbuf, NULL); g_signal_connect (week_view->jump_buttons[i], "event", G_CALLBACK (e_week_view_on_jump_button_event), week_view); } /* ... omitted */ e_week_view_on_jump_button_event (GnomeCanvasItem *item, GdkEvent *event, EWeekView *week_view) { /* ... omitted */ else if (event->type == GDK_KEY_PRESS) { /* return, if Tab, Control or Alt is pressed */ if ((event->key.keyval == GDK_Tab) || (event->key.state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) return FALSE; /* with a return key or a simple character, jump to the day */ if ((event->key.keyval == GDK_Return) || ((event->key.keyval >= 0x20) && (event->key.keyval <= 0xFF))) { e_week_view_jump_to_button_item (week_view, item); return TRUE; } } /* ... omitted */ }-- code snip end -----------------------------------------------------------------------------------So, the "action" is only supported through the signal handler to GnomeCanvasPixbuf "event" signal, not in a new subclass. My aim is to support this action only in the jumpbutton instances, not in any other instances of GnomeCanvasPixbuf.Thanks, -Bolian Bill Haneman wrote:Bolian: The best way to ensure that an AtkFactory is used only with certain instances of a GObject type is to create a new subtype. In your case, this means that GnomeCanvasItem should be subclassed, and an appropriateAtkFactory registered for the new type or types.GnomeCanvasItem is already an abstract class, so you must already be using subclasses. If your GnomeCanvasItems are instances of existing GnomeCanvas subtypes, for instance GnomeCanvasWidget instances, you may need to create something like a GnomeCanvasActiveWidget type which is used for your 'actionable' canvas items. regards Bill On Thu, 2003-09-04 at 08:06, Bolian Yin wrote:Hi Padraig,I met the problem in gnome-canvas-item. Gail has impl for gnome-canvas-item, but programmers can add many functions to a gnome-canvas-item.For example, a gnome-canvas-item support an action in some context, and want to add a action interface to the atkobject creates for it. In this case, I cannot register a new factory to create the atk object, or all the gnome-canvas-items will create their atk objects using the new factory. Is there ways to make a atk factory only used for some instances of gnome-canvas-item, and in other case the default (gail) factory will be used?Thanks, Bolian------------------------------------------------------------------------
Attachment:
action.tar.gz
Description: application/gzip