I have decided that I want to extend the GtkImageView widget to make it extensible. Right now, it handles showing images that you can zoom in on and drag around. It will be extended so that you can do the following things:
- Drag a selection on the widget. Very similar to how gThumbs Image->Crop dialog works.
- Various kinds of drawing operations.
I thought about implementing this as "tools":
+------------+ | | 1 1 +-------------+ |GtkImageView| ------> |GtkIImageTool| | | +-------------+ +------------+ |_____________________ / | +-------------------+ +--------------------+ |GtkImageToolDragger| |GtkImageToolSelector| +-------------------+ +--------------------+
In this diagram, GtkImageView has a reference to a GtkIImageTool which is an interface that abstracts out certain behaviour of GtkImageView. GtkImageToolDragger and GtkImageToolSelector are two concrete implementations of the GtkIImageTool interface. When GtkImageView references a GtkImageToolDragger, it behaves like normal. You have a hand cursor and can drag the image. When GtkImageView references a GtkImageToolSelector, it instead displays a selection cursor and you can make a rectangular selection on the image.
Using this arrangement, it is now possible to dynamically alter the behaviour of GtkImageView.
It should be possible to achieve this, but the interface that GtkIImageTool will specify, might become to fat.
Inga kommentarer:
Skicka en kommentar