00001 #ifndef _WOOPSI_KEY_H_ 00002 #define _WOOPSI_KEY_H_ 00003 00004 #include <nds.h> 00005 #include "button.h" 00006 00007 namespace WoopsiUI { 00008 00012 class WoopsiKey : public Button { 00013 public: 00014 00018 enum KeyType { 00019 KEY_NONE = 0, 00020 KEY_ALPHA_NUMERIC_SYMBOL = 1, 00021 KEY_RETURN = 3, 00022 KEY_CONTROL = 4, 00023 KEY_SHIFT = 5, 00024 KEY_CAPS_LOCK = 6, 00025 KEY_BACKSPACE = 7, 00026 KEY_SPACE = 8 00027 }; 00028 00037 enum KeyMode { 00038 KEY_MODE_NORMAL = 0, 00039 KEY_MODE_SHIFT = 1, 00040 KEY_MODE_CONTROL = 2, 00041 KEY_MODE_SHIFT_CONTROL = 3, 00042 KEY_MODE_CAPS_LOCK = 4, 00043 KEY_MODE_CONTROL_CAPS_LOCK = 5 00044 }; 00045 00057 WoopsiKey(s16 x, s16 y, u16 width, u16 height, const char* text, const KeyType keyType = KEY_ALPHA_NUMERIC_SYMBOL, FontBase* font = NULL); 00058 00075 WoopsiKey(s16 x, s16 y, u16 width, u16 height, const char* normalText, const char* shiftText, const char* controlText, const char* shiftControlText, const char* capsLockText, const char* controlCapsLockText, const KeyType keyType = KEY_ALPHA_NUMERIC_SYMBOL, FontBase* font = NULL); 00076 00087 WoopsiKey(s16 x, s16 y, u16 width, u16 height, const char glyph, const KeyType keyType = KEY_ALPHA_NUMERIC_SYMBOL, FontBase* font = NULL); 00088 00093 inline const KeyType getKeyType() const { return _keyType; }; 00094 00099 inline void setKeyType(KeyType keyType) { _keyType = keyType; }; 00100 00106 void setKeyMode(KeyMode keyMode); 00107 00114 const char getValue() const; 00115 00116 protected: 00117 KeyType _keyType; 00118 char* _normalText; 00119 char* _shiftText; 00120 char* _controlText; 00121 char* _shiftControlText; 00122 char* _capsLockText; 00123 char* _controlCapsLockText; 00124 KeyMode _keyMode; 00129 virtual inline ~WoopsiKey() { 00130 delete[] _normalText; 00131 delete[] _shiftText; 00132 delete[] _controlText; 00133 delete[] _shiftControlText; 00134 delete[] _capsLockText; 00135 delete[] _controlCapsLockText; 00136 }; 00137 00141 inline WoopsiKey(const WoopsiKey& key) : Button(key) { }; 00142 }; 00143 } 00144 00145 #endif