aboutsummaryrefslogtreecommitdiff
path: root/src/keys.hh
blob: 40c01718af4fbfefb531153fbef36df4ddbd9366 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * Key parser
 *
 * Copyright (C) 2009 Jorge Arellano Cid <jcid@dillo.org>
 * Copyright (C) 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 */

#ifndef __KEYS_HH__
#define __KEYS_HH__


typedef enum {
   KEYS_INVALID = -1,
   KEYS_NOP,   /* No operation bound */
   KEYS_OPEN,
   KEYS_NEW_WINDOW,
   KEYS_NEW_TAB,
   KEYS_LEFT_TAB,
   KEYS_RIGHT_TAB,
   KEYS_CLOSE_TAB,
   KEYS_FIRST_TAB,
   KEYS_LAST_TAB,
   KEYS_FIND,
   KEYS_WEBSEARCH,
   KEYS_BOOKMARKS,
   KEYS_RELOAD,
   KEYS_STOP,
   KEYS_SAVE,
   KEYS_HIDE_PANELS,
   KEYS_FILE_MENU,
   KEYS_CLOSE_ALL,
   KEYS_BACK,
   KEYS_FORWARD,
   KEYS_GOTO,
   KEYS_HOME,
   KEYS_VIEW_SOURCE,
   KEYS_SCREEN_UP,
   KEYS_SCREEN_DOWN,
   KEYS_SCREEN_LEFT,
   KEYS_SCREEN_RIGHT,
   KEYS_LINE_UP,
   KEYS_LINE_DOWN,
   KEYS_LEFT,
   KEYS_RIGHT,
   KEYS_TOP,
   KEYS_BOTTOM,
   KEYS_ZOOM_IN,
   KEYS_ZOOM_OUT,
   KEYS_ZOOM_RESET
} KeysCommand_t;

class Keys {
private:
   static int nodeByKeyCmp(const void *node, const void *key);
   static void delKeyCmd(int key, int mod);
   static KeysCommand_t getCmdCode(const char *symbolName);
   static int getKeyCode(char *keyName);
   static int getModifier(char *modifierName);
   static void parseKey(char *key, char *symbol);
   static const char *getKeyName(int key);
public:
   static void init();
   static void free();
   static void parse(FILE *fp);
   static KeysCommand_t getKeyCmd(void);
   static int getShortcut(KeysCommand_t cmd);
   static void genAboutKeys(void);
};


#endif /* __KEYS_HH__ */