Package org.apache.pivot.wtk.skin
Class MenuItemSkin
- java.lang.Object
-
- org.apache.pivot.wtk.skin.ComponentSkin
-
- org.apache.pivot.wtk.skin.ButtonSkin
-
- org.apache.pivot.wtk.skin.MenuItemSkin
-
- All Implemented Interfaces:
ButtonListener
,ButtonPressListener
,ButtonStateListener
,ComponentKeyListener
,ComponentListener
,ComponentMouseButtonListener
,ComponentMouseListener
,ComponentMouseWheelListener
,ComponentStateListener
,ComponentTooltipListener
,ConstrainedVisual
,Menu.ItemListener
,Skin
,Visual
- Direct Known Subclasses:
TerraMenuItemSkin
public abstract class MenuItemSkin extends ButtonSkin implements Menu.ItemListener
Abstract base class for menu item skins.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ButtonListener
ButtonListener.Adapter, ButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ButtonPressListener
ButtonPressListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ButtonStateListener
ButtonStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentKeyListener
ComponentKeyListener.Adapter, ComponentKeyListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentListener
ComponentListener.Adapter, ComponentListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseButtonListener
ComponentMouseButtonListener.Adapter, ComponentMouseButtonListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseListener
ComponentMouseListener.Adapter, ComponentMouseListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentMouseWheelListener
ComponentMouseWheelListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentStateListener
ComponentStateListener.Adapter, ComponentStateListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.ComponentTooltipListener
ComponentTooltipListener.Listeners
-
Nested classes/interfaces inherited from interface org.apache.pivot.wtk.Menu.ItemListener
Menu.ItemListener.Listeners
-
-
Field Summary
Fields Modifier and Type Field Description protected ApplicationContext.ScheduledCallback
buttonPressCallback
protected int
buttonPressInterval
protected MenuPopup
menuPopup
-
Fields inherited from class org.apache.pivot.wtk.skin.ButtonSkin
highlighted
-
-
Constructor Summary
Constructors Constructor Description MenuItemSkin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activeChanged(Menu.Item menuItem)
Called when an item's active state has changed.void
buttonPressed(Button button)
Called when a button is pressed.void
enabledChanged(Component component)
Called when a component's enabled state has changed.void
install(Component component)
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.boolean
isFocusable()
By default, skins are focusable.void
menuChanged(Menu.Item menuItem, Menu previousMenu)
Called when an item's menu has changed.boolean
mouseDown(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is pressed over a component.void
mouseOut(Component component)
Called when the mouse exits a component.void
mouseOver(Component component)
Called when the mouse enters a component.boolean
mouseUp(Component component, Mouse.Button button, int x, int y)
Called when a mouse button is released over a component.-
Methods inherited from class org.apache.pivot.wtk.skin.ButtonSkin
actionChanged, buttonDataChanged, buttonGroupChanged, dataRendererChanged, focusedChanged, layout, stateChanged, toggleButtonChanged, triStateChanged
-
Methods inherited from class org.apache.pivot.wtk.skin.ComponentSkin
colorFromObject, colorFromObject, colorFromObject, colorFromObject, currentTheme, cursorChanged, decodeFont, defaultBackgroundColor, defaultForegroundColor, dragSourceChanged, dropTargetChanged, fontFromObject, getBaseline, getBaseline, getColor, getComponent, getFocusRectangleStroke, getHeight, getPreferredSize, getSize, getTextInputMethodListener, getThemeFont, getWidth, heightLimitsChanged, invalidateComponent, isOpaque, keyPressed, keyReleased, keyTyped, locationChanged, menuHandlerChanged, mouseClick, mouseMove, mouseWheel, nameChanged, parentChanged, preferredSizeChanged, repaintComponent, repaintComponent, repaintComponent, repaintComponent, repaintComponent, setDefaultStyles, setSize, sizeChanged, themeHasThickFocusRectangle, themeHasTransitionEnabled, themeIsDark, themeIsFlat, tooltipDelayChanged, tooltipTextChanged, tooltipTriggered, visibleChanged, widthLimitsChanged
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pivot.wtk.ConstrainedVisual
getPreferredHeight, getPreferredWidth, setSize
-
-
-
-
Field Detail
-
menuPopup
protected MenuPopup menuPopup
-
buttonPressInterval
protected int buttonPressInterval
-
buttonPressCallback
protected ApplicationContext.ScheduledCallback buttonPressCallback
-
-
Method Detail
-
install
public void install(Component component)
Description copied from class:ComponentSkin
Must be implemented in every subclass in order to do component-specific operations at instantiation time, but every subclass must call this superclass method to setup the necessary listeners, etc.- Specified by:
install
in interfaceSkin
- Overrides:
install
in classButtonSkin
- Parameters:
component
- The component to which the skin is being attached.
-
isFocusable
public boolean isFocusable()
Description copied from class:ComponentSkin
By default, skins are focusable.- Specified by:
isFocusable
in interfaceSkin
- Overrides:
isFocusable
in classComponentSkin
- Returns:
true
if this skin is focusable;false
, otherwise.
-
mouseOver
public void mouseOver(Component component)
Description copied from interface:ComponentMouseListener
Called when the mouse enters a component.Default is to do nothing.
- Specified by:
mouseOver
in interfaceComponentMouseListener
- Overrides:
mouseOver
in classButtonSkin
- Parameters:
component
- Component that is now under the mouse pointer.
-
mouseOut
public void mouseOut(Component component)
Description copied from interface:ComponentMouseListener
Called when the mouse exits a component.Default is to do nothing.
- Specified by:
mouseOut
in interfaceComponentMouseListener
- Overrides:
mouseOut
in classButtonSkin
- Parameters:
component
- Component that has now lost the mouse pointer.
-
mouseDown
public boolean mouseDown(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is pressed over a component.- Specified by:
mouseDown
in interfaceComponentMouseButtonListener
- Overrides:
mouseDown
in classComponentSkin
- Parameters:
component
- Component that is under the mouse pointer.button
- Which mouse button was pressed.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
mouseUp
public boolean mouseUp(Component component, Mouse.Button button, int x, int y)
Description copied from interface:ComponentMouseButtonListener
Called when a mouse button is released over a component.- Specified by:
mouseUp
in interfaceComponentMouseButtonListener
- Overrides:
mouseUp
in classComponentSkin
- Parameters:
component
- Component user the mouse pointer.button
- Which mouse button that was released.x
- X position of the mouse.y
- Y position of the mouse.- Returns:
true
to consume the event;false
to allow it to propagate (default).
-
enabledChanged
public void enabledChanged(Component component)
Description copied from interface:ComponentStateListener
Called when a component's enabled state has changed.Called both when the component is enabled and when it is disabled. The component's
enabled
flag has already been set when this method is called so the new state can be determined by calling theComponent.isEnabled()
method.- Specified by:
enabledChanged
in interfaceComponentStateListener
- Overrides:
enabledChanged
in classButtonSkin
- Parameters:
component
- The component whose enabled state is changing.
-
buttonPressed
public void buttonPressed(Button button)
Description copied from interface:ButtonPressListener
Called when a button is pressed.- Specified by:
buttonPressed
in interfaceButtonPressListener
- Overrides:
buttonPressed
in classButtonSkin
- Parameters:
button
- The button that was just pressed.
-
menuChanged
public void menuChanged(Menu.Item menuItem, Menu previousMenu)
Description copied from interface:Menu.ItemListener
Called when an item's menu has changed.- Specified by:
menuChanged
in interfaceMenu.ItemListener
- Parameters:
menuItem
- The item that has been moved.previousMenu
- The menu where the item used to live.
-
activeChanged
public void activeChanged(Menu.Item menuItem)
Description copied from interface:Menu.ItemListener
Called when an item's active state has changed.- Specified by:
activeChanged
in interfaceMenu.ItemListener
- Parameters:
menuItem
- The item that is changing.
-
-