00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef KXKBSYSTEMTRAY_H
00013 #define KXKBSYSTEMTRAY_H
00014
00015 #include <ksystemtray.h>
00016
00017 #include <tqstring.h>
00018 #include <tqvaluelist.h>
00019
00020 #include "kxkbconfig.h"
00021
00022
00023 class TQLabel;
00024 class TQPopupMenu;
00025 class XkbRules;
00026
00027
00028
00029
00030
00031 class KxkbLabelController: public QObject
00032 {
00033
00034
00035 public:
00036 enum { START_MENU_ID = 100, CONFIG_MENU_ID = 130, HELP_MENU_ID = 131 };
00037
00038 KxkbLabelController(TQLabel *label, TQPopupMenu* contextMenu);
00039
00040 void initLayoutList(const TQValueList<LayoutUnit>& layouts, const XkbRules& rule);
00041 void setCurrentLayout(const LayoutUnit& layout);
00042
00043 void setError(const TQString& layoutInfo="");
00044 void setShowFlag(bool showFlag) { m_showFlag = showFlag; }
00045 void show() { label->show(); }
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 private:
00057 TQLabel* label;
00058 TQPopupMenu* contextMenu;
00059
00060 const int m_menuStartIndex;
00061 bool m_showFlag;
00062 int m_prevLayoutCount;
00063 TQMap<TQString, TQString> m_descriptionMap;
00064
00065 void setToolTip(const TQString& tip);
00066 void setPixmap(const TQPixmap& pixmap);
00067 };
00068
00069
00070 class KxkbSystemTray : public KSystemTray
00071 {
00072 Q_OBJECT
00073
00074 public:
00075 KxkbSystemTray():
00076 KSystemTray(NULL)
00077 {}
00078
00079 void mouseReleaseEvent(TQMouseEvent *ev)
00080 {
00081 if (ev->button() == TQMouseEvent::LeftButton)
00082 emit toggled();
00083 KSystemTray::mouseReleaseEvent(ev);
00084 }
00085
00086 signals:
00087 void menuActivated(int);
00088 void toggled();
00089 };
00090
00091
00092 #endif