示例#1
0
void TItemList::RenameItem(LPCSTR fn0, LPCSTR fn1, EItemType type)
{
	if (!OnItemRenameEvent.empty())	OnItemRenameEvent(fn0,fn1,type);
    if (type==TYPE_OBJECT){
        TElTreeItem* item0			= FHelper.FindObject(tvItems,fn0); 	VERIFY(item0);
        ListItem* prop				= (ListItem*)item0->Tag; 			VERIFY(prop);
		prop->SetName				(fn1);
        TElTreeItem* item1			= FHelper.FindObject(tvItems,fn1);
        if (item1) prop->item		= item1;
    }
}
示例#2
0
void __fastcall TfrmEditLightAnim::OnItemFocused(TElTreeItem* item)
{
    if (item&&FHelper.IsObject(item)){
        ListItem* prop 			= (ListItem*)item->Tag; VERIFY(prop);
        AnsiString nm			= prop->Key();
		CLAItem* I  			= LALib.FindItem(nm.c_str());
        SetCurrentItem			(I,prop);
    }else{
        SetCurrentItem			(0,0);
    }
}
示例#3
0
bool ListModel::isNewItemCheckable(ListItem* parent, int row)
{
    if (row > 0) {
        ListItem* previous = parent->child(row - 1);
        if (previous)
            return previous->isCheckable();
    } else
        return parent->isProject() || parent->isMilestone();

    return false;
}
示例#4
0
int &List::getNthElement(int n) {
	if (currentSize >= n + 1 && n >= 0) {
		ListItem* tmp = first;
		for (int i = 0; i < n; i++) {
			tmp = tmp->getNext();
		}
		return tmp->getContent();
	}
	else
		throw std::out_of_range("List index out of range");
}
示例#5
0
void ListBox::CreateItems()
{
    if (format_.fontPointSize() > 16.0)
	format_.setFontPointSize(16.0);

    for (size_t i = 0; i < data_.size(); i++)
    {
		ListItem* item = new ListItem(ctx_, data_[i], this);
		item->setFont(format_.font());
    }
    setMinimumSize(minimumSize().width(), sizeHint().height());
}
示例#6
0
const std::string& ComboBox::getItemText(int itemIndex) const
{
  if (itemIndex >= 0 && (size_t)itemIndex < m_items.size()) {
    ListItem* item = m_items[itemIndex];
    return item->getText();
  }
  else {
    // Returns the text of the combo-box (it should be empty).
    ASSERT(getText().empty());
    return getText();
  }
}
示例#7
0
void ListWidget::addItem(const std::string &content)
{
	ListItem* item = new ListItem();
	item->setText(content);
	item->setRelativePosition(computeItemPosition(items_.size()));
	item->setSize({this->getSize().x - SCROLLBAR_WIDTH, ITEM_HEIGHT});
	items_.push_back(std::unique_ptr<ListItem>(item));

	// If this is the first item, select it
	if(items_.size() == 1)
		selectItem(*item);
}
示例#8
0
int List::deleteLast() {
	if (currentSize != 0) {
		int tmp = last->getContent();
		ListItem *del = last;
		last = del->getPrevious();
		delete del;
		currentSize--;
		return tmp;
	}
	else
		return 0;
}
示例#9
0
int List::addItem(std::vector< std::string >* values)
{
	ListItem tempItem; //Creating a tempororary item

	tempItem.create(colWidth, values, x, nextItemY);

	listItems->push_back(tempItem);

	nextItemY = nextItemY + rowHeight;

	return 0;
}
示例#10
0
void C4PortraitSelDlg::LoaderThread::Execute() {
  // list empty?
  if (!LoadItems.size()) {
    // then we're done!
    SignalStop();
    return;
  }
  // load one item at the time
  ListItem *pLoadItem = LoadItems.front();
  pLoadItem->Load();
  LoadItems.erase(LoadItems.begin());
}
示例#11
0
void NotesWidget::insertNewNote(QString guid, QString noteBook, QString title)
{
    ListItem* item = new ListItem(this);
    item->setText(title);
    item->setNoteBookGUID(noteBook);
    item->setIcon(QIcon::fromTheme("basket"));
    item->setGUID(guid);

    signalsDisabled = true;
    setCurrentItem(item);
    signalsDisabled = false;
}
示例#12
0
int List::deleteFirst() {
	if (currentSize != 0) {
		int tmp = first->getContent();
		ListItem *del = first;
		first = del->getNext();
		delete del;
		currentSize--;
		return tmp;
	}
	else
		return 0;
}
示例#13
0
STDMETHODIMP OrxEvent::CheckEvent(LPCOLESTR Code, IDispatch **pbIDispatch)
{
    ListItem    *Current;
    ESource     *Content;
    HRESULT      RetCode=DISP_E_UNKNOWNNAME;
    int          i=0;
    size_t       CodeLen;
    RetCode = DISP_E_UNKNOWNNAME;


    if (!Code)
    {
        RetCode = E_POINTER;
    }
    else
    {
        CodeLen = wcslen(Code);
    }
    if (!pbIDispatch)
    {
        RetCode = E_POINTER;
    }
    else
    {
        *pbIDispatch = (IDispatch *)NULL;
    }
    if (RetCode == DISP_E_UNKNOWNNAME)
    {
        while (Current = EventSourceChain->FindItem(i++))
        {
            Content = (ESource *)Current->GetContent();
            if (Content->EventType == ESource::ParseProcedure)
            {
                if (CodeLen == Content->CodeLen)
                {
                    if (Content->Code)
                    {
                        if (wcsicmp(Code,Content->Code) == 0)
                        {
                            *pbIDispatch = (IDispatch *)Content;
                            RetCode = S_OK;
                            ((IDispatch*) Content)->AddRef();
                            break;
                        }
                    }
                }
            }
        }
    }
    FPRINTF2(logfile,"OrxEvent::CheckEvent() HRESULT %08x. \n",RetCode);
    return RetCode;
}
示例#14
0
void NotesWidget::setNoteSortType(qint8 type)
{
    sortType = type;

    for (int i = 0; i < count(); i++) {
        ListItem* item = reinterpret_cast<ListItem*>(this->item(i));
        item->setSortType(sortType);
    }

    sortItems();

    sql::updateSyncStatus("noteSortType", sortType);
}
示例#15
0
ListItem* NotesWidget::getNoteWithGuid(QString guid)
{
    ListItem* item = reinterpret_cast<ListItem*>(this->currentItem());
    if ((item != NULL) && (item->getGUID() == guid))
        return item;

    for (int i = 0; i < count(); i++) {
        ListItem* item = reinterpret_cast<ListItem*>(this->item(i));
        if (item->getGUID() == guid) {
            return item;
        }
    }
    return NULL;
}
示例#16
0
int TagMngrListModel::rowCount(const QModelIndex &parent) const
{
    ListItem* parentItem = 0;

    if (parent.column() > 0)
        return 0;

    if (!parent.isValid())
        parentItem = d->rootItem;
    else
        parentItem = static_cast<ListItem*>(parent.internalPointer());

    return parentItem->childCount();
}
示例#17
0
void ComboBox::setSelectedItemIndex(int itemIndex)
{
  if (itemIndex >= 0 &&
      (size_t)itemIndex < m_items.size() &&
      m_selected != itemIndex) {
    m_selected = itemIndex;

    ListItems::iterator it = m_items.begin() + itemIndex;
    ListItem* item = *it;
    m_entry->setText(item->getText());

    onChange();
  }
}
示例#18
0
void List::insertElementAt(int i, int pos) {
	if (pos <= 0)
		prependElement(i);
	else if (pos >= getSize())
		appendElement(i);
	else {
		ListItem *tmp = first;
		while (pos-- > 0) {
			tmp = tmp->getNext();
		}
		new ListItem(tmp->getPrevious(), tmp, i);
		currentSize++;
	}
}
	ListItem*
	_FindStringItem(BObjectList<ListItem>& list, const char* text,
		ListItem* parent)
	{
		for (int32 i = 0; i < list.CountItems(); i++) {
			ListItem* item = list.ItemAt(i);
			ListItem* superItem = (ListItem*)fListView->Superitem(item);
			if (parent != NULL && parent != superItem)
				continue;
			if (strcmp(item->Text(), text) == 0)
				return item;
		}
		return NULL;
	}
