~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/applets/webbrowser/browserhistorycombobox.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2008 Aaron Seigo <aseigo@kde.org>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU Library General Public License as
 
6
 *   published by the Free Software Foundation; either version 2, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program 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
 
12
 *   GNU General Public License for more details
 
13
 *
 
14
 *   You should have received a copy of the GNU Library General Public
 
15
 *   License along with this program; if not, write to the
 
16
 *   Free Software Foundation, Inc.,
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef BROWSERHISTORYCOMBOBOX_H
 
21
#define BROWSERHISTORYCOMBOBOX_H
 
22
 
 
23
#include <QtGui/QGraphicsProxyWidget>
 
24
 
 
25
class KComboBox;
 
26
 
 
27
namespace Plasma
 
28
{
 
29
 
 
30
class ComboBoxPrivate;
 
31
 
 
32
/**
 
33
 * @class ComboBox plasma/widgets/combobox.h <Plasma/Widgets/ComboBox>
 
34
 *
 
35
 * @short Provides a Plasma-themed combo box.
 
36
 */
 
37
class BrowserHistoryComboBox : public QGraphicsProxyWidget
 
38
{
 
39
    Q_OBJECT
 
40
 
 
41
    Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget)
 
42
    Q_PROPERTY(QString text READ text NOTIFY textChanged)
 
43
    Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
 
44
    Q_PROPERTY(KComboBox *nativeWidget READ nativeWidget WRITE setNativeWidget)
 
45
 
 
46
    Q_PROPERTY(qreal animationUpdate READ animationUpdate WRITE setAnimationUpdate)
 
47
 
 
48
public:
 
49
    explicit BrowserHistoryComboBox(QGraphicsWidget *parent = 0);
 
50
    ~BrowserHistoryComboBox();
 
51
 
 
52
    /**
 
53
     * @return the display text
 
54
     */
 
55
    QString text() const;
 
56
 
 
57
    /**
 
58
     * Sets the stylesheet used to control the visual display of this ComboBox
 
59
     *
 
60
     * @arg stylesheet a CSS string
 
61
     */
 
62
    void setStyleSheet(const QString &stylesheet);
 
63
 
 
64
    /**
 
65
     * @return the stylesheet currently used with this widget
 
66
     */
 
67
    QString styleSheet();
 
68
 
 
69
    /**
 
70
     * Sets the combo box wrapped by this ComboBox (widget must inherit KComboBox), ownership is transferred to the ComboBox
 
71
     *
 
72
     * @arg combo box that will be wrapped by this ComboBox
 
73
     * @since KDE4.4
 
74
     */
 
75
    void setNativeWidget(KComboBox *nativeWidget);
 
76
 
 
77
    /**
 
78
     * @return the native widget wrapped by this ComboBox
 
79
     */
 
80
    KComboBox *nativeWidget() const;
 
81
 
 
82
    /**
 
83
     * Adds an item to the combo box with the given text. The
 
84
     * item is appended to the list of existing items.
 
85
     */
 
86
    void addItem(const QString &text);
 
87
 
 
88
    void setProgressValue(int value);
 
89
    
 
90
    void setDisplayProgress(bool enable);
 
91
 
 
92
public Q_SLOTS:
 
93
    void clear();
 
94
 
 
95
Q_SIGNALS:
 
96
    /**
 
97
     * This signal is sent when the user chooses an item in the combobox.
 
98
     * The item's text is passed.
 
99
     */
 
100
    void activated(const QString &text);
 
101
 
 
102
    /**
 
103
     * This signal is sent whenever the currentIndex in the combobox changes 
 
104
     * either through user interaction or programmatically. 
 
105
     * The item's text is passed.
 
106
     */
 
107
    void textChanged(const QString &text);
 
108
 
 
109
protected:
 
110
    void resizeEvent(QGraphicsSceneResizeEvent *event);
 
111
    void paint(QPainter *painter,
 
112
               const QStyleOptionGraphicsItem *option,
 
113
               QWidget *widget);
 
114
    void focusInEvent(QFocusEvent *event);
 
115
    void focusOutEvent(QFocusEvent *event);
 
116
    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
 
117
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
 
118
    void changeEvent(QEvent *event);
 
119
 
 
120
private slots:
 
121
    void setAnimationUpdate(qreal progress);
 
122
    qreal animationUpdate() const;
 
123
 
 
124
private:
 
125
    ComboBoxPrivate * const d;
 
126
 
 
127
    friend class ComboBoxPrivate;
 
128
    Q_PRIVATE_SLOT(d, void syncBorders())
 
129
};
 
130
 
 
131
} // namespace Plasma
 
132
 
 
133
#endif // multiple inclusion guard