1/*
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
19import android.graphics.drawable.Drawable;
20
21/**
22 * Subclass of {@link Menu} for sub menus.
23 * <p>
24 * Sub menus do not support item icons, or nested sub menus.
25 *
26 * <div class="special reference">
27 * <h3>Developer Guides</h3>
28 * <p>For information about creating menus, read the
29 * <a href="{@docRoot}guide/topics/ui/menus.html">Menus</a> developer guide.</p>
30 * </div>
31 */
32
33public interface SubMenu extends Menu {
34    /**
35     * Sets the submenu header's title to the title given in <var>titleRes</var>
36     * resource identifier.
37     *
38     * @param titleRes The string resource identifier used for the title.
39     * @return This SubMenu so additional setters can be called.
40     */
41    public SubMenu setHeaderTitle(int titleRes);
42
43    /**
44     * Sets the submenu header's title to the title given in <var>title</var>.
45     *
46     * @param title The character sequence used for the title.
47     * @return This SubMenu so additional setters can be called.
48     */
49    public SubMenu setHeaderTitle(CharSequence title);
50
51    /**
52     * Sets the submenu header's icon to the icon given in <var>iconRes</var>
53     * resource id.
54     *
55     * @param iconRes The resource identifier used for the icon.
56     * @return This SubMenu so additional setters can be called.
57     */
58    public SubMenu setHeaderIcon(int iconRes);
59
60    /**
61     * Sets the submenu header's icon to the icon given in <var>icon</var>
62     * {@link Drawable}.
63     *
64     * @param icon The {@link Drawable} used for the icon.
65     * @return This SubMenu so additional setters can be called.
66     */
67    public SubMenu setHeaderIcon(Drawable icon);
68
69    /**
70     * Sets the header of the submenu to the {@link View} given in
71     * <var>view</var>. This replaces the header title and icon (and those
72     * replace this).
73     *
74     * @param view The {@link View} used for the header.
75     * @return This SubMenu so additional setters can be called.
76     */
77    public SubMenu setHeaderView(View view);
78
79    /**
80     * Clears the header of the submenu.
81     */
82    public void clearHeader();
83
84    /**
85     * Change the icon associated with this submenu's item in its parent menu.
86     *
87     * @see MenuItem#setIcon(int)
88     * @param iconRes The new icon (as a resource ID) to be displayed.
89     * @return This SubMenu so additional setters can be called.
90     */
91    public SubMenu setIcon(int iconRes);
92
93    /**
94     * Change the icon associated with this submenu's item in its parent menu.
95     *
96     * @see MenuItem#setIcon(Drawable)
97     * @param icon The new icon (as a Drawable) to be displayed.
98     * @return This SubMenu so additional setters can be called.
99     */
100    public SubMenu setIcon(Drawable icon);
101
102    /**
103     * Gets the {@link MenuItem} that represents this submenu in the parent
104     * menu.  Use this for setting additional item attributes.
105     *
106     * @return The {@link MenuItem} that launches the submenu when invoked.
107     */
108    public MenuItem getItem();
109}
110