de.matthiasmann.twl
Class RadialPopupMenu

java.lang.Object
  extended by de.matthiasmann.twl.Widget
      extended by de.matthiasmann.twl.Container
          extended by de.matthiasmann.twl.PopupWindow
              extended by de.matthiasmann.twl.RadialPopupMenu

public class RadialPopupMenu
extends PopupWindow

A radial popup menu with round buttons


Nested Class Summary
protected  class RadialPopupMenu.RoundButton
           
 
Nested classes/interfaces inherited from class de.matthiasmann.twl.Widget
Widget.OffscreenMouseAdjustments, Widget.RenderOffscreen
 
Field Summary
 
Fields inherited from class de.matthiasmann.twl.Widget
STATE_DISABLED, STATE_HAS_FOCUSED_CHILD, STATE_HAS_OPEN_POPUPS, STATE_KEYBOARD_FOCUS
 
Constructor Summary
RadialPopupMenu(Widget owner)
           
 
Method Summary
protected  void addButton(RadialPopupMenu.RoundButton button)
           
 Button addButton(java.lang.String theme, java.lang.Runnable cb)
           
protected  void applyTheme(ThemeInfo themeInfo)
          Apply the given theme.
protected  void applyThemeRadialPopupMenu(ThemeInfo themeInfo)
           
protected  void boundDragEventFinished()
           
 int getButtonRadius()
           
 int getMouseButton()
           
 int getPreferredInnerHeight()
          Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children.
 int getPreferredInnerWidth()
          Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children.
 int getRadius()
           
protected  void layout()
          Called when the layoutInvalid flag is set.
protected  void layoutRadial()
           
protected static int limit(int value, int min, int max)
           
 boolean openPopup()
          Opens the pop-up window with it's current size and position.
 boolean openPopup(Event evt)
          Opens the radial popup menu around the current mouse position and uses the event's mouse button as button activator.
 boolean openPopupAt(int centerX, int centerY)
          Opens the radial popup menu around the specified coordinate
 void removeButton(Button btn)
           
protected  void setAllButtonsPressed()
           
 void setButtonRadius(int buttonRadius)
           
 void setMouseButton(int mouseButton)
          Sets the mouse button to which the buttons of this radial menu should react.
 void setRadius(int radius)
           
 
Methods inherited from class de.matthiasmann.twl.PopupWindow
bindMouseDrag, centerPopup, closePopup, escapePressed, getOwner, getPreferredHeight, getPreferredWidth, getRequestCloseCallback, handleEvent, handleEventPopup, isCloseOnClickedOutside, isCloseOnEscape, isMouseInside, isOpen, mouseClickedOutside, openPopupCentered, openPopupCentered, requestPopupClose, setCloseOnClickedOutside, setCloseOnEscape, setRequestCloseCallback
 
Methods inherited from class de.matthiasmann.twl.Container
getMinHeight, getMinWidth
 
