Exemplo n.º 1
0
    /**
     * Pops the top layer.
     */
    public void Pop()
    {
        if (IsEmpty())
        {
            // there are no layers in the stack
            return;
        }

        InputLayer layerToBeRemoved = Top();

        layerToBeRemoved.Deactivate();

        layerStack.RemoveAt(layerStack.Count - 1);
        EnsureModality();

        // QQQ for debugging only
        if (!IsEmpty())
        {
            topLayer = Top();
        }
    }
Exemplo n.º 2
0
    private void EnsureModality()
    {
        bool activateLayer = true;

        for (int i = layerStack.Count - 1; i >= 0; --i)
        {
            // the topmost layer is always activated since we set activateLayer as true
            InputLayer layer = layerStack[i];
            if (activateLayer)
            {
                layer.Activate();
            }
            else
            {
                layer.Deactivate();
            }

            // if the current layer is modal, then the succeeding layers are deactivated
            if (activateLayer && layer.IsModal)
            {
                activateLayer = false;
            }
        }
    }