00001 #ifndef MYTHUIVIRTUALKEYBOARD_H_
00002 #define MYTHUIVIRTUALKEYBOARD_H_
00003
00004 #include "mythscreentype.h"
00005
00006 class QKeyEvent;
00007
00009 enum PopupPosition
00010 {
00011 VK_POSABOVEEDIT = 1,
00012 VK_POSBELOWEDIT,
00013 VK_POSTOPDIALOG,
00014 VK_POSBOTTOMDIALOG,
00015 VK_POSCENTERDIALOG
00016 };
00017
00018 struct KeyDefinition
00019 {
00020 QString name;
00021 QString type;
00022 QString normal, shift, alt, altshift;
00023 QString up, down, left, right;
00024 };
00025
00036 class MUI_PUBLIC MythUIVirtualKeyboard : public MythScreenType
00037 {
00038 Q_OBJECT
00039
00040 public:
00041 MythUIVirtualKeyboard(MythScreenStack *parentStack, MythUITextEdit *m_parentEdit);
00042 ~MythUIVirtualKeyboard();
00043 bool Create(void);
00044 bool keyPressEvent(QKeyEvent *e);
00045
00046 signals:
00047 void keyPressed(QString key);
00048
00049 protected slots:
00050 void charClicked(void);
00051 void shiftClicked(void);
00052 void delClicked(void);
00053 void lockClicked(void);
00054 void altClicked(void);
00055 void compClicked(void);
00056 void moveleftClicked(void);
00057 void moverightClicked(void);
00058 void backClicked(void);
00059 void returnClicked(void);
00060
00061 private:
00062 void loadKeyDefinitions(const QString &lang);
00063 void parseKey(const QDomElement &element);
00064 void updateKeys(bool connectSignals = false);
00065 QString decodeChar(QString c);
00066 QString getKeyText(KeyDefinition key);
00067
00068 MythUITextEdit *m_parentEdit;
00069 PopupPosition m_preferredPos;
00070
00071 QMap<QString, KeyDefinition> m_keyMap;
00072
00073 MythUIButton *m_lockButton;
00074 MythUIButton *m_altButton;
00075 MythUIButton *m_compButton;
00076 MythUIButton *m_shiftLButton;
00077 MythUIButton *m_shiftRButton;
00078
00079 bool m_shift;
00080 bool m_alt;
00081 bool m_lock;
00082
00083 bool m_composing;
00084 QString m_composeStr;
00085 };
00086
00087 #endif