Exemple #1
0
void InternalWindow::mouseDragged(MouseEventDetails* const e)
{
    if(getMenuBar() != NULL)
    {
        bool isContained;
        isContained = getMenuBar()->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
        if(isContained)
        {
            getMenuBar()->mouseDragged(e);
            Component::mouseDragged(e);
            return;
        }
    }
    if(getTitlebar() != NULL)
    {
        bool isContained;
        isContained = getTitlebar()->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
        if(isContained)
        {
            getTitlebar()->mouseDragged(e);
            Component::mouseDragged(e);
            return;
        }
    }
    if(!getLockInput())
    {
        ComponentContainer::mouseDragged(e);
    }
}
Exemple #2
0
void InternalWindow::mouseWheelMoved(MouseWheelEventDetails* const e)
{
    if(!getLockInput())
    {
        ComponentContainer::mouseWheelMoved(e);
    }
}
void InternalWindow::mouseWheelMoved(const MouseWheelEventUnrecPtr e)
{
    if(!getLockInput())
    {
        ComponentContainer::mouseWheelMoved(e);
    }
}
void InternalWindow::keyPressed(const KeyEventUnrecPtr e)
{
    if(!getLockInput())
    {
        //Check for Accelerator Keys
        UInt32 RelevantModifiers = (e->getModifiers() & KeyEvent::KEY_MODIFIER_ALT) |
            (e->getModifiers() & KeyEvent::KEY_MODIFIER_CONTROL) |
            (e->getModifiers() & KeyEvent::KEY_MODIFIER_SHIFT) |
            (e->getModifiers() & KeyEvent::KEY_MODIFIER_META);
        KeyAcceleratorMapItor MapItor = _KeyAcceleratorMap.find(KeyEvent::getHashable(e->getKey(), RelevantModifiers));
        if(MapItor != _KeyAcceleratorMap.end())
        {
            (*MapItor).second->acceleratorTyped(KeyAcceleratorEvent::create(InternalWindowRefPtr(this), e->getTimeStamp(), e->getKey(), e->getModifiers()));
        }
        //Send Key event to Component that has Focus
        //If there is not Focused Component then do nothing
        if(getFocusedComponent() != NULL &&
           getFocusedComponent() != this)
        {
            getFocusedComponent()->keyPressed(e);
            ComponentContainerRefPtr ParentContainer(getFocusedComponent()->getParentContainer());
            while(ParentContainer != NULL &&
                  ParentContainer != this)
            {
                ParentContainer->keyPressed(e);
                ParentContainer = dynamic_cast<ComponentContainer*>(ParentContainer->getParentContainer());
            }
        }
        Component::keyPressed(e);
    }
}
void InternalWindow::mouseEntered(const MouseEventUnrecPtr e)
{
    if(getMenuBar() != NULL)
    {
        bool isContained;
        isContained = getMenuBar()->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
    }
    if(getTitlebar() != NULL)
    {
        bool isContained;
        isContained = getTitlebar()->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
    }
    if(!getLockInput())
    {
        ComponentContainer::mouseEntered(e);
    }
}
void InternalWindow::keyTyped(const KeyEventUnrecPtr e)
{
    if(!getLockInput())
    {
        //Send Key event to Component that has Focus
        //If there is not Focused Component then do nothing
        if(getFocusedComponent() != NULL &&
           getFocusedComponent() != ComponentRefPtr(this))
        {
            getFocusedComponent()->keyTyped(e);
            ComponentContainerRefPtr ParentContainer(getFocusedComponent()->getParentContainer());
            while(ParentContainer != NULL &&
                  ParentContainer != ComponentContainerRefPtr(this))
            {
                ParentContainer->keyTyped(e);
                ParentContainer = dynamic_cast<ComponentContainer*>(ParentContainer->getParentContainer());
            }
        }
        Component::keyTyped(e);
    }
}
Exemple #7
0
UInt32 InternalWindow::queryCursor(const Pnt2f& CursorLoc) const
{
    if(!getLockInput() && getResizable())
    {
        //Check if the Mouse is whithin the resize border width
        WindowArea TheArea(getCursurArea(CursorLoc));
        switch(TheArea)
        {
            case WINDOW_LEFT_BORDER:
            case WINDOW_RIGHT_BORDER:
                return WindowEventProducer::CURSOR_RESIZE_W_TO_E;
                break;

            case WINDOW_TOP_BORDER:
            case WINDOW_BOTTOM_BORDER:
                return WindowEventProducer::CURSOR_RESIZE_N_TO_S;
                break;

            case WINDOW_TOP_LEFT_BORDER:
            case WINDOW_BOTTOM_RIGHT_BORDER:
                return WindowEventProducer::CURSOR_RESIZE_NW_TO_SE;
                break;

            case WINDOW_TOP_RIGHT_BORDER:
            case WINDOW_BOTTOM_LEFT_BORDER:
                return WindowEventProducer::CURSOR_RESIZE_SW_TO_NE;
                break;

            case WINDOW_OUTSIDE:
            case WINDOW_MAIN_PANEL:
            case WINDOW_TITLE_BAR:
                return WindowEventProducer::CURSOR_POINTER;
                break;
        }
    }

    return Inherited::queryCursor(CursorLoc);
}
Exemple #8
0
void InternalWindow::mouseExited(MouseEventDetails* const e)
{
    if(getMenuBar() != NULL)
    {
        bool isContained;
        isContained = getMenuBar()->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
    }
    if(getTitlebar() != NULL)
    {
        bool isContained;
        isContained = getTitlebar()->isContained(e->getLocation(), true);
        checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
    }
    if(!getLockInput())
    {
        if(getParentDrawingSurface() != NULL && getParentDrawingSurface()->getEventProducer() != NULL)
        {
            getParentDrawingSurface()->getEventProducer()->setCursorType(WindowEventProducer::CURSOR_POINTER);
        }
        ComponentContainer::mouseExited(e);
    }
}
Exemple #9
0
void InternalWindow::keyTyped(KeyEventDetails* const e)
{
    if(!getLockInput())
    {
        //Send Key event to Component that has Focus
        //If there is not Focused Component then do nothing
        if(getFocusedComponent() != NULL &&
           getFocusedComponent() != this)
        {
            getFocusedComponent()->keyTyped(e);
            if(e->isConsumed()) return;
            ComponentContainerRefPtr ParentContainer(getFocusedComponent()->getParentContainer());
            while(ParentContainer != NULL &&
                  ParentContainer != this)
            {
                ParentContainer->keyTyped(e);
                if(e->isConsumed()) return;
                ParentContainer = dynamic_cast<ComponentContainer*>(ParentContainer->getParentContainer());
            }
        }
        Component::keyTyped(e);
    }
}
Exemple #10
0
void InternalWindow::mousePressed(MouseEventDetails* const e)
{

    if(!getLockInput())
    {

        //Check if the Mouse is whithin the resize border width
        if(getResizable())
        {
            WindowArea TheArea(getCursurArea(e->getLocation()));
            switch(TheArea)
            {
                case WINDOW_LEFT_BORDER:
                case WINDOW_RIGHT_BORDER:
                case WINDOW_TOP_BORDER:
                case WINDOW_BOTTOM_BORDER:
                case WINDOW_TOP_LEFT_BORDER:
                case WINDOW_BOTTOM_RIGHT_BORDER:
                case WINDOW_TOP_RIGHT_BORDER:
                case WINDOW_BOTTOM_LEFT_BORDER:
                    setLockInput(true);

                    _WindowStartPosition = getPosition();
                    _WindowStartSize = getSize();
                    _MouseStartPosition = e->getLocation();
                    _BorderDragged = TheArea;
    
                    _BorderDragMouseDraggedConnection = getParentDrawingSurface()->getEventProducer()->connectMouseDragged(boost::bind(&InternalWindow::borderDragMouseDragged, this, _1));
                    _BorderDragMouseReleasedConnection = getParentDrawingSurface()->getEventProducer()->connectMouseReleased(boost::bind(&InternalWindow::borderDragMouseReleased, this, _1));
                    _BorderDragKeyPressedConnection = getParentDrawingSurface()->getEventProducer()->connectKeyPressed(boost::bind(&InternalWindow::borderDragKeyPressed, this, _1));
                    break;
            }
        }
        if(getMenuBar() != NULL)
        {
            bool isContained;
            isContained = getMenuBar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
            if(isContained)
            {
                getMenuBar()->mousePressed(e);
                if(e->isConsumed()) return;
                Component::mousePressed(e);
                return;
            }
        }
        if(getTitlebar() != NULL)
        {
            bool isContained;
            isContained = getTitlebar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
            if(isContained)
            {
                getTitlebar()->mousePressed(e);
                if(e->isConsumed()) return;
                Component::mousePressed(e);
                return;
            }
        }

        //ComponentContainer MousePressed Handling
        bool isContained(false);
        for(Int32 i(getMFChildren()->size()-1) ; i>=0 ; --i)
        {
            isContained = getChildren(i)->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getChildren(i),isContained,e->getViewport());
            if(isContained)
            {
                takeFocus();
                if(!getChildren(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
                {
                    getChildren(i)->takeFocus();
                }
                getChildren(i)->mousePressed(e);
                if(e->isConsumed()) return;
                break;
            }
        }
        Component::mousePressed(e);
    }
}
void InternalWindow::mousePressed(const MouseEventUnrecPtr e)
{

    if(!getLockInput())
    {

        //Check if the Mouse is whithin the resize border width
        if(getResizable())
        {
            WindowArea TheArea(getCursurArea(e->getLocation()));
            switch(TheArea)
            {
                case WINDOW_LEFT_BORDER:
                case WINDOW_RIGHT_BORDER:
                case WINDOW_TOP_BORDER:
                case WINDOW_BOTTOM_BORDER:
                case WINDOW_TOP_LEFT_BORDER:
                case WINDOW_BOTTOM_RIGHT_BORDER:
                case WINDOW_TOP_RIGHT_BORDER:
                case WINDOW_BOTTOM_LEFT_BORDER:
                    setLockInput(true);

                    _BorderDraggedListener.setWindowStartPosition(getPosition());
                    _BorderDraggedListener.setWindowStartSize(getSize());
                    _BorderDraggedListener.setMouseStartPosition(e->getLocation());
                    _BorderDraggedListener.setBorderDragged(TheArea);

                    getDrawingSurface()->getEventProducer()->addMouseMotionListener(&_BorderDraggedListener);
                    getDrawingSurface()->getEventProducer()->addMouseListener(&_BorderDraggedListener);
                    getDrawingSurface()->getEventProducer()->addKeyListener(&_BorderDraggedListener);
                    break;
            }
        }
        if(getMenuBar() != NULL)
        {
            bool isContained;
            isContained = getMenuBar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getMenuBar(),isContained,e->getViewport());
            if(isContained)
            {
                getMenuBar()->mousePressed(e);
                Component::mousePressed(e);
                return;
            }
        }
        if(getTitlebar() != NULL)
        {
            bool isContained;
            isContained = getTitlebar()->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getTitlebar(),isContained,e->getViewport());
            if(isContained)
            {
                getTitlebar()->mousePressed(e);
                Component::mousePressed(e);
                return;
            }
        }

        //ComponentContainer MousePressed Handling
        bool isContained(false);
        for(Int32 i(getMFChildren()->size()-1) ; i>=0 ; --i)
        {
            isContained = getChildren(i)->isContained(e->getLocation(), true);
            checkMouseEnterExit(e,e->getLocation(),getChildren(i),isContained,e->getViewport());
            if(isContained)
            {
                takeFocus();
                if(!getChildren(i)->getType().isDerivedFrom(ComponentContainer::getClassType()))
                {
                    getChildren(i)->takeFocus();
                }
                getChildren(i)->mousePressed(e);
                break;
            }
        }
        Component::mousePressed(e);
    }
}