Home | History | Annotate | Download | only in view
      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 
     17 package android.view;
     18 
     19 import android.annotation.DrawableRes;
     20 import android.annotation.StringRes;
     21 import 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.
     27  *
     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>
     33  */
     34 
     35 public 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      */
     43     public SubMenu setHeaderTitle(@StringRes int titleRes);
     44 
     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      */
     60     public SubMenu setHeaderIcon(@DrawableRes int iconRes);
     61 
     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      */
     93     public SubMenu setIcon(@DrawableRes int iconRes);
     94 
     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 }
    112