From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kxkb/kxkbtraywindow.h | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 kxkb/kxkbtraywindow.h (limited to 'kxkb/kxkbtraywindow.h') diff --git a/kxkb/kxkbtraywindow.h b/kxkb/kxkbtraywindow.h new file mode 100644 index 000000000..9c2c070c6 --- /dev/null +++ b/kxkb/kxkbtraywindow.h @@ -0,0 +1,92 @@ +// +// C++ Interface: kxkbtraywindow +// +// Description: +// +// +// Author: Andriy Rysin , (C) 2006 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef KXKBSYSTEMTRAY_H +#define KXKBSYSTEMTRAY_H + +#include + +#include +#include + +#include "kxkbconfig.h" + + +class QLabel; +class QPopupMenu; +class XkbRules; + +/* This class is responsible for displaying flag/label for the layout, + catching keyboard/mouse events and displaying menu when selected +*/ + +class KxkbLabelController: public QObject +{ +// Q_OBJECT + +public: + enum { START_MENU_ID = 100, CONFIG_MENU_ID = 130, HELP_MENU_ID = 131 }; + + KxkbLabelController(QLabel *label, QPopupMenu* contextMenu); + + void initLayoutList(const QValueList& layouts, const XkbRules& rule); + void setCurrentLayout(const LayoutUnit& layout); +// void setCurrentLayout(const QString& layout, const QString &variant); + void setError(const QString& layoutInfo=""); + void setShowFlag(bool showFlag) { m_showFlag = showFlag; } + void show() { label->show(); } + +// signals: +// +// void menuActivated(int); +// void toggled(); + +// protected: +// +// void mouseReleaseEvent(QMouseEvent *); + +private: + QLabel* label; + QPopupMenu* contextMenu; + + const int m_menuStartIndex; + bool m_showFlag; + int m_prevLayoutCount; + QMap m_descriptionMap; + + void setToolTip(const QString& tip); + void setPixmap(const QPixmap& pixmap); +}; + + +class KxkbSystemTray : public KSystemTray +{ + Q_OBJECT + + public: + KxkbSystemTray(): + KSystemTray(NULL) + {} + + void mouseReleaseEvent(QMouseEvent *ev) + { + if (ev->button() == QMouseEvent::LeftButton) + emit toggled(); + KSystemTray::mouseReleaseEvent(ev); + } + + signals: + void menuActivated(int); + void toggled(); +}; + + +#endif -- cgit v1.2.1