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
27public interface SubMenu extends Menu {
28    /**
29     * Sets the submenu header's title to the title given in <var>titleRes</var>
30     * resource identifier.
31     *
32     * @param titleRes The string resource identifier used for the title.
33     * @return This SubMenu so additional setters can be called.
34     */
35    public SubMenu setHeaderTitle(int titleRes);
36
37    /**
38     * Sets the submenu header's title to the title given in <var>title</var>.
39     *
40     * @param title The character sequence used for the title.
41     * @return This SubMenu so additional setters can be called.
42     */
43    public SubMenu setHeaderTitle(CharSequence title);
44
45    /**
46     * Sets the submenu header's icon to the icon given in <var>iconRes</var>
47     * resource id.
48     *
49     * @param iconRes The resource identifier used for the icon.
50     * @return This SubMenu so additional setters can be called.
51     */
52    public SubMenu setHeaderIcon(int iconRes);
53
54    /**
55     * Sets the submenu header's icon to the icon given in <var>icon</var>
56     * {@link Drawable}.
57     *
58     * @param icon The {@link Drawable} used for the icon.
59     * @return This SubMenu so additional setters can be called.
60     */
61    public SubMenu setHeaderIcon(Drawable icon);
62
63    /**
64     * Sets the header of the submenu to the {@link View} given in
65     * <var>view</var>. This replaces the header title and icon (and those
66     * replace this).
67     *
68     * @param view The {@link View} used for the header.
69     * @return This SubMenu so additional setters can be called.
70     */
71    public SubMenu setHeaderView(View view);
72
73    /**
74     * Clears the header of the submenu.
75     */
76    public void clearHeader();
77
78    /**
79     * Change the icon associated with this submenu's item in its parent menu.
80     *
81     * @see MenuItem#setIcon(int)
82     * @param iconRes The new icon (as a resource ID) to be displayed.
83     * @return This SubMenu so additional setters can be called.
84     */
85    public SubMenu setIcon(int iconRes);
86
87    /**
88     * Change the icon associated with this submenu's item in its parent menu.
89     *
90     * @see MenuItem#setIcon(Drawable)
91     * @param icon The new icon (as a Drawable) to be displayed.
92     * @return This SubMenu so additional setters can be called.
93     */
94    public SubMenu setIcon(Drawable icon);
95
96    /**
97     * Gets the {@link MenuItem} that represents this submenu in the parent
98     * menu.  Use this for setting additional item attributes.
99     *
100     * @return The {@link MenuItem} that launches the submenu when invoked.
101     */
102    public MenuItem getItem();
103}
104