File: KeyPressWidget.h

package info (click to toggle)
moagg 0.18-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,924 kB
  • ctags: 4,059
  • sloc: cpp: 23,814; sh: 2,652; makefile: 283
file content (37 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (3)
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