2006-12-03 Dimitris Glezos <dimitris@glezos.com>
[dia.git] / lib / handle.h
blobe42860a4074ade2bab6b5e42ad74e61646fbaf5c
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.
19 /*! \file handle.h - describing the different behavious of handles, used e.g. to resize objects */
20 #ifndef HANDLE_H
21 #define HANDLE_H
23 #include "diatypes.h"
24 #include "geometry.h"
26 /*! Some object resizing depends on the placement of the handle */
27 typedef enum {
28 HANDLE_RESIZE_NW, /*!< north/west or top/left */
29 HANDLE_RESIZE_N, /*!< north or top */
30 HANDLE_RESIZE_NE, /*!< north/east or top/right */
31 HANDLE_RESIZE_W, /*!< west or left */
32 HANDLE_RESIZE_E, /*!< east or right */
33 HANDLE_RESIZE_SW, /*!< south/west or bottom/left */
34 HANDLE_RESIZE_S, /*!< south or bottom */
35 HANDLE_RESIZE_SE, /*!< south/east or bottom/right */
36 HANDLE_MOVE_STARTPOINT, /*!< for lines: the beginning */
37 HANDLE_MOVE_ENDPOINT, /*!< for lines: the ending */
39 /*! These handles can be used privately by objects: */
40 HANDLE_CUSTOM1=200,
41 HANDLE_CUSTOM2,
42 HANDLE_CUSTOM3,
43 HANDLE_CUSTOM4,
44 HANDLE_CUSTOM5,
45 HANDLE_CUSTOM6,
46 HANDLE_CUSTOM7,
47 HANDLE_CUSTOM8,
48 HANDLE_CUSTOM9
49 } HandleId;
51 /*! HandleType is used for color coding the different handles */
52 typedef enum {
53 HANDLE_NON_MOVABLE,
54 HANDLE_MAJOR_CONTROL,
55 HANDLE_MINOR_CONTROL,
57 NUM_HANDLE_TYPES /* Must be last */
58 } HandleType;
60 /*! When an objects move_handle() function is called this is passed in */
61 typedef enum {
62 HANDLE_MOVE_USER,
63 HANDLE_MOVE_USER_FINAL,
64 HANDLE_MOVE_CONNECTED,
65 HANDLE_MOVE_CREATE, /*!< the initial drag during object placement */
66 HANDLE_MOVE_CREATE_FINAL /*!< finish of initial drag */
67 } HandleMoveReason;
69 /*! If the handle is connectable or not */
70 typedef enum {
71 HANDLE_NONCONNECTABLE, /*!< not connectable */
72 HANDLE_CONNECTABLE, /*!< connectable */
73 HANDLE_CONNECTABLE_NOBREAK /*!< (unused) Don't break connection on object move */
74 } HandleConnectType;
76 /*!
77 * \brief A handle is used to resize objects or to connet to them.
79 struct _Handle {
80 HandleId id; /*!< gives (mostly) the placement relative to the object */
81 HandleType type; /*!< color coding */
82 Point pos; /*! where the handle currently is in diagram coordinates */
84 HandleConnectType connect_type; /*!< how to connect if at all */
85 ConnectionPoint *connected_to; /*!< NULL if not connected */
89 #endif /* HANDLE_H */