File indexing completed on 2024-09-08 10:50:17
0001 #ifndef EXISTING_WINDOW_CONDITION_H 0002 #define EXISTING_WINDOW_CONDITION_H 0003 /* SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz> 0004 SPDX-FileCopyrightText: 1999-2001 Lubos Lunak <l.lunak@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 0009 #include "conditions/condition.h" 0010 0011 #include <QObject> 0012 #include <QString> 0013 #include <QWindowList> 0014 0015 #include <KConfig> // Needed because of some Qt Status redefinitions 0016 #include <KConfigGroup> // Needed because of some Qt Status redefinitions 0017 #include <config-X11.h> 0018 0019 #if HAVE_X11 0020 #include <X11/Xlib.h> 0021 #include <fixx11h.h> 0022 #else 0023 #define None 0 0024 #endif 0025 0026 namespace KHotKeys 0027 { 0028 class Condition_list_base; 0029 class Windowdef_list; 0030 0031 /** 0032 * @author Michael Jansen <kde@michael-jansen.biz> 0033 */ 0034 class Q_DECL_EXPORT Existing_window_condition : public QObject, public Condition 0035 { 0036 Q_OBJECT 0037 typedef Condition base; 0038 0039 public: 0040 Existing_window_condition(Windowdef_list *window_P, Condition_list_base *parent = nullptr); 0041 Existing_window_condition(KConfigGroup &cfg_P, Condition_list_base *parent_P); 0042 ~Existing_window_condition() override; 0043 bool match() const override; 0044 void cfg_write(KConfigGroup &cfg_P) const override; 0045 const Windowdef_list *window() const; 0046 Windowdef_list *window(); 0047 Existing_window_condition *copy() const override; 0048 const QString description() const override; 0049 public Q_SLOTS: 0050 void window_added(WId w_P); 0051 void window_removed(WId w_P); 0052 0053 private: 0054 void init(); 0055 void set_match(WId w_P = None); 0056 Windowdef_list *_window; 0057 bool is_match; 0058 }; 0059 0060 } // namespace KHotKeys 0061 0062 #endif /* #ifndef EXISTING_WINDOW_CONDITION_H */