blob: 38662b09d4d4fd6a63358fd49446e7524e884b12 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.view;
18
Tor Norbye7b9c9122013-05-30 16:48:33 -070019import android.annotation.DrawableRes;
20import android.annotation.StringRes;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021import android.graphics.drawable.Drawable;
22
23/**
24 * Subclass of {@link Menu} for sub menus.
25 * <p>
26 * Sub menus do not support item icons, or nested sub menus.
Joe Fernandez558459f2011-10-13 16:47:36 -070027 *
28 * <div class="special reference">
29 * <h3>Developer Guides</h3>
30 * <p>For information about creating menus, read the
31 * <a href="{@docRoot}guide/topics/ui/menus.html">Menus</a> developer guide.</p>
32 * </div>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080033 */
34
35public interface SubMenu extends Menu {
36 /**
37 * Sets the submenu header's title to the title given in <var>titleRes</var>
38 * resource identifier.
39 *
40 * @param titleRes The string resource identifier used for the title.
41 * @return This SubMenu so additional setters can be called.
42 */
Tor Norbye7b9c9122013-05-30 16:48:33 -070043 public SubMenu setHeaderTitle(@StringRes int titleRes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044
45 /**
46 * Sets the submenu header's title to the title given in <var>title</var>.
47 *
48 * @param title The character sequence used for the title.
49 * @return This SubMenu so additional setters can be called.
50 */
51 public SubMenu setHeaderTitle(CharSequence title);
52
53 /**
54 * Sets the submenu header's icon to the icon given in <var>iconRes</var>
55 * resource id.
56 *
57 * @param iconRes The resource identifier used for the icon.
58 * @return This SubMenu so additional setters can be called.
59 */
Tor Norbye7b9c9122013-05-30 16:48:33 -070060 public SubMenu setHeaderIcon(@DrawableRes int iconRes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080061
62 /**
63 * Sets the submenu header's icon to the icon given in <var>icon</var>
64 * {@link Drawable}.
65 *
66 * @param icon The {@link Drawable} used for the icon.
67 * @return This SubMenu so additional setters can be called.
68 */
69 public SubMenu setHeaderIcon(Drawable icon);
70
71 /**
72 * Sets the header of the submenu to the {@link View} given in
73 * <var>view</var>. This replaces the header title and icon (and those
74 * replace this).
75 *
76 * @param view The {@link View} used for the header.
77 * @return This SubMenu so additional setters can be called.
78 */
79 public SubMenu setHeaderView(View view);
80
81 /**
82 * Clears the header of the submenu.
83 */
84 public void clearHeader();
85
86 /**
87 * Change the icon associated with this submenu's item in its parent menu.
88 *
89 * @see MenuItem#setIcon(int)
90 * @param iconRes The new icon (as a resource ID) to be displayed.
91 * @return This SubMenu so additional setters can be called.
92 */
Tor Norbye7b9c9122013-05-30 16:48:33 -070093 public SubMenu setIcon(@DrawableRes int iconRes);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094
95 /**
96 * Change the icon associated with this submenu's item in its parent menu.
97 *
98 * @see MenuItem#setIcon(Drawable)
99 * @param icon The new icon (as a Drawable) to be displayed.
100 * @return This SubMenu so additional setters can be called.
101 */
102 public SubMenu setIcon(Drawable icon);
103
104 /**
105 * Gets the {@link MenuItem} that represents this submenu in the parent
106 * menu. Use this for setting additional item attributes.
107 *
108 * @return The {@link MenuItem} that launches the submenu when invoked.
109 */
110 public MenuItem getItem();
111}