Fix UI
[kdenetwork.git] / kdict / actions.h
blob568a9f7cdf408f7f756f3b68cf7e6c3edd031f53
1 /* -------------------------------------------------------------
3 actions.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 DictComboAction, special KAction subclasses used
13 DictLabelAction, in the toolbar
14 DictButtonAction
16 ------------------------------------------------------------- */
18 #ifndef _ACTIONS_H_
19 #define _ACTIONS_H_
21 #include <qguardedptr.h>
22 #include <qptrlist.h>
23 #include <kaction.h>
24 #include <kglobalsettings.h>
26 class KComboBox;
27 class QLabel;
28 class QPushButton;
31 class DictComboAction : public KAction
33 Q_OBJECT
35 public:
36 DictComboAction( const QString& text, QObject* parent,
37 const char* name, bool editable, bool autoSized );
38 ~DictComboAction();
40 virtual int plug( QWidget *w, int index = -1 );
41 virtual void unplug( QWidget *w );
43 QWidget* widget();
44 void setFocus();
46 QString currentText() const;
47 void selectAll();
48 void setEditText(const QString &s);
49 void setCurrentItem(int index);
50 void clearEdit();
52 void clear();
53 void setList(QStringList items);
55 KGlobalSettings::Completion completionMode();
56 void setCompletionMode(KGlobalSettings::Completion mode);
58 signals:
59 void activated(int);
60 void activated(const QString&);
62 private slots:
63 void slotComboActivated(int);
64 void slotComboActivated(const QString&);
66 private:
67 QGuardedPtr<KComboBox> m_combo;
68 bool m_editable, m_autoSized;
69 KGlobalSettings::Completion m_compMode;
73 class DictLabelAction : public KAction
75 Q_OBJECT
77 public:
78 DictLabelAction( const QString &text, QObject *parent = 0, const char *name = 0 );
79 ~DictLabelAction();
81 virtual int plug( QWidget *widget, int index = -1 );
82 virtual void unplug( QWidget *widget );
84 void setBuddy(QWidget *buddy);
86 private:
87 QGuardedPtr<QLabel> m_label;
92 class DictButtonAction : public KAction
94 Q_OBJECT
96 public:
97 DictButtonAction( const QString& text, QObject* receiver,
98 const char* slot, QObject* parent, const char* name );
99 ~DictButtonAction();
101 virtual int plug( QWidget *w, int index = -1 );
102 virtual void unplug( QWidget *w );
104 int widthHint();
105 void setWidth(int width);
107 private:
108 QGuardedPtr<QPushButton> m_button;
111 #endif