subtraction of already painted area: be fool and
[kdelibs.git] / kdeui / ksqueezedtextlabel.h
blob9b1b230fc7146c02490174e3cfd8e05d255986a0
1 /* This file is part of the KDE libraries
2 Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de>
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.
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.
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., 51 Franklin Steet, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef KSQUEEZEDTEXTLABEL_H
20 #define KSQUEEZEDTEXTLABEL_H
22 #include <qlabel.h>
24 #include <kdelibs_export.h>
26 /**
27 * @short A replacement for QLabel that squeezes its text
29 * A label class that squeezes its text into the label
31 * If the text is too long to fit into the label it is divided into
32 * remaining left and right parts which are separated by three dots.
34 * Example:
35 * http://www.kde.org/documentation/index.html could be squeezed to
36 * http://www.kde...ion/index.html
38 * \image html ksqueezedtextlabel.png "KSqueezedTextLabel Widget"
40 * @author Ronny Standtke <Ronny.Standtke@gmx.de>
44 * QLabel
46 class KDEUI_EXPORT KSqueezedTextLabel : public QLabel {
47 Q_OBJECT
49 public:
50 /**
51 * Default constructor.
53 KSqueezedTextLabel( QWidget *parent, const char *name = 0 );
54 KSqueezedTextLabel( const QString &text, QWidget *parent, const char *name = 0 );
56 virtual QSize minimumSizeHint() const;
57 virtual QSize sizeHint() const;
58 /**
59 * Overridden for internal reasons; the API remains unaffected.
61 virtual void setAlignment( int );
63 public slots:
64 void setText( const QString & );
66 protected:
67 /**
68 * used when widget is resized
70 void resizeEvent( QResizeEvent * );
71 /**
72 * does the dirty work
74 void squeezeTextToLabel();
75 QString fullText;
77 protected:
78 virtual void virtual_hook( int id, void* data );
79 private:
80 class KSqueezedTextLabelPrivate;
81 KSqueezedTextLabelPrivate *d;
84 #endif // KSQUEEZEDTEXTLABEL_H