blob: 2e3a568a0a1b1ac6ce62d667a86ca96b2b80bdde [file] [log] [blame]
Martin Koegler498ef462011-09-04 07:04:43 +00001/* Copyright 2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
2 * Copyright 2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
3 *
4 * This is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this software; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 * USA.
18 */
19
20#include <string.h>
21#include <FL/Fl.H>
22
23#include "menukey.h"
24#include "parameters.h"
25
26static const MenuKeySymbol menuSymbols[] = {
27 {"F1", FL_F + 1},
28 {"F2", FL_F + 2},
29 {"F3", FL_F + 3},
30 {"F4", FL_F + 4},
31 {"F5", FL_F + 5},
32 {"F6", FL_F + 6},
33 {"F7", FL_F + 7},
34 {"F8", FL_F + 8},
35 {"F9", FL_F + 9},
36 {"F10", FL_F + 10},
37 {"F11", FL_F + 11},
38 {"F12", FL_F + 12},
39 {"Pause", FL_Pause},
40 {"Print", FL_Print},
41 {"Scroll_Lock", FL_Scroll_Lock},
42 {"Escape", FL_Escape},
43 {"Insert", FL_Insert},
44 {"Delete", FL_Delete},
45 {"Home", FL_Home},
46 {"Page_Up", FL_Page_Up},
47 {"Page_Down", FL_Page_Down},
48};
49
50int getMenuKeySymbolCount()
51{
52 return sizeof(menuSymbols)/sizeof(menuSymbols[0]);
53}
54
55const MenuKeySymbol* getMenuKeySymbols()
56{
57 return menuSymbols;
58}
59
60int getMenuKeyCode()
61{
62 const char *menuKeyStr;
63 int menuKeyCode = 0;
64
65 menuKeyStr = menuKey;
66 for(int i = 0; i < getMenuKeySymbolCount(); i++)
67 if (!strcmp(menuSymbols[i].name, menuKeyStr))
68 menuKeyCode = menuSymbols[i].keycode;
69
70 return menuKeyCode;
71}