File indexing completed on 2024-12-01 13:34:28

0001 #ifndef ACTIVE_WINDOW_CONDITION_H
0002 #define ACTIVE_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 
0013 #include <QWindowList>
0014 
0015 class KConfigGroup;
0016 
0017 namespace KHotKeys
0018 {
0019 class Condition_list_base;
0020 class Windowdef_list;
0021 
0022 /**
0023  * @author Michael Jansen <kde@michael-jansen.biz>
0024  */
0025 class Q_DECL_EXPORT Active_window_condition : public QObject, public Condition
0026 {
0027     Q_OBJECT
0028     typedef Condition base;
0029 
0030 public:
0031     Active_window_condition(Windowdef_list *window_P, Condition_list_base *parent_P = nullptr);
0032     Active_window_condition(KConfigGroup &cfg_P, Condition_list_base *parent_P);
0033     ~Active_window_condition() override;
0034     bool match() const override;
0035     void cfg_write(KConfigGroup &cfg_P) const override;
0036     const Windowdef_list *window() const;
0037     Windowdef_list *window();
0038     Active_window_condition *copy() const override;
0039     const QString description() const override;
0040 public Q_SLOTS:
0041     void active_window_changed(WId);
0042 
0043 private:
0044     void init();
0045     void set_match();
0046     Windowdef_list *_window;
0047     bool is_match;
0048 };
0049 
0050 } // namespace KHotKeys
0051 
0052 #endif /* #ifndef ACTIVE_WINDOW_CONDITION_H */