File indexing completed on 2024-04-28 05:51:09

0001 /*
0002  *  SPDX-FileCopyrightText: 2002-2003 Jesper K. Pedersen <blackie@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-only
0005  **/
0006 
0007 #ifndef __kmultiformlistboxwindowed
0008 #define __kmultiformlistboxwindowed
0009 
0010 #include "kmultiformlistbox-shower.h"
0011 #include <QWidget>
0012 
0013 class QVBoxLayout;
0014 class QListWidgetItem;
0015 class QListWidget;
0016 class WindowListboxItem;
0017 class KMultiFormListBoxFactory;
0018 class QPushButton;
0019 
0020 /**
0021    This class implements the windowed look for a @ref KMultiFormListBox
0022 
0023    @internal
0024 */
0025 class KMultiFormListBoxWindowed : public QWidget, KMultiFormListBoxShower
0026 {
0027     Q_OBJECT
0028 
0029     friend class KMultiFormListBox;
0030 
0031 private:
0032     KMultiFormListBoxWindowed(KMultiFormListBoxFactory *factory, QWidget *parent, bool showUpDownButtons, bool showHelpButton, const QString &addButtonText);
0033 
0034     KMultiFormListBoxEntryList elements() override;
0035     const KMultiFormListBoxEntryList elements() const;
0036     void append(KMultiFormListBoxEntry *) override;
0037     WindowListboxItem *selected();
0038     QWidget *qWidget() override
0039     {
0040         return this;
0041     }
0042 
0043     QVBoxLayout *_layout = nullptr;
0044     KMultiFormListBoxFactory *_factory = nullptr;
0045     QList<QPushButton *> _buttonList;
0046     QListWidget *_listbox = nullptr;
0047     void delElement(QWidget *) override; // Deletes the given element
0048     void delAnElement() override;
0049     void addElement() override;
0050 
0051 public Q_SLOTS:
0052     void addNewElement();
0053 
0054 Q_SIGNALS:
0055     void showHelp();
0056 
0057 private Q_SLOTS:
0058     void slotEditSelected();
0059     void slotEditSelected(QListWidgetItem *item);
0060     void slotCopySelected();
0061     void slotMoveItemUp();
0062     void slotMoveItemDown();
0063     void slotDeleteEntry();
0064     void slotUpdateButtonState();
0065 };
0066 
0067 #endif /* kmultiformlistboxwindowed */