2 * Copyright (C) 2007 Andriy Rysin (rysin@kde.org)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
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.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include <QMouseEvent>
27 #include <plasma/applet.h>
28 #include <plasma/widgets/icon.h>
34 class KxkbApplet
: public Plasma::Applet
38 explicit KxkbApplet(QObject
*parent
, const QVariantList
&args
);
41 // void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,
42 // const QRect& contentsRect);
43 QSizeF
contentSizeHint() const;
47 // KxkbWidget* m_kxkbWidget;
52 Flexible widget to show layouts
54 class KxkbPlasmaWidget
: public KxkbWidget
59 enum { ICON
= 1, TEXT
= 2 };
61 KxkbPlasmaWidget(QGraphicsItem
* parent
=0, int controlType
=MENU_FULL
);
62 virtual ~KxkbPlasmaWidget() { delete m_menu
; } //delete m_indicatorWidget; }
63 // Plasma::Icon* widget() { return m_indicatorWidget; }
66 QMenu
* contextMenu() { return m_menu
; }
67 void setToolTip(const QString
& tip
) { m_indicatorWidget
->setToolTip(tip
); }
68 void setPixmap(const QPixmap
& pixmap
) { if( m_displayMode
==ICON
) m_indicatorWidget
->setIcon(pixmap
); }
69 void setText(const QString
& text
) { if (m_displayMode
==TEXT
) m_indicatorWidget
->setText(text
); }
70 void setVisible(bool visible
) { m_indicatorWidget
->setVisible(visible
); }
73 const int m_displayMode
;
74 Plasma::Icon
* m_indicatorWidget
;
79 K_EXPORT_PLASMA_APPLET(kxkb
, KxkbApplet
)