00001 // 00002 // C++ Implementation: %{MODULE} 00003 // 00004 // Description: 00005 // 00006 // 00007 // Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR} 00008 // 00009 // Copyright: See COPYING file that comes with this distribution 00010 // 00011 // 00012 #ifndef WW_NO_LISTWIDGET 00013 00014 #include "qwwlistwidget.h" 00015 00027 QwwListWidget::QwwListWidget(QWidget *parent) : QListWidget(parent) { 00028 connect(this, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), SLOT(curCh(QListWidgetItem*))); 00029 } 00030 00034 void QwwListWidget::moveCurrentDown() { 00035 int pos = currentRow(); 00036 if (pos==count()-1) return; 00037 QListWidgetItem *item = takeItem(pos); 00038 insertItem(pos+1, item); 00039 setCurrentItem(item); 00040 } 00041 00045 void QwwListWidget::moveCurrentUp() { 00046 int pos = currentRow(); 00047 if (pos==0) return; 00048 QListWidgetItem *item = takeItem(pos); 00049 insertItem(pos-1, item); 00050 setCurrentItem(item); 00051 } 00052 00056 void QwwListWidget::removeCurrent() { 00057 QListWidgetItem *item = currentItem(); 00058 delete item; 00059 emit currentAvailable(currentItem()!=0); 00060 } 00061 00066 void QwwListWidget::curCh(QListWidgetItem * i) { 00067 emit currentAvailable(i!=0); 00068 } 00069 00070 #endif