~ubuntu-branches/ubuntu/wily/unity-2d/wily

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/indicatorentrywidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-08-25 18:16:57 UTC
  • mfrom: (1.1.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20110825181657-opb29rqsxae3i98f
Tags: 4.2.0-0ubuntu1
* New upstream release:
  - [panel] application menus do not appear on first hover after dismissal
    (lp: #825262)
  - [dash] Lens icons badly scaled (lp: #825368)
  - [panel] indicators are shifted offscreen to the right (lp: #827673)
  - [panel] scrubbing from system indicators to menubar should be possible
    (lp: #706903)
  - [launcher] Closed applications don't get their launcher counts cleared
    (lp: #767367)
  - [dash] selected item should not be underlined but use the same 
    treatment as unity (lp: #817456)
  - [dash] categories should be collapsed by default (lp: #827214)
  - [dash] Ratings filter (lp: #831855)
  - [dash] Multirange filter (lp: #831856)
  - [dash] ToggleButton filter (lp: #831857)
  - [dash] Icon size must be bigger to match the mockups (lp: #831858)
  - [dash] "Refine search" right margin should be 15 pixels (lp: #832058)
  - [dash] "Refine search" should be "Filter results" (lp: #832060)
  - [dash] Font sizes should match new design (lp: #832114)
  - [panel] Glitch: application menu appearing when pressing the BFB 
    (lp: #825060)
  - [panel] Glitch: application menus are quickly opened after a drag gesture
    (lp: #825267)
  - [dash] File thumbnails aspect ratio is not respected (lp: #832204)
* debian/control: require current the current versions of nux and unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This file is part of unity-2d
 
3
 *
 
4
 * Copyright 2011 Canonical Ltd.
 
5
 *
 
6
 * Authors:
 
7
 * - Aurélien Gâteau <aurelien.gateau@canonical.com>
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; version 3.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
 * GNU General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
 */
 
21
#ifndef INDICATORENTRYWIDGET_H
 
22
#define INDICATORENTRYWIDGET_H
 
23
 
 
24
// Local
 
25
 
 
26
// libunity-core
 
27
#include <UnityCore/IndicatorEntry.h>
 
28
 
 
29
// Qt
 
30
#include <QWidget>
 
31
 
 
32
struct _GtkWidgetPath;
 
33
struct _PangoLayout;
 
34
 
 
35
class QPainter;
 
36
 
 
37
class IndicatorEntryWidget : public QWidget, public sigc::trackable
 
38
{
 
39
Q_OBJECT
 
40
public:
 
41
    IndicatorEntryWidget(const unity::indicator::Entry::Ptr& entry);
 
42
    ~IndicatorEntryWidget();
 
43
 
 
44
    QSize minimumSizeHint() const;
 
45
    QSize sizeHint() const;
 
46
 
 
47
    void setPadding(int);
 
48
 
 
49
    bool isEmpty() const;
 
50
 
 
51
    unity::indicator::Entry::Ptr entry() const;
 
52
 
 
53
    /**
 
54
     * Shows the menu.
 
55
     *
 
56
     * When this method is called because of a click, button
 
57
     * must be set to Qt::LeftButton.
 
58
     *
 
59
     * When it is called because user previously clicked an indicator and moved the
 
60
     * mouse to another indicator, button must be set to Qt::NoButton.
 
61
     */
 
62
    void showMenu(Qt::MouseButton button);
 
63
 
 
64
Q_SIGNALS:
 
65
    void isEmptyChanged();
 
66
 
 
67
protected:
 
68
    void resizeEvent(QResizeEvent*);
 
69
    void paintEvent(QPaintEvent*);
 
70
    void mousePressEvent(QMouseEvent*);
 
71
    void mouseReleaseEvent(QMouseEvent*);
 
72
    void wheelEvent(QWheelEvent*);
 
73
    bool event(QEvent*);
 
74
 
 
75
private:
 
76
    unity::indicator::Entry::Ptr m_entry;
 
77
    QPixmap m_pix;
 
78
    int m_padding;
 
79
    bool m_hasIcon;
 
80
    bool m_hasLabel;
 
81
    struct _GtkWidgetPath* m_gtkWidgetPath;
 
82
    void updatePix();
 
83
    QPixmap decodeIcon();
 
84
    void paintActiveBackground(QImage*);
 
85
 
 
86
    struct _PangoLayout* createPangoLayout();
 
87
    void paintLabel(QImage*, struct _PangoLayout*, int labelX);
 
88
};
 
89
 
 
90
#endif /* INDICATORENTRYWIDGET_H */