not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / kxkb / kxkb_applet.h
blob3cbaa4bf81d42d6cc03e5b2c0bfdaafa7129df62
1 /*
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.
20 #ifndef KXKBAPPLET_H
21 #define KXKBAPPLET_H
24 #include <QMouseEvent>
25 #include <QPixmap>
27 #include <plasma/applet.h>
28 #include <plasma/widgets/icon.h>
31 class QSizeF;
32 class KxkbCore;
34 class KxkbApplet : public Plasma::Applet
36 Q_OBJECT
37 public:
38 explicit KxkbApplet(QObject *parent, const QVariantList &args);
39 ~KxkbApplet();
41 // void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,
42 // const QRect& contentsRect);
43 QSizeF contentSizeHint() const;
45 private:
46 KxkbCore* m_kxkbCore;
47 // KxkbWidget* m_kxkbWidget;
52 Flexible widget to show layouts
54 class KxkbPlasmaWidget : public KxkbWidget
56 Q_OBJECT
58 public:
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; }
65 protected:
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); }
72 private:
73 const int m_displayMode;
74 Plasma::Icon* m_indicatorWidget;
75 QMenu* m_menu;
79 K_EXPORT_PLASMA_APPLET(kxkb, KxkbApplet)
81 #endif