summaryrefslogtreecommitdiffstats
path: root/kregexpeditor/KMultiFormListBox/kmultiformlistboxentry.h
blob: b3750bba267f4364353ed3a3e0ef14bcc5224567 (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
/*
 *  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 __kmultiformlistboxentry
#define __kmultiformlistboxentry

#include <tqpoint.h>
#include <tqwidget.h>
#include <tqpushbutton.h>

/**
   This widget must be the base class for an entry widget used in the @ref
   KMultiFormListBox class. It is necessary for you to inherit this class to get any
   information attached to the elements in the KMultiFormListBox.

   The KMultiFormListBox widget features a fast scrolling mechanism through the Idx
   button. If you want to use this in you KMultiFormListBox, then you must do the
   following:
   @li Create a @ref TQPushButton as a sub-widget to your KMultiFormListBoxEntry.
   @li Override the @ref indexButton method to return your TQPushButton
   @li Override the @ref idxString to return a @ref TQString
   with a textual representation of the content in this KMultiFormListBoxEntry. This
   string will be used in the drop-down box which the user gets when he
   presses the Idx button.
   @li The drop down window must be aligned horizontal to some widget
   (which should be next to the Idx button, to ensure a good looking GUI. The
   position of the drop down widget may be specified in two ways: (1)
   override the @ref valueWidget method to return a widget, to align with
   (that is the upper right corner of the drop down  window will be the
   same as the lower right corner of this widget) or (2) override the @ref
   indexWindowPos method to return a start point for the drop down window and
   a width.
 **/
class KMultiFormListBoxEntry : public TQWidget
{
  Q_OBJECT
  

public:
  KMultiFormListBoxEntry(TQWidget *parent, const char *name) : TQWidget(parent,name) {}

  virtual TQPushButton *indexButton() { return 0; }
  virtual TQWidget *valueWidget() { return 0; }

  virtual void indexWindowPos(TQPoint *start, int *width); // both variables are return values.

  // This function must return a string representing the KMultiFormListBox. This is
  // used when showing the fast-search menu available from the `Idx' button.
  virtual TQString idxString() { return TQString::fromLatin1(""); }

public slots:
  void acceptIndexButton();

signals:
  void gotoIndex(KMultiFormListBoxEntry *);

};

#endif /* kmultiformlistboxentry */