示例#20
0
void __fastcall TfrmSoundLib::OnItemsFocused(ListItemsVec& items)
{
	PropItemVec props;

    RegisterModifiedTHM	();
    m_Snd.destroy		();
    m_THM_Current.clear	();
                                          
	if (!items.empty()){
	    for (ListItemsIt it=items.begin(); it!=items.end(); it++){
            ListItem* prop = *it;
            if (prop){
            	ESoundThumbnail* thm=FindUsedTHM(prop->Key());
                if (!thm) m_THM_Used.push_back(thm=xr_new<ESoundThumbnail>(prop->Key()));
                m_THM_Current.push_back(thm);
                thm->FillProp		(props);
            }
        }
    }

	ButtonValue* B=0;
    if (m_THM_Current.size()==1)
    {
        ESoundThumbnail* thm=m_THM_Current.back();
        u32 size=0;
        u32 time=0;
        PlaySound(thm->SrcName(), size, time);

        CanvasValue* C=0;
        C=PHelper().CreateCanvas	(props,"Attenuation",	"", 64);
        C->tag						= (int)this;
        C->OnDrawCanvasEvent.bind	(this,&TfrmSoundLib::OnAttenuationDraw);
//		C->OnTestEqual.bind			(this,&TfrmSoundLib::OnPointDataTestEqual);
        B=PHelper().CreateButton	(props,"Auto Att",		"By Min,By Max",ButtonValue::flFirstOnly);
        B->OnBtnClickEvent.bind		(this,&TfrmSoundLib::OnAttClick);
        
        PHelper().CreateCaption		(props,"File Length",	shared_str().sprintf("%.2f Kb",float(size)/1024.f));
        PHelper().CreateCaption		(props,"Total Time", 	shared_str().sprintf("%.2f sec",float(time)/1000.f));
        if (!m_Flags.is(flReadOnly)){
	        B=PHelper().CreateButton(props,"Control",		"Play,Stop",ButtonValue::flFirstOnly);
    	    B->OnBtnClickEvent.bind	(this,&TfrmSoundLib::OnControlClick);
        }
    }
    if (!m_Flags.is(flReadOnly)){
	    B=PHelper().CreateButton	(props,"Auto Play",		bAutoPlay?"on":"off",ButtonValue::flFirstOnly);
    	B->OnBtnClickEvent.bind		(this,&TfrmSoundLib::OnControl2Click);
    }
    
	m_ItemProps->AssignItems		(props);
}
示例#21
0
void MainWindow::noteTitleChange(QString newTitle)
{
    QString guid = ui->noteTitle->objectName();

    if (guid.isEmpty())
        return;

    emit titleChanged(newTitle, guid);

    ListItem *note = ui->NotesList->getNoteWithGuid(guid);
    if (note == NULL)
        return;

    note->setText(newTitle);
}
示例#22
0
void MainWindow::switchNote()
{
    ListItem* l = reinterpret_cast<ListItem*>(ui->NotesList->currentItem());
    QString id = l->getGUID();

    if (id.isEmpty())
        return;

    ui->noteTitle->clear();
    ui->titleBar->show();
    ui->editButton->setChecked(false);
    clearConflictBar();

    JS(QString("loadNote('%1', false);").arg(id));
}
示例#23
0
QModelIndex ListModel::parent(const QModelIndex& index) const
{
    if (!index.isValid()) // root
        return QModelIndex();

    ListItem* item = itemFromIndex(index);
    if (!item)
        return QModelIndex();

    ListItem* parent = item->parent();
    if (parent->isRoot()) // top level item
        return QModelIndex();

    return createIndex(parent->row(), 0, parent);
}
示例#24
0
QModelIndex ListModel::index(int row, int column, const QModelIndex& parent) const
{
    if (row < 0 || column < 0)
        return QModelIndex();

    ListItem* parentItem = itemFromIndex(parent);
    if (!parentItem || row >= parentItem->childCount())
        return QModelIndex();

    ListItem* childItem = parentItem->child(row);
    if (!childItem)
        return QModelIndex();

    return createIndex(row, column, childItem);
}
示例#25
0
ListItem* ListModel::itemFromId(int itemId, ListItem* parent) const
{
    if (!parent)
        parent = root();
    for (int i = 0, n = parent->childCount(); i < n; ++i) {
        ListItem* child = parent->child(i);
        if (child->id() == itemId)
            return child;
    }
    for (int i = 0, n = parent->childCount(); i < n; ++i) {
        ListItem* found = itemFromId(itemId, parent->child(i));
        if (found)
            return found;
    }
    return nullptr;
}
示例#26
0
int List::deleteAt(int pos) {
	if (pos <= 0)
		return deleteFirst();
	else if (pos >= getSize())
		return deleteLast();
	else {
		ListItem *del = first;
		while (pos-- > 0) {
			del = del->getNext();
		}
		int val = del->getContent();
		delete del;
		currentSize--;
		return val;
	}
}
示例#27
0
void List::insertElementAt(int i, int pos) {
	if (pos <= 0) {
		prependElement(i);
	}
	else if (pos >= getSize()) {
		appendElement(i);
	}
	else {
		ListItem* p = first;
		// iterate over elements
		while (pos-- > 0) {
			p = p->getNext();
		}
		new ListItem(p->getPrevious(), p, i);
		++currentSize;
	}
}
示例#28
0
void NotesWidget::startDrag( Qt::DropActions supportedActions )
{
    ListItem* l = reinterpret_cast<ListItem*>(currentItem());

    if (l == NULL)
        return;

    QMimeData *data = new QMimeData;
    data->setData("qevernote/note", l->encode());

    QDrag *drag = new QDrag(this);
    drag->setPixmap(l->icon().pixmap(24, 24));
    drag->setHotSpot(QPoint(12,12));
    drag->setMimeData(data);

    drag->exec(supportedActions, Qt::MoveAction);
}
void C4Network2ResDlg::Update()
{
	// check through own resources and current res list
	ListItem *pItem = static_cast<ListItem *>(pClientWindow->GetFirst()), *pNext;
	C4Network2Res *pRes; int iResID=-1;
	while ((pRes = ::Network.ResList.getRefNextRes(++iResID)))
	{
		iResID = pRes->getResID();
		// resource checking: deleted resource(s) present?
		while (pItem && (pItem->GetResID() < iResID))
		{
			pNext = static_cast<ListItem *>(pItem->GetNext());
			delete pItem; pItem = pNext;
		}
		// same resource present for update?
		if (pItem && pItem->GetResID() == iResID)
		{
			pItem->Update(pRes);
			pItem = static_cast<ListItem *>(pItem->GetNext());
		}
		else
			// not present: insert (or add if pItem=NULL)
			InsertElement(new ListItem(this, pRes), pItem);
	}
	// del trailing items
	while (pItem)
	{
		pNext = static_cast<ListItem *>(pItem->GetNext());
		delete pItem; pItem = pNext;
	}
}
示例#30
0
// Add an item to the list (returns id)
ListItem* ListBox::AddItem(std::string text)
{
	// Add a ListItem to the contentbox
	ListItem *item;
	item = (ListItem*)contentBox->AddItem(new ListItem(menuSystem, []() {}));

	// Size item to fit box
	item->SetSize(Vec2(size.x, _ITEMHEIGHT));

	// Set onClick function to select this item
	item->SetOnClick([=]()
	{
		this->SetSelectedItem(item);
	});

	// Parse the text, and extract each substring
	GLint pos1, pos2;
	pos1 = 0;
	pos2 = 0;

	while (pos1 < text.length())
	{
		// Find next tag-character
		pos2 = text.find_first_of("#", pos1);
		
		// If none was found...
		if (pos2 == std::string::npos)
		{
			// Set pos2 to the end of the string
			pos2 = text.length();
		}

		// Add substring to list-item
		item->AddItem(text.substr(pos1, pos2 - pos1));

		// Move pos1 to one character after next
		pos1 = pos2 + 1;
	}

	// Add list item to listItems
	listItems.push_back(item);

	// Return id of the new item
	return item;
}