コード例 #1
0
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);
    }
}
コード例 #2
0
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);
    }
}
コード例 #3
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);
    }
}
コード例 #4
0
void ComponentTreeModel::valueForPathChanged(TreePath path, const boost::any& newValue)
{
    try
    {
        ComponentWeakPtr NewComponent = boost::any_cast<ComponentWeakPtr>(newValue);
        ComponentWeakPtr OldComponent = boost::any_cast<ComponentWeakPtr>(path.getLastPathComponent());
        if(NewComponent != NULL &&
           OldComponent  != NULL &&
           NewComponent != OldComponent &&
           OldComponent->getParentContainer() != NULL)
        {
            ComponentContainerRefPtr ParentContainer(OldComponent->getParentContainer());
            Int32 ChildIndex(ParentContainer->getChildIndex(OldComponent));
            if(ChildIndex >= 0)
            {
                (*ParentContainer->editMFChildren())[ChildIndex] = NewComponent;
                produceTreeStructureChanged(path.getParentPath(),std::vector<UInt32>(1, ChildIndex),std::vector<boost::any>(1, newValue));
            }
        }
    }
    catch(boost::bad_any_cast &)
    {
    }
}