2005-03-03 02:18:19 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GIMP_RECTANGLE_TOOL_H__
|
|
|
|
#define __GIMP_RECTANGLE_TOOL_H__
|
|
|
|
|
2006-09-06 02:25:31 +08:00
|
|
|
|
2005-08-15 22:23:28 +08:00
|
|
|
#include "gimptool.h"
|
2005-03-03 02:18:19 +08:00
|
|
|
|
2005-09-04 03:48:22 +08:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_0,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_CONTROLS,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_DIMENSIONS_ENTRY,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_PRESSX,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_PRESSY,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_X1,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_Y1,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_X2,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_Y2,
|
|
|
|
GIMP_RECTANGLE_TOOL_PROP_FUNCTION,
|
2006-06-01 03:45:38 +08:00
|
|
|
GIMP_RECTANGLE_TOOL_PROP_CONSTRAIN,
|
2006-06-06 01:14:16 +08:00
|
|
|
GIMP_RECTANGLE_TOOL_PROP_LAST = GIMP_RECTANGLE_TOOL_PROP_CONSTRAIN
|
2005-09-04 03:48:22 +08:00
|
|
|
} GimpRectangleToolProp;
|
|
|
|
|
2006-06-06 01:14:16 +08:00
|
|
|
|
2005-08-15 22:23:28 +08:00
|
|
|
#define GIMP_TYPE_RECTANGLE_TOOL (gimp_rectangle_tool_interface_get_type ())
|
|
|
|
#define GIMP_IS_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_RECTANGLE_TOOL))
|
|
|
|
#define GIMP_RECTANGLE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleTool))
|
|
|
|
#define GIMP_RECTANGLE_TOOL_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_RECTANGLE_TOOL, GimpRectangleToolInterface))
|
2005-03-03 02:18:19 +08:00
|
|
|
|
2006-09-06 02:25:31 +08:00
|
|
|
#define GIMP_RECTANGLE_TOOL_GET_OPTIONS(t) (GIMP_RECTANGLE_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
|
|
|
|
|
2005-03-03 02:18:19 +08:00
|
|
|
|
|
|
|
/* possible functions */
|
|
|
|
enum
|
|
|
|
{
|
2006-06-03 03:34:47 +08:00
|
|
|
RECT_INACTIVE,
|
2005-03-03 02:18:19 +08:00
|
|
|
RECT_CREATING,
|
|
|
|
RECT_MOVING,
|
2005-03-10 06:22:38 +08:00
|
|
|
RECT_RESIZING_UPPER_LEFT,
|
|
|
|
RECT_RESIZING_UPPER_RIGHT,
|
|
|
|
RECT_RESIZING_LOWER_LEFT,
|
|
|
|
RECT_RESIZING_LOWER_RIGHT,
|
2005-03-03 02:18:19 +08:00
|
|
|
RECT_RESIZING_LEFT,
|
|
|
|
RECT_RESIZING_RIGHT,
|
2005-03-10 06:22:38 +08:00
|
|
|
RECT_RESIZING_TOP,
|
|
|
|
RECT_RESIZING_BOTTOM,
|
2005-03-03 02:18:19 +08:00
|
|
|
RECT_EXECUTING
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-08-15 22:23:28 +08:00
|
|
|
typedef struct _GimpRectangleTool GimpRectangleTool;
|
|
|
|
typedef struct _GimpRectangleToolInterface GimpRectangleToolInterface;
|
2005-03-03 02:18:19 +08:00
|
|
|
|
2005-08-15 22:23:28 +08:00
|
|
|
struct _GimpRectangleToolInterface
|
2005-03-03 02:18:19 +08:00
|
|
|
{
|
2005-08-15 22:23:28 +08:00
|
|
|
GTypeInterface base_iface;
|
2005-03-03 02:18:19 +08:00
|
|
|
|
2006-06-05 01:08:26 +08:00
|
|
|
gboolean (* execute) (GimpRectangleTool *rect_tool,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
2006-06-06 01:14:16 +08:00
|
|
|
void (* cancel) (GimpRectangleTool *rect_tool);
|
2006-06-05 01:08:26 +08:00
|
|
|
|
|
|
|
gboolean (* rectangle_changed) (GimpRectangleTool *rect_tool);
|
2005-08-15 22:23:28 +08:00
|
|
|
};
|
2005-03-03 02:18:19 +08:00
|
|
|
|
|
|
|
|
2005-08-15 22:23:28 +08:00
|
|
|
GType gimp_rectangle_tool_interface_get_type (void) G_GNUC_CONST;
|
2005-03-03 02:18:19 +08:00
|
|
|
|
|
|
|
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_constructor (GObject *object);
|
|
|
|
void gimp_rectangle_tool_dispose (GObject *object);
|
|
|
|
gboolean gimp_rectangle_tool_initialize (GimpTool *tool,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2006-05-24 01:37:18 +08:00
|
|
|
void gimp_rectangle_tool_control (GimpTool *tool,
|
|
|
|
GimpToolAction action,
|
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_button_press (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_button_release (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_motion (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
guint32 time,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
gboolean gimp_rectangle_tool_key_press (GimpTool *tool,
|
|
|
|
GdkEventKey *kevent,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2006-08-22 01:10:29 +08:00
|
|
|
void gimp_rectangle_tool_modifier_key (GimpTool *tool,
|
|
|
|
GdkModifierType key,
|
|
|
|
gboolean press,
|
|
|
|
GdkModifierType state,
|
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_oper_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-25 22:23:09 +08:00
|
|
|
gboolean proximity,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_cursor_update (GimpTool *tool,
|
|
|
|
GimpCoords *coords,
|
|
|
|
GdkModifierType state,
|
2006-03-29 01:59:18 +08:00
|
|
|
GimpDisplay *display);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_draw (GimpDrawTool *draw);
|
2006-06-06 01:14:16 +08:00
|
|
|
gboolean gimp_rectangle_tool_execute (GimpRectangleTool *rect_tool);
|
|
|
|
void gimp_rectangle_tool_cancel (GimpRectangleTool *rect_tool);
|
|
|
|
void gimp_rectangle_tool_halt (GimpRectangleTool *rectangle);
|
2005-10-20 05:13:25 +08:00
|
|
|
void gimp_rectangle_tool_configure (GimpRectangleTool *rectangle);
|
2006-06-01 03:45:38 +08:00
|
|
|
void gimp_rectangle_tool_set_constrain (GimpRectangleTool *rectangle,
|
|
|
|
gboolean constrain);
|
2006-06-11 02:24:58 +08:00
|
|
|
gboolean gimp_rectangle_tool_no_movement (GimpRectangleTool *rectangle);
|
2005-09-04 03:48:22 +08:00
|
|
|
|
|
|
|
/* convenience functions */
|
|
|
|
|
|
|
|
void gimp_rectangle_tool_install_properties (GObjectClass *klass);
|
|
|
|
void gimp_rectangle_tool_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
void gimp_rectangle_tool_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
|
|
|
|
2005-03-03 02:18:19 +08:00
|
|
|
#endif /* __GIMP_RECTANGLE_TOOL_H__ */
|