]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * User extension designed to be used on the BB10 platform.\r | |
3 | *\r | |
4 | * This component is used to recreate the Tab Menu component of the BB10 SDK. To recreate a native BB10 experience, it is\r | |
5 | * advised to insert this component into a {@link Ext.Toolbar} and have it aligned to the left edge.\r | |
6 | *\r | |
7 | * // Used within a toolbar\r | |
8 | * {\r | |
9 | * xtype: 'toolbar',\r | |
10 | * items: [{\r | |
11 | * xclass: 'Ext.theme.blackberry.TabMenuButton',\r | |
12 | * text: 'Chats',\r | |
13 | * iconCls: 'chats',\r | |
14 | * menuItems: [{\r | |
15 | * text: 'Chats',\r | |
16 | * iconCls: 'chats',\r | |
17 | * handler: function() {\r | |
18 | * // do something\r | |
19 | * }\r | |
20 | * }, {\r | |
21 | * text: 'Contacts',\r | |
22 | * iconCls: 'contacts',\r | |
23 | * handler: function() {\r | |
24 | * // do something\r | |
25 | * }\r | |
26 | * }]\r | |
27 | * }]\r | |
28 | * }\r | |
29 | */\r | |
30 | Ext.define('Ext.theme.blackberry.TabMenuButton', {\r | |
31 | extend: 'Ext.theme.blackberry.MenuButton',\r | |
32 | \r | |
33 | config: {\r | |
34 | /**\r | |
35 | * @hide\r | |
36 | */\r | |
37 | ui: 'tab',\r | |
38 | \r | |
39 | /**\r | |
40 | * @hide\r | |
41 | */\r | |
42 | cls: 'tabmenu',\r | |
43 | \r | |
44 | /**\r | |
45 | * The items to be used within the {@link Ext.Menu} which is shown when this button is tapped.\r | |
46 | *\r | |
47 | * // Used within a toolbar\r | |
48 | * {\r | |
49 | * xtype: 'toolbar',\r | |
50 | * items: [{\r | |
51 | * xclass: 'Ext.theme.blackberry.TabMenuButton',\r | |
52 | * text: 'Chats',\r | |
53 | * iconCls: 'chats',\r | |
54 | * menuItems: [{\r | |
55 | * text: 'Chats',\r | |
56 | * iconCls: 'chats',\r | |
57 | * handler: function() {\r | |
58 | * // do something\r | |
59 | * }\r | |
60 | * }, {\r | |
61 | * text: 'Contacts',\r | |
62 | * iconCls: 'contacts',\r | |
63 | * handler: function() {\r | |
64 | * // do something\r | |
65 | * }\r | |
66 | * }]\r | |
67 | * }]\r | |
68 | * }\r | |
69 | * \r | |
70 | * @type {}\r | |
71 | */\r | |
72 | menuItems: [],\r | |
73 | \r | |
74 | /**\r | |
75 | * @hide\r | |
76 | */\r | |
77 | menuSide: 'left'\r | |
78 | },\r | |
79 | \r | |
80 | onMenuButtonTap: function(button) {\r | |
81 | if (button) {\r | |
82 | this.setText(button.getText());\r | |
83 | this.setIconCls(button.getIconCls());\r | |
84 | }\r | |
85 | \r | |
86 | Ext.Viewport.hideMenu(this.getMenuSide());\r | |
87 | }\r | |
88 | }); |