Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/woopsikeyboard.h
00001 #ifndef _WOOPSI_KEYBOARD_H_
00002 #define _WOOPSI_KEYBOARD_H_
00003 
00004 #include <nds.h>
00005 #include "woopsiarray.h"
00006 #include "gadgetstyle.h"
00007 #include "gadget.h"
00008 #include "gadgeteventhandler.h"
00009 #include "graphicsport.h"
00010 
00011 namespace WoopsiUI {
00012 
00013     class WoopsiKey;
00014     class WoopsiTimer;
00015     class KeyboardEventHandler;
00016 
00022     class WoopsiKeyboard : public Gadget, public GadgetEventHandler {
00023     public:
00024 
00034         WoopsiKeyboard(s16 x, s16 y, GadgetStyle* style = NULL);
00035 
00040         virtual void handleReleaseEvent(const GadgetEventArgs& e);
00041 
00046         virtual void handleReleaseOutsideEvent(const GadgetEventArgs& e);
00047 
00052         virtual void handleClickEvent(const GadgetEventArgs& e);
00053 
00058         virtual void handleActionEvent(const GadgetEventArgs& e);
00059 
00064         virtual void processKeyRelease(WoopsiKey* key);
00065 
00070         inline const bool isShiftDown() const { return _isShiftDown; };
00071 
00076         inline const bool isControlDown() const { return _isControlDown; };
00077 
00082         inline const bool isCapsLockDown() const { return _isCapsLockDown; };
00083 
00089         inline void addKeyboardEventHandler(KeyboardEventHandler* eventHandler) { _keyboardEventHandlers.push_back(eventHandler); };
00090 
00095         void removeKeyboardEventHandler(KeyboardEventHandler* eventHandler);
00096 
00097     protected:
00098         WoopsiKey* _shiftKey;           
00099         WoopsiKey* _controlKey;         
00100         WoopsiKey* _capsLockKey;        
00101         bool _isShiftDown;              
00102         bool _isControlDown;            
00103         bool _isCapsLockDown;           
00104         WoopsiTimer* _timer;            
00105         u32 _initialRepeatTime;         
00106         u32 _secondaryRepeatTime;       
00107         WoopsiArray<KeyboardEventHandler*> _keyboardEventHandlers;  
00115         virtual void drawBorder(GraphicsPort* port);
00116 
00121         void showCorrectKeys();
00122 
00126         void showNormalKeys();
00127 
00131         void showShiftKeys();
00132 
00136         void showControlKeys();
00137 
00141         void showShiftControlKeys();
00142 
00146         void showCapsLockKeys();
00147 
00151         void showControlCapsLockKeys();
00152 
00156         virtual inline ~WoopsiKeyboard() { };
00157 
00161         inline WoopsiKeyboard(const WoopsiKeyboard& keyboard) : Gadget(keyboard) { };
00162 
00167         void raiseKeyboardPressEvent(WoopsiKey* key);
00168 
00173         void raiseKeyboardRepeatEvent(WoopsiKey* key);
00174 
00179         void raiseKeyboardReleaseEvent(WoopsiKey* key);
00180     };
00181 }
00182 
00183 #endif
 All Classes Functions Variables Enumerations Enumerator