|
|
452870 |
#ifndef KEYBOARD_H
|
|
|
452870 |
#define KEYBOARD_H
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
#include "graph.h"
|
|
|
452870 |
#include "input.h"
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
struct Keyboard;
|
|
|
452870 |
typedef struct Keyboard Keyboard;
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
typedef struct Key {
|
|
|
452870 |
// keep these filds at the begining for easyest static initialization
|
|
|
452870 |
int x, y, w, h;
|
|
|
452870 |
unsigned int keySym;
|
|
|
452870 |
const char *label;
|
|
|
452870 |
const char *label2;
|
|
|
452870 |
|
|
|
452870 |
// these fields will be set while initialization
|
|
|
452870 |
Keyboard *kbd;
|
|
|
452870 |
TextLayout tl;
|
|
|
452870 |
TextLayout tl2;
|
|
|
452870 |
|
|
|
452870 |
// dynamic fields
|
|
|
452870 |
int down;
|
|
|
452870 |
} Key;
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
struct Keyboard {
|
|
|
452870 |
// keep these filds at the begining for easyest static initialization
|
|
|
452870 |
Key *keys;
|
|
|
452870 |
int keysCount;
|
|
|
452870 |
int w, h;
|
|
|
452870 |
|
|
|
452870 |
// these fields will be set while initialization
|
|
|
452870 |
App *app;
|
|
|
452870 |
|
|
|
452870 |
// dynamic fields
|
|
|
452870 |
Key *downKey;
|
|
|
452870 |
};
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
int keyInit(Key *k, Keyboard *kbd);
|
|
|
452870 |
void keyDeinit(Key *k);
|
|
|
452870 |
void keyDraw(Key *k, int cx, int cy, int cw, int ch);
|
|
|
452870 |
void keyDown(Key *k);
|
|
|
452870 |
void keyUp(Key *k);
|
|
|
452870 |
|
|
|
452870 |
int keyboardInit(Keyboard *kbd, App *app);
|
|
|
452870 |
void keyboardDeinit(Keyboard *kbd);
|
|
|
452870 |
void keyboardDraw(Keyboard *kbd, int cx, int cy, int cw, int ch);
|
|
|
452870 |
void keyboardMouseDown(Keyboard *kbd, int x, int y);
|
|
|
452870 |
void keyboardMouseUp(Keyboard *kbd);
|
|
|
452870 |
|
|
|
452870 |
|
|
|
452870 |
#endif
|