chalk

squeezedcombobox.h
Go to the documentation of this file.
1/* ============================================================
2 * Author: Tom Albers <tomalbers@kde.nl>
3 * Date : 2005-01-01
4 * Description :
5 *
6 * Copyright 2005 by Tom Albers
7 *
8 * This program is free software; you can redistribute it
9 * and/or modify it under the terms of the GNU General
10 * Public License as published by the Free Software Foundation;
11 * either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * ============================================================ */
20
23#ifndef SQUEEZEDCOMBOBOX_H
24#define SQUEEZEDCOMBOBOX_H
25
26class TQTimer;
27
28// TQt includes.
29
30#include <tqcombobox.h>
31#include <tqtooltip.h>
32
34
44class SqueezedComboBoxTip : public TQToolTip
45{
46public:
57 SqueezedComboBoxTip( TQWidget *parent, SqueezedComboBox *name );
58
59protected:
65 void maybeTip( const TQPoint& pos );
66
67private:
68 SqueezedComboBox* m_originalWidget;
69};
70
82class SqueezedComboBox : public TQComboBox
83{
84 TQ_OBJECT
85
86
87public:
93 SqueezedComboBox(TQWidget *parent = 0, const char *name = 0 );
94
98 virtual ~SqueezedComboBox();
99
100 bool contains(const TQString & text) const;
101
110 void insertSqueezedItem(const TQString& newItem, int index);
111
117 TQString itemHighlighted( );
118
122 virtual TQSize sizeHint() const;
123
124private slots:
125 void slotTimeOut();
126 void slotUpdateToolTip( int index );
127
128private:
129 void resizeEvent ( TQResizeEvent * );
130 TQString squeezeText( const TQString& original);
131
132 TQMap<int,TQString> m_originalItems;
133 TQTimer* m_timer;
134 SqueezedComboBoxTip* m_tooltip;
135};
136
137#endif // SQUEEZEDCOMBOBOX_H
This class shows a tooltip for a SqueezedComboBox the tooltip will contain the full text and helps th...
void maybeTip(const TQPoint &pos)
Reimplemented version from TQToolTip which shows the tooltip when needed.
This widget is a TQComboBox, but then a little bit different.
void insertSqueezedItem(const TQString &newItem, int index)
This inserts a item to the list.
virtual TQSize sizeHint() const
Sets the sizeHint() of this widget.
TQString itemHighlighted()
This method returns the full text (not squeezed) of the currently highlighted item.
virtual ~SqueezedComboBox()
destructor