Package com.biglybt.pif.ui.menus
Interface MenuItem
- All Known Subinterfaces:
TableContextMenuItem
- All Known Implementing Classes:
MenuItemImpl
,TableContextMenuItemImpl
public interface MenuItem
Menu item access for the UI.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final int
check box style menu item - data must be of type Booleanstatic final int
menu containing submenu itemsstatic final int
normal selection menu, no Data value requiredstatic final int
radio style - data must be Booleanstatic final int
separator line -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFillListener
(MenuItemFillListener listener) Adds a listener to be notified when the menu item is about to be displayed.void
Adds a selection listener for this menu item.void
Adds a selection listener for this menu item.getData()
Get the current data value associated with the menu: Boolean for CHECK styleget the menu's graphicThe header that a top menu item will be placed under for the fancy menuGet the child item with the given resource key.int
Returns the number of menu itemsMenuItem[]
getItems()
Get all child items currently associated with this MenuItem.Retrieve the menu ID that the menu item belongs toint
Retrieve the parent MenuItem.Retrieve the resource key ("name") of this menu itemint
getStyle()
Get the type of the menu itemgetText()
Gets the text to display for this menu item.boolean
Whether or not this item is enabled or notboolean
Returns whether the menu item is selected or not.boolean
Returns whether the menu item is visible or not.void
remove()
Removes the menu item.void
Removes all child menu items from this menu (if any exist).void
removeFillListener
(MenuItemFillListener listener) void
Removes a selection listener from this menu item.void
Removes a selection listener from this menu item.void
Set the current data value associated with the menu: Boolean for CHECK stylevoid
setDisposeWithUIDetach
(String uiType) Auto-dispose of MenuItem when a specific UI is detached (Seeinvalid @link
{@link com.biglybt.pif.ui.UIInstance#UIT_*
void
setEnabled
(boolean enabled) Set the enabled status of the menu itemvoid
setGraphic
(Graphic graphic) set the menu item's iconvoid
setHeaderCategory
(String header) Sets which header to place the menu item under for top level fancy menuvoid
setMinUserMode
(int minUserMode) void
setStyle
(int style) Set the style of the menu item (see STYLE_ constants)void
setSubmenuBuilder
(MenuBuilder builder) ForSTYLE_MENU
, builder is called when user wants to see the submenu items.void
Sets the text to display for this menu item.void
setVisible
(boolean visible) Sets whether the menu item is visible or not.
-
Field Details
-
STYLE_PUSH
static final int STYLE_PUSHnormal selection menu, no Data value required- See Also:
-
STYLE_CHECK
static final int STYLE_CHECKcheck box style menu item - data must be of type Boolean- See Also:
-
STYLE_RADIO
static final int STYLE_RADIOradio style - data must be Boolean- See Also:
-
STYLE_SEPARATOR
static final int STYLE_SEPARATORseparator line- See Also:
-
STYLE_MENU
static final int STYLE_MENUmenu containing submenu items- See Also:
-
HEADER_CONTROL
- See Also:
-
HEADER_SOCIAL
- See Also:
-
HEADER_ORGANIZE
- See Also:
-
HEADER_OTHER
- See Also:
-
HEADER_CONTENT
- See Also:
-
-
Method Details
-
getResourceKey
String getResourceKey()Retrieve the resource key ("name") of this menu item- Returns:
- resource key for this menu
-
getStyle
int getStyle()Get the type of the menu item -
setStyle
void setStyle(int style) Set the style of the menu item (see STYLE_ constants)- Parameters:
style
-
-
getData
Object getData()Get the current data value associated with the menu: Boolean for CHECK style- Returns:
-
setData
Set the current data value associated with the menu: Boolean for CHECK style- Parameters:
data
-
-
isEnabled
boolean isEnabled()Whether or not this item is enabled or not- Returns:
-
setEnabled
void setEnabled(boolean enabled) Set the enabled status of the menu item- Parameters:
enabled
-
-
setGraphic
set the menu item's icon- Parameters:
graphic
-
-
getGraphic
Graphic getGraphic()get the menu's graphic- Returns:
-
getParent
MenuItem getParent()Retrieve the parent MenuItem.- Returns:
- parent menu object, or null if no parent
-
getItems
MenuItem[] getItems()Get all child items currently associated with this MenuItem.- Returns:
- An array of items (if this object has the menu style associated) or null otherwise.
-
getItemCount
int getItemCount()Returns the number of menu items -
getItem
Get the child item with the given resource key.- Returns:
- The child MenuItem object which has the resource key specified, or null otherwise.
-
getText
String getText()Gets the text to display for this menu item. -
setText
Sets the text to display for this menu item. You can also pass null to revert back to the default behaviour. -
getMenuID
String getMenuID()Retrieve the menu ID that the menu item belongs to- Returns:
MenuManager
.MENU_ constant.- Since:
- 3.0.0.7
-
remove
void remove()Removes the menu item. Calling this will remove the item from the menus, as well as removing all listeners and removing all child menu items (if any exist). The behaviour of this object is undefined after this method has been called. If you need to interact with this object when you are about to destroy it, you should do it before you call the remove method.- Since:
- 3.0.0.7
-
removeAllChildItems
void removeAllChildItems()Removes all child menu items from this menu (if any exist).- Since:
- 3.0.0.7
-
setVisible
void setVisible(boolean visible) Sets whether the menu item is visible or not.- Since:
- 3.0.2.0
-
isVisible
boolean isVisible()Returns whether the menu item is visible or not.- Since:
- 3.0.2.0
-
isSelected
boolean isSelected()Returns whether the menu item is selected or not. This method should only be called if the menu is of type STYLE_RADIO or type STYLE_CHECK and if the menu item has already had a selected or deselected state assigned to it.- Since:
- 3.0.2.4
-
setHeaderCategory
Sets which header to place the menu item under for top level fancy menu -
getHeaderCategory
String getHeaderCategory()The header that a top menu item will be placed under for the fancy menu -
getMinUserMode
int getMinUserMode() -
setMinUserMode
void setMinUserMode(int minUserMode) -
setDisposeWithUIDetach
Auto-dispose of MenuItem when a specific UI is detached (Seeinvalid @link
{@link com.biglybt.pif.ui.UIInstance#UIT_*
- Parameters:
uiType
-
-
getDisposeWithUIDetach
String getDisposeWithUIDetach()
-