Fix UI
[kdenetwork.git] / kdict / matchview.h
blobf619820ef8d934f3089b60fd4bc552a96bd3e290
1 /* -------------------------------------------------------------
3 matchview.h (part of The KDE Dictionary Client)
5 Copyright (C) 2000-2001 Christian Gebauer <gebauer@kde.org>
7 This file is distributed under the Artistic License.
8 See LICENSE for details.
10 -------------------------------------------------------------
12 MatchView This widget contains the list of matching definitions
14 ------------------------------------------------------------- */
17 #ifndef _MATCHVIEW_H_
18 #define _MATCHVIEW_H_
20 #include <qlistview.h>
21 class KPopupMenu;
24 //********* MatchViewItem ********************************************
26 class MatchViewItem : public QListViewItem
29 public:
31 MatchViewItem(QListView *view,const QString &text);
32 MatchViewItem(QListView *view,QListViewItem *after,const QString &text);
33 MatchViewItem(QListViewItem *item,const QString &text,const QString &commandStr);
34 MatchViewItem(QListViewItem *item,QListViewItem *after,const QString &text,const QString &commandStr);
35 ~MatchViewItem();
37 void setOpen(bool o);
38 void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment);
40 QString command;
41 QStringList subEntrys;
45 //********* MatchView ******************************************
48 class MatchView : public QWidget
50 Q_OBJECT
52 public:
54 MatchView(QWidget *parent=0,const char *name=0);
55 ~MatchView();
57 void updateStrategyCombo();
58 bool selectStrategy(const QString &strategy) const;
59 void match(const QString &query);
61 signals:
63 void defineRequested(const QString &query);
64 void matchRequested(const QString &query);
65 void clipboardRequested();
66 void windowClosed();
68 protected:
70 void closeEvent ( QCloseEvent * e );
72 private slots:
74 void strategySelected(int num);
75 void enableGetButton();
76 void mouseButtonPressed(int, QListViewItem *, const QPoint &, int);
77 void returnPressed(QListViewItem *i);
78 void getOneItem(QListViewItem *i);
79 void getSelected();
80 void getAll();
81 void doGet(QStringList &defines);
82 void newList(const QStringList &matches);
83 void buildPopupMenu(QListViewItem *, const QPoint &, int);
84 void popupGetCurrent();
85 void popupDefineCurrent();
86 void popupMatchCurrent();
87 void popupDefineClip();
88 void popupMatchClip();
89 void expandList();
90 void collapseList();
92 private:
94 QComboBox *w_strat;
95 QListView *w_list;
96 QPushButton *w_get,*w_getAll;
98 bool getOn, getAllOn;
100 KPopupMenu *rightBtnMenu;
101 MatchViewItem *popupCurrent;
102 QString popupClip; // needed for rightbtn-popup menu
105 #endif