1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
#ifndef KEYPRESS_WIDGET_H
#define KEYPRESS_WIDGET_H
#include <pglabel.h>
#include <pgeventobject.h>
#include <pgmessageobject.h>
class KeyPressWidget : public PG_Label, public PG_EventObject
{
public:
KeyPressWidget(SDLKey key, PG_Widget *parent,
const PG_Rect &r, const char *style="ThemeWidget");
virtual ~KeyPressWidget();
inline SDLKey getKey()
{
return m_key;
}
void revertKey();
void saveKey();
protected:
bool eventKeyDown(const SDL_KeyboardEvent *key);
bool eventMouseButtonDown(const SDL_MouseButtonEvent *mouse);
void eventShow();
SDLKey m_key;
SDLKey m_oldKey;
bool m_focus;
};
#endif // KEYPRESS_WIDGET_H
|