kmymoneyselector.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                              kmymoneyselector.h
00003                              -------------------
00004     begin                : Thu Jun 29 2006
00005     copyright            : (C) 2006 by Thomas Baumgart
00006     email                : Thomas Baumgart <ipwizard@users.sourceforge.net>
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef KMYMONEYSELECTOR_H
00019 #define KMYMONEYSELECTOR_H
00020 
00021 // ----------------------------------------------------------------------------
00022 // QT Includes
00023 
00024 #include <qwidget.h>
00025 #include <qlistview.h>
00026 class QHBoxLayout;
00027 
00028 // ----------------------------------------------------------------------------
00029 // KDE Includes
00030 
00031 class KListView;
00032 
00033 // ----------------------------------------------------------------------------
00034 // Project Includes
00035 
00036 #include <kmymoney/mymoneyutils.h>
00037 
00053 class KMyMoneySelector : public QWidget
00054 {
00055   Q_OBJECT
00056 public:
00057   KMyMoneySelector(QWidget *parent=0, const char *name=0, QWidget::WFlags flags = 0);
00058   virtual ~KMyMoneySelector();
00059 
00073   void setSelectionMode(const QListView::SelectionMode mode);
00074 
00080   QListView::SelectionMode selectionMode(void) const { return m_selMode; }
00081 
00089   void selectedItems(QStringList& list) const;
00090 
00097   QStringList selectedItems(void) const;
00098 
00105   void itemList(QStringList& list) const;
00106 
00113   QStringList itemList(void) const;
00114 
00125   bool allItemsSelected(void) const;
00126 
00136   void setSelected(const QString& id, const bool state = false);
00137 
00141   KListView* listView(void) const { return m_listView; };
00142 
00150   void selectAllItems(const bool state);
00151 
00160   void selectItems(const QStringList& itemList, const bool state);
00161 
00170   void protectItem(const QString& itemId, const bool protect = true);
00171 
00176   void setOptimizedWidth(void);
00177 
00183   void removeItem(const QString& id);
00184 
00193   QListViewItem* newItem(const QString& name, const QString& key = QString(), const QString& id = QString(), QCheckListItem::Type type = QCheckListItem::RadioButtonController);
00194 
00199   QListViewItem* newItem(const QString& name, QListViewItem* after, const QString& key = QString(), const QString& id = QString(), QCheckListItem::Type type = QCheckListItem::RadioButtonController);
00200 
00215   QListViewItem* newItem(QListViewItem* parent, const QString& name, const QString& key, const QString& id);
00216 
00231   QListViewItem* newTopItem(const QString& name, const QString& key, const QString& id);
00232 
00242   virtual bool match(const QRegExp& exp, QListViewItem* item) const;
00243 
00253   void ensureItemVisible(const QListViewItem *item);
00254 
00261   QListViewItem* item(const QString& id) const;
00262 
00271   virtual bool contains(const QString& txt) const;
00272 
00276   virtual void clear(void);
00277 
00281   int optimizedWidth(void) const;
00282 
00283 public slots:
00288   void slotSelectAllItems(void) { selectAllItems(true); };
00289 
00294   void slotDeselectAllItems(void) { selectAllItems(false); };
00295 
00296 signals:
00297   void stateChanged(void);
00298 
00299   void itemSelected(const QString& id);
00300 
00301 protected:
00308   void selectedItems(QStringList& list, QListViewItem* item) const;
00309 
00315   bool allItemsSelected(const QListViewItem *item) const;
00316 
00323   void selectAllSubItems(QListViewItem* item, const bool state);
00324 
00332   void selectSubItems(QListViewItem* item, const QStringList& itemList, const bool state);
00333 
00334 public slots:
00343   int slotMakeCompletion(const QRegExp& exp);
00344 
00350   int slotMakeCompletion(const QString& txt);
00351 
00352 
00353 protected slots:
00361   void slotShowSelected(void);
00362 
00366   void slotItemSelected(QListViewItem *it_v);
00367 
00374   void slotListRightMouse(QListViewItem* it_v, const QPoint& p, int /* col */);
00375 
00376 protected:
00377   KListView*                m_listView;
00378   QStringList               m_itemList;
00379   QString                   m_baseName;
00380   QListView::SelectionMode  m_selMode;
00381   QHBoxLayout*              m_layout;
00382 
00383 private:
00384   const QListViewItem*      m_visibleItem;
00385 };
00386 
00387 #endif

Generated on Wed Jan 26 13:03:17 2011 for KMyMoney by  doxygen 1.5.6