summaryrefslogtreecommitdiffstats
path: root/kexi/formeditor/editlistviewdialog.h
blob: 0eb3017b73b7827a8e961b8ebc2f2ac0892f75f6 (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
/* This file is part of the KDE project
   Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef EDITLISTVIEW_DIALOG_H
#define EDITLISTVIEW_DIALOG_H

#include <tqintdict.h>
#include <tqtoolbutton.h>
#include <kdialogbase.h>

class TQFrame;
class TQListView;
class TQListViewItem;
class KListViewItem;
class KListView;
class KListBox;
class TQListBoxItem;

namespace KoProperty {
	class Property;
	class Set;
	class Editor;
}

namespace KFormDesigner {

//! A dialog to edit the contents of a listvuew (KListView or TQListView)
/*! The dialog contains two pages, one to edit columns and one to edit ist items. 
 KoProperty::Editor is used in columns to edit column properties
 (there are two properties not supported by TQt Designer: 'width' and 'resizable'). 
 The user can enter list contents inside the list
 using KListViewItem::setRenameable(). Pixmaps are not yet supported. */
class KFORMEDITOR_EXPORT EditListViewDialog : public KDialogBase
{
	Q_OBJECT
  

	public:
		EditListViewDialog(TQWidget *parent);
		~EditListViewDialog() {}

		int exec(TQListView *listview);

	public slots:
		// Columns page
		void updateItemProperties(TQListBoxItem*);
		void newItem();
		void removeItem();
		void MoveItemUp();
		void MoveItemDown();
		void changeProperty(KoProperty::Set& set, KoProperty::Property& property);

		// Contents page
		void updateButtons(TQListViewItem*);
		void newRow();
		void newChildRow();
		void removeRow();
		void MoveRowUp();
		void MoveRowDown();

	protected:
		/*! Loads all child items of \a item into \a listview (may be different from the \a items 's listview) as child of \a parent item.
		This is used to copy the contents of a listview into another listview. */
		void loadChildNodes(TQListView *listview, TQListViewItem *item, TQListViewItem *parent);

	protected:
		enum { BNewRow = 10, BNewChild, BRemRow, BRowUp, BRowDown , BColAdd = 20, BColRem, BColUp, BColDown };
		KoProperty::Editor  *m_editor;
		KoProperty::Set  *m_propSet;
		TQFrame   *m_contents, *m_column;
		KListBox  *m_listbox;
		KListView  *m_listview;
		TQIntDict<TQToolButton>  m_buttons;
};

}

#endif