| 1 |
#include "gtkimageviewperl.h" |
|---|
| 2 |
|
|---|
| 3 |
MODULE = Gtk2::ImageView::Tool PACKAGE = Gtk2::ImageView::Tool PREFIX = gtk_iimage_tool_ |
|---|
| 4 |
|
|---|
| 5 |
=for object Gtk2::ImageView::Tool Interface for objects capable of being used as tools by Gtk2::ImageView |
|---|
| 6 |
=cut |
|---|
| 7 |
|
|---|
| 8 |
=for position DESCRIPTION |
|---|
| 9 |
|
|---|
| 10 |
=head1 DESCRIPTION |
|---|
| 11 |
|
|---|
| 12 |
Gtk2::ImageView::Tool is an interface that defines how Gtk2::ImageView interacts with objects that acts as tools. Gtk2::ImageView delegates many of its most important tasks (such as drawing) to its tool which carries out all the hard work. The Gtk2::ImageView package comes with two tools; Gtk2::ImageView::Tool::Dragger and Gtk2::ImageView::Tool::Selector, but by implementing your own tool it is possible to extend Gtk2::ImageView to do stuff its author didn't imagine. |
|---|
| 13 |
|
|---|
| 14 |
Gtk2::ImageView uses Gtk2::ImageView::Tool::Dragger by default, as that tool is he most generally useful one. However, it is trivial to make it use another tool. |
|---|
| 15 |
|
|---|
| 16 |
my $view = Gtk2::ImageView->new; |
|---|
| 17 |
my $tool = Gtk2::ImageView::Tool::Selector ($view); |
|---|
| 18 |
$view->set_tool ($tool); |
|---|
| 19 |
|
|---|
| 20 |
Using the above code makes the view use the selector tool instead of the default dragger tool. |
|---|
| 21 |
|
|---|
| 22 |
=cut |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
gboolean |
|---|
| 26 |
gtk_iimage_tool_button_press (tool, ev) |
|---|
| 27 |
GtkIImageTool * tool |
|---|
| 28 |
GdkEvent * ev |
|---|
| 29 |
C_ARGS: |
|---|
| 30 |
tool, (GdkEventButton *) ev |
|---|
| 31 |
|
|---|
| 32 |
gboolean |
|---|
| 33 |
gtk_iimage_tool_button_release (tool, ev) |
|---|
| 34 |
GtkIImageTool * tool |
|---|
| 35 |
GdkEvent * ev |
|---|
| 36 |
C_ARGS: |
|---|
| 37 |
tool, (GdkEventButton *) ev |
|---|
| 38 |
|
|---|
| 39 |
gboolean |
|---|
| 40 |
gtk_iimage_tool_motion_notify (tool, ev) |
|---|
| 41 |
GtkIImageTool * tool |
|---|
| 42 |
GdkEvent * ev |
|---|
| 43 |
C_ARGS: |
|---|
| 44 |
tool, (GdkEventMotion *) ev |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
=for apidoc |
|---|
| 48 |
|
|---|
| 49 |
Indicate 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: |
|---|
| 50 |
|
|---|
| 51 |
=over |
|---|
| 52 |
|
|---|
| 53 |
=item Gtk2::ImageView::set_pixbuf() |
|---|
| 54 |
|
|---|
| 55 |
=item Gtk2::ImageView::set_tool() |
|---|
| 56 |
|
|---|
| 57 |
=item Gtk2::ImageView::damage_pixels() |
|---|
| 58 |
|
|---|
| 59 |
=back |
|---|
| 60 |
|
|---|
| 61 |
If the reset_fit parameter is TRUE, it means that a new pixbuf has been loaded into the view. |
|---|
| 62 |
|
|---|
| 63 |
=over |
|---|
| 64 |
|
|---|
| 65 |
=item tool : the tool |
|---|
| 66 |
|
|---|
| 67 |
=item reset_fit : whether the view is resetting its fit mode or not |
|---|
| 68 |
|
|---|
| 69 |
=item rect : rectangle containing the changed area or NULL |
|---|
| 70 |
|
|---|
| 71 |
=back |
|---|
| 72 |
|
|---|
| 73 |
=cut |
|---|
| 74 |
void |
|---|
| 75 |
gtk_iimage_tool_pixbuf_changed (tool, reset_fit, rect) |
|---|
| 76 |
GtkIImageTool * tool |
|---|
| 77 |
gboolean reset_fit |
|---|
| 78 |
GdkRectangle * rect |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
=for apidoc |
|---|
| 82 |
|
|---|
| 83 |
Called whenever the image view decides that any part of the image it shows needs to be redrawn. |
|---|
| 84 |
|
|---|
| 85 |
=over |
|---|
| 86 |
|
|---|
| 87 |
=item tool : the tool |
|---|
| 88 |
|
|---|
| 89 |
=item opts : the Gtk2::Gdk::Pixbuf::DrawOpts to use in this draw |
|---|
| 90 |
|
|---|
| 91 |
=item drawable : a Gtk2::Gdk::Drawable to draw on |
|---|
| 92 |
|
|---|
| 93 |
=back |
|---|
| 94 |
|
|---|
| 95 |
=cut |
|---|
| 96 |
void |
|---|
| 97 |
gtk_iimage_tool_paint_image (tool, opts, drawable) |
|---|
| 98 |
GtkIImageTool * tool |
|---|
| 99 |
GdkPixbufDrawOpts * opts |
|---|
| 100 |
GdkDrawable * drawable |
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
=for apidoc |
|---|
| 104 |
|
|---|
| 105 |
Ask the tool what cursor it wants displayed. |
|---|
| 106 |
|
|---|
| 107 |
=over |
|---|
| 108 |
|
|---|
| 109 |
=item tool : the tool |
|---|
| 110 |
|
|---|
| 111 |
=item x : the mouse pointers X-coordinate |
|---|
| 112 |
|
|---|
| 113 |
=item y : the mouse pointers Y-coordinate |
|---|
| 114 |
|
|---|
| 115 |
=back |
|---|
| 116 |
|
|---|
| 117 |
=head3 Returns |
|---|
| 118 |
|
|---|
| 119 |
=over |
|---|
| 120 |
|
|---|
| 121 |
=item The appropriate cursor. |
|---|
| 122 |
|
|---|
| 123 |
=back |
|---|
| 124 |
|
|---|
| 125 |
=cut |
|---|
| 126 |
GdkCursor * |
|---|
| 127 |
gtk_iimage_tool_cursor_at_point (tool, x, y) |
|---|
| 128 |
GtkIImageTool * tool |
|---|
| 129 |
int x |
|---|
| 130 |
int y |
|---|