]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/Resize.java
Sync git svn branch with SVN repository r33324.
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / Resize.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g2d.element.handler;\r
13 \r
14 import java.awt.geom.Rectangle2D;\r
15 \r
16 import org.simantics.g2d.element.IElement;\r
17 import org.simantics.g2d.element.ElementClass.Single;\r
18 import org.simantics.g2d.element.handler.impl.Resizeable;\r
19 \r
20 /**\r
21  * This interface is implemented by all elements whose internal size can \r
22  * be modified. \r
23  * \r
24  * @See {@link InternalSize} Handler for acquiring internal size of an element\r
25  * @See {@link Resizeable} size can be changed by user\r
26  * @author Toni Kalajainen\r
27  */\r
28 @Single\r
29 public interface Resize extends ElementHandler, InternalSize {\r
30         \r
31         /**\r
32          * Modify the size of \r
33          * @param e\r
34          * @param ctx\r
35          * @param newSize\r
36          */\r
37         void resize(IElement e, Rectangle2D newSize);\r
38         \r
39         /**\r
40          * Returns width/height ratio if dimensions of the element are uniform, and\r
41          * null if not.\r
42          *  \r
43          * @return aspect ratio or null \r
44          */\r
45         Double getFixedAspectRatio(IElement e);\r
46         \r
47         /**\r
48          * Get minimum size if one exists\r
49          * @param e element\r
50          * @return the minimum size or null\r
51          */\r
52         Rectangle2D getMinimumSize(IElement e);\r
53         \r
54         /**\r
55          * Get the maximum size of the element\r
56          * @param e element\r
57          * @return the maximum size or null\r
58          */\r
59         Rectangle2D getMaximumSize(IElement e);\r
60         \r
61 }\r