summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/action_list_widget.h
blob: c2f32477e9a6e078c3fe13be6251dfd84e4047af (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/****************************************************************************

 KHotKeys
 
 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>

 Distributed under the terms of the GNU General Public License version 2.
 
****************************************************************************/

#ifndef _ACTION_LIST_WIDGET_H_
#define _ACTION_LIST_WIDGET_H_

#include <tqlistview.h>

#include <actions.h>
#include <kdialogbase.h>

#include <action_list_widget_ui.h>

#include "activate_window_widget.h"

namespace KHotKeys
{

class Action_data;
class Command_url_widget;
class Menuentry_widget;
class Dcop_widget;
class Keyboard_input_widget;

class Action_list_item;

class Action_list_widget
    : public Action_list_widget_ui
    {
    Q_OBJECT
    public:
        Action_list_widget( TQWidget* parent_P = NULL, const char* name_P = NULL );
        virtual ~Action_list_widget();
        void set_data( const Action_list* data_P );
        Action_list* get_data( Action_data* data_P ) const;
    public slots:
        void clear_data();
    protected:
        Action_list_item* create_listview_item( Action* action_P, TQListView* parent1_P,
            TQListViewItem* parent2_P, TQListViewItem* after_P, bool copy_P );
        void edit_listview_item( Action_list_item* item_P );
        enum type_t { TYPE_COMMAND_URL_ACTION, TYPE_MENUENTRY_ACTION, TYPE_DCOP_ACTION,
            TYPE_KEYBOARD_INPUT_ACTION, TYPE_ACTIVATE_WINDOW_ACTION };
    protected slots:
        void new_selected( int type_P );
        virtual void copy_pressed();
        virtual void delete_pressed();
        virtual void modify_pressed();
        virtual void current_changed( TQListViewItem* item_P );
    protected:
        Action_list_item* selected_item;
    };

typedef Action_list_widget Action_list_tab;

class Action_list_item
    : public TQListViewItem
    {
    public:
        Action_list_item( TQListView* parent_P, Action* action_P );
        Action_list_item( TQListViewItem* parent_P, Action* action_P );
        Action_list_item( TQListView* parent_P, TQListViewItem* after_P, Action* action_P );
        Action_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, Action* action_P );
        virtual ~Action_list_item();
        virtual TQString text( int column_P ) const;
        Action* action() const;
        void set_action( Action* action_P );
    protected:
        Action* _action; // owns it
    };
        
class Action_dialog
    {
    public:
        virtual Action* edit_action() = 0;
        virtual ~Action_dialog();
    };
    
class Command_url_action_dialog
    : public KDialogBase, public Action_dialog
    {
    Q_OBJECT
    public:
        Command_url_action_dialog( Command_url_action* action_P );
        virtual Action* edit_action();
    protected:
        virtual void accept();
        Command_url_widget* widget;
        Command_url_action* action;
    };
        
class Menuentry_action_dialog
    : public KDialogBase, public Action_dialog
    {
    Q_OBJECT
    public:
        Menuentry_action_dialog( Menuentry_action* action_P );
        virtual Action* edit_action();
    protected:
        virtual void accept();
        Menuentry_widget* widget;
        Menuentry_action* action;
    };
        
class Dcop_action_dialog
    : public KDialogBase, public Action_dialog
    {
    Q_OBJECT
    public:
        Dcop_action_dialog( Dcop_action* action_P );
        virtual Action* edit_action();
    protected:
        virtual void accept();
        Dcop_widget* widget;
        Dcop_action* action;
    };
        
class Keyboard_input_action_dialog
    : public KDialogBase, public Action_dialog
    {
    Q_OBJECT
    public:
        Keyboard_input_action_dialog( Keyboard_input_action* action_P );
        virtual Action* edit_action();
    protected:
        virtual void accept();
        Keyboard_input_widget* widget;
        Keyboard_input_action* action;
    };
        
class Activate_window_action_dialog
    : public KDialogBase, public Action_dialog
    {
    Q_OBJECT
    public:
        Activate_window_action_dialog( Activate_window_action* action_P );
        virtual Action* edit_action();
    protected:
        virtual void accept();
        Activate_window_widget* widget;
        Activate_window_action* action;
    };
        
//***************************************************************************
// Inline
//***************************************************************************

// Action_list_item

inline
Action_list_item::Action_list_item( TQListView* parent_P, Action* action_P )
    : TQListViewItem( parent_P ), _action( action_P )
    {
    }
    
inline
Action_list_item::Action_list_item( TQListViewItem* parent_P, Action* action_P )
    : TQListViewItem( parent_P ), _action( action_P )
    {
    }

inline
Action_list_item::Action_list_item( TQListView* parent_P, TQListViewItem* after_P,
    Action* action_P )
    : TQListViewItem( parent_P, after_P ), _action( action_P )
    {
    }

inline
Action_list_item::Action_list_item( TQListViewItem* parent_P, TQListViewItem* after_P,
    Action* action_P )
    : TQListViewItem( parent_P, after_P ), _action( action_P )
    {
    }

inline
Action* Action_list_item::action() const
    {
    return _action;
    }
    
inline
void Action_list_item::set_action( Action* action_P )
    {
    delete _action;
    _action = action_P;
    }

// Action_dialog

inline
Action_dialog::~Action_dialog()
    {
    }

} // namespace KHotKeys

#endif