|
1 | | -declare module "ui/action-bar" { |
| 1 | +/** |
| 2 | + * Contains the action bar related classes. |
| 3 | + */ |
| 4 | +declare module "ui/action-bar" { |
2 | 5 | import observable = require("data/observable"); |
3 | 6 | import view = require("ui/core/view"); |
4 | 7 | import dependencyObservable = require("ui/core/dependency-observable"); |
5 | 8 | import bindable = require("ui/core/bindable"); |
6 | 9 | import pages = require("ui/page"); |
7 | 10 |
|
| 11 | + /** |
| 12 | + * Provides an abstraction over the ActionBar (android) and NavigationBar (iOS). |
| 13 | + */ |
8 | 14 | export class ActionBar extends view.View implements view.AddArrayFromBuilder, view.AddChildFromBuilder { |
| 15 | + |
| 16 | + /** |
| 17 | + * Gets or sets the action bar title. |
| 18 | + */ |
9 | 19 | title: string; |
10 | 20 |
|
| 21 | + /** |
| 22 | + * Gets or sets the title view. When set - replaces the title with a custom view. |
| 23 | + */ |
| 24 | + titleView: view.View; |
| 25 | + |
| 26 | + /** |
| 27 | + * Gets or sets the navigation button (a.k.a. the back button). |
| 28 | + */ |
11 | 29 | navigationButton: NavigationButton; |
| 30 | + |
| 31 | + /** |
| 32 | + * Gets the collection of action items. |
| 33 | + */ |
12 | 34 | actionItems: ActionItems; |
13 | | - titleView: view.View; |
14 | | - |
| 35 | + |
| 36 | + /** |
| 37 | + * Gets the android specific options of the action bar. |
| 38 | + */ |
15 | 39 | android: AndroidActionBarSettings; |
16 | 40 |
|
| 41 | + /** |
| 42 | + * Gets the page that contains the action bar. |
| 43 | + */ |
17 | 44 | page: pages.Page; |
18 | 45 |
|
19 | | - shouldShow(): boolean |
20 | | - |
| 46 | + /** |
| 47 | + * Updates the action bar. |
| 48 | + */ |
21 | 49 | update(); |
22 | 50 |
|
23 | 51 | //@private |
| 52 | + _shouldShow(): boolean |
24 | 53 | _updateAndroid(menu: android.view.IMenu); |
25 | 54 | _onAndroidItemSelected(itemId: number): boolean |
26 | 55 |
|
27 | 56 | _addArrayFromBuilder(name: string, value: Array<any>): void; |
28 | 57 | _addChildFromBuilder(name: string, value: any): void; |
29 | | - |
30 | 58 | //@endprivate |
31 | 59 | } |
32 | 60 |
|
| 61 | + /** |
| 62 | + * Represents a collection of ActionItems. |
| 63 | + */ |
33 | 64 | export class ActionItems { |
| 65 | + /** |
| 66 | + * Adds an item to the collection. |
| 67 | + * @param item - the item to be added |
| 68 | + */ |
34 | 69 | addItem(item: ActionItem): void; |
| 70 | + |
| 71 | + /** |
| 72 | + * Removes an item to the collection. |
| 73 | + * @param item - The item to be removed. |
| 74 | + */ |
35 | 75 | removeItem(item: ActionItem): void; |
| 76 | + |
| 77 | + /** |
| 78 | + * Gets an array of the current action items in the collection. |
| 79 | + */ |
36 | 80 | getItems(): Array<ActionItem>; |
| 81 | + |
| 82 | + /** |
| 83 | + * Gets an item at a specified index. |
| 84 | + * @param index - The index. |
| 85 | + */ |
37 | 86 | getItemAt(index: number): ActionItem; |
38 | 87 | } |
39 | 88 |
|
| 89 | + /** |
| 90 | + * Base class for action items. |
| 91 | + */ |
40 | 92 | export class ActionItemBase extends bindable.Bindable { |
41 | 93 | /** |
42 | 94 | * String value used when hooking to tap event. |
|
53 | 105 | */ |
54 | 106 | public static iconProperty: dependencyObservable.Property; |
55 | 107 |
|
| 108 | + /** |
| 109 | + * Gets or sets the text of the action item. |
| 110 | + */ |
56 | 111 | text: string; |
| 112 | + |
| 113 | + /** |
| 114 | + * Gets or sets the icon of the action item. |
| 115 | + */ |
57 | 116 | icon: string; |
| 117 | + |
| 118 | + /** |
| 119 | + * Gets the action bar that contains the action item. |
| 120 | + */ |
58 | 121 | actionBar: ActionBar; |
59 | 122 |
|
60 | 123 | /** |
|
75 | 138 | //@endprivate |
76 | 139 | } |
77 | 140 |
|
| 141 | + /** |
| 142 | + * Represents an action item in the action bar. |
| 143 | + */ |
78 | 144 | export class ActionItem extends ActionItemBase { |
| 145 | + /** |
| 146 | + * Gets the iOS specific options of the action item. |
| 147 | + */ |
79 | 148 | ios: IOSActionItemSettings; |
| 149 | + |
| 150 | + /** |
| 151 | + * Gets the Android specific options of the action item. |
| 152 | + */ |
80 | 153 | android: AndroidActionItemSettings; |
81 | 154 | } |
82 | 155 |
|
| 156 | + /** |
| 157 | + * Represents Android specific options of the action item. |
| 158 | + */ |
83 | 159 | export interface AndroidActionItemSettings { |
| 160 | + /** |
| 161 | + * Gets or sets the position of the action item in the action bar. |
| 162 | + * 1. actionBar - item is shown in the action bar. |
| 163 | + * 2. actionBarIfRoom - item is shown in the action bar if there is room for it. Otherwise it is put in the popup menu. |
| 164 | + * 3. popup - item is shown in the popup menu. |
| 165 | + */ |
84 | 166 | position: string; |
85 | 167 | } |
86 | 168 |
|
| 169 | + /** |
| 170 | + * Represents Android specific options of the action item. |
| 171 | + */ |
87 | 172 | export interface IOSActionItemSettings { |
| 173 | + /** |
| 174 | + * Gets or sets the position of the action item in the action bar. |
| 175 | + * 1. left - items is shown at the left part of the navigation bar. This is the default value. |
| 176 | + * 2. right - items is shown at the right part of the navigation bar. |
| 177 | + */ |
88 | 178 | position: string; |
89 | 179 | } |
90 | 180 |
|
| 181 | + /** |
| 182 | + * Represents Android specific options of the action bar. |
| 183 | + */ |
91 | 184 | export interface AndroidActionBarSettings { |
| 185 | + |
| 186 | + /** |
| 187 | + * Gets or sets the action bar icon. |
| 188 | + */ |
92 | 189 | icon: string; |
| 190 | + |
| 191 | + /** |
| 192 | + * Gets or sets the visibility of the action bar icon. |
| 193 | + * The icon is visible by default in pre-lollipop (API level < 20) versions of android and is hidden in lollipop (API level >= 20) |
| 194 | + * The possible values are: |
| 195 | + * 1. auto - the default behavior. This is the default value. |
| 196 | + * 2. always - the icon is aways shown. |
| 197 | + * 3. never - the icon is aways hidden. |
| 198 | + */ |
93 | 199 | iconVisibility: string; |
94 | 200 | } |
95 | | - |
| 201 | + |
| 202 | + /** |
| 203 | + * Represents the navigation (a.k.a. "back") button. |
| 204 | + */ |
96 | 205 | export class NavigationButton extends ActionItemBase { |
97 | 206 |
|
98 | 207 | } |
|
0 commit comments