summaryrefslogtreecommitdiffstats
path: root/kdict/actions.h
blob: 3ce80182e72f6dc1a332a1e7fc2870e59234be9f (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
107
108
109
110
111
112
113
114
/* -------------------------------------------------------------

   actions.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.

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

   DictComboAction,            special KAction subclasses used
   DictLabelAction,            in the toolbar
   DictButtonAction

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

#ifndef _ACTIONS_H_
#define _ACTIONS_H_

#include <tqguardedptr.h>
#include <tqptrlist.h>
#include <kaction.h>
#include <kglobalsettings.h>

class KComboBox;
class TQLabel;
class TQPushButton;


class DictComboAction : public KAction
{
  Q_OBJECT
  TQ_OBJECT

  public:
    DictComboAction( const TQString& text, TQObject* tqparent,
                     const char* name, bool editable, bool autoSized );
    ~DictComboAction();

    virtual int plug( TQWidget *w, int index = -1 );
    virtual void unplug( TQWidget *w );

    TQWidget* widget();
    void setFocus();

    TQString currentText() const;
    void selectAll();
    void setEditText(const TQString &s);
    void setCurrentItem(int index);
    void clearEdit();

    void clear();
    void setList(TQStringList items);

    KGlobalSettings::Completion completionMode();
    void setCompletionMode(KGlobalSettings::Completion mode);

  signals:
    void activated(int);
    void activated(const TQString&);

  private slots:
    void slotComboActivated(int);
    void slotComboActivated(const TQString&);

  private:
    TQGuardedPtr<KComboBox> m_combo;
    bool m_editable, m_autoSized;
    KGlobalSettings::Completion m_compMode;
};


class DictLabelAction : public KAction
{
  Q_OBJECT
  TQ_OBJECT

  public:
    DictLabelAction( const TQString &text, TQObject *tqparent = 0, const char *name = 0 );
    ~DictLabelAction();

    virtual int plug( TQWidget *widget, int index = -1 );
    virtual void unplug( TQWidget *widget );

    void setBuddy(TQWidget *buddy);

  private:
    TQGuardedPtr<TQLabel> m_label;

};


class DictButtonAction : public KAction
{
  Q_OBJECT
  TQ_OBJECT

  public:
    DictButtonAction( const TQString& text, TQObject* receiver,
                     const char* slot, TQObject* tqparent, const char* name );
    ~DictButtonAction();

    virtual int plug( TQWidget *w, int index = -1 );
    virtual void unplug( TQWidget *w );

    int widthHint();
    void setWidth(int width);

  private:
    TQGuardedPtr<TQPushButton> m_button;
};

#endif