KKBSwitch – keyboard layout indicator
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.

kbconfig.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /***************************************************************************
  2. kbconfig.h - description
  3. -------------------
  4. begin : Sun Jul 8 2001
  5. copyright : (C) 2001 by Leonid Zeitlin
  6. email : lz@europe.com
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #ifndef KBCONFIG_H
  17. #define KBCONFIG_H
  18. #include "kbgroup.h"
  19. #include <ntqptrvector.h>
  20. #include <ntqvaluevector.h>
  21. #include <tdeconfig.h>
  22. #define ICONS_SECTION "Icons"
  23. #define OPTIONS_SECTION "Options"
  24. #define FLAG_ICON_WIDTH 21
  25. #define FLAG_ICON_HEIGHT 14
  26. class TDEGlobalAccel;
  27. typedef TQPtrVector<KBGroup> KBGroupVector;
  28. /**The class that stores configuration information of KBSwitch
  29. *@author Leonid Zeitlin
  30. */
  31. class KBConfig {
  32. public:
  33. enum IconStyle { ICON_FLAG, ICON_CODE, ICON_CODE_AND_FLAG };
  34. enum GroupScope { SCOPE_GLOBAL, SCOPE_CLASS, SCOPE_WINDOW };
  35. private:
  36. KBGroupVector m_groups;
  37. bool m_toggle_mode;
  38. int m_default_groupno;
  39. //bool m_perwindow_group;
  40. GroupScope m_group_scope;
  41. bool m_autostart;
  42. bool m_use_shortcuts;
  43. IconStyle m_icon_style;
  44. TDEGlobalAccel *m_keys;
  45. public:
  46. KBConfig();
  47. ~KBConfig();
  48. int groupCount() { return m_groups.count(); };
  49. KBGroup *getGroup(int groupno) { return m_groups[groupno]; };
  50. bool toggle_mode() {return m_toggle_mode; };
  51. /** No descriptions */
  52. void set_toggle_mode(bool value) {m_toggle_mode = value; };
  53. int default_groupno() { return m_default_groupno; };
  54. void set_default_groupno(int value) { m_default_groupno = value; };
  55. /*bool perwindow_group() { return m_perwindow_group; };
  56. void set_perwindow_group(int value) { m_perwindow_group = value; };*/
  57. GroupScope group_scope() { return m_group_scope; }
  58. void set_group_scope(GroupScope value) { m_group_scope = value; }
  59. bool autostart() { return m_autostart; }
  60. void set_autostart(bool value) { m_autostart = value; }
  61. IconStyle icon_style() { return m_icon_style; }
  62. void set_icon_style(IconStyle value) { m_icon_style = value; }
  63. bool use_shortcuts() { return m_use_shortcuts; }
  64. void set_use_shortcuts(bool value) { m_use_shortcuts = value; }
  65. TDEGlobalAccel *keys() { return m_keys; }
  66. /** Load the KBSwitch configration from the application TDEConfig object */
  67. void load(TDEConfig *config);
  68. /** Save the KBSwitch configration to the application TDEConfig object */
  69. void save(TDEConfig *config);
  70. /** No descriptions */
  71. /*void notifyChanged();*/
  72. /*static TQString entryForGroup(int i) {
  73. return TQString("Group%1").arg(i+1);
  74. }*/
  75. void drawIcons(IconStyle icon_style, TQValueVector<TQPixmap> *icons,
  76. TQStringList *iconpaths);
  77. void checkKeysEnabled();
  78. int getNextGroup(int groupno) {
  79. return groupno >= groupCount() - 1 ? 0 : groupno + 1;
  80. }
  81. private: // Private methods
  82. /** No descriptions */
  83. //void guessGroupPixmaps();
  84. /** No descriptions */
  85. //void drawDefaultPixmaps();
  86. /** No descriptions */
  87. //void loadConfiguredPixmaps(TDEConfig *config);
  88. void drawFlagPixmap(TQPixmap &pix, TQString &path, const TQString &code,
  89. int group, TDEConfig *config);
  90. void drawCodePixmap(TQPixmap &pix, const TQString &code);
  91. void drawCodeAndFlagPixmap(TQPixmap &pix, TQString &path,
  92. const TQString &countryCode, const TQString &langCode, int group,
  93. TDEConfig *config);
  94. void drawDefaultPixmap(TQPixmap &pix, int group);
  95. bool getGroupImage(TQImage &img, TQString &path, const TQString &code, int group,
  96. TDEConfig *config);
  97. void getXkbLayouts(TQStringList &layouts);
  98. };
  99. #endif