summaryrefslogtreecommitdiffstats
path: root/khotkeys/kcontrol/windowdef_list_widget.h
blob: b49146a859664b6df75a511ce0e90700985407d6 (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
/****************************************************************************

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

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

#ifndef _WINDOWDEF_LIST_WIDGET_H_
#define _WINDOWDEF_LIST_WIDGET_H_

#include <tqlistview.h>

#include <kdialogbase.h>

#include <windows.h>
#include <windowdef_list_widget_ui.h>

namespace KHotKeys
{

class Action_data;
class Action_data_base;
class Windowdef_simple_widget;

class Windowdef_list_item;

class Windowdef_list_widget
    : public Windowdef_list_widget_ui
    {
    Q_OBJECT
    public:
        Windowdef_list_widget( TQWidget* parent_P = NULL, const char* name_P = NULL );
        virtual ~Windowdef_list_widget();
        void set_data( const Windowdef_list* data_P );
        Windowdef_list* get_data() const;
        void set_autodetect( TQObject* obj_P, const char* slot_P );
    public slots:
        void clear_data();
    protected:
        Windowdef_list_item* create_listview_item( Windowdef* window_P, TQListView* parent1_P,
            TQListViewItem* parent2_P, TQListViewItem* after_P, bool copy_P );
        void edit_listview_item( Windowdef_list_item* item_P );
        enum type_t { TYPE_WINDOWDEF_SIMPLE };
    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:
        TQObject* autodetect_object;
        const char* autodetect_slot;
        Windowdef_list_item* selected_item;
    };

typedef Windowdef_list_widget Windowdef_list_tab;

class Windowdef_list_item
    : public QListViewItem
    {
    public:
        Windowdef_list_item( TQListView* parent_P, Windowdef* window_P );
        Windowdef_list_item( TQListViewItem* parent_P, Windowdef* window_P );
        Windowdef_list_item( TQListView* parent_P, TQListViewItem* after_P, Windowdef* window_P );
        Windowdef_list_item( TQListViewItem* parent_P, TQListViewItem* after_P, Windowdef* window_P );
        virtual ~Windowdef_list_item();
        virtual TQString text( int column_P ) const;
        Windowdef* window() const;
        void set_window( Windowdef* window_P );
    protected:
        Windowdef* _window; // owns it
    };
        
class Windowdef_dialog
    {
    public:
        virtual Windowdef* edit_windowdef() = 0;
        virtual ~Windowdef_dialog();
    };
    
class Windowdef_simple_dialog
    : public KDialogBase, public Windowdef_dialog
    {
    Q_OBJECT
    public:
        Windowdef_simple_dialog( Windowdef_simple* window_P, TQObject* obj_P, const char* slot_P );
        virtual Windowdef* edit_windowdef();
    protected:
        virtual void accept();
        Windowdef_simple_widget* widget;
        Windowdef_simple* window;
    };
        
//***************************************************************************
// Inline
//***************************************************************************

// Windowdef_list_widget

inline
void Windowdef_list_widget::set_autodetect( TQObject* obj_P, const char* slot_P )
    {
    autodetect_object = obj_P;
    autodetect_slot = slot_P;
    }

// Windowdef_list_item

inline
Windowdef_list_item::Windowdef_list_item( TQListView* parent_P, Windowdef* window_P )
    : TQListViewItem( parent_P ), _window( window_P )
    {
    }
    
inline
Windowdef_list_item::Windowdef_list_item( TQListViewItem* parent_P, Windowdef* window_P )
    : TQListViewItem( parent_P ), _window( window_P )
    {
    }

inline
Windowdef_list_item::Windowdef_list_item( TQListView* parent_P, TQListViewItem* after_P,
    Windowdef* window_P )
    : TQListViewItem( parent_P, after_P ), _window( window_P )
    {
    }

inline
Windowdef_list_item::Windowdef_list_item( TQListViewItem* parent_P, TQListViewItem* after_P,
    Windowdef* window_P )
    : TQListViewItem( parent_P, after_P ), _window( window_P )
    {
    }

inline
Windowdef* Windowdef_list_item::window() const
    {
    return _window;
    }
    
inline
void Windowdef_list_item::set_window( Windowdef* window_P )
    {
    delete _window;
    _window = window_P;
    }

// Windowdef_dialog

inline
Windowdef_dialog::~Windowdef_dialog()
    {
    }

} // namespace KHotKeys

#endif