- Main Page
- Classes
- Files

- File List

# 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
    00021         class WoopsiKeyboard : public Gadget, public GadgetEventHandler {
    00022         public:
    00023
    00034                 WoopsiKeyboard(s16 x, s16 y, u32 flags, 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
    00120                 void showCorrectKeys();
    00121
    00125                 void showNormalKeys();
    00126
    00130                 void showShiftKeys();
    00131
    00135                 void showControlKeys();
    00136
    00140                 void showShiftControlKeys();
    00141
    00145                 void showCapsLockKeys();
    00146
    00150                 void showControlCapsLockKeys();
    00151
    00155                 virtual inline ~WoopsiKeyboard() { };
    00156
    00160                 inline WoopsiKeyboard(const WoopsiKeyboard& keyboard) : Gadget(keyboard) { };
    00161
    00166                 void raiseKeyboardPressEvent(WoopsiKey* key);
    00167
    00172                 void raiseKeyboardRepeatEvent(WoopsiKey* key);
    00173
    00178                 void raiseKeyboardReleaseEvent(WoopsiKey* key);
    00179         };
    00180 }
    00181
    00182 #endif