File: keyboard.h

package info (click to toggle)
literki 0.0.0+20100113.git1da40724-1.2
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 3,444 kB
  • ctags: 1,153
  • sloc: cpp: 5,263; makefile: 72
file content (46 lines) | stat: -rw-r--r-- 1,172 bytes parent folder | download | duplicates (2)
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
38
39
40
41
42
43
44
45
46
#ifndef _KEYBOARD_H
#define _KEYBOARD_H

#include <string>
#include <vector>

#include "keymap.h"
#include "applet.h"

struct KeyboardForegroundColors {
    std::vector<XColor> transparent;
    int cur_transparent;
    std::vector<XColor> opaque;
    int cur_opaque;

    KeyboardForegroundColors():cur_transparent(0), cur_opaque(0){}
};

class Keyboard : public Applet {
  public:
    Keyboard(AppletWindowParams params, 
	     const std::string& layout_landscape,
	     const std::string& layout_portrait,
	     KeyboardForegroundColors colors);
    virtual ~Keyboard(){}
    virtual AppAction OnMousePress(int x, int y);
    virtual AppAction OnMouseMove(int x, int y);
    virtual AppAction OnMouseRelease(int x, int y);

    virtual void OnRotate(Rotation rot);
    void Load(const std::string& layout);

  private:
    void DrawKey(MyWindow* win, Keymap::Key k, bool highlite = false);
    void DrawSym(MyWindow* win, int x, int y, Keymap::Key k, bool highlite);
    void DrawKeys();

    std::string layout_landscape,
		layout_portrait;
    Keymap keymap;
    KeyboardForegroundColors colors;
    int lastkeyx, lastkeyy;
    int lastpressx, lastpressy;
};

#endif