1 /****************************************************************************
5 Copyright (C) 1999-2001 Lubos Lunak <l.lunak@kde.org>
7 Distributed under the terms of the GNU General Public License version 2.
9 ****************************************************************************/
11 #ifndef _ACTIONS_LISTVIEW_WIDGET_H_
12 #define _ACTIONS_LISTVIEW_WIDGET_H_
14 #include <Q3ListViewItem>
16 #include <khlistview.h>
18 #include <action_data.h>
24 class Action_listview_item
;
25 class Action_data_base
;
27 class Actions_listview_widget
: public QWidget
31 Actions_listview_widget( QWidget
* parent_P
= NULL
, const char* name_P
= NULL
);
32 Action_listview_item
* current_action() const;
33 void set_current_action( Action_listview_item
* item
);
34 Action_data_base
* current_action_data() const;
35 void set_action_data( Action_data_base
* data_P
, bool recent_action_P
= false );
36 void action_name_changed( const QString
& name_P
);
39 void new_action( Action_data_base
* data_P
);
42 Action_listview_item
* create_item( Q3ListViewItem
* parent_P
, Q3ListViewItem
* after_P
, Action_data_base
* data_P
);
43 void build_up_recursively( Action_data_group
* parent_P
,
44 Action_listview_item
* item_parent_P
);
45 Action_listview_item
* recent_item
;
46 Action_listview_item
* saved_current_item
;
47 KHListView
* actions_listview
;
49 void item_moved( Q3ListViewItem
* item_P
, Q3ListViewItem
* was_after_P
, Q3ListViewItem
* after_P
);
50 void current_changed( Q3ListViewItem
* item_P
);
52 void current_action_changed();
55 // CHECKME a jak to bude s parent itemu, kdyz Action_data uz maji vlastni parent ?
56 class Action_listview_item
57 : public Q3ListViewItem
60 virtual QString
text( int column_P
) const;
61 Action_data_base
* data() const;
62 void set_data( Action_data_base
* data_P
);
63 Action_listview_item( Q3ListView
* parent_P
, Q3ListViewItem
* after_P
,
64 Action_data_base
* data_P
);
65 Action_listview_item( Q3ListViewItem
* parent_P
, Q3ListViewItem
* after_P
,
66 Action_data_base
* data_P
);
68 Action_data_base
* _data
; // CHECKME doesn't own !!!
71 //***************************************************************************
73 //***************************************************************************
75 // Actions_listview_widget
78 Action_listview_item
* Actions_listview_widget::current_action() const
80 return saved_current_item
;
84 Action_data_base
* Actions_listview_widget::current_action_data() const
86 return current_action() != NULL
? current_action()->data() : NULL
;
90 void Actions_listview_widget::clear()
92 actions_listview
->clear();
94 saved_current_item
= 0;
100 // Action_listview_item
103 Action_listview_item::Action_listview_item( Q3ListView
* parent_P
, Q3ListViewItem
* after_P
,
104 Action_data_base
* data_P
)
105 : Q3ListViewItem( parent_P
, after_P
), _data( data_P
)
107 if( dynamic_cast< Action_data_group
* >( data_P
))
108 setExpandable( true );
112 Action_listview_item::Action_listview_item( Q3ListViewItem
* parent_P
, Q3ListViewItem
* after_P
,
113 Action_data_base
* data_P
)
114 : Q3ListViewItem( parent_P
, after_P
), _data( data_P
)
116 if( dynamic_cast< Action_data_group
* >( data_P
))
117 setExpandable( true );
121 Action_data_base
* Action_listview_item::data() const
127 void Action_listview_item::set_data( Action_data_base
* data_P
)
132 } // namespace KHotKeys