The whole API for GtkImageView is not completed yet, but it is slowly getting there. Much of the design is borrowed (or almost stolen) from gThumb. Here is a birds eye view of the three main classes along with their counterparts in gThumb:
- GtkImageView (gtkimageview.c, gtkimageview.h)
This is the main class of the package. It provides a draggable and zoomable pane on which images can be displayed. The user of the class can customize how images are displayed and whether high or low quality scaling should be used. It also implements a number of useful keybindings for manipulating the image view.
Much code and ideas was borrowed from the ImageViewer widget in gThumb in the files /libgthumb/image-viewer.{c,h}.
- GtkImageScrollWin (gtkimagescrollwin.c, gtkimagescrollwin.h)
This class implements a kind of GtkScrolledWindow which is more suitable to use in conjuction with GtkImageView. A GtkImageView embedded inside a GtkImageScrollWin will have auto-hiding horizontal and vertical scrollbars. Additionally, in the bottom right corner it has a button which brings up a GtkImageNavigor for the image.
This class corresponds to the GthNavWindow class in /libgthumb/gth-nav-window.{c,h}.
- GtkImageNavigator (gtkimagenavigator.c, gtkimagenavigator.h)
The GtkImageNavigator provides a small popup window showing a preview of the GdkPixbuf it references. It contains a rectangle which the user can drag which causes the GtkImageNavigator to emit a certain signal, signalling to possibly a GtkImageView that it should change its scroll.
It is fairly similar to the NavWindow class in /libgthumb/nav-window.{c,h}.
And here follows a small example showing how the library is supposed to be used:
Inga kommentarer:
Skicka en kommentar