You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menukey.cxx 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* 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. #include <string.h>
  20. #include <FL/Fl.H>
  21. #include "menukey.h"
  22. #include "parameters.h"
  23. static const MenuKeySymbol menuSymbols[] = {
  24. {"F1", FL_F + 1},
  25. {"F2", FL_F + 2},
  26. {"F3", FL_F + 3},
  27. {"F4", FL_F + 4},
  28. {"F5", FL_F + 5},
  29. {"F6", FL_F + 6},
  30. {"F7", FL_F + 7},
  31. {"F8", FL_F + 8},
  32. {"F9", FL_F + 9},
  33. {"F10", FL_F + 10},
  34. {"F11", FL_F + 11},
  35. {"F12", FL_F + 12},
  36. {"Pause", FL_Pause},
  37. {"Print", FL_Print},
  38. {"Scroll_Lock", FL_Scroll_Lock},
  39. {"Escape", FL_Escape},
  40. {"Insert", FL_Insert},
  41. {"Delete", FL_Delete},
  42. {"Home", FL_Home},
  43. {"Page_Up", FL_Page_Up},
  44. {"Page_Down", FL_Page_Down},
  45. };
  46. int getMenuKeySymbolCount()
  47. {
  48. return sizeof(menuSymbols)/sizeof(menuSymbols[0]);
  49. }
  50. const MenuKeySymbol* getMenuKeySymbols()
  51. {
  52. return menuSymbols;
  53. }
  54. int getMenuKeyCode()
  55. {
  56. const char *menuKeyStr;
  57. int menuKeyCode = 0;
  58. menuKeyStr = menuKey;
  59. for(int i = 0; i < getMenuKeySymbolCount(); i++)
  60. if (!strcmp(menuSymbols[i].name, menuKeyStr))
  61. menuKeyCode = menuSymbols[i].keycode;
  62. return menuKeyCode;
  63. }