Ejemplo n.º 1
0
void TabPanel::setSelectedIndex(const Int32& Index)
{
    if(getSelectionModel() != NULL)
    {
        getSelectionModel()->setSelectedIndex(Index);
    }
}
Ejemplo n.º 2
0
void PopupMenu::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if(whichField & VisibleFieldMask)
    {
        if(getVisible())
        {
            producePopupMenuWillBecomeVisible(PopupMenuEvent::create(PopupMenuRefPtr(this), getSystemTime()));
        }
        else
        {
            producePopupMenuWillBecomeInvisible(PopupMenuEvent::create(PopupMenuRefPtr(this), getSystemTime()));
            if(getSelectionModel() != NULL)
            {
                getSelectionModel()->clearSelection();
            }
            removeMousePresenceOnComponents();
        }
    }

    if(whichField & SizeFieldMask)
    {
        updateSeparatorSizes();
    }

    if(whichField & SelectionModelFieldMask && getSelectionModel() != NULL)
    {
        getSelectionModel()->addSelectionListener(&_MenuSelectionListener);
    }
}
Ejemplo n.º 3
0
void PopupMenu::clearSelection(void)
{
    if(getSelectionModel() != NULL)
    {
        getSelectionModel()->clearSelection();
    }
}
Ejemplo n.º 4
0
void TabPanel::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if( (whichField & TabsFieldMask) || (whichField & TabContentsFieldMask))
    {
		updateLayout();
	}

    if(whichField & TabsFieldMask)
    {
        updateTabFocusConnections();
    }

    if(whichField & TabPanel::SelectionModelFieldMask)
    {
        _TabSelectionChangedConnection.disconnect();
        if(getSelectionModel() != NULL)
        {
            _TabSelectionChangedConnection = getSelectionModel()->connectSelectionChanged(boost::bind(&TabPanel::handleTabSelectionChanged, this, _1));
        }
    }
}
Ejemplo n.º 5
0
Int32 TabPanel::getSelectedIndex(void) const
{
    if(getSelectionModel() != NULL)
    {
        return getSelectionModel()->getSelectedIndex();
    }
    else
    {
        return -1;
    }
}
Ejemplo n.º 6
0
void PopupMenu::setSelection(const Int32& Index)
{
	if(Index >= 0 && Index < getNumItems())
	{
        if(getSelectionModel() != NULL)
        {
		    getSelectionModel()->setSelectedIndex(Index);
        }
	}
	else
	{
		clearSelection();
	}
}
Ejemplo n.º 7
0
void PopupMenu::mouseDragged(const MouseEventUnrecPtr e)
{
    UInt32 i(0);
    while (i<getMFChildren()->size() && !getChildren(i)->isContained(e->getLocation(), true))
    {
        ++i;
    }
	
	if(i<getMFChildren()->size() && getSelectionModel()->getSelectedIndex() != i)
	{
		getSelectionModel()->setSelectedIndex(i);
	}
    ComponentContainer::mouseDragged(e);
}
Ejemplo n.º 8
0
void DefaultTableColumnModel::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    if(whichField & SelectionModelFieldMask)
    {
        _SelectionChangedConnection.disconnect();
        if(getSelectionModel() != NULL)
        {
            _SelectionChangedConnection = getSelectionModel()->connectSelectionChanged(boost::bind(&DefaultTableColumnModel::handleSelectionChanged, this, _1));
        }
    }
}
Ejemplo n.º 9
0
void MenuBar::handleMenuArmedPopupMenuCanceled(PopupMenuEventDetails* const e)
{
    _MouseMovedConnection.disconnect();
    _MouseDraggedConnection.disconnect();
    
    getSelectionModel()->clearSelection();
}
UInt32 DefaultTableColumnModel::getSelectedColumnCount(void) const
{
    if(_ColumnSelectionAllowed && getSelectionModel() != NULL)
    {
        UInt32 SelectedCount(0);
        for(UInt32 i(0) ; i<getMFInternalColumns()->size() ; ++i)
        {
            if(getSelectionModel()->isSelectedIndex(i))
            {
                ++SelectedCount;
            }
        }
        return SelectedCount;
    }
    else
    {
        return 0;
    }
}
void DefaultTableColumnModel::changed(ConstFieldMaskArg whichField, 
                            UInt32            origin,
                            BitVector         details)
{
    Inherited::changed(whichField, origin, details);

    //Do not respond to changes that have a Sync origin
    if(origin & ChangedOrigin::Sync)
    {
        return;
    }

    if(whichField & SelectionModelFieldMask)
    {
        _SelectionChangedConnection.disconnect();
        if(getSelectionModel() != NULL)
        {
            _SelectionChangedConnection = getSelectionModel()->connectSelectionChanged(boost::bind(&DefaultTableColumnModel::handleSelectionChanged, this, _1));
        }
    }
}
Ejemplo n.º 12
0
void MenuBar::handleMenuArmedMouseDragged(MouseEventDetails* const e)
{
    UInt32 i(0);
    while (i<getMFChildren()->size())
    {
        if(getChildren(i)->isContained(e->getLocation(), true))
        {
            getSelectionModel()->setSelectedIndex(i);
            break;
        }
        ++i;
    }
}
Ejemplo n.º 13
0
void MenuBar::mousePressed(MouseEventDetails* const e)
{
    UInt32 i(0);
    while (i<getMFChildren()->size())
    {
        if(getChildren(i)->isContained(e->getLocation(), true))
        {
            getSelectionModel()->setSelectedIndex(i);
            _MouseMovedConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectMouseMoved(boost::bind(&MenuBar::handleMenuArmedMouseMoved, this, _1));
            _MouseDraggedConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectMouseDragged(boost::bind(&MenuBar::handleMenuArmedMouseDragged, this, _1));
            break;
        }
        ++i;
    }
    ComponentContainer::mousePressed(e);
}
std::vector<UInt32> DefaultTableColumnModel::getSelectedColumns(void) const
{
    if(_ColumnSelectionAllowed)
    {
        std::vector<UInt32> SelectedVector;
        for(UInt32 i(0) ; i<getMFInternalColumns()->size() ; ++i)
        {
            if(getSelectionModel()->isSelectedIndex(i))
            {
                SelectedVector.push_back(i);
            }
        }
        return SelectedVector;
    }
    else
    {
        return std::vector<UInt32>();
    }
}