~ubuntu-branches/ubuntu/dapper/psi/dapper

« back to all changes in this revision

Viewing changes to libpsi/psiwidgets/iconwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2004-06-15 00:10:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040615001041-enywb6pcpe4sjsw6
Tags: 0.9.2-1
* New upstream release
* Set KDEDIR for ./configure so kde specific files get installed
* Don't install libpsiwidgets.so. It got installed in /usr/share
  where it doesn't belong. May be included (at a better location)
  later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * iconwidget.h - misc. Iconset- and Icon-aware widgets
 
3
 * Copyright (C) 2003  Michail Pishchagin
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Lesser General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2.1 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Lesser General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this library; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef ICONWIDGET_H
 
22
#define ICONWIDGET_H
 
23
 
 
24
#include <qlistbox.h>
 
25
#include <qpushbutton.h>
 
26
#include <qtoolbutton.h>
 
27
 
 
28
class QPaintEvent;
 
29
 
 
30
class Icon;
 
31
class Iconset;
 
32
 
 
33
class IconsetSelectItem;
 
34
 
 
35
class IconsetSelect : public QListBox
 
36
{
 
37
        Q_OBJECT
 
38
public:
 
39
        IconsetSelect(QWidget *parent = 0, const char *name = 0);
 
40
        ~IconsetSelect();
 
41
 
 
42
        void insert(const Iconset &); // iconsets must be inserted in following order: most prioritent first
 
43
 
 
44
        const Iconset *iconset() const;
 
45
 
 
46
public slots:
 
47
        void moveItemUp();
 
48
        void moveItemDown();
 
49
 
 
50
private:
 
51
        class Private;
 
52
        Private *d;
 
53
 
 
54
        void paintCell(QPainter *p, int row, int col);
 
55
 
 
56
        friend class IconsetSelectItem;
 
57
};
 
58
 
 
59
class IconWidgetItem : public QObject, public QListBoxItem
 
60
{
 
61
        Q_OBJECT
 
62
public:
 
63
        IconWidgetItem(QListBox *parent = 0, QListBoxItem *after = 0)
 
64
        : QListBoxItem(parent, after) {}
 
65
 
 
66
        virtual const Iconset *iconset() const { return 0; }
 
67
};
 
68
 
 
69
class IconsetDisplayItem;
 
70
 
 
71
class IconsetDisplay : public QListBox
 
72
{
 
73
        Q_OBJECT
 
74
public:
 
75
        IconsetDisplay(QWidget *parent = 0, const char *name = 0);
 
76
        ~IconsetDisplay();
 
77
 
 
78
        void setIconset(const Iconset &);
 
79
private:
 
80
        class Private;
 
81
        Private *d;
 
82
 
 
83
        void paintCell(QPainter *p, int row, int col);
 
84
 
 
85
        friend class IconsetDisplayItem;
 
86
};
 
87
 
 
88
class IconButton : public QPushButton
 
89
{
 
90
        Q_OBJECT
 
91
        Q_PROPERTY( QString iconName READ iconName WRITE setIcon )
 
92
        Q_PROPERTY( bool textVisible READ textVisible WRITE setTextVisible )
 
93
 
 
94
        Q_OVERRIDE( QPixmap pixmap DESIGNABLE false SCRIPTABLE false )
 
95
        Q_OVERRIDE( QIconSet iconSet DESIGNABLE false SCRIPTABLE false )
 
96
 
 
97
public:
 
98
        IconButton(QWidget *parent = 0, const char *name = 0);
 
99
        ~IconButton();
 
100
 
 
101
        void setIcon(const QPixmap &);
 
102
 
 
103
public slots:
 
104
        void setIcon(const Icon *, bool activate = true);
 
105
        void forceSetIcon(const Icon *, bool activate = true);
 
106
        void setIcon(const QString &);
 
107
        const QString &iconName() const;
 
108
 
 
109
        void setText(const QString &);
 
110
 
 
111
        bool textVisible() const;
 
112
        void setTextVisible(bool);
 
113
 
 
114
public:
 
115
        class Private;
 
116
private:
 
117
        Private *d;
 
118
 
 
119
        virtual void drawButtonLabel(QPainter *p);
 
120
};
 
121
 
 
122
class IconToolButton : public QToolButton
 
123
{
 
124
        Q_OBJECT
 
125
        Q_PROPERTY( QString iconName READ iconName WRITE setIcon )
 
126
 
 
127
        Q_OVERRIDE( QPixmap pixmap DESIGNABLE false SCRIPTABLE false )
 
128
        Q_OVERRIDE( QIconSet iconSet DESIGNABLE false SCRIPTABLE false )
 
129
 
 
130
public:
 
131
        IconToolButton(QWidget *parent = 0, const char *name = 0);
 
132
        ~IconToolButton();
 
133
 
 
134
        void setIcon(const QPixmap &);
 
135
 
 
136
public slots:
 
137
        void setIcon(const Icon *, bool activate = true);
 
138
        void setIcon(const QString &);
 
139
        const QString &iconName() const;
 
140
 
 
141
public:
 
142
        class Private;
 
143
private:
 
144
        Private *d;
 
145
 
 
146
        void drawButtonLabel(QPainter *p);
 
147
};
 
148
 
 
149
#endif