Search in sources :

Example 1 with WindowState

use of org.rstudio.core.client.layout.WindowState in project rstudio by rstudio.

the class AnimationHelper method focusGoesOnTop.

private static boolean focusGoesOnTop(LogicalWindow top, LogicalWindow bottom) {
    // If one window is maximized and the other is minimized, focus the
    // maximized one.
    WindowState topState = top.getState();
    WindowState bottomState = bottom.getState();
    if (topState == WindowState.MAXIMIZE && bottomState == WindowState.MINIMIZE)
        return true;
    else if (topState == WindowState.MINIMIZE && bottomState == WindowState.MAXIMIZE)
        return false;
    if (top.getState() == MAXIMIZE || bottom.getState() == MAXIMIZE || top.getState() == EXCLUSIVE || bottom.getState() == EXCLUSIVE) {
        assert top.getState() == MINIMIZE || bottom.getState() == MINIMIZE || top.getState() == HIDE || bottom.getState() == HIDE;
        // If one of the windows is minimized, focus the other one.
        return top.getState() == MAXIMIZE || top.getState() == EXCLUSIVE;
    }
    assert top.getState() == NORMAL && bottom.getState() == NORMAL;
    assert top.getNormal().isVisible() || bottom.getNormal().isVisible();
    return !top.getNormal().isVisible();
}
Also used : WindowState(org.rstudio.core.client.layout.WindowState)

Example 2 with WindowState

use of org.rstudio.core.client.layout.WindowState in project rstudio by rstudio.

the class DualWindowLayoutPanel method resizePanes.

// resize the panes based on the specified bottom height and return the
// new window state for the top pane (this implements snap to minimize)
private WindowState resizePanes(int bottom) {
    WindowState topState = null;
    int height = layout_.getOffsetHeight();
    // If the height of upper or lower panel is smaller than this
    // then that panel will minimize
    final int MIN_HEIGHT = 60;
    if (bottom < MIN_HEIGHT) {
        topState = WindowState.MAXIMIZE;
        normalHeight_ = snapMinimizeNormalHeight_;
    } else if (bottom >= height - MIN_HEIGHT) {
        topState = WindowState.MINIMIZE;
        normalHeight_ = snapMinimizeNormalHeight_;
    } else {
        topState = WindowState.NORMAL;
        normalHeight_ = new NormalHeight(bottom, height, Window.getClientHeight());
    }
    session_.persistClientState();
    return topState;
}
Also used : WindowState(org.rstudio.core.client.layout.WindowState)

Example 3 with WindowState

use of org.rstudio.core.client.layout.WindowState in project rstudio by rstudio.

the class LogicalWindow method onWindowStateChange.

public void onWindowStateChange(WindowStateChangeEvent event) {
    WindowState newState = event.getNewState();
    if (state_ == EXCLUSIVE && newState == MAXIMIZE)
        newState = NORMAL;
    if (newState == state_)
        newState = NORMAL;
    events_.fireEvent(new WindowStateChangeEvent(newState, event.skipFocusChange()));
}
Also used : WindowState(org.rstudio.core.client.layout.WindowState) WindowStateChangeEvent(org.rstudio.core.client.events.WindowStateChangeEvent)

Aggregations

WindowState (org.rstudio.core.client.layout.WindowState)3 WindowStateChangeEvent (org.rstudio.core.client.events.WindowStateChangeEvent)1