1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 3 /* 4 * GThumb 5 * 6 * Copyright (C) 2009 Free Software Foundation, Inc. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 22 #ifndef GTH_IMAGE_SELECTOR_H 23 #define GTH_IMAGE_SELECTOR_H 24 25 #include <glib.h> 26 #include <glib-object.h> 27 #include "gth-image-viewer.h" 28 29 G_BEGIN_DECLS 30 31 #define GTH_TYPE_IMAGE_SELECTOR (gth_image_selector_get_type ()) 32 #define GTH_IMAGE_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_IMAGE_SELECTOR, GthImageSelector)) 33 #define GTH_IMAGE_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_IMAGE_SELECTOR, GthImageSelectorClass)) 34 #define GTH_IS_IMAGE_SELECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_IMAGE_SELECTOR)) 35 #define GTH_IS_IMAGE_SELECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_IMAGE_SELECTOR)) 36 #define GTH_IMAGE_SELECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_IMAGE_SELECTOR, GthImageSelectorClass)) 37 38 typedef struct _GthImageSelector GthImageSelector; 39 typedef struct _GthImageSelectorClass GthImageSelectorClass; 40 typedef struct _GthImageSelectorPrivate GthImageSelectorPrivate; 41 42 typedef enum { 43 GTH_SELECTOR_TYPE_REGION, 44 GTH_SELECTOR_TYPE_POINT 45 } GthSelectorType; 46 47 struct _GthImageSelector 48 { 49 GObject __parent; 50 GthImageSelectorPrivate *priv; 51 }; 52 53 struct _GthImageSelectorClass 54 { 55 GObjectClass __parent_class; 56 57 /*< signals >*/ 58 59 void (* selection_changed) (GthImageSelector *selector); 60 void (* selected) (GthImageSelector *selector, 61 int x, 62 int y); 63 void (* motion_notify) (GthImageSelector *selector, 64 int x, 65 int y); 66 void (* mask_visibility_changed) (GthImageSelector *selector); 67 void (* grid_visibility_changed) (GthImageSelector *selector); 68 }; 69 70 GType gth_image_selector_get_type (void); 71 GthImageViewerTool * gth_image_selector_new (GthSelectorType type); 72 gboolean gth_image_selector_set_selection_x (GthImageSelector *selector, 73 int x); 74 gboolean gth_image_selector_set_selection_y (GthImageSelector *selector, 75 int y); 76 gboolean gth_image_selector_set_selection_pos (GthImageSelector *selector, 77 int x, 78 int y); 79 gboolean gth_image_selector_set_selection_width (GthImageSelector *selector, 80 int width); 81 gboolean gth_image_selector_set_selection_height (GthImageSelector *selector, 82 int height); 83 void gth_image_selector_set_selection (GthImageSelector *selector, 84 cairo_rectangle_int_t selection); 85 void gth_image_selector_get_selection (GthImageSelector *selector, 86 cairo_rectangle_int_t *selection); 87 void gth_image_selector_set_ratio (GthImageSelector *selector, 88 gboolean use_ratio, 89 double ratio, 90 gboolean swap_x_and_y_to_start); 91 double gth_image_selector_get_ratio (GthImageSelector *selector); 92 gboolean gth_image_selector_get_use_ratio (GthImageSelector *selector); 93 void gth_image_selector_set_mask_visible (GthImageSelector *selector, 94 gboolean visible); 95 gboolean gth_image_selector_get_mask_visible (GthImageSelector *selector); 96 void gth_image_selector_set_grid_type (GthImageSelector *selector, 97 GthGridType grid_type); 98 GthGridType gth_image_selector_get_grid_type (GthImageSelector *selector); 99 void gth_image_selector_bind_dimensions (GthImageSelector *selector, 100 gboolean bind, 101 int factor); 102 void gth_image_selector_center (GthImageSelector *selector); 103 104 G_END_DECLS 105 106 #endif /* GTH_IMAGE_SELECTOR_H */ 107