abstract class AbstractScrollBar extends GenericWidget implements ModelChangeListener
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractScrollBar.Part
Enumerate all possible mouse positions in the widget area.
|
Modifier and Type | Field and Description |
---|---|
protected NativeRectangle |
highLightedRect
If not
null , the bounding rectangle of currently highlighted part,
this rectangle must be invalidated when highlighted part or thumb position changes. |
protected AbstractScrollBar.Part |
lastHoverPart
The part the mouse was last time hovered over.
|
protected int |
lastModelPos
Last pressed mouse model position.
|
protected int |
lastMousePos
Last pressed mouse position along the scrolling direction.
|
protected AbstractScrollBar.Part |
lastPressedPart
The part the mouse was last time pressed in.
|
protected ScrollModel |
model
The scroll model
|
private static int[] |
MOUSE_ACTIONS
Mouse actions this widget is interested
|
config
insets, location, LOG, mousePtr, nativeInsets, physicalLocation
Constructor and Description |
---|
AbstractScrollBar(ScrollModel model)
The (only) constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy this widget.
|
protected abstract void |
doDraw(GuiDriver<?,?> gd,
GuiColorResolver gc)
Draw widget using the prepared driver and color resolver.
|
void |
draw()
Draw widget.
|
Widget<GuiOutputManager> |
findMouseSource(NativePoint p)
Find the widget positioned just below the specified mouse position (in physical units).
|
protected static int |
minLength()
Get the scrollbar minimum length along the scrolling direction.
|
protected static int |
minWidth()
Get the scrollbar minimum height.
|
void |
modelChanged(Model m)
This method is called by the model after it was changed.
|
protected int[] |
mouseActions()
Sub-classes will override this to return a list of mouse actions on which the widget
responds.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Notification of a mouse entered event occurred for this widget.
|
void |
mouseExited(java.awt.event.MouseEvent e)
Notification of a mouse exited event occurred for this widget.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Notification of a mouse moved event occurred for this widget.
|
void |
mouseReleased(java.awt.event.MouseEvent e)
Notification of a mouse released event occurred for this widget.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Notification of a mouse wheel moved event occurred for this widget.
|
protected abstract void |
updateMouseHitInfo(int x,
int y) |
private void |
updatePart(java.awt.event.MouseEvent e)
Repaint parts according to their highlight and pressed status when mouse position changes.
|
afterConfigUpdate, config, height, initialize, setSize, width
dimension, minimumSize
_setHidden, _setVisible, activateDirectManipulation, addFocusListener, addKeyListener, afterConfigUpdateBase, ancestor, ancestorId, autoResize, bounds, clear, clearWidget, clipRectangle, clipRectangle, clipWith, copyColors, copyState, createMouseHoverAction, deactivateDirectManipulation, debug, disable, disableTooltip, displayPhysicalLocation, drawCaret, enable, enableTooltip, enclosingFrame, focusTraversable, forceCursorOnFocus, forceVisibility, getActualBounds, getAndResetBitmap, getAndSetBitmap, getBitmapCopy, getCachedScreenLocation, getCachedScreenPhysicalLocation, getCustomMousePointer, getDefaultEvent, getEffectiveMousePointer, getId, getLoadedMousePointer, getMenuMouse, getMouseActions, getMousePosition, getPortableMouseEventCoordinates, getSelectedText, getState, getTextHeight, getTextHeightNative, getTextHeightNative, getTextWidth, getTextWidth, getTextWidthNative, getTextWidthNative, getVisiblePart, getZOrderClass, hasFocus, hidden, hide, highlighted, ignoreAction, initialHeight, initialWidth, insets, isCurrent, isDirectManipulationActive, isDirectManipulationCapable, isDirectManipulationRequired, isDisplayed, isEnabled, isFocusable, isHeader, isMouseDrag, isRealized, isRepaintDisabled, isRMBEntrySupported, isScreenLocationCached, isTabStop, isThreeD, isTotallyObscured, isVisible, isVisible, location, manageSystemActions, mouseClicked, mouseDragged, mousePressed, moveToBottom, moveToTop, name, navigable, oleDoDrop, oleDrag, oleDragging, oleStartDragging, onOleDragging, onOleDropEnd, parent, parent, parentObject, parentOrSelf, parentOrSelfObject, physicalBounds, physicalDimension, physicalLocation, postprocessConfig, prepParentLocation, preventFocusWhenMouseDownEventDefined, processDirectManipulationEvent, processEvent, processFocusEvent, processKeyEvent, processKeyEventForSelectableWidget, processKeyListeners, processMnemonic, processMnemonicImpl, processSystemKey, raiseLegacyMouseEvents, reflectAncestorChange, reflectLocationChange, refresh, registerWidgetStateListener, repaint, repaint, repaint, requestFocus, requestSync, resetBitmap, resizeTo, resolveFont, resolvePopupMenuId, resolveTitleFont, screen, screenDimension, screenHeight, screenLocation, screenPhysicalLocation, screenWidth, setBitmap, setCachedScreenLocation, setCachedScreenPhysicalLocation, setEnabled, setHidden, setHighlighted, setLocation, setLocation, setMousePointer, setParent, setPhysicalLocation, setState, setVisible, show, showPopupMenu, supportsCustomMousePointer, sync, topLevelWindow, toString, translate, unrealize, unregisterWidgetStateListener, updateSizeWorker, widgetStateChanged, window
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canMovetoTop, defaultMousePtr, enforceDefaultMousePtr, getLegacyWidget, getTriggerWidget, getTriggerWidget, hasFocus, ignoreEnable, isDirectManipulable, isDroppable, isInitialValueLayout, isLegacyFocus, maySwitchFocus, parent, refreshWidget, requestFocus, requestFocus, systemFocusGrabbed, validateDisplayValue
protected NativeRectangle highLightedRect
null
, the bounding rectangle of currently highlighted part,
this rectangle must be invalidated when highlighted part or thumb position changes.protected AbstractScrollBar.Part lastHoverPart
protected int lastModelPos
protected int lastMousePos
protected AbstractScrollBar.Part lastPressedPart
protected ScrollModel model
private static final int[] MOUSE_ACTIONS
public AbstractScrollBar(ScrollModel model)
protected static final int minLength()
protected static final int minWidth()
public void destroy()
destroy
in interface Widget<GuiOutputManager>
destroy
in class AbstractWidget<GuiOutputManager>
public void draw()
draw
in interface Widget<GuiOutputManager>
draw
in class AbstractWidget<GuiOutputManager>
public Widget<GuiOutputManager> findMouseSource(NativePoint p)
this
.findMouseSource
in interface Widget<GuiOutputManager>
findMouseSource
in class AbstractWidget<GuiOutputManager>
p
- The mouse physical location.null
if none found.public void modelChanged(Model m)
modelChanged
in interface ModelChangeListener
m
- the model that was changedpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
mouseEntered
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
mouseExited
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
mouseWheelMoved
in class AbstractWidget<GuiOutputManager>
e
- The mouse event.protected abstract void doDraw(GuiDriver<?,?> gd, GuiColorResolver gc)
gd
- the drivergc
- the color resolver.protected int[] mouseActions()
AbstractWidget
MouseEvent
codes and P2J specific
MouseEvt
actions.
If null
, it means the widget does not respond to mouse events.
mouseActions
in class AbstractWidget<GuiOutputManager>
protected abstract void updateMouseHitInfo(int x, int y)
private void updatePart(java.awt.event.MouseEvent e)
e
- the mouse event with the mouse position.