Methods inherited from class de.matthiasmann.twl.Widget
add, addActionMapping, addPropertyChangeListener, addPropertyChangeListener, adjustSize, afterAddToGUI, allChildrenRemoved, applyThemeBackground, applyThemeBorder, applyThemeInputMap, applyThemeMaxSize, applyThemeMinSize, applyThemeMouseCursor, applyThemeOffscreenExtra, applyThemeOverlay, applyThemeTooltip, beforeRemoveFromGUI, borderChanged, canAcceptKeyboardFocus, childAdded, childInvalidateLayout, childRemoved, childVisibilityChanged, computeSize, destroy, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, focusFirstChild, focusLastChild, focusNextChild, focusPrevChild, getActionMap, getAnimationState, getBackground, getBorderBottom, getBorderHorizontal, getBorderLeft, getBorderRight, getBorderTop, getBorderVertical, getBottom, getChild, getChildAt, getChildIndex, getGUI, getHeight, getInnerBottom, getInnerHeight, getInnerRight, getInnerWidth, getInnerX, getInnerY, getInputMap, getKeyboardFocusOrder, getMaxHeight, getMaxWidth, getMouseCursor, getMouseCursor, getNumChildren, getOffscreenExtraBottom, getOffscreenExtraLeft, getOffscreenExtraRight, getOffscreenExtraTop, getOrCreateActionMap, getOverlay, getParent, getRenderOffscreen, getRight, getRootWidget, getTheme, getThemePath, getThemeTooltipContent, getTintAnimator, getTooltipContent, getTooltipContentAt, getWidgetAt, getWidth, getX, getY, giveupKeyboardFocus, handleKeyStrokeAction, hasKeyboardFocus, hasOpenPopups, hasSharedAnimationState, insertChild, invalidateLayout, invalidateLayoutLocally, isAbsoluteTheme, isClip, isDepthFocusTraversal, isEnabled, isFocusKeyEnabled, isInside, isLocallyEnabled, isVisible, keyboardFocusChildChanged, keyboardFocusGained, keyboardFocusGained, keyboardFocusLost, layoutChildFullInnerArea, layoutChildrenFullInnerArea, moveChild, paint, paintBackground, paintChild, paintChildren, paintDragOverlay, paintOverlay, paintWidget, positionChanged, reapplyTheme, removeAllChildren, removeChild, removeChild, removePropertyChangeListener, removePropertyChangeListener, requestKeyboardFocus, requestKeyboardFocus, resetTooltip, setActionMap, setBackground, setBorderSize, setBorderSize, setBorderSize, setBorderSize, setCanAcceptKeyboardFocus, setClip, setDepthFocusTraversal, setEnabled, setFocusKeyEnabled, setInnerSize, setInputMap, setMaxSize, setMinSize, setMouseCursor, setOffscreenExtra, setOffscreenExtra, setOverlay, setPosition, setRenderOffscreen, setSize, setTheme, setTintAnimator, setTooltipContent, setVisible, sizeChanged, updateTintAnimation, updateTooltip, validateLayout, widgetDisabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RadialPopupMenu

public RadialPopupMenu(Widget owner)
Method Detail

getButtonRadius

public int getButtonRadius()

setButtonRadius

public void setButtonRadius(int buttonRadius)

getRadius

public int getRadius()

setRadius

public void setRadius(int radius)

getMouseButton

public int getMouseButton()

setMouseButton

public void setMouseButton(int mouseButton)
Sets the mouse button to which the buttons of this radial menu should react. The default is Event.MOUSE_LBUTTON

Parameters:
mouseButton - the mouse button

addButton

public Button addButton(java.lang.String theme,
                        java.lang.Runnable cb)

removeButton

public void removeButton(Button btn)

addButton

protected void addButton(RadialPopupMenu.RoundButton button)

openPopup

public boolean openPopup()
Description copied from class: PopupWindow
Opens the pop-up window with it's current size and position. In order for this to work the owner must be part of the GUI tree. When a pop-up window is shown it is always visible and enabled.

Overrides:
openPopup in class PopupWindow
Returns:
true if the pop-up window could be opened.
See Also:
PopupWindow.getOwner(), Widget.getGUI()

openPopupAt

public boolean openPopupAt(int centerX,
                           int centerY)
Opens the radial popup menu around the specified coordinate

Parameters:
centerX - the X coordinate of the popup center
centerY - the Y coordinate of the popup center
Returns:
true if the popup was opened

limit

protected static int limit(int value,
                           int min,
                           int max)

openPopup

public boolean openPopup(Event evt)
Opens the radial popup menu around the current mouse position and uses the event's mouse button as button activator.

Parameters:
evt - the Event.Type.MOUSE_BTNDOWN event
Returns:
true if the popup was opened

getPreferredInnerWidth

public int getPreferredInnerWidth()
Description copied from class: Widget
Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerWidth in class Container
Returns:
the preferred inner width

getPreferredInnerHeight

public int getPreferredInnerHeight()
Description copied from class: Widget
Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Overrides:
getPreferredInnerHeight in class Container
Returns:
the preferred inner height

applyTheme

protected void applyTheme(ThemeInfo themeInfo)
Description copied from class: Widget
Apply the given theme. This method also calls invalidateLayout()

Overrides:
applyTheme in class Widget
Parameters:
themeInfo - The theme info for this widget

applyThemeRadialPopupMenu

protected void applyThemeRadialPopupMenu(ThemeInfo themeInfo)

layout

protected void layout()
Description copied from class: Widget
Called when the layoutInvalid flag is set. The default implementation does nothing.

Overrides:
layout in class Container

layoutRadial

protected void layoutRadial()

setAllButtonsPressed

protected void setAllButtonsPressed()

boundDragEventFinished

protected void boundDragEventFinished()