summaryrefslogtreecommitdiffstats
path: root/kdict/matchview.h
blob: 54c2dab5d3fcb3fdbd7033dbeed4e89e626ab185 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* -------------------------------------------------------------

   matchview.h (part of The KDE Dictionary Client)

   Copyright (C) 2000-2001 Christian Gebauer <gebauer@kde.org>

   This file is distributed under the Artistic License.
   See LICENSE for details.

   -------------------------------------------------------------

   MatchView  This widget contains the list of matching definitions

 ------------------------------------------------------------- */


#ifndef _MATCHVIEW_H_
#define _MATCHVIEW_H_

#include <tqlistview.h>
class KPopupMenu;


//*********  MatchViewItem  ********************************************

class MatchViewItem : public TQListViewItem
{
  
public:
                
  MatchViewItem(TQListView *view,const TQString &text);
  MatchViewItem(TQListView *view,TQListViewItem *after,const TQString &text);
  MatchViewItem(TQListViewItem *item,const TQString &text,const TQString &commandStr);
  MatchViewItem(TQListViewItem *item,TQListViewItem *after,const TQString &text,const TQString &commandStr);
  ~MatchViewItem();

  void setOpen(bool o);
  void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int tqalignment);

  TQString command;
  TQStringList subEntrys;
};


//*********  MatchView  ******************************************


class MatchView : public TQWidget
{
  Q_OBJECT
  TQ_OBJECT

public:

  MatchView(TQWidget *tqparent=0,const char *name=0);
  ~MatchView();

  void updateStrategyCombo();
  bool selectStrategy(const TQString &strategy) const;
  void match(const TQString &query);

signals:

  void defineRequested(const TQString &query);
  void matchRequested(const TQString &query);
  void clipboardRequested();
  void windowClosed();

protected:

  void closeEvent ( TQCloseEvent * e );

private slots:

  void strategySelected(int num);
  void enableGetButton();
  void mouseButtonPressed(int, TQListViewItem *, const TQPoint &, int);
  void returnPressed(TQListViewItem *i);
  void getOneItem(TQListViewItem *i);
  void getSelected();
  void getAll();
  void doGet(TQStringList &defines);
  void newList(const TQStringList &matches);
  void buildPopupMenu(TQListViewItem *, const TQPoint &, int);
  void popupGetCurrent();
  void popupDefineCurrent();
  void popupMatchCurrent();
  void popupDefineClip();
  void popupMatchClip();
  void expandList();
  void collapseList();

private:

  TQComboBox *w_strat;
  TQListView *w_list;
  TQPushButton *w_get,*w_getAll;

  bool getOn, getAllOn;

  KPopupMenu *rightBtnMenu;
  MatchViewItem *popupCurrent;
  TQString popupClip;   // needed for rightbtn-popup menu
};

#endif