GtkImageView Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Known Implementations |
GtkIImageToolGtkIImageTool — 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, GdkRectangle *rect); void gtk_iimage_tool_paint_image (GtkIImageTool *tool, GdkPixbufDrawOpts *opts, GdkDrawable *drawable); GdkCursor * gtk_iimage_tool_cursor_at_point (GtkIImageTool *tool, int x, int y);
Known Implementations
GtkIImageTool is implemented by GtkImageToolDragger, GtkImageToolPainter 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
gtk_iimage_tool_button_press ()
gboolean gtk_iimage_tool_button_press (GtkIImageTool *tool, GdkEventButton *ev);
|
|
|
|
Returns : |
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.
|
the tool |
|
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.
|
the tool |
|
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.
|
the tool |
|
whether the view is resetting its fit mode or not |
|
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.
|
the tool |
|
the GdkPixbufDrawOpts to use in this draw |
|
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.
|
|
|
the mouse pointers X-coordinate |
|
the mouse pointers Y-coordinate |
Returns : |
The appropriate cursor or NULL if the widgets default
cursor should be used.
|