//
//     Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

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

// PyKDE4 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 General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.


class KEditListBox : QGroupBox
{
%TypeHeaderCode
#include <keditlistbox.h>
%End


public:

    class CustomEditor
    {

    public:
                                CustomEditor ();
                                CustomEditor (QWidget* repWidget, KLineEdit* edit);
                                CustomEditor (KComboBox* combo);
        void                    setRepresentationWidget (QWidget* repWidget);
        void                    setLineEdit (KLineEdit* edit);
        virtual QWidget*        representationWidget () const;
        virtual KLineEdit*      lineEdit () const;

    private:
                                CustomEditor (const KEditListBox::CustomEditor&);

    public:
    };   // CustomEditor


public:

    enum Button
    {
        Add,
        Remove,
        UpDown,
        All
    };

    typedef QFlags<KEditListBox::Button> Buttons;

    explicit                KEditListBox (QWidget* parent /TransferThis/ = 0);
    explicit                KEditListBox (const QString& title, QWidget* parent /TransferThis/ = 0);
    explicit                KEditListBox (QWidget* parent /TransferThis/, const char* name, bool checkAtEntering = 0, KEditListBox::Buttons buttons = KEditListBox::All);
    explicit                KEditListBox (const QString& title, QWidget* parent /TransferThis/, const char* name, bool checkAtEntering = 0, KEditListBox::Buttons buttons = KEditListBox::All);
                            KEditListBox (const QString& title, const KEditListBox::CustomEditor& customEditor, QWidget* parent /TransferThis/ = 0, const char* name = 0, bool checkAtEntering = 0, KEditListBox::Buttons buttons = KEditListBox::All);
    QListView*              listView () const;
    KLineEdit*              lineEdit () const;
    QPushButton*            addButton () const;
    QPushButton*            removeButton () const;
    QPushButton*            upButton () const;
    QPushButton*            downButton () const;
    int                     count () const;
    void                    insertStringList (const QStringList& list, int index = -1);
    void                    insertItem (const QString& text, int index = -1);
    void                    clear ();
    QString                 text (int index) const;
    int                     currentItem () const;
    QString                 currentText () const;
    QStringList             items () const;
    void                    setItems (const QStringList& items);
    KEditListBox::Buttons   buttons () const;
    void                    setButtons (KEditListBox::Buttons buttons);
    void                    setCheckAtEntering (bool check);
    bool                    checkAtEntering ();

    void                    setCustomEditor (const KEditListBox::CustomEditor& editor);
    bool                    eventFilter (QObject* o, QEvent* e);


signals:
    void                    changed ();
    void                    added (const QString& text);
    void                    removed (const QString& text);

protected:
    void                    moveItemUp ();
    void                    moveItemDown ();
    void                    addItem ();
    void                    removeItem ();
    void                    enableMoveButtons (const QModelIndex&, const QModelIndex&);
    void                    typedSomething (const QString& text);

private:
                            KEditListBox (const KEditListBox&);
};   // KEditListBox


