323ba2d88d0051b528949d4c80cd843a57d9ff92
[pub/Android/ownCloud.git] / actionbarsherlock / src / com / actionbarsherlock / internal / view / menu / MenuView.java
1 /*
2 * Copyright (C) 2006 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 com.actionbarsherlock.internal.view.menu;
18
19 import android.graphics.drawable.Drawable;
20
21 /**
22 * Minimal interface for a menu view. {@link #initialize(MenuBuilder)} must be called for the
23 * menu to be functional.
24 *
25 * @hide
26 */
27 public interface MenuView {
28 /**
29 * Initializes the menu to the given menu. This should be called after the
30 * view is inflated.
31 *
32 * @param menu The menu that this MenuView should display.
33 */
34 public void initialize(MenuBuilder menu);
35
36 /**
37 * Returns the default animations to be used for this menu when entering/exiting.
38 * @return A resource ID for the default animations to be used for this menu.
39 */
40 public int getWindowAnimations();
41
42 /**
43 * Minimal interface for a menu item view. {@link #initialize(MenuItemImpl, int)} must be called
44 * for the item to be functional.
45 */
46 public interface ItemView {
47 /**
48 * Initializes with the provided MenuItemData. This should be called after the view is
49 * inflated.
50 * @param itemData The item that this ItemView should display.
51 * @param menuType The type of this menu, one of
52 * {@link MenuBuilder#TYPE_ICON}, {@link MenuBuilder#TYPE_EXPANDED},
53 * {@link MenuBuilder#TYPE_DIALOG}).
54 */
55 public void initialize(MenuItemImpl itemData, int menuType);
56
57 /**
58 * Gets the item data that this view is displaying.
59 * @return the item data, or null if there is not one
60 */
61 public MenuItemImpl getItemData();
62
63 /**
64 * Sets the title of the item view.
65 * @param title The title to set.
66 */
67 public void setTitle(CharSequence title);
68
69 /**
70 * Sets the enabled state of the item view.
71 * @param enabled Whether the item view should be enabled.
72 */
73 public void setEnabled(boolean enabled);
74
75 /**
76 * Displays the checkbox for the item view. This does not ensure the item view will be
77 * checked, for that use {@link #setChecked}.
78 * @param checkable Whether to display the checkbox or to hide it
79 */
80 public void setCheckable(boolean checkable);
81
82 /**
83 * Checks the checkbox for the item view. If the checkbox is hidden, it will NOT be
84 * made visible, call {@link #setCheckable(boolean)} for that.
85 * @param checked Whether the checkbox should be checked
86 */
87 public void setChecked(boolean checked);
88
89 /**
90 * Sets the shortcut for the item.
91 * @param showShortcut Whether a shortcut should be shown(if false, the value of
92 * shortcutKey should be ignored).
93 * @param shortcutKey The shortcut key that should be shown on the ItemView.
94 */
95 public void setShortcut(boolean showShortcut, char shortcutKey);
96
97 /**
98 * Set the icon of this item view.
99 * @param icon The icon of this item. null to hide the icon.
100 */
101 public void setIcon(Drawable icon);
102
103 /**
104 * Whether this item view prefers displaying the condensed title rather
105 * than the normal title. If a condensed title is not available, the
106 * normal title will be used.
107 *
108 * @return Whether this item view prefers displaying the condensed
109 * title.
110 */
111 public boolean prefersCondensedTitle();
112
113 /**
114 * Whether this item view shows an icon.
115 *
116 * @return Whether this item view shows an icon.
117 */
118 public boolean showsIcon();
119 }
120 }