public void mouseDown(MouseEvent e) { if (e.button == 1) { mMouseIsDown = true; mMouseDownLoc = new Point(e.x, e.y); mShellSizeBeforeResize = mShell.getSize(); sideCurrentlyResizing = getResizeSide(e.x, e.y); } if (isInside(e.x, e.y, mToolbar.getBounds())) { if (mToolbar.mouseDown(e)) redrawToolbar(); } if (isInside(e.x, e.y, mArrowButtonBounds)) { // if we click a selected button, deselect and switch to hover if (mArrowButtonState == AbstractButtonPaintManager.STATE_SELECTED) { mArrowButtonState = AbstractButtonPaintManager.STATE_HOVER; redrawArrowButton(); } else { // click mArrowButtonState = AbstractButtonPaintManager.STATE_SELECTED; redrawArrowButton(); arrowButtonClicked(); } } else { // reset state if clicked elsewhere if (mArrowButtonState != AbstractButtonPaintManager.STATE_NONE) { mArrowButtonState = AbstractButtonPaintManager.STATE_NONE; redrawArrowButton(); } } }
public void mouseMove(MouseEvent e) { Cursor cur = mShell.getCursor(); if (isInside(e.x, e.y, mToolbar.getBounds())) { if (mToolbar.mouseMove(e)) redrawToolbar(); } else { if (mToolbar.dehover()) redrawToolbar(); } if (mArrowButtonBounds != null) { if (mArrowButtonState != AbstractButtonPaintManager.STATE_SELECTED) { if (isInside(e.x, e.y, mArrowButtonBounds)) { if (mArrowButtonState == AbstractButtonPaintManager.STATE_NONE) { mArrowButtonState = AbstractButtonPaintManager.STATE_HOVER; redrawArrowButton(); } } else { if (mArrowButtonState != AbstractButtonPaintManager.STATE_NONE) { mArrowButtonState = AbstractButtonPaintManager.STATE_NONE; redrawArrowButton(); } } } } if (getMaximized()) { if (cur != null) mShell.setCursor(null); return; } if (!mShellMaximized) { int side = getResizeSide(e.x, e.y); doResize(side, e); } }
public void mouseUp(MouseEvent e) { mMouseIsDown = false; mMouseDownLoc = null; sideCurrentlyResizing = SIDE_NONE; if (isInside(e.x, e.y, mToolbar.getBounds())) { if (mToolbar.mouseUp(e)) redrawToolbar(); } else { // update side resize cursor doResize(getResizeSide(e.x, e.y), e); // don't let the shell disappear due to extremely small size Point size = mShell.getSize(); if (size.x < 40 || size.y < 40) { if (size.x < 40) size.x = 40; if (size.y < 40) size.y = 40; mShell.setSize(size.x, size.y); } } }
private void redrawToolbar() { mToolbar.redraw(); }
// internal List<RibbonButton> getToolbarButtons() { return mToolbar.getButtons(); }