00001 /*************************************************************************** 00002 kmymoneycompletion.h - description 00003 ------------------- 00004 begin : Mon Apr 26 2004 00005 copyright : (C) 2000-2004 by Michael Edwardes 00006 email : mte@users.sourceforge.net 00007 Javier Campos Morales <javi_c@users.sourceforge.net> 00008 Felix Rodriguez <frodriguez@users.sourceforge.net> 00009 John C <thetacoturtle@users.sourceforge.net> 00010 Thomas Baumgart <ipwizard@users.sourceforge.net> 00011 Kevin Tambascio <ktambascio@users.sourceforge.net> 00012 ***************************************************************************/ 00013 00014 /*************************************************************************** 00015 * * 00016 * This program is free software; you can redistribute it and/or modify * 00017 * it under the terms of the GNU General Public License as published by * 00018 * the Free Software Foundation; either version 2 of the License, or * 00019 * (at your option) any later version. * 00020 * * 00021 ***************************************************************************/ 00022 00023 #ifndef KMYMONEYCOMPLETION_H 00024 #define KMYMONEYCOMPLETION_H 00025 00026 // ---------------------------------------------------------------------------- 00027 // QT Includes 00028 00029 #include <qwidget.h> 00030 #include <qvbox.h> 00031 #include <qregexp.h> 00032 class QListViewItem; 00033 00034 // ---------------------------------------------------------------------------- 00035 // KDE Includes 00036 00037 class KListView; 00038 00039 // ---------------------------------------------------------------------------- 00040 // Project Includes 00041 00042 class KMyMoneySelector; 00043 00048 class kMyMoneyCompletion : public QVBox 00049 { 00050 Q_OBJECT 00051 public: 00052 00053 kMyMoneyCompletion(QWidget *parent=0, const char *name=0); 00054 virtual ~kMyMoneyCompletion(); 00055 00059 virtual void show(void) { show(true); } 00060 00061 00065 virtual void hide(void); 00066 00073 void setSelected(const QString& id); 00074 00075 virtual KMyMoneySelector* selector(void) const { return m_selector; } 00076 00077 public slots: 00078 void slotMakeCompletion(const QString& txt); 00079 00080 void slotItemSelected(QListViewItem *item, const QPoint& pos, int col); 00081 00082 protected: 00087 virtual bool eventFilter( QObject *, QEvent * ); 00088 00095 void adjustSize(const int count); 00096 00101 void adjustSize(void); 00102 00103 void connectSignals(QWidget *widget, KListView* lv); 00104 00105 void show(bool presetSelected); 00106 00107 signals: 00108 void itemSelected(const QString& id); 00109 00110 protected: 00111 QWidget* m_parent; 00112 QWidget* m_widget; 00113 QString m_id; 00114 KListView* m_lv; 00115 KMyMoneySelector* m_selector; 00116 QRegExp m_lastCompletion; 00117 00118 static const int MAX_ITEMS; 00119 00120 }; 00121 00122 #endif