~ubuntu-branches/ubuntu/gutsy/kde4libs/gutsy

« back to all changes in this revision

Viewing changes to kdeui/kguiitem.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-02-21 11:00:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070221110012-6kw8khr9knv6lmg1
Tags: 3.80.3-0ubuntu1
New upstream unstable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE libraries
2
 
    Copyright (C) 2001 Holger Freyther (freyher@yahoo.com)
3
 
                  based on ideas from Martijn and Simon
4
 
 
5
 
    This library is free software; you can redistribute it and/or
6
 
    modify it under the terms of the GNU Library General Public
7
 
    License version 2 as published by the Free Software Foundation.
8
 
 
9
 
    This library is distributed in the hope that it will be useful,
10
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
    Library General Public License for more details.
13
 
 
14
 
    You should have received a copy of the GNU Library General Public License
15
 
    along with this library; see the file COPYING.LIB.  If not, write to
16
 
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 
    Boston, MA 02110-1301, USA.
18
 
 
19
 
    Many thanks to Simon tronical Hausmann
20
 
*/
21
 
 
22
 
#ifndef kguiitem_h
23
 
#define kguiitem_h
24
 
 
25
 
#include <qstring.h>
26
 
 
27
 
#include <kglobal.h>
28
 
#include <kicontheme.h>
29
 
 
30
 
class QIcon;
31
 
 
32
 
/**
33
 
 * @short An abstract class for GUI data such as ToolTip and Icon.
34
 
 *
35
 
 * @author Holger Freyther <freyher@yahoo.com>
36
 
 * @see KStdGuiItem
37
 
 */
38
 
class KDEUI_EXPORT KGuiItem
39
 
{
40
 
public:
41
 
    KGuiItem();
42
 
 
43
 
    // ### This should probably be explicit in KDE 4; it's easy to get
44
 
    // subtle bugs otherwise - the icon name, tooltip and whatsthis text
45
 
    // get changed behind your back if you do 'setButtonFoo( "Bar" );'
46
 
    // It gives the wrong impression that you just change the text.
47
 
    KGuiItem( const QString &text, 
48
 
              const QString &iconName  = QString(),
49
 
              const QString &toolTip   = QString(), 
50
 
              const QString &whatsThis = QString() );
51
 
 
52
 
    KGuiItem( const QString &text, const QIcon &iconSet, 
53
 
              const QString &toolTip   = QString(), 
54
 
              const QString &whatsThis = QString() );
55
 
 
56
 
    KGuiItem( const KGuiItem &rhs );
57
 
    KGuiItem &operator=( const KGuiItem &rhs );
58
 
 
59
 
    ~KGuiItem();
60
 
 
61
 
    QString text() const;
62
 
    QString plainText() const;
63
 
#ifndef KDE_NO_COMPAT
64
 
    QIcon iconSet( K3Icon::Group, int size = 0, KInstance* instance = KGlobal::instance()) const;
65
 
    QIcon iconSet() const;
66
 
#else
67
 
    QIcon iconSet( K3Icon::Group=K3Icon::Small, int size = 0, KInstance* instance = KGlobal::instance()) const;
68
 
#endif
69
 
 
70
 
    QString iconName() const;
71
 
    QString toolTip() const;
72
 
    QString whatsThis() const;
73
 
    bool isEnabled() const;
74
 
    bool hasIcon() const;
75
 
#ifndef KDE_NO_COMPAT
76
 
    bool hasIconSet() const { return hasIcon(); }
77
 
#endif
78
 
 
79
 
    void setText( const QString &text );
80
 
    void setIcon( const QIcon &iconset );
81
 
    void setIconName( const QString &iconName );
82
 
    void setToolTip( const QString &tooltip );
83
 
    void setWhatsThis( const QString &whatsThis );
84
 
    void setEnabled( bool enable );
85
 
 
86
 
private:
87
 
    class KGuiItemPrivate;
88
 
    KGuiItemPrivate *d;
89
 
};
90
 
 
91
 
/* vim: et sw=4
92
 
 */
93
 
 
94
 
#endif
95