summaryrefslogtreecommitdiffstats
path: root/kdict/applet/kdictapplet.h
blob: 8e56e48e59be1425d5527de592f8670c52b24321 (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
/* -------------------------------------------------------------

   kdictapplet.h (part of The KDE Dictionary Client)

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

   The applet is loosely based on the "Run" applet included in KDE.
   Copyright (c) 2000 Matthias Elter <elter@kde.org> (Artistic License)

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

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

    PopupBox        helper class
    DictApplet      a small kicker-applet

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

#ifndef _DICTAPPLET_H_
#define _DICTAPPLET_H_

#include <tqhbox.h>
#include <kpanelapplet.h>

class TQLabel;
class TQPushButton;
class KHistoryCombo;


//*********  PopupBox  ********************************************

class PopupBox : public TQHBox
{
  Q_OBJECT
  

public:
  PopupBox();
  ~PopupBox();

  bool showBox();

signals:
  void hidden();

public slots:
  void enablePopup();

protected:
  void hideEvent(TQHideEvent *);

private:
  bool popupEnabled;

};

//*********  DictApplet  ********************************************

class DictApplet : public KPanelApplet
{
  Q_OBJECT
  

public:
  DictApplet(const TQString& configFile, Type t = Stretch, int actions = 0, TQWidget *parent = 0, const char *name = 0);
  virtual ~DictApplet();

  int widthForHeight(int height) const;
  int heightForWidth(int width) const;

protected:
  void resizeEvent(TQResizeEvent*);
  bool eventFilter( TQObject *, TQEvent * );

  void sendCommand(const TQCString &fun, const TQString &data);

protected slots:
  void sendDelayedCommand();
  void startQuery(const TQString&);
  void comboTextChanged(const TQString&);
  void queryClipboard();
  void startDefine();
  void startMatch();
  void showExternalCombo();
  void externalComboHidden();
  void updateCompletionMode(TDEGlobalSettings::Completion mode);

private:
  KHistoryCombo  *internalCombo, *externalCombo;
  TDECompletion    *completionObject;
  TQLabel         *textLabel, *iconLabel;
  TQPushButton    *verticalBtn, *clipboardBtn, *defineBtn, *matchBtn;
  TQWidget        *baseWidget;
  PopupBox       *popupBox;

  int            waiting;
  TQCString       delayedFunc;
  TQString        delayedData;

};

#endif