Beispiel #1
0
//____ SelectItem() _________________________________________________
void WgMenu::SelectItem(WgMenuItem* pItem)
{
	m_pSelectedItem = 0;

	if(pItem == 0 || !pItem->IsVisible() )
		return;

	switch( pItem->GetType() )
	{
		case ENTRY:
		{
			m_pSelectedItem = pItem;

			WgItemInfo * pInfo = new WgItemInfo[1];
			pInfo->id = pItem->GetId();
											//TODO: Add index (and in the future pObject).

			_queueEvent( new WgItemsSelectEvent(this,1,pInfo));
			_itemSelected();
		}
		break;
		case CHECKBOX:
		{
			WgMenuCheckBox * pCheckBox = (WgMenuCheckBox*) pItem;

			if( pCheckBox->IsChecked() )
			{
				pCheckBox->Uncheck();
				_queueEvent( new WgItemToggleEvent(this,pItem->GetId(),WgObjectPtr(),true));
			}
			else
			{
				pCheckBox->Check();
				_queueEvent( new WgItemToggleEvent(this,pItem->GetId(),WgObjectPtr(),false));
			}

			_itemSelected();
		}
		break;
		case RADIOBUTTON:
			if( m_pSelectedItem )
				_queueEvent( new WgItemToggleEvent(this,m_pSelectedItem->GetId(),WgObjectPtr(),false));
			m_pSelectedItem = pItem;
			((WgMenuRadioButton*)pItem)->Select();
			_queueEvent( new WgItemToggleEvent(this,pItem->GetId(),WgObjectPtr(),true));
			_itemSelected();
		break;

		default:
            break;
	}
}
Beispiel #2
0
QObject * Selecter::itemSelected(Report::ItemInterface * item, QPointF pos, Qt::KeyboardModifiers keys )
{
	m_prevActiveObject = m_activeObject;
    m_activeObject = static_cast<QObject *>(item);
    m_activeObjectPressPos = pos;

    return _itemSelected(item, pos, keys);
}
Beispiel #3
0
QObject * Selecter::itemSelected(QObject * object, QPointF pos, Qt::KeyboardModifiers keys)
{
    m_prevActiveObject = m_activeObject;
    m_activeObject = object;
    m_activeObjectPressPos = pos;

    Report::ItemInterface* item = dynamic_cast<Report::ItemInterface*>( object );

    if (!item)
    {
        free();
        if (m_prevActiveObject != m_activeObject)
            emit activeObjectChanged(m_activeObject, m_prevActiveObject);
        //		emit selectionChanged(items);
        return m_activeObject;
    }

    return _itemSelected(item, pos, keys);
}