summaryrefslogtreecommitdiffstats
path: root/src/gui/propertieslistview.h
blob: c6ad8f73c88b03e1f39540fe95371ea1e5f162c4 (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
/***************************************************************************
 *   Copyright (C) 2003-2004 by David Saxton                               *
 *   david@bluehaze.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.                                   *
 ***************************************************************************/

#ifndef PROPERTIESLISTVIEW_H
#define PROPERTIESLISTVIEW_H

#include <klistview.h>
#include <qmap.h>

class CNItemGroup;
class ItemGroup;
class PIEditor;
class PLVItem;
class QPushButton;

typedef QMap< QString, PLVItem * > PLVItemMap;

/**
@author Daniel Clarke
@author David Saxton
*/
class PropertiesListView : public KListView
{
Q_OBJECT
public:
	PropertiesListView( QWidget *parent = 0l, const char *name = 0l );
	~PropertiesListView();
	
public slots:
	/**
	 * Creates a new set of property items and inserts them into the widget.
	 */
	void slotCreate( ItemGroup * itemGroup );
	/**
	 * Updates the set of property items (enables/disables according to whether
	 * the items have differing values, etc). This will be called by slotCreate,
	 * and any time new items are selected / unselected.
	 */
	void slotUpdate( ItemGroup * itemGroup );
	/**
	 * Removes all property items from the widget.
	 */
	void slotClear();
	void slotSelectionChanged(QListViewItem *item);
	/**
	 * Whenthe selected items have different values, then the property editor
	 * for the disagreeing property will have a value taken from one of the
	 * items, but will also be disabled. This will enable all disabled property
	 * editors and set the items to the value contained.
	 */
	void slotMergeProperties();
	void slotSetDefaults();
	
protected slots:
	void headerSizeChanged(int section, int oldSize, int newSize);
	void slotDataChanged(const QString &id, QVariant data);
	void destroyEditor();
	
protected:
	virtual void wheelEvent( QWheelEvent *e );
	
	PIEditor *m_editor;
	QPushButton *m_diffBt;
	PLVItem *p_lastItem;
	PLVItemMap m_plvItemMap;
};

#endif