GtkIImageTool

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

Synopsis




                    GtkIImageTool;
gboolean            gtk_iimage_tool_button_press        (GtkIImageTool *tool,
                                                         GdkEventButton *ev);
gboolean            gtk_iimage_tool_button_release      (GtkIImageTool *tool,
                                                         GdkEventButton *ev);
gboolean            gtk_iimage_tool_motion_notify       (GtkIImageTool *tool,
                                                         GdkEventMotion *ev);
void                gtk_iimage_tool_pixbuf_changed      (GtkIImageTool *tool,
                                                         gboolean reset_fit);
void                gtk_iimage_tool_paint_image         (GtkIImageTool *tool,
                                                         DrawSettings *ds,
                                                         GdkDrawable *drawable);
GdkCursor*          gtk_iimage_tool_cursor_at_point     (GtkIImageTool *tool,
                                                         int x,
                                                         int y);

Object Hierarchy


  GInterface
   +----GtkIImageTool

Known Implementations

GtkIImageTool is implemented by GtkImageToolDragger and GtkImageToolSelector.

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.

      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.

Details

GtkIImageTool

typedef struct _GtkIImageTool GtkIImageTool;


gtk_iimage_tool_button_press ()

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

tool :
ev :
Returns :

gtk_iimage_tool_button_release ()

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

tool :
ev :
Returns :

gtk_iimage_tool_motion_notify ()

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

tool :
ev :
Returns :

gtk_iimage_tool_pixbuf_changed ()

void                gtk_iimage_tool_pixbuf_changed      (GtkIImageTool *tool,
                                                         gboolean reset_fit);

This method is called by the view whenever its pixbuf or its tool changes. That is, when any of the methods gtk_image_view_set_pixbuf() or gtk_image_view_set_tool() is invoked. If the reset_fit parameter is TRUE, then the tool is free to treat the pixbuf as completely new. See also GtkImageView::pixbuf-changed.

tool : The tool
reset_fit : Whether the view is resetting its fit mode or not.

gtk_iimage_tool_paint_image ()

void                gtk_iimage_tool_paint_image         (GtkIImageTool *tool,
                                                         DrawSettings *ds,
                                                         GdkDrawable *drawable);

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

tool : The tool
ds : A set of draw settings to use for this draw.
drawable : A drawable to draw the image data 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.

tool :
x : the mouse pointers X-coordinate
y : the mouse pointers Y-coordinate
Returns : The appropriate cursor