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
|
/*
* Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License version 2 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
**/
#ifndef __indexWindow
#define __indexWindow
#include <tqlistbox.h>
/**
Post a toplevel listbox synchronously.
When the user presses the Idx button in the @ref KMultiFormListBox, then a
listbox with the elements from the KMultiFormListBox must be shown. From this
listbox the user should chose the element he wants to scroll to.
This widget takes care of posting this listbox, and ensuring that the
user can not do anything else before he has chosen an element.
This widget resembles the behavior of @ref TQPopupMenu, the difference
is, however, that the TQPopupMenu can not handle that the elements in the
menu exceed the size of the screen. This widget can.
In the future this widget may be replaced with the TQPopupMenu if the
TQPopupMenu can handle this situation. But for now - it works!
@internal
**/
class indexWindow : public QWidget{
Q_OBJECT
public:
indexWindow();
/**
This method inserts an element into the listbox which is shown when
the @ref exec method is invoked.
**/
void insertItem(TQString txt);
/**
This function shows the index window with the elements inserted using
the @ref insertItem function. The function will not return before the
user has chosen an element in the listbox, or have pressed the right
mouse button outside the window. As a result of returning from this
function, the listbox is hidden.
@param start The upper left corner of the pop-up window.
@param width The width of the window
@return The index of the element chosen, or -1 if no element has been
chosen.
**/
int exec(const TQPoint &start, int width);
protected:
void finish(int retVal);
virtual void hideEvent(TQHideEvent *h);
protected slots:
void lbSelected(int);
private:
TQListBox *lb;
bool lbFinish;
int itemSelected;
};
#endif /* indexWindow */
|