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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2006 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#ifndef CKEYCHOOSERWIDGET_H
#define CKEYCHOOSERWIDGET_H
#include <tqwidget.h>
#include <tqmap.h>
#include <tqstringlist.h>
#include <kcombobox.h>
#include "cscrollerwidgetset.h"
class CLexiconKeyChooser;
//class CMinMaxLayout;
class TQIconSet;
//class TQComboBox;
class TQStringList;
class TQPoint;
class TQMouseEvent;
class TQWheelEvent;
class TQHBoxLayout;
/*
* We use this class to conrtol the focus move in the combobox
* This class is used in the key chooser widgets
*/
class CKCComboBox : public TQComboBox {
TQ_OBJECT
public:
CKCComboBox(bool rw, TQWidget * parent=0, const char * name=0 );
/**
* Returns the size this widget would like to have.
*/
// virtual TQSize sizeHint() const;
protected:
/**
* Reimplementation.
*/
virtual bool eventFilter( TQObject *o, TQEvent *e );
/**
* Scrolls in the list if the wheel of the mouse was used.
*/
virtual void wheelEvent( TQWheelEvent* e);
signals:
/**
* Emitted when the user moves the focus away from the combo by pressing tab
*/
void focusOut(int itemIndex);
};
/**
* This class implements the KeyCooser Widget, which
* consists of a @ref TQComboBox, two normal ref @TQToolButton
* and a enhanced @ref CScrollButton
*
* @author The BibleTime team
*/
class CKeyChooserWidget : public TQWidget {
TQ_OBJECT
public:
/**
* the constructor
*/
CKeyChooserWidget(TQStringList *list=0, const bool useNextPrevSignals = false, TQWidget *parent=0, const char *name=0);
/**
* the constructor
*/
CKeyChooserWidget(int count=0, const bool useNextPrevSignals = false, TQWidget *parent=0, const char *name=0);
/**
* This function does clear the combobox, then fill in
* the StringList, set the ComboBox' current item to index
* and if do_emit is true, it will emit @ref #changed
*
* @param list the stringlist to be inserted
* @param index the index that the combobox is to jump to
* @param do_emit should we emit @ref #changed(int)
*/
void reset(const int count, int index, bool do_emit);
void reset(TQStringList& list, int index, bool do_emit);
void reset(TQStringList *list, int index, bool do_emit);
/**
* Initializes this widget. We need this function because
* we have more than one constructor.
*/
virtual void init();
/**
*
*/
// virtual void adjustSize();
/**
* Sets the tooltips for the given entries using the parameters as text.
*/
void setToolTips( const TQString comboTip, const TQString nextEntry, const TQString scrollButton, const TQString previousEntry);
/**
* Sets the current item to the one with the given text
*/
bool setItem( const TQString item);
/**
* Return the combobox of this key chooser widget.
*/
TQComboBox* comboBox() {return m_comboBox;};
public slots:
/**
* is called to lock the combobox
*/
void lock()
;
/**
* is called to unlock the combobox
*/
void unlock();
/**
* is called to move the combobox to a certain index
* @param index the index to jump to
*/
void changeCombo(int index);
void slotComboChanged(int index);
signals:
/**
* Is emitted if the widget changed, but
* only if it is not locked or being reset
*
* @param the current ComboBox index
*/
void changed(int index);
/**
* Is emitted if the widget was left with a focus out event.
* @param index The new index of the ComboBox
*/
void focusOut(int index);
protected:
/**
* indicates wheter we are resetting at the moment
*/
bool isResetting;
/**
*
*/
TQString oldKey;
protected slots: // Protected slots
/**
* Is called when the return key was presed in the combobox.
*/
void slotReturnPressed( /*const TQString&*/ );
private:
friend class CLexiconKeyChooser;
TQStringList m_list;
bool m_useNextPrevSignals;
bool updatelock;
/**
* Members should never be public!!
*/
CKCComboBox* m_comboBox;
TQHBoxLayout *m_mainLayout;
CScrollerWidgetSet * m_scroller;
};
#endif
|