Keyboard.h 613 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "LabelSet.h"
  3. #include "Key.h"
  4. #include <vector>
  5. #include <stack>
  6. class Keyboard
  7. {
  8. public:
  9. Keyboard(CWnd* _pWnd = NULL);
  10. void rebind(CWnd* _pWnd);
  11. const CSize& getSize() const;
  12. void draw();
  13. int hit(const CPoint& pt);
  14. bool press(int index);
  15. bool release(int index);
  16. ~Keyboard(void);
  17. protected:
  18. void initLabelSet(BYTE states[]);
  19. void initKeys(BYTE states[]);
  20. void releaseAll(CDC* pDc);
  21. private:
  22. int unit;
  23. LabelSetEx ls;
  24. std::vector<Key*> keys;
  25. std::stack<Key*> keyStack;
  26. //Key* keys[256];
  27. CSize sz;
  28. CWnd* pWnd;
  29. Key* pCur;
  30. };