aboutsummaryrefslogtreecommitdiffstats
path: root/rule_api/src
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-08-23 20:05:32 -0700
committerTor Norbye <tnorbye@google.com>2011-08-23 20:26:59 -0700
commitbf9db3ba5053c8f22a07ee748b2cb41d374d8642 (patch)
tree98290fcc6e113de4710c88fc59ef5428d30a76d0 /rule_api/src
parent6b6b377d706d6a4a6e11f83f6db9424537287952 (diff)
downloadsdk-bf9db3ba5053c8f22a07ee748b2cb41d374d8642.zip
sdk-bf9db3ba5053c8f22a07ee748b2cb41d374d8642.tar.gz
sdk-bf9db3ba5053c8f22a07ee748b2cb41d374d8642.tar.bz2
Use GridLayout state to determine exact row and column boundaries
This changeset updates the GridLayout support to consider the state of a rendered GridLayout when deciding where the rows and columns are. This information is already available in the GridLayout object, so if one is provided use that data rather than inferring it from the bounds of the views in each row and column. This required changing the view rules API a bit to pass the view objects in to the key entry points (drawing selection, drag & drop and resize). Change-Id: If8484f7f7181c65d0a2fdf629ffd515edd05448b
Diffstat (limited to 'rule_api/src')
-rwxr-xr-xrule_api/src/com/android/ide/common/api/IViewRule.java68
1 files changed, 53 insertions, 15 deletions
diff --git a/rule_api/src/com/android/ide/common/api/IViewRule.java b/rule_api/src/com/android/ide/common/api/IViewRule.java
index d29ef71..c11f500 100755
--- a/rule_api/src/com/android/ide/common/api/IViewRule.java
+++ b/rule_api/src/com/android/ide/common/api/IViewRule.java
@@ -134,26 +134,44 @@ public interface IViewRule {
* @param graphics the graphics context to paint into
* @param parentNode the parent layout node
* @param childNodes the child nodes selected in the parent layout
+ * @param view An instance of the view to be painted (may be null)
*/
void paintSelectionFeedback(IGraphics graphics, INode parentNode,
- List<? extends INode> childNodes);
+ List<? extends INode> childNodes, Object view);
// ==== Drag'n'drop support ====
/**
- * Called when the d'n'd starts dragging over the target node.
- * If interested, returns a DropFeedback passed to onDrop/Move/Leave/Paint.
- * If not interested in drop, return null.
- * Followed by a paint.
+ * Called when the d'n'd starts dragging over the target node. If
+ * interested, returns a DropFeedback passed to onDrop/Move/Leave/Paint. If
+ * not interested in drop, return null. Followed by a paint.
+ *
+ * @param targetNode the {@link INode} for the target layout receiving a
+ * drop event
+ * @param targetView the corresponding View object for the target layout, or
+ * null if not known
+ * @param elements an array of {@link IDragElement} element descriptors for
+ * the dragged views
+ * @return a {@link DropFeedback} object with drop state (which will be
+ * supplied to a follow-up {@link #onDropMove} call), or null if the
+ * drop should be ignored
*/
- DropFeedback onDropEnter(INode targetNode,
- IDragElement[] elements);
+ DropFeedback onDropEnter(INode targetNode, Object targetView, IDragElement[] elements);
/**
- * Called after onDropEnter.
- * Returns a DropFeedback passed to onDrop/Move/Leave/Paint (typically same
- * as input one).
- * Returning null will invalidate the drop workflow.
+ * Called after onDropEnter. Returns a DropFeedback passed to
+ * onDrop/Move/Leave/Paint (typically same as input one). Returning null
+ * will invalidate the drop workflow.
+ *
+ * @param targetNode the {@link INode} for the target layout receiving a
+ * drop event
+ * @param elements an array of {@link IDragElement} element descriptors for
+ * the dragged views
+ * @param feedback the {@link DropFeedback} object created by
+ * {@link #onDropEnter(INode, Object, IDragElement[])}
+ * @param where the current mouse drag position
+ * @return a {@link DropFeedback} (which is usually just the same one passed
+ * into this method)
*/
DropFeedback onDropMove(INode targetNode,
IDragElement[] elements,
@@ -176,6 +194,12 @@ public interface IViewRule {
* <i>...user leaves canvas...</i>
* - onDropLeave(node2, feedback2)
* </pre>
+ * @param targetNode the {@link INode} for the target layout receiving a
+ * drop event
+ * @param elements an array of {@link IDragElement} element descriptors for
+ * the dragged views
+ * @param feedback the {@link DropFeedback} object created by
+ * {@link #onDropEnter(INode, Object, IDragElement[])}
*/
void onDropLeave(INode targetNode,
IDragElement[] elements,
@@ -186,7 +210,15 @@ public interface IViewRule {
* <p>
* TODO: Document that this method will be called under an edit lock so you can
* directly manipulate the nodes without wrapping it in an
- * {@link INode#editXml(String, INodeHandler)} call
+ * {@link INode#editXml(String, INodeHandler)} call.
+ *
+ * @param targetNode the {@link INode} for the target layout receiving a
+ * drop event
+ * @param elements an array of {@link IDragElement} element descriptors for
+ * the dragged views
+ * @param feedback the {@link DropFeedback} object created by
+ * {@link #onDropEnter(INode, Object, IDragElement[])}
+ * @param where the mouse drop position
*/
void onDropped(INode targetNode,
IDragElement[] elements,
@@ -197,9 +229,11 @@ public interface IViewRule {
* Called when pasting elements in an existing document on the selected target.
*
* @param targetNode The first node selected.
+ * @param targetView the corresponding View object for the target layout, or
+ * null if not known
* @param pastedElements The elements being pasted.
*/
- void onPaste(INode targetNode, IDragElement[] pastedElements);
+ void onPaste(INode targetNode, Object targetView, IDragElement[] pastedElements);
// ==== XML Creation ====
@@ -261,11 +295,15 @@ public interface IViewRule {
* @param parent the layout containing the child
* @param horizEdge The horizontal edge being resized, or null
* @param verticalEdge the vertical edge being resized, or null
+ * @param childView an instance of the resized node view, or null if not known
+ * @param parentView an instance of the parent layout view object, or null if not known
* @return a {@link DropFeedback} object which performs an update painter callback
* etc.
*/
- DropFeedback onResizeBegin(INode child, INode parent,
- SegmentType horizEdge, SegmentType verticalEdge);
+ DropFeedback onResizeBegin(
+ INode child, INode parent,
+ SegmentType horizEdge, SegmentType verticalEdge,
+ Object childView, Object parentView);
/**
* Called by the IDE on the parent layout when a child widget is being resized. This