void
QvisPlotListBox::clickHandler(const QPoint &clickLocation, bool rightClick,
    bool doubleClicked, Qt::KeyboardModifiers modifiers)
{
    QPoint itemClickLocation(clickLocation);
    int action = -1, opId = -1;
    bool bs = signalsBlocked();

    QvisPlotListBoxItem *actionItem = 0;

    // Walk through all of the items, checking if we've clicked in each one.
    for (int i = 0; i < count(); ++i)
    {
        QListWidgetItem *current = item(i);
        QvisPlotListBoxItem *item2 = (QvisPlotListBoxItem *)current;
        int y = visualItemRect(current).y();
        int h = visualItemRect(current).height();
        if (clickLocation.y() >= y && clickLocation.y() < (y + h))
        {
            if(!rightClick &&
               (modifiers & (Qt::ControlModifier | Qt::MetaModifier)) > 0)
            {
                // If we're using Ctrl or Meta + mouse click then switch
                // the item to its reverse selection.
                blockSignals(false);
                current->setSelected(!current->isSelected());
                blockSignals(bs);
            }
            else
            {
                // If the item is not selected, select it.
                blockSignals(false);
                current->setSelected(true);
                blockSignals(bs);

                // Reduce the y location of the click location to be local
                // to the item
                itemClickLocation.setY(clickLocation.y() - y);

                // Handle the click.
                if (action == -1)
                {
                    action = item2->clicked(itemClickLocation, doubleClicked, opId);
                    if(action >= 0 && action <= 7)
                        actionItem = item2;
                }
            }
        }
        else if(rightClick || doubleClicked)
        {
            blockSignals(false);
            current->setSelected(false);
            blockSignals(bs);
        }
    }

    switch(action)
    {
    case 0: // expand clicked
        emit itemExpansionChanged();
        reset();
        break;
    case 1: // subset clicked
         emit activateSubsetWindow();
        break;
    case 2: // plot clicked
         emit activatePlotWindow(opId);
        break;
    case 3: // operator clicked
         emit activateOperatorWindow(opId);
        break;
    case 4: // promote clicked
         emit promoteOperator(opId);
        break;
    case 5: // demote clicked
        emit demoteOperator(opId);
        break;
    case 6: // delete clicked
         emit removeOperator(opId);
        break;
    case 7: // selection clicked
         emit activateSelectionsWindow(actionItem->GetSelectionName());
        break;
    default:
        if(rightClick)
        {
            emit itemSelectionChanged();
        }
        break;
    }
}
void GeneratorObjectImplementation::synchronizedUIStopListen(SceneObject* player, int value) {
	if (!player->isPlayerCreature())
		return;

	removeOperator(cast<CreatureObject*>(player));
}
void HarvesterObjectImplementation::synchronizedUIStopListen(CreatureObject* player, int value) {
	if (!player->isPlayerCreature())
		return;

	removeOperator(player);
}