summaryrefslogtreecommitdiffstats
path: root/twin/kcmtwin/twinrules/ruleswidget.h
blob: f3f6f988149acd1c6826fdead3ce1c55b273d7ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * Copyright (c) 2004 Lubos Lunak <l.lunak@kde.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */


#ifndef __RULESWIDGET_H__
#define __RULESWIDGET_H__

#include <kdialogbase.h>
#include <twin.h>
#include <kshortcutdialog.h>

#include "ruleswidgetbase.h"
#include "editshortcutbase.h"

namespace KWinInternal
{

class Rules;
class DetectDialog;

class RulesWidget
    : public RulesWidgetBase
    {
    Q_OBJECT
    public:
        RulesWidget( TQWidget* parent = NULL, const char* name = NULL );
        void setRules( Rules* r );
        Rules* rules() const;
        bool finalCheck();
        void prepareWindowSpecific( WId window );
    signals:
        void changed( bool state );
    protected slots:
        virtual void detectClicked();
        virtual void wmclassMatchChanged();
        virtual void roleMatchChanged();
        virtual void titleMatchChanged();
        virtual void extraMatchChanged();
        virtual void machineMatchChanged();
        virtual void shortcutEditClicked();
    private slots:
        // geometry tab
        void updateEnableposition();
        void updateEnablesize();
        void updateEnabledesktop();
        void updateEnablemaximizehoriz();
        void updateEnablemaximizevert();
        void updateEnableminimize();
        void updateEnableshade();
        void updateEnablefullscreen();
        void updateEnableplacement();
        // preferences tab
        void updateEnableabove();
        void updateEnablebelow();
        void updateEnablenoborder();
        void updateEnableskiptaskbar();
        void updateEnableskippager();
        void updateEnableacceptfocus();
        void updateEnablecloseable();
        void updateEnableopacityactive();
        void updateEnableopacityinactive();
        // workarounds tab
        void updateEnablefsplevel();
        void updateEnablemoveresizemode();
        void updateEnabletype();
        void updateEnableignoreposition();
        void updateEnableminsize();
        void updateEnablemaxsize();
        void updateEnablestrictgeometry();
        void updateEnableshortcut();
        void updateEnabledisableglobalshortcuts();
        // internal
        void detected( bool );
    private:
        int desktopToCombo( int d ) const;
        int comboToDesktop( int val ) const;
        void prefillUnusedValues( const KWin::WindowInfo& info );
        DetectDialog* detect_dlg;
        bool detect_dlg_ok;
    };

class RulesDialog
    : public KDialogBase
    {
    Q_OBJECT
    public:
        RulesDialog( TQWidget* parent = NULL, const char* name = NULL );
        Rules* edit( Rules* r, WId window, bool show_hints );
    protected:
        virtual void accept();
    private slots:
        void displayHints();
    private:
        RulesWidget* widget;
        Rules* rules;
    };

class EditShortcut
    : public EditShortcutBase
    {
    Q_OBJECT
    public:
        EditShortcut( TQWidget* parent = NULL, const char* name = NULL );
    protected:
        void editShortcut();
        void clearShortcut();
    };

class EditShortcutDialog
    : public KDialogBase
    {
    Q_OBJECT
    public:
        EditShortcutDialog( TQWidget* parent = NULL, const char* name = NULL );
        void setShortcut( const TQString& cut );
        TQString shortcut() const;
    private:
        EditShortcut* widget;
    };

// slightly duped from utils.cpp
class ShortcutDialog
    : public TDEShortcutDialog
    {
    Q_OBJECT
    public:
        ShortcutDialog( const TDEShortcut& cut, TQWidget* parent = NULL, const char* name = NULL );
        virtual void accept();
    };

} // namespace

#endif