MechListBox::~MechListBox()
{
	removeAllItems( true );

	delete MechListBoxItem::s_templateItem;
	MechListBoxItem::s_templateItem = NULL;
}
void ComponentIconListBox::setType( int newType, int otherNewType, int orThis )
{
	if ( newType == type && itemCount )
		return;

	type = newType;
	scrollBar->setGreen();

	
	removeAllItems( 0 );

	itemSelected = -1;

	
	if ( !masterComponentList.Count() )
	{
		int count = 256;
		LogisticsComponent* pComp[256];
		LogisticsData::instance->getAllComponents( pComp, count );
		//for ( int j = 0; j < 2048; j++ )
		//{
			for ( int i = 0; i < count; i++ )
			{
				ComponentListItem* pItem = new ComponentListItem( pComp[i] );
				masterComponentList.Append( pItem );	
			}			
	

	//	for ( EList< ComponentListItem*, ComponentListItem* >::EIterator iter = masterComponentList.Begin();
	//	!iter.IsDone(); iter++ )
	//	{
	///		delete *iter;
	//		turn++;
	//	}

	//	masterComponentList.Clear();
	//	}
	}

	for ( EList< ComponentListItem*, ComponentListItem* >::EIterator iter = masterComponentList.Begin();
		!iter.IsDone(); iter++ )
		{
			if ( (*iter)->getComponent()->isAvailable() )
			{
				if ( (*iter)->getComponent()->getType() == type || 
					(*iter)->getComponent()->getType() == otherNewType ||
					 (*iter)->getComponent()->getType() == orThis )
				{
					if ( (*iter)->globalX() > globalX() )
					{
						(*iter)->move( -globalX(), 0 );
					}
					addSortedItem( (*iter) );
				}
			}
		}

	selectFirstAvailableComponent();

}
Beispiel #3
0
void MSCheckPopupMenu::updateData(void)
{
  if (MSView::model()!=0)
   {
     freeze();
     const MSStringVector& aStringVector=stringVector();
     unsigned currentCount(itemCount());
     unsigned i;
     MSWidgetVector itemVector(children());
     MSCheckMenuItem *pMenuItem;
     for (i=0;i<aStringVector.length();i++)
      {
	if (i<itemVector.length())
	 {
           pMenuItem=(MSCheckMenuItem *)itemVector(i);
	   pMenuItem->label(aStringVector(i));
	   pMenuItem->state(MSFalse);
	 }
	else 
	  {
	    pMenuItem=new MSCheckMenuItem(this,aStringVector(i),0,i);
	    pMenuItem->selectColor(_selectColor);
	  }
	setItem(pMenuItem,i);
      }
     for (i=aStringVector.length();i<itemVector.length();i++)
      {
	pMenuItem=(MSCheckMenuItem *)itemVector(i);
	delete pMenuItem;
      }
     unfreeze();
     computeSize();
   }
  else removeAllItems();
}
void ContactListProxyModel::setSortStatus(bool sort)
{
    if(sort!=m_sort_status)
    {
        m_sort_status=sort;
        removeAllItems();
    }
}
void ContactListProxyModel::setShowSeparator(bool show)
{
    if(show!=m_show_separator)
    {
        m_show_separator=show;
        removeAllItems();
    }
}
void ContactListProxyModel::setShowOffline(bool show)
{
    if(show!=m_show_offline)
    {
        m_show_offline=show;
        removeAllItems();
    }
}
void ContactListProxyModel::setShowEmptyGroup(bool show)
{
    if(show!=m_show_empty_group)
    {
        m_show_empty_group=show;
        removeAllItems();
    }
}
void ContactListProxyModel::setModelType(int type)
{
    type%=4;
    if(type!=m_model_type)
    {
        m_model_type=type;
        removeAllItems();
    }
}
//! Reads attributes of the element
void CGUIContextMenu::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
	IGUIElement::deserializeAttributes(in,options);

	Pos = in->getAttributeAsPosition2d("Position");

	// link to this item's parent
	if (Parent && ( Parent->getType() == EGUIET_CONTEXT_MENU || Parent->getType() == EGUIET_MENU ) )
		((CGUIContextMenu*)Parent)->setSubMenu(in->getAttributeAsInt("ParentItem"),this);

	CloseHandling = (ECONTEXT_MENU_CLOSE)in->getAttributeAsInt("CloseHandling");

	removeAllItems();

	// read the item list
	const s32 count = in->getAttributeAsInt("ItemCount");

	for (s32 i=0; i<count; ++i)
	{
		core::stringc tmp;
		core::stringw txt;
		s32 commandid=-1;
		bool enabled=true;
		bool checked=false;
		bool autochecking=false;

		tmp = "IsSeparator"; tmp += i;
		if ( in->existsAttribute(tmp.c_str()) && in->getAttributeAsBool(tmp.c_str()) )
			addSeparator();
		else
		{
			tmp = "Text"; tmp += i;
			if ( in->existsAttribute(tmp.c_str()) )
				txt = in->getAttributeAsStringW(tmp.c_str());

			tmp = "CommandID"; tmp += i;
			if ( in->existsAttribute(tmp.c_str()) )
				commandid = in->getAttributeAsInt(tmp.c_str());

			tmp = "Enabled"; tmp += i;
			if ( in->existsAttribute(tmp.c_str()) )
				enabled = in->getAttributeAsBool(tmp.c_str());

			tmp = "Checked"; tmp += i;
			if ( in->existsAttribute(tmp.c_str()) )
				checked = in->getAttributeAsBool(tmp.c_str());

 			tmp = "AutoChecking"; tmp += i;
			if ( in->existsAttribute(tmp.c_str()) )
				autochecking = in->getAttributeAsBool(tmp.c_str());

 			addItem(core::stringw(txt.c_str()).c_str(), commandid, enabled, false, checked, autochecking);
		}
	}

	recalculateSize();
}
cOrderProcesser::cOrderProcesser(cPlayer *thePlayer) {
	assert(thePlayer);
	player = thePlayer;
	orderPlaced = false;
	frigateSent = false;
	secondsUntilArrival = -1;
	secondsUntilNewPricesWillBeCalculated = getRandomizedSecondsToWait();
	memset(pricePaidForItem, -1, sizeof(pricePaidForItem));
	removeAllItems();
	updatePricesForStarport();
	unitIdOfFrigateSent = -1;
	cellCalculator = new cCellCalculator(&map);
}
Beispiel #11
0
void aListBox::destroy()
{
	if (scrollBar)
	{
		scrollBar->destroy();
		delete scrollBar;
		scrollBar = NULL;
	}

	removeAllItems( true );
	
	aObject::destroy();
}
void ComponentListBox::setVehicle( LogisticsVehicle* pVeh )
{
	removeAllItems( true );

	if ( pVeh )
	{
		LogisticsComponent* components[256];
		long componentCount = 256;

		pVeh->getComponents( componentCount, components );

		setComponents( componentCount, components );	

	}
}
void JourGraphicScene::mise_a_jour()
{

    removeAllItems();
    dessinerFond();
    Agenda& ag = Agenda::getInstance();
    int i = 0;
    //reconstruction entiere de la scene
    for(Agenda::iterator it = ag.begin() ; it != ag.end() ; ++it)
    {
        QColor fond;
        if((*it).isProgrammationPartieTache())
            fond = QColor("orange") ;
        else if((*it).isRdv())
            fond = QColor("yellow");
        else if((*it).isProgrammationTache())
            fond = QColor("green");
        else if((*it).isEvenement1j())
            fond = QColor("red") ;
        else if((*it).isEvenementPj())
            fond = QColor("blue") ;

        if(!(*it).isEvenementPj() && (*it).getDate() == date)
        { //ajout d'un evenement sur 1 jour
            ajouterEvenement((*it).getSujet(),(*it).getHoraire(),(*it).getDuree(),&(*it),fond);

        }else if((*it).isEvenementPj())
        { // ajout d'un evnement sur plusieurs jours
            EvenementPj *evt = dynamic_cast<EvenementPj*>(&(*it));
            QDate deb = evt->getDate(), fin = evt->getDateFin();
            if(date == deb)
            {
                int nb_mins = evt->getHoraire().secsTo(QTime(22,0)) / 60;
                ajouterEvenement(evt->getSujet(),evt->getHoraire(),Duree(nb_mins),evt,fond);
            }else if(date<fin && date>deb)
            {
                ajouterEvenement(evt->getSujet(),QTime(6,0),Duree(960),evt,fond);
            }else if(date == fin)
            {
                int nb_mins = QTime(6,0).secsTo(evt->getHoraireFin()) / 60;
                ajouterEvenement(evt->getSujet(),QTime(6,0),Duree(nb_mins),evt,fond);
            }
        }
    }
}
cBuildingList::~cBuildingList() {
	TIMER_progress = 0;
	lastClickedId = 0;
	buttonIconIdPressed = 0; // the button to draw at the left of the list
	buttonIconIdUnpressed = 0;
	buttonDrawX = 0;
	buttonDrawY = 0;
	scrollingOffset = 0; // the offset for scrolling through the list.
	available = false; // is this list available?
	removeAllItems();
	for (int i = 0; i < MAX_ITEMS; i++) {
		items[i] = NULL;
	}
	upgradeLevel = 0;
	upgrading = false;
	maxItems = 0;
	acceptsOrders = false;
}
Beispiel #15
0
void XFE_ReadAttachPanel::removeAllAttachments()
{
    removeAllItems();

    if (_pane && _attachments) {
        MSG_FreeAttachmentList(_pane, _attachments);
        _attachments=NULL;
    }

    // pop down attachment properties dialog, if it's managed
    if (_propertiesDialog)
        XtUnmanageChild(_propertiesDialog);

    // unlock frame, just in case this call caused an in-progress
    // drag to cancel without exiting fe_SaveSynchronousURL()
    if (_attachDrag)
        _attachDrag->unlockFrame();
}
Beispiel #16
0
void MSOptionPopupMenu::rebuildMenu(void)
{
  removeAllItems();
  if (MSView::model()!=0)
   {
     unsigned n=optionsModel().length();
     if (n>0)
      {
	for (unsigned i=0;i<n;i++)
	 {
	   MSMenuItem *pMenuItem=new MSMenuItem(this,optionsModel()(i),0,i);
	   setItem(pMenuItem,i);
	 }
      }
   }
  computeSize();
  optionMenu()->setSelectedItem(0);
  optionMenu()->computeSize();
}
void ContactListProxyModel::setSettings(int type, bool show_offline, bool show_empty, bool sort_status, bool show_separator, const QVariant & account_font, const QVariant & group_font, const QVariant & online_font, const QVariant & offline_font, const QVariant & separator_font, const QVariant & account_color, const QVariant & group_color, const QVariant & online_color, const QVariant & offline_color, const QVariant & separator_color)
{
    m_model_type = type%4;
    m_show_offline = show_offline;
    m_show_empty_group = show_empty;
    m_sort_status = sort_status;
    m_show_separator = show_separator;
    m_account_font = account_font;
    m_group_font = group_font;
    m_online_font = online_font;
    m_offline_font = offline_font;
    m_separator_font = separator_font;
    m_account_color = account_color;
    m_group_color = group_color;
    m_online_color = online_color;
    m_offline_color = offline_color;
    m_separator_color = separator_color;
    removeAllItems();
}
Beispiel #18
0
void MontageView::initActions()
{
  m_remove_action     = new QAction( tr("Remove item from calibration list"), 
				     tr("Remove"), CTRL+Key_R, this );
  m_remove_all_action = new QAction( tr("Remove all images from calibration list"), 
				     tr("Remove All "), CTRL+SHIFT+Key_R, this );
  m_open_action       = new QAction( tr("Open this image"), 
				     tr("Open"), CTRL+Key_O, this );
  
  connect( m_remove_action,     SIGNAL( activated() ), this, SLOT( removeItem()     ));
  connect( m_remove_all_action, SIGNAL( activated() ), this, SLOT( removeAllItems() ));
  connect( m_open_action,       SIGNAL( activated() ), this, SLOT( openItem()       ));

  m_remove_action    ->addTo( &m_item_menu );
  m_remove_all_action->addTo( &m_item_menu );
  m_open_action      ->addTo( &m_item_menu );

  m_remove_all_action->setEnabled(true);
  m_remove_action    ->setEnabled(false);
  m_open_action      ->setEnabled(false);
}
void ComponentListBox::setMech( LogisticsVariant* pMech )
{
	removeAllItems( true );

	if ( pMech )
	{
		LogisticsComponent* components[256];
		long componentCount = 256;

		pMech->getComponents( componentCount, components );

		setComponents( componentCount, components );
		
		int sensor = pMech->getSensorID();
		int ECM = pMech->getECM();

		if ( sensor > 0 )
		{
			aTextListItem* textItem = new aTextListItem( IDS_SALVAGE_AREA_COMPONENTS );
			textItem->setText( 32000 + sensor );
			textItem->setColor( 0xffc29b00 );
			textItem->setHelpID( IDS_HELP_COMP0 + sensor );
			AddItem( textItem );			
		}

		if ( ECM > 0 )
		{
			aTextListItem* textItem = new aTextListItem( IDS_SALVAGE_AREA_COMPONENTS );
			textItem->setText( 32000 + ECM );
			textItem->setColor( 0xffc29b00 );
			textItem->setHelpID( IDS_HELP_COMP0 + ECM );
			AddItem( textItem );
		}

	}
}
Beispiel #20
0
Layout::~Layout()
{
	removeAllItems(true);
}
cOrderProcesser::~cOrderProcesser() {
	removeAllItems();
	player = NULL;
	delete cellCalculator;
	cellCalculator = NULL;
}
void cOrderProcesser::setOrderHasBeenProcessed() {
	orderPlaced = false;
	frigateSent = false;
	removeAllItems();
	unitIdOfFrigateSent = -1;
}
bool ContactListProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
    if (action == Qt::IgnoreAction)
        return true;
    if (!data->hasFormat("application/qutim.item"))
        return false;
    if (column > 0)
        return false;
    QByteArray encoded_data = data->data("application/qutim.item");
    QDataStream stream(&encoded_data, QIODevice::ReadOnly);
    quint64 item_row,item_column;
    qint64 item_id;
    stream >> item_row >> item_column >> item_id;
    QModelIndex index = createIndex((int)item_row,(int)item_column,(quint32)item_id);
    if(!index.isValid())
        return false;
    int type = index.data(Qt::UserRole).toInt();
    int parent_type = parent.data(Qt::UserRole).toInt();
    switch(m_model_type)
    {
    case 0:
        switch(type)
        {
        case 0:
            if(parent_type==1) {
                TreeModelItem old_item = static_cast<TreeItem*>(getItem(index)->getSourceIndex().internalPointer())->getStructure();
                TreeModelItem new_item = old_item;
                new_item.m_account_name = static_cast<TreeItem*>(getItem(parent)->getSourceIndex().internalPointer())->getStructure().m_account_name;
                if(new_item.m_account_name!=old_item.m_account_name)
                    return false;
                new_item.m_parent_name = static_cast<TreeItem*>(getItem(parent)->getSourceIndex().internalPointer())->getStructure().m_item_name;
                if(new_item.m_parent_name==old_item.m_parent_name)
                    return false;
                PluginSystem::instance().moveItemSignalFromCL(old_item, new_item);
                return false;
            }
        case 1:
            if(parent_type==2) {
                if(parent!=index.parent())
                    return false;
                TreeItem *group = static_cast<TreeItem*>(getItem(index)->getSourceIndex().internalPointer());
                group->parent()->moveChild(group->getStructure().m_item_name,row);
                m_tree_view->setUpdatesEnabled(false);
                removeAllItems();
                m_tree_view->setUpdatesEnabled(true);
                return false;
            }
            return false;
        default:
            return false;
        }
    case 1:
        switch(type)
        {
        case 0:
            return false;
        case 1:
            if(parent==index.parent())
            {
                moveChild(getItem(index)->getName(),row);
                m_tree_view->setUpdatesEnabled(false);
                removeAllItems();
                m_tree_view->setUpdatesEnabled(true);
            }
            return false;
        }
        return false;
    default:
        return false;
    }
}