• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.app.Activity;
20 import android.graphics.drawable.Drawable;
21 import android.widget.AdapterView;
22 
23 /**
24  * Extension of {@link Menu} for context menus providing functionality to modify
25  * the header of the context menu.
26  * <p>
27  * Context menus do not support item shortcuts and item icons.
28  * <p>
29  * To show a context menu on long click, most clients will want to call
30  * {@link Activity#registerForContextMenu} and override
31  * {@link Activity#onCreateContextMenu}.
32  */
33 public interface ContextMenu extends Menu {
34     /**
35      * Sets the context menu 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 ContextMenu so additional setters can be called.
40      */
setHeaderTitle(int titleRes)41     public ContextMenu setHeaderTitle(int titleRes);
42 
43     /**
44      * Sets the context menu 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 ContextMenu so additional setters can be called.
48      */
setHeaderTitle(CharSequence title)49     public ContextMenu setHeaderTitle(CharSequence title);
50 
51     /**
52      * Sets the context menu 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 ContextMenu so additional setters can be called.
57      */
setHeaderIcon(int iconRes)58     public ContextMenu setHeaderIcon(int iconRes);
59 
60     /**
61      * Sets the context menu 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 ContextMenu so additional setters can be called.
66      */
setHeaderIcon(Drawable icon)67     public ContextMenu setHeaderIcon(Drawable icon);
68 
69     /**
70      * Sets the header of the context menu 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 ContextMenu so additional setters can be called.
76      */
setHeaderView(View view)77     public ContextMenu setHeaderView(View view);
78 
79     /**
80      * Clears the header of the context menu.
81      */
clearHeader()82     public void clearHeader();
83 
84     /**
85      * Additional information regarding the creation of the context menu.  For example,
86      * {@link AdapterView}s use this to pass the exact item position within the adapter
87      * that initiated the context menu.
88      */
89     public interface ContextMenuInfo {
90     }
91 }
92