Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: lib/iron_iconset.dart

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/iron_icon.dart ('k') | lib/iron_iconset_svg.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // DO NOT EDIT: auto-generated with `pub run custom_element_apigen:update` 1 // DO NOT EDIT: auto-generated with `pub run custom_element_apigen:update`
2 2
3 /// Dart API for the polymer element `iron_iconset`. 3 /// Dart API for the polymer element `iron_iconset`.
4 @HtmlImport('iron_iconset_nodart.html') 4 @HtmlImport('iron_iconset_nodart.html')
5 library polymer_elements.lib.src.iron_iconset.iron_iconset; 5 library polymer_elements.lib.src.iron_iconset.iron_iconset;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:js' show JsArray, JsObject; 8 import 'dart:js' show JsArray, JsObject;
9 import 'package:web_components/web_components.dart'; 9 import 'package:web_components/web_components.dart';
10 import 'package:polymer_interop/polymer_interop.dart'; 10 import 'package:polymer_interop/polymer_interop.dart';
11 import 'iron_meta.dart'; 11 import 'iron_meta.dart';
12 12
13 /// The `iron-iconset` element allows users to define their own icon sets. 13
14 /// The `src` property specifies the url of the icon image. Multiple icons may
15 /// be included in this image and they may be organized into rows.
16 /// The `icons` property is a space separated list of names corresponding to the
17 /// icons. The names must be ordered as the icons are ordered in the icon image.
18 /// Icons are expected to be square and are the size specified by the `size`
19 /// property. The `width` property corresponds to the width of the icon image
20 /// and must be specified if icons are arranged into multiple rows in the image.
21 ///
22 /// All `iron-iconset` elements are available for use by other `iron-iconset`
23 /// elements via a database keyed by id. Typically, an element author that wants
24 /// to support a set of custom icons uses a `iron-iconset` to retrieve
25 /// and use another, user-defined iconset.
26 ///
27 /// Example:
28 ///
29 /// <iron-iconset id="my-icons" src="my-icons.png" width="96" size="24"
30 /// icons="location place starta stopb bus car train walk">
31 /// </iron-iconset>
32 ///
33 /// This will automatically register the icon set "my-icons" to the iconset
34 /// database. To use these icons from within another element, make a
35 /// `iron-iconset` element and call the `byId` method to retrieve a
36 /// given iconset. To apply a particular icon to an element, use the
37 /// `applyIcon` method. For example:
38 ///
39 /// iconset.applyIcon(iconNode, 'car');
40 ///
41 /// Themed icon sets are also supported. The `iron-iconset` can contain child
42 /// `property` elements that specify a theme with an offsetX and offsetY of the
43 /// theme within the icon resource. For example.
44 ///
45 /// <iron-iconset id="my-icons" src="my-icons.png" width="96" size="24"
46 /// icons="location place starta stopb bus car train walk">
47 /// <property theme="special" offsetX="256" offsetY="24"></property>
48 /// </iron-iconset>
49 ///
50 /// Then a themed icon can be applied like this:
51 ///
52 /// iconset.applyIcon(iconNode, 'car', 'special');
53 @CustomElementProxy('iron-iconset') 14 @CustomElementProxy('iron-iconset')
54 class IronIconset extends HtmlElement with CustomElementProxyMixin, PolymerBase { 15 class IronIconset extends HtmlElement with CustomElementProxyMixin, PolymerBase {
55 IronIconset.created() : super.created(); 16 IronIconset.created() : super.created();
56 factory IronIconset() => new Element.tag('iron-iconset'); 17 factory IronIconset() => new Element.tag('iron-iconset');
57 18
58 /// Array of fully-qualified names of icons in this set. 19 /// Array of fully-qualified names of icons in this set.
59 List get iconNames => jsElement[r'iconNames']; 20 List get iconNames => jsElement[r'iconNames'];
60 set iconNames(List value) { jsElement[r'iconNames'] = (value != null && value is! JsArray) ? new JsObject.jsify(value) : value;} 21 set iconNames(List value) { jsElement[r'iconNames'] = (value != null && value is! JsArray) ? new JsObject.jsify(value) : value;}
61 22
62 /// A space separated list of names corresponding to icons in the iconset 23 /// A space separated list of names corresponding to icons in the iconset
(...skipping 19 matching lines...) Expand all
82 num get width => jsElement[r'width']; 43 num get width => jsElement[r'width'];
83 set width(num value) { jsElement[r'width'] = value; } 44 set width(num value) { jsElement[r'width'] = value; }
84 45
85 /// Applies an icon to the given element as a css background image. This 46 /// Applies an icon to the given element as a css background image. This
86 /// method does not size the element, and it's usually necessary to set 47 /// method does not size the element, and it's usually necessary to set
87 /// the element's height and width so that the background image is visible. 48 /// the element's height and width so that the background image is visible.
88 /// [element]: The element to which the icon is applied. 49 /// [element]: The element to which the icon is applied.
89 /// [icon]: The name or index of the icon to apply. 50 /// [icon]: The name or index of the icon to apply.
90 /// [theme]: (optional) The name or index of the icon to apply. 51 /// [theme]: (optional) The name or index of the icon to apply.
91 /// [scale]: (optional, defaults to 1) Icon scaling factor. 52 /// [scale]: (optional, defaults to 1) Icon scaling factor.
92 applyIcon(Element element, icon, String theme, num scale) => 53 applyIcon(Element element, icon, theme, scale) =>
93 jsElement.callMethod('applyIcon', [element, icon, theme, scale]); 54 jsElement.callMethod('applyIcon', [element, icon, theme, scale]);
94 55
95 /// Remove an icon from the given element by undoing the changes effected 56 /// Remove an icon from the given element by undoing the changes effected
96 /// by `applyIcon`. 57 /// by `applyIcon`.
97 /// [element]: The element from which the icon is removed. 58 /// [element]: The element from which the icon is removed.
98 removeIcon(Element element) => 59 removeIcon(Element element) =>
99 jsElement.callMethod('removeIcon', [element]); 60 jsElement.callMethod('removeIcon', [element]);
100 } 61 }
OLDNEW
« no previous file with comments | « lib/iron_icon.dart ('k') | lib/iron_iconset_svg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698