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.
26 #include <plasma/widgets/boxlayout.h>
28 #include "kxkbwidget.h"
30 #include "kxkb_applet.h"
35 KxkbPlasmaWidget::KxkbPlasmaWidget(QGraphicsItem
* parent
, int controlType
) :
36 KxkbWidget(controlType
),
39 // if( controlType == ICON )
40 m_indicatorWidget
= new Plasma::Icon(parent
);
41 m_indicatorWidget
->setIconSize(32,32);
42 connect(m_indicatorWidget
, SIGNAL(clicked()), this, SIGNAL(iconToggled()));
44 // m_indicatorWidget = new Plasma::PushButton(parent);
45 m_menu
= new QMenu(NULL
); // TODO: proper parent
51 KxkbApplet::KxkbApplet(QObject
*parent
, const QVariantList
&args
)
52 : Plasma::Applet(parent
, args
)
54 m_kxkbCore
= new KxkbCore(KxkbCore::KXKB_COMPONENT
);
55 if( m_kxkbCore
->newInstance() < 0 ) {
56 setFailedToLaunch(true);
59 new Plasma::HBoxLayout(this);
60 setDrawStandardBackground(true);
61 KxkbWidget
* kxkbWidget
= new KxkbPlasmaWidget(this, KxkbWidget::MENU_FULL
);
62 m_kxkbCore
->setWidget(kxkbWidget
);
63 // m_kxkbWidget = kxkbWidget;
65 //setCustomMenu(widget->history()->popup());
70 KxkbApplet::~KxkbApplet()
72 if (failedToLaunch()) {
74 // Do some cleanup here
80 QSizeF
KxkbApplet::contentSizeHint() const
82 // return QSizeF(m_kxkbCore->size());
86 void KxkbApplet::paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,
87 const QRect& contentsRect)
91 ((KxkbPlasmaWidget*)m_kxkbWidget)->widget()->paint(painter, option, NULL);
95 #include "kxkb_applet.moc"