File indexing completed on 2024-05-12 16:39:46
0001 /* This file is part of the KDE project 0002 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef EDITLISTVIEW_DIALOG_H 0021 #define EDITLISTVIEW_DIALOG_H 0022 0023 #include "kformdesigner_export.h" 0024 0025 #include <QHash> 0026 #include <QToolButton> 0027 #include <KPageDialog> 0028 0029 class QListView; 0030 class QListViewItem; 0031 class QListBoxItem; 0032 class KListViewItem; 0033 class KListView; 0034 class KListBox; 0035 class KPropertySet; 0036 class KProperty; 0037 class KPropertyEditorView; 0038 0039 namespace KFormDesigner 0040 { 0041 0042 //! A dialog to edit the contents of a listview (KListView or QListView) 0043 /*! The dialog contains two pages, one to edit columns and one to edit ist items. 0044 KPropertyEditorView is used in columns to edit column properties 0045 (there are two properties not supported by Qt Designer: 'width' and 'resizable'). 0046 The user can enter list contents inside the list 0047 using KListViewItem::setRenameable(). Pixmaps are not yet supported. */ 0048 class KFORMDESIGNER_EXPORT EditListViewDialog : public KPageDialog 0049 { 0050 Q_OBJECT 0051 0052 public: 0053 explicit EditListViewDialog(QWidget *parent); 0054 ~EditListViewDialog() {} 0055 0056 int exec(QListView *listview); 0057 0058 public Q_SLOTS: 0059 // Columns page 0060 void updateItemProperties(QListBoxItem*); 0061 void newItem(); 0062 void removeItem(); 0063 void MoveItemUp(); 0064 void MoveItemDown(); 0065 void changeProperty(KPropertySet& set, KProperty& property); 0066 0067 // Contents page 0068 void updateButtons(QListViewItem*); 0069 void newRow(); 0070 void newChildRow(); 0071 void removeRow(); 0072 void MoveRowUp(); 0073 void MoveRowDown(); 0074 0075 protected: 0076 /*! 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. 0077 This is used to copy the contents of a listview into another listview. */ 0078 void loadChildNodes(QListView *listview, QListViewItem *item, QListViewItem *parent); 0079 0080 protected: 0081 enum Buttons { BNewRow = 10, BNewChild, BRemRow, BRowUp, BRowDown , BColAdd = 20, BColRem, BColUp, BColDown }; 0082 KPropertyEditorView *m_editor; 0083 KPropertySet *m_propSet; 0084 KPageWidgetItem *m_columnsPageItem, *m_contentsPageItem; 0085 KListBox *m_listbox; 0086 KListView *m_listview; 0087 QHash<Buttons, QToolButton*> m_buttons; 0088 }; 0089 0090 } 0091 0092 #endif