Diffstat (limited to 'microkde/kdeui/ksqueezedtextlabel.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/ksqueezedtextlabel.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/microkde/kdeui/ksqueezedtextlabel.h b/microkde/kdeui/ksqueezedtextlabel.h new file mode 100644 index 0000000..1634adc --- a/dev/null +++ b/microkde/kdeui/ksqueezedtextlabel.h | |||
@@ -0,0 +1,76 @@ | |||
1 | /* This file is part of the KDE libraries | ||
2 | Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de> | ||
3 | |||
4 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | ||
6 | License version 2 as published by the Free Software Foundation. | ||
7 | |||
8 | This library is distributed in the hope that it will be useful, | ||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | Library General Public License for more details. | ||
12 | |||
13 | You should have received a copy of the GNU Library General Public License | ||
14 | along with this library; see the file COPYING.LIB. If not, write to | ||
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
16 | Boston, MA 02111-1307, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef KSQUEEZEDTEXTLABEL_H | ||
20 | #define KSQUEEZEDTEXTLABEL_H | ||
21 | |||
22 | #include <qlabel.h> | ||
23 | |||
24 | /** | ||
25 | * A label class that squeezes its text into the label | ||
26 | * | ||
27 | * If the text is too long to fit into the label it is divided into | ||
28 | * remaining left and right parts which are separated by three dots. | ||
29 | * | ||
30 | * Example: | ||
31 | * http://www.kde.org/documentation/index.html could be squeezed to | ||
32 | * http://www.kde...ion/index.html | ||
33 | |||
34 | * @short A replacement for QLabel that squeezes its text | ||
35 | * @author Ronny Standtke <Ronny.Standtke@gmx.de> | ||
36 | * @version $Id$ | ||
37 | * | ||
38 | */ | ||
39 | |||
40 | /* | ||
41 | * @ref QLabel | ||
42 | */ | ||
43 | class KSqueezedTextLabel : public QLabel { | ||
44 | Q_OBJECT | ||
45 | |||
46 | public: | ||
47 | /** | ||
48 | * Default constructor. | ||
49 | */ | ||
50 | KSqueezedTextLabel( QWidget *parent, const char *name = 0 ); | ||
51 | KSqueezedTextLabel( const QString &text, QWidget *parent, const char *name = 0 ); | ||
52 | |||
53 | virtual QSize minimumSizeHint() const; | ||
54 | |||
55 | public slots: | ||
56 | void setText( const QString & ); | ||
57 | |||
58 | protected: | ||
59 | /** | ||
60 | * used when widget is resized | ||
61 | */ | ||
62 | void resizeEvent( QResizeEvent * ); | ||
63 | /** | ||
64 | * does the dirty work | ||
65 | */ | ||
66 | void squeezeTextToLabel(); | ||
67 | QString fullText; | ||
68 | |||
69 | protected: | ||
70 | virtual void virtual_hook( int id, void* data ); | ||
71 | private: | ||
72 | class KSqueezedTextLabelPrivate; | ||
73 | KSqueezedTextLabelPrivate *d; | ||
74 | }; | ||
75 | |||
76 | #endif // KSQUEEZEDTEXTLABEL_H | ||