Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- 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
    00022         class WoopsiKeyboard : public Gadget, public GadgetEventHandler {
    00023         public:
    00024
    00036                 WoopsiKeyboard(s16 x, s16 y, u32 flags, GadgetStyle* style = NULL);
    00037
    00042                 virtual void handleReleaseEvent(const GadgetEventArgs& e);
    00043
    00048                 virtual void handleReleaseOutsideEvent(const GadgetEventArgs& e);
    00049
    00054                 virtual void handleClickEvent(const GadgetEventArgs& e);
    00055
    00060                 virtual void handleActionEvent(const GadgetEventArgs& e);
    00061
    00066                 virtual void processKeyRelease(WoopsiKey* key);
    00067
    00072                 inline const bool isShiftDown() const { return _isShiftDown; };
    00073
    00078                 inline const bool isControlDown() const { return _isControlDown; };
    00079
    00084                 inline const bool isCapsLockDown() const { return _isCapsLockDown; };
    00085
    00091                 inline void addKeyboardEventHandler(KeyboardEventHandler* eventHandler) { _keyboardEventHandlers.push_back(eventHandler); };
    00092
    00097                 void removeKeyboardEventHandler(KeyboardEventHandler* eventHandler);
    00098
    00099         protected:
    00100                 WoopsiKey* _shiftKey;
    00101                 WoopsiKey* _controlKey;
    00102                 WoopsiKey* _capsLockKey;
    00103                 bool _isShiftDown;
    00104                 bool _isControlDown;
    00105                 bool _isCapsLockDown;
    00106                 WoopsiTimer* _timer;
    00107                 u32 _initialRepeatTime;
    00108                 u32 _secondaryRepeatTime;
    00109                 WoopsiArray<KeyboardEventHandler*> _keyboardEventHandlers;
    00117                 virtual void drawBorder(GraphicsPort* port);
    00118
    00123                 void showCorrectKeys();
    00124
    00128                 void showNormalKeys();
    00129
    00133                 void showShiftKeys();
    00134
    00138                 void showControlKeys();
    00139
    00143                 void showShiftControlKeys();
    00144
    00148                 void showCapsLockKeys();
    00149
    00153                 void showControlCapsLockKeys();
    00154
    00158                 virtual inline ~WoopsiKeyboard() { };
    00159
    00163                 inline WoopsiKeyboard(const WoopsiKeyboard& keyboard) : Gadget(keyboard) { };
    00164
    00169                 void raiseKeyboardPressEvent(WoopsiKey* key);
    00170
    00175                 void raiseKeyboardRepeatEvent(WoopsiKey* key);
    00176
    00181                 void raiseKeyboardReleaseEvent(WoopsiKey* key);
    00182         };
    00183 }
    00184
    00185 #endif