/***************************************************************************
 * chordlist.cpp: implementation of ChordList class
 *
 * This file is part of KTabEdit, a KDE tabulature editor
 *
 * copyright (C) 2003-2006 the KTabEdit development team <mrgwen@gmail.com>
 * copyright (C) 2002-2003 the KGuitar development team <mrgwen@gmail.com>
 ***************************************************************************/

/***************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * See the file COPYING for more information.
 ***************************************************************************/

#include "chordlist.h"
#include "chordlistitem.h"

ChordList::ChordList(QWidget *parent)
: KListWidget(parent)
{
}

void ChordList::inSort(ChordListItem *it)
{
	int l = ((QString) it->text()).length();
	uint best = 0;
	
	for (int i = 0; i < count(); i++) {
		if (((QString) item(i)->text()).length() < l)
			best++;
		else
			break;
	}
	
	insertItem(best, it);
}

ChordListItem* ChordList::currentItemPointer()
{
	return (ChordListItem*)currentItem();
}

#include "chordlist.moc"
