~ubuntu-branches/ubuntu/maverick/newsbeuter/maverick

« back to all changes in this revision

Viewing changes to include/keymap.h

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2007-04-21 19:44:35 UTC
  • Revision ID: james.westby@ubuntu.com-20070421194435-21g6134ws2yvarlt
Tags: upstream-0.3
ImportĀ upstreamĀ versionĀ 0.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef NEWSBEUTER_KEYMAP__H
 
2
#define NEWSBEUTER_KEYMAP__H
 
3
 
 
4
#include <string>
 
5
#include <map>
 
6
#include <utility>
 
7
#include <vector>
 
8
 
 
9
#include <configparser.h>
 
10
 
 
11
// in configuration: bind-key <key> <operation>
 
12
 
 
13
#define KM_NEWSBEUTER (1<<0)
 
14
#define KM_PODBEUTER  (1<<1)
 
15
#define KM_BOTH (KM_NEWSBEUTER | KM_PODBEUTER)
 
16
 
 
17
namespace newsbeuter {
 
18
 
 
19
        enum operation {        OP_NIL = 0, 
 
20
                                                // general and newsbeuter-specific operations:
 
21
                                                OP_NB_MIN,
 
22
                                                OP_QUIT, 
 
23
                                                OP_RELOAD, 
 
24
                                                OP_RELOADALL, 
 
25
                                                OP_MARKFEEDREAD, 
 
26
                                                OP_MARKALLFEEDSREAD, 
 
27
                                                OP_OPEN, 
 
28
                                                OP_SAVE, 
 
29
                                                OP_NEXTUNREAD, 
 
30
                                                OP_OPENINBROWSER, 
 
31
                                                OP_HELP, 
 
32
                                                OP_TOGGLESOURCEVIEW, 
 
33
                                                OP_TOGGLEITEMREAD, 
 
34
                                                OP_TOGGLESHOWREAD, 
 
35
                                                OP_SHOWURLS,
 
36
                                                OP_CLEARTAG, 
 
37
                                                OP_SETTAG, 
 
38
                                                OP_SEARCH, 
 
39
                                                OP_ENQUEUE,
 
40
                                                OP_NB_MAX,
 
41
 
 
42
                                                // podbeuter-specific operations:
 
43
                                                OP_PB_MIN, 
 
44
                                                OP_PB_DOWNLOAD, 
 
45
                                                OP_PB_CANCEL, 
 
46
                                                OP_PB_DELETE,
 
47
                                                OP_PB_PURGE, 
 
48
                                                OP_PB_TOGGLE_DLALL, 
 
49
                                                OP_PB_MOREDL, 
 
50
                                                OP_PB_LESSDL, 
 
51
                                                OP_PB_PLAY, 
 
52
                                                OP_PB_MAX };
 
53
 
 
54
        class keymap : public config_action_handler {
 
55
                public:
 
56
                        keymap();
 
57
                        ~keymap();
 
58
                        void set_key(operation op, const std::string& key);
 
59
                        void unset_key(const std::string& key);
 
60
                        operation get_opcode(const std::string& opstr);
 
61
                        operation get_operation(const std::string& keycode);
 
62
                        std::string getkey(operation );
 
63
                        virtual action_handler_status handle_action(const std::string& action, const std::vector<std::string>& params);
 
64
                        void get_keymap_descriptions(std::vector<std::pair<std::string,std::string> >& descs, unsigned short flags);
 
65
                private:
 
66
                        std::map<std::string,operation> keymap_;
 
67
        };
 
68
 
 
69
}
 
70
 
 
71
 
 
72
#endif