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.

windowclasswatcher.h 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /***************************************************************************
  2. * Copyright (C) 2004 by Leonid Zeitlin *
  3. * lz@europe.com *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef WINDOWCLASSWATCHER_H
  21. #define WINDOWCLASSWATCHER_H
  22. #include "windowwatcher.h"
  23. #include <ntqmap.h>
  24. class TQString;
  25. /**
  26. This class watcher for active window changes and keeps a group per window class
  27. @author Leonid Zeitlin
  28. */
  29. class WindowClassWatcher : public WindowWatcher {
  30. Q_OBJECT
  31. private:
  32. typedef TQMap<WId, TQString> WinClassMap;
  33. WinClassMap m_win_class_map;
  34. struct KBClassInfo {
  35. int groupno;
  36. int next_groupno;
  37. int refcount;
  38. KBClassInfo() : refcount(0) {}
  39. };
  40. typedef TQMap<TQString, KBClassInfo> ClassGroupMap;
  41. ClassGroupMap m_class_group_map;
  42. ClassGroupMap::Iterator m_active_class;
  43. TQString getWindowClass(WId id);
  44. protected:
  45. virtual void windowAdded(WId id);
  46. virtual void windowRemoved(WId id);
  47. virtual void activeWindowChanged(WId id);
  48. public:
  49. WindowClassWatcher(KBConfig *kbconf, TQObject *parent = 0, const char *name = 0);
  50. ~WindowClassWatcher();
  51. virtual void changeGroup(int groupno, int next_groupno);
  52. virtual void reset();
  53. };
  54. #endif