123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #pragma once
- #include "config.h"
- #include "LabelSet.h"
- #include <memory>
- class Key
- {
- public:
- virtual bool hitTest(const CPoint& pt) const = 0;
- virtual BYTE getState() const = 0;
- virtual BYTE getVkey() const = 0;
- virtual LPCTSTR getLabel() const = 0;
- virtual const CRect& getRect() const = 0;
- virtual const LabelSetEx& getLabelSet() const = 0;
- virtual void press() = 0;
- virtual void release() = 0;
- virtual void draw(CDC* pDc) const;
- virtual ~Key(void) {}
- public:
- static COLORREF clrBord[2];
- static COLORREF clrFill[2];
- static COLORREF clrText[2];
- };
- class SimpleKey : public Key
- {
- public:
- SimpleKey(LabelSetEx* _pls,const KeyConfig& _kc,int _unit,BYTE _stat);
- bool hitTest(const CPoint& pt) const;
- BYTE getState() const;
- BYTE getVkey() const;
- LPCTSTR getLabel() const;
- const CRect& getRect() const;
- const LabelSetEx& getLabelSet() const;
- void press();
- void release();
- ~SimpleKey();
- protected:
- SimpleKey();
- protected:
- LabelSetEx* pls;
- short id;
- short offset;
- CRect rt;
- BYTE vk;
- BYTE state;
- };
- class KeyDecorator : public Key
- {
- public:
- KeyDecorator(Key* _pkey);
- bool hitTest(const CPoint& pt) const;
- BYTE getState() const;
- BYTE getVkey() const;
- LPCTSTR getLabel() const;
- const CRect& getRect() const;
- const LabelSetEx& getLabelSet() const;
- virtual void press();
- virtual void release();
- protected:
- std::auto_ptr<Key> pkey;
- };
- class ShiftKey : public KeyDecorator
- {
- public:
- ShiftKey(Key* _pkey,short _id1,short _id2);
- void press();
- void release();
- private:
- short id1;
- short id2;
- };
- class LockKey : public KeyDecorator
- {
- public:
- LockKey(Key* _pkey,short _id);
- void press();
- void release();
- private:
- short id;
- };
|