GtkIImageTool

GtkIImageTool — Interface for objects capable of being used as tools by GtkImageView

Functions

Object Hierarchy

    GInterface
    ╰── GtkIImageTool

Description

GtkIImageTool is an interface that defines how GtkImageView interacts with objects that acts as tools. GtkImageView delegates many of its most important tasks (such as drawing) to its tool which carries out all the hard work. The GtkImageView package comes with two tools; GtkImageToolDragger and GtkImageToolSelector, but by implementing your own tool it is possible to extend GtkImageView to do stuff its author (thats me) didn't imagine.

GtkImageView uses GtkImageToolDragger by default, as that tool is he most generally useful one. However, it is trivial to make it use another tool.

1
2
3
GtkImageView *view = GTK_IMAGE_VIEW (gtk_image_view_new ());
GtkIImageTool *tool = gtk_image_tool_selector_new (view);
gtk_image_view_set_tool (view, tool);

Using the above code makes the view use the selector tool instead of the default dragger tool.

Functions

gtk_iimage_tool_button_press ()

gboolean
gtk_iimage_tool_button_press (GtkIImageTool *tool,
                              GdkEventButton *ev);

gtk_iimage_tool_button_release ()

gboolean
gtk_iimage_tool_button_release (GtkIImageTool *tool,
                                GdkEventButton *ev);

Handles a GdkEventButton event of a button release. The implementing function should return TRUE if it handled the event, for examply by releasing the grab, and FALSE otherwise.

Parameters

tool

the tool

 

ev

a GdkEventButton event

 

returns

TRUE if the event was handled, FALSE otherwise

 

gtk_iimage_tool_motion_notify ()

gboolean
gtk_iimage_tool_motion_notify (GtkIImageTool *tool,
                               GdkEventMotion *ev);

Handles a GdkEventMotion event. The implementing function should return TRUE if it handled the event and FALSE otherwise.

Parameters

tool

the tool

 

ev

a GdkEventMotion event

 

returns

TRUE if the event was handled, FALSE otherwise

 

gtk_iimage_tool_pixbuf_changed ()

void
gtk_iimage_tool_pixbuf_changed (GtkIImageTool *tool,
                                gboolean reset_fit,
                                GdkRectangle *rect);

Indiate to the tool that either a part of, or the whole pixbuf that the image view shows has changed. This method is called by the view whenever its pixbuf or its tool changes. That is, when any of the following methods are used:

If the reset_fit parameter is TRUE, it means that a new pixbuf has been loaded into the view. rect is a rectangle in image space coordinates that indicates which rectangular region of the pixbufs pixels that is modified. If rect is NULL, then all of the pixbuf has changed. See also GtkImageView::pixbuf-changed.

Parameters

tool

the tool

 

reset_fit

whether the view is resetting its fit mode or not

 

rect

rectangle containing the changed area or NULL

 

gtk_iimage_tool_paint_image ()

void
gtk_iimage_tool_paint_image (GtkIImageTool *tool,
                             GdkPixbufDrawOpts *opts,
                             GdkDrawable *drawable);

Called whenever the image view decides that any part of the image it shows needs to be redrawn.

Parameters

tool

the tool

 

opts

the GdkPixbufDrawOpts to use in this draw

 

drawable

a GdkDrawable to draw on

 

gtk_iimage_tool_cursor_at_point ()

GdkCursor *
gtk_iimage_tool_cursor_at_point (GtkIImageTool *tool,
                                 int x,
                                 int y);

Ask the tool what cursor it wants displayed. E.g. if the tool keeps track of image maps in the image, then this method can be implemented to return an appropriate cursor when the mouse pointer hovers at the specified point in the widget.

Parameters

x

the mouse pointers X-coordinate

 

y

the mouse pointers Y-coordinate

 

returns

The appropriate cursor or NULL if the widgets default cursor should be used.

 

Types and Values

See Also

Non-instantiable classed types: Interfaces