~ubuntu-branches/ubuntu/trusty/kdeplasma-addons/trusty

« back to all changes in this revision

Viewing changes to applets/plasmaboard/BoardKey.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-05-25 09:50:14 UTC
  • mfrom: (1.1.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100525095014-6mlrm9z9bkws0zkt
Tags: 4:4.4.80-0ubuntu1
* New upstream beta release:
  - Bump kde-sc-dev-latest build-dep version to 4.4.80
  - Refresh kubuntu_04_kimpanel_disable_scim.diff
  - Update various .install files
  - Drop liblancelot0a and liblancelot-dev packages; Upstream has broken ABI
    without an .so version bump, and after discussion with Debian it was
    decided it was not worth it to ship an unstable library.
  - Add liblancelot files to plasma-widget-lancelot, adding appropriate
    Replaces: entries
* Switch to source format 3.0 (quilt):
  - Bump debhelper build-depend version to 7.3.16 or greater

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define BOARDKEY_H
22
22
 
23
23
#include <widget.h>
24
 
#include <plasma/widgets/pushbutton.h>
25
 
 
26
 
class PlasmaboardWidget;
27
 
 
28
 
class BoardKey : public Plasma::PushButton  {
29
 
         Q_OBJECT
 
24
 
 
25
class BoardKey  {
 
26
 
30
27
public:
31
 
        BoardKey(PlasmaboardWidget *parent);
32
 
        virtual ~BoardKey();
33
 
 
34
 
        unsigned int getKeycode();
35
 
 
36
 
        /*
37
 
          Replaces text on the button. Warning! This does not trigger a repaint for performance reasons.
38
 
          If you are updating an already painted button, call update() !
39
 
          */
40
 
        void setText(QString text);
41
 
        QString text();
 
28
    BoardKey(QPoint relativePosition, QSize relativeSize, unsigned int keycode);
 
29
    virtual ~BoardKey();
 
30
 
 
31
    bool contains (const QPoint &point) const;
 
32
    bool intersects (const QRectF &rect) const;
 
33
    unsigned int getKeycode() const;
 
34
    unsigned int getKeysymbol(int level) const;
 
35
    virtual QString label() const;
 
36
    virtual void paint(QPainter *painter);
 
37
    QPoint position() const;
 
38
    /**
 
39
      * called when button is pressed
 
40
      */
 
41
    virtual void pressed();
 
42
 
 
43
    virtual void pressRepeated();
 
44
    QRectF rect() const;
 
45
    QSize relativeSize() const;
 
46
    /**
 
47
      * called when button is pressed
 
48
      */
 
49
    virtual void released();
 
50
    /**
 
51
      * Called to "unpress" the button
 
52
      */
 
53
    virtual void reset();
 
54
    void setKeycode(unsigned int keycode);
 
55
    virtual void setPixmap(QPixmap *pixmap);
 
56
    QSize size() const;
 
57
    virtual void unpressed();
 
58
    void updateDimensions(double factor_x, double factor_y);
 
59
 
 
60
protected:    
 
61
    void sendKey();
 
62
    virtual void sendKeyPress();
 
63
    virtual void sendKeyRelease();
 
64
    void setUpPainter(QPainter *painter) const;
 
65
 
42
66
private:
43
 
        QTimer* m_pushUp;
44
 
        QString labelText;
45
 
        int fontSize;
46
 
 
47
 
public Q_SLOTS:
48
 
        void sendKeycodePress();
49
 
        void sendKeycodeRelease();
50
 
        void sendKeycodeToggled();
51
 
 
52
 
 
53
 
protected Q_SLOTS:
54
 
        /*
55
 
         * Called to "unpress" the button
56
 
         */
57
 
        void reset();
58
 
        /*
59
 
         * called when button is pressed
60
 
         */
61
 
        virtual void pressed();
62
 
        /*
63
 
         * called when button is pressed
64
 
         */
65
 
        virtual void released();
66
 
 
67
 
protected:
68
 
        void setUpPainter(QPainter *painter);
69
 
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
70
 
        unsigned int keycode;
 
67
    unsigned int m_keycode;
 
68
    QPixmap* m_pixmap;
 
69
    QPoint m_relativePosition;
 
70
    QRectF m_rect;
 
71
    QSize m_relativeSize;
71
72
 
72
73
};
73
74