2006-12-05 David Lodge <dave@cirt.net>
[dia.git] / app / tool.h
blob49ddb705f12adaa92c832d4c5d216a15aa05aa54
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1998 Alexander Larsson
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #ifndef TOOL_H
19 #define TOOL_H
21 #include <gdk/gdk.h>
23 typedef struct _Tool Tool;
24 typedef struct _ToolInfo ToolInfo;
25 typedef struct _ToolState ToolState;
27 typedef enum _ToolType ToolType;
29 #include "display.h"
31 typedef void (* ButtonPressFunc) (Tool *, GdkEventButton *, DDisplay *ddisp);
32 typedef void (* DoubleClickFunc) (Tool *, GdkEventButton *, DDisplay *ddisp);
33 typedef void (* ButtonReleaseFunc) (Tool *, GdkEventButton *, DDisplay *ddisp);
34 typedef void (* MotionFunc) (Tool *, GdkEventMotion *, DDisplay *ddisp);
36 enum _ToolType {
37 CREATE_OBJECT_TOOL,
38 MAGNIFY_TOOL,
39 MODIFY_TOOL,
40 SCROLL_TOOL
43 struct _Tool {
44 ToolType type;
46 /* Action functions */
47 ButtonPressFunc button_press_func;
48 ButtonReleaseFunc button_release_func;
49 MotionFunc motion_func;
50 DoubleClickFunc double_click_func;
53 struct _ToolInfo {
54 ToolType type;
55 char *tooltip;
58 struct _ToolState {
59 ToolType type;
60 gpointer extra_data;
61 gpointer user_data;
62 GtkWidget *button;
63 int invert_persistence;
66 extern Tool *active_tool, *transient_tool;
68 void tool_get(ToolState *state);
69 void tool_restore(const ToolState *state);
70 void tool_free(Tool *tool);
71 void tool_select(ToolType type, gpointer extra_data, gpointer user_date,
72 GtkWidget *button, int invert_persistence);
73 void tool_select_former(void);
74 void tool_reset(void);
75 void tool_options_dialog_show(ToolType type, gpointer extra_data,
76 gpointer user_data,GtkWidget *button,
77 int invert_persistence);
79 #endif /* TOOL_H */