diff options
author | Tor Norbye <tnorbye@google.com> | 2010-11-19 18:45:57 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2010-11-22 10:00:44 -0800 |
commit | 9672aa7c01849cbc4e11c1bd73c682fa4fc3241e (patch) | |
tree | 65f6bae4b48bb0cb2b855297c439dba4d43a8251 /eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api | |
parent | 476a6e18ba87159b34fabb8a0bd73abb804c5079 (diff) | |
download | sdk-9672aa7c01849cbc4e11c1bd73c682fa4fc3241e.zip sdk-9672aa7c01849cbc4e11c1bd73c682fa4fc3241e.tar.gz sdk-9672aa7c01849cbc4e11c1bd73c682fa4fc3241e.tar.bz2 |
Refactor selection painting to fix highlighting of included views
This changeset moves the painting of selection bounds and selection
hints out of the view rules and into the core IDE. The reason for this
is that the visual appearance of the selection shouldn't be up to each
rule; for one thing the selection highlight should be consistent and
not vary from view to view (and in fact there was only a single
implementation of the paint selection method among the view rules),
and for another the view rules are in theory sharable among IDEs
whereas the selection appearance is going to be IDE specific. There
was also painting of "hints" in the RelativeLayout; rather than having
the visual appearance of this dictated by the rule, this is also moved
into the IDE such that the rules only provide the hint text and the
hints are displayed by the IDE itself.
The above refactoring also fixes selection feedback for <include>'ed
views, which were not visually selectable because there was no
corresponding ViewRule, so nobody to paint selection. With these
changes selection painting is now independent of the rules.
Change-Id: I22dd926102128634a443b8bafb54d4764f1eda41
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api')
-rwxr-xr-x | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IViewRule.java | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IViewRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IViewRule.java index 0ec8eb3..fba22ba 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IViewRule.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IViewRule.java @@ -99,38 +99,18 @@ public interface IViewRule { // ==== Selection ==== /** - * Called by the canvas when a view is being selected. - * <p/> - * Before the method is called, the canvas' Graphic Context is initialized - * with a foreground color already set to the desired selection color, fully - * opaque and with the default adequate font. - * - * @param gc An {@link IGraphics} instance, to perform drawing operations. - * @param selectedNode The node selected. Never null. - * @param displayName The name to display, as returned by {@link #getDisplayName()}. - * @param isMultipleSelection A boolean set to true if more than one element is selected. - */ - void onSelected(IGraphics gc, - INode selectedNode, - String displayName, - boolean isMultipleSelection); - - /** - * Called by the canvas when a single child view is being selected. + * Returns a list of strings that will be displayed when a single child is being + * selected in a layout corresponding to this rule. This gives the container a chance + * to describe the child's layout attributes or other relevant information. * <p/> * Note that this is called only for single selections. * <p/> - * This allows a parent to draw stuff around its children, for example to display - * layout attributes graphically. * - * @param gc An {@link IGraphics} instance, to perform drawing operations. * @param parentNode The parent of the node selected. Never null. * @param childNode The child node that was selected. Never null. + * @return a list of strings to be displayed, or null or empty to display nothing */ - void onChildSelected(IGraphics gc, - INode parentNode, - INode childNode); - + List<String> getSelectionHint(INode parentNode, INode childNode); // ==== Drag'n'drop support ==== |