• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21/**
22 * Defines the Menu Component.
23 *
24 * @interface MenuInterface
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @since 9
27 */
28/**
29 * Defines the Menu Component.
30 *
31 * @interface MenuInterface
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @crossplatform
34 * @since 10
35 */
36/**
37 * Defines the Menu Component.
38 *
39 * @interface MenuInterface
40 * @syscap SystemCapability.ArkUI.ArkUI.Full
41 * @crossplatform
42 * @atomicservice
43 * @since 11
44 */
45interface MenuInterface {
46  /**
47   * Creates the menu component.
48   *
49   * @returns { MenuAttribute }
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @since 9
52   */
53  /**
54   * Creates the menu component.
55   *
56   * @returns { MenuAttribute }
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @crossplatform
59   * @since 10
60   */
61  /**
62   * Creates the menu component.
63   *
64   * @returns { MenuAttribute }
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @crossplatform
67   * @atomicservice
68   * @since 11
69   */
70  (): MenuAttribute;
71}
72
73/**
74 * Declare SubMenuExpandingMode
75 *
76 * @enum { number }
77 * @syscap SystemCapability.ArkUI.ArkUI.Full
78 * @crossplatform
79 * @atomicservice
80 * @since 12
81 */
82declare enum SubMenuExpandingMode {
83  /**
84   * Sub-menu will expand besides main menu
85   *
86   * @syscap SystemCapability.ArkUI.ArkUI.Full
87   * @crossplatform
88   * @atomicservice
89   * @since 12
90   */
91  SIDE_EXPAND = 0,
92
93  /**
94   * Sub-menu will expand embedded in main menu
95   *
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @crossplatform
98   * @atomicservice
99   * @since 12
100   */
101  EMBEDDED_EXPAND = 1,
102
103  /**
104   * Sub-menu will expand over main menu
105   *
106   * @syscap SystemCapability.ArkUI.ArkUI.Full
107   * @crossplatform
108   * @atomicservice
109   * @since 12
110   */
111  STACK_EXPAND = 2,
112}
113
114/**
115 * Defines the Menu component attribute functions.
116 *
117 * @extends CommonMethod<MenuAttribute>
118 * @syscap SystemCapability.ArkUI.ArkUI.Full
119 * @since 9
120 */
121/**
122 * Defines the Menu component attribute functions.
123 *
124 * @extends CommonMethod<MenuAttribute>
125 * @syscap SystemCapability.ArkUI.ArkUI.Full
126 * @crossplatform
127 * @since 10
128 */
129/**
130 * Defines the Menu component attribute functions.
131 *
132 * @extends CommonMethod<MenuAttribute>
133 * @syscap SystemCapability.ArkUI.ArkUI.Full
134 * @crossplatform
135 * @atomicservice
136 * @since 11
137 */
138declare class MenuAttribute extends CommonMethod<MenuAttribute> {
139  /**
140   * Sets the Menu text size.
141   *
142   * @param { Length } value - Indicates the font size of menu item.
143   * @returns { MenuAttribute }
144   * @syscap SystemCapability.ArkUI.ArkUI.Full
145   * @since 9
146   * @deprecated since 10
147   * @useinstead font
148   */
149  fontSize(value: Length): MenuAttribute;
150
151  /**
152   * Sets the font style.
153   * Family and style are not supported currently and will be fixed in future.
154   *
155   * @param { Font } value - Indicates the font style of menu item.
156   * @returns { MenuAttribute }
157   * @syscap SystemCapability.ArkUI.ArkUI.Full
158   * @crossplatform
159   * @since 10
160   */
161  /**
162   * Sets the font style.
163   * Family and style are not supported currently and will be fixed in future.
164   *
165   * @param { Font } value - Indicates the font style of menu item.
166   * @returns { MenuAttribute }
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @crossplatform
169   * @atomicservice
170   * @since 11
171   */
172  font(value: Font): MenuAttribute;
173
174  /**
175   * Sets the Menu font color.
176   *
177   * @param { ResourceColor } value - Indicates the font color of menu item.
178   * @returns { MenuAttribute }
179   * @syscap SystemCapability.ArkUI.ArkUI.Full
180   * @crossplatform
181   * @since 10
182   */
183  /**
184   * Sets the Menu font color.
185   *
186   * @param { ResourceColor } value - Indicates the font color of menu item.
187   * @returns { MenuAttribute }
188   * @syscap SystemCapability.ArkUI.ArkUI.Full
189   * @crossplatform
190   * @atomicservice
191   * @since 11
192   */
193  fontColor(value: ResourceColor): MenuAttribute;
194
195  /**
196   * Sets the radius of the corner around the menu.
197   * When the radius is less than the menu width, the default border radius is used.
198   *
199   * @param { Dimension | BorderRadiuses } value - the border radius.
200   * @returns { MenuAttribute }
201   * @syscap SystemCapability.ArkUI.ArkUI.Full
202   * @crossplatform
203   * @since 10
204   */
205  /**
206   * Sets the radius of the corner around the menu.
207   * When the radius is less than the menu width, the default border radius is used.
208   *
209   * @param { Dimension | BorderRadiuses } value - the border radius.
210   * @returns { MenuAttribute }
211   * @syscap SystemCapability.ArkUI.ArkUI.Full
212   * @crossplatform
213   * @atomicservice
214   * @since 11
215   */
216  radius(value: Dimension | BorderRadiuses): MenuAttribute;
217
218  /**
219   * Set the divider of menu item
220   *
221   * @param { DividerStyleOptions | undefined } options
222   * @returns { MenuAttribute }
223   * @syscap SystemCapability.ArkUI.ArkUI.Full
224   * @crossplatform
225   * @atomicservice
226   * @since 12
227   */
228  menuItemDivider(options: DividerStyleOptions | undefined): MenuAttribute;
229
230  /**
231   * Set the divider of menu item group
232   *
233   * @param { DividerStyleOptions | undefined } options
234   * @returns { MenuAttribute }
235   * @syscap SystemCapability.ArkUI.ArkUI.Full
236   * @crossplatform
237   * @atomicservice
238   * @since 12
239   */
240  menuItemGroupDivider(options: DividerStyleOptions | undefined): MenuAttribute;
241
242  /**
243   * Set the expanding mode of sub-menu
244   *
245   * @param { SubMenuExpandingMode } mode
246   * @returns { MenuAttribute }
247   * @syscap SystemCapability.ArkUI.ArkUI.Full
248   * @crossplatform
249   * @atomicservice
250   * @since 12
251   */
252  subMenuExpandingMode(mode: SubMenuExpandingMode): MenuAttribute;
253}
254
255/**
256 * Defines Menu Component.
257 *
258 * @syscap SystemCapability.ArkUI.ArkUI.Full
259 * @since 9
260 */
261/**
262 * Defines Menu Component.
263 *
264 * @syscap SystemCapability.ArkUI.ArkUI.Full
265 * @crossplatform
266 * @since 10
267 */
268/**
269 * Defines Menu Component.
270 *
271 * @syscap SystemCapability.ArkUI.ArkUI.Full
272 * @crossplatform
273 * @atomicservice
274 * @since 11
275 */
276declare const Menu: MenuInterface;
277
278/**
279 * Defines Menu Component instance.
280 *
281 * @syscap SystemCapability.ArkUI.ArkUI.Full
282 * @since 9
283 */
284/**
285 * Defines Menu Component instance.
286 *
287 * @syscap SystemCapability.ArkUI.ArkUI.Full
288 * @crossplatform
289 * @since 10
290 */
291/**
292 * Defines Menu Component instance.
293 *
294 * @syscap SystemCapability.ArkUI.ArkUI.Full
295 * @crossplatform
296 * @atomicservice
297 * @since 11
298 */
299declare const MenuInstance: MenuAttribute;
300