//
//     Copyright 2006 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2005 Jim Bublitz and/or Phil Thompson
//     may also apply


//                 Generated by preSip
//            module tdeui  version KDE 3.5.3


// This software 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.
//
// This software 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 library; see the file COPYING.
// If not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


class TDEListView : TQListView
{
%TypeHeaderCode
#include <tdelistview.h>
%End


public:

    enum SelectionModeExt
    {
        Single, 
        Multi, 
        Extended, 
        NoSelection, 
        FileManager
    };

                         TDEListView (TQWidget* /TransferThis/ = 0, const char* = 0);
    virtual void         setAcceptDrops (bool);
    virtual bool         isExecuteArea (const TQPoint&);
    bool                 isExecuteArea (int);
    TQPtrList<TQListViewItem> selectedItems () const;

%If ( KDE_3_4_0 -  )
    TQPtrList<TQListViewItem> selectedItems (bool) const;
%End

    void                 moveItem (TQListViewItem*, TQListViewItem* /Transfer/, TQListViewItem*);
    TQListViewItem*       lastItem () const;
    TQListViewItem*       lastChild () const;

%If ( KDE_3_1_0 -  )
    KLineEdit*           renameLineEdit () const;
%End

    bool                 itemsMovable () const;
    bool                 itemsRenameable () const;
    bool                 dragEnabled () const;
    bool                 autoOpen () const;
    bool                 isRenameable (int) const;
    bool                 dropVisualizer () const;
    int                  tooltipColumn () const;
    bool                 createChildren () const;
    bool                 dropHighlighter () const;
    int                  dropVisualizerWidth () const;
    SelectionModeExt     selectionModeExt () const;
    int                  itemIndex (const TQListViewItem*) const;
    TQListViewItem*       itemAtIndex (int);
    void                 setFullWidth ();
    void                 setFullWidth (bool);
    bool                 fullWidth () const;

%If ( KDE_3_0_1 -  )
    virtual int          addColumn (const TQString&, int = -1);
    virtual int          addColumn (const TQIconSet&, const TQString&, int = -1);
    virtual void         removeColumn (int);
%End

    void                 setAlternateBackground (const TQColor&);
    const TQColor&        alternateBackground () const;
    void                 saveLayout (TDEConfig*, const TQString&) const;
    void                 restoreLayout (TDEConfig*, const TQString&);
    virtual void         setSorting (int, bool = 1);
    int                  columnSorted () const;
    bool                 ascendingSort () const;

%If ( KDE_3_2_0 -  )
    virtual void         takeItem (TQListViewItem*);

%If ( KDE_3_4_0 -  )
    void                 setShadeSortColumn (bool);
    bool                 shadeSortColumn () const;
%End

%End


signals:
    void                 executed (TQListViewItem*);
    void                 executed (TQListViewItem*, const TQPoint&, int);
    void                 dropped (TQDropEvent*, TQListViewItem*);
    void                 dropped (TDEListView*, TQDropEvent*, TQListViewItem*);
    void                 dropped (TDEListView*, TQDropEvent*, TQListViewItem* /Transfer/, TQListViewItem*);
    void                 dropped (TQDropEvent*, TQListViewItem* /Transfer/, TQListViewItem*);
    void                 moved ();
    void                 aboutToMove ();
    void                 moved (TQListViewItem*, TQListViewItem*, TQListViewItem*);
    void                 moved (TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>&);
    void                 itemRenamed (TQListViewItem*, const TQString&, int);
    void                 itemRenamed (TQListViewItem*);
    void                 menuShortCutPressed (TDEListView*, TQListViewItem*);
    void                 contextMenu (TDEListView*, TQListViewItem*, const TQPoint&);

%If ( KDE_3_3_0 -  )
    void                 itemAdded (TQListViewItem*);
    void                 itemRemoved (TQListViewItem*);
%End


public slots:
    virtual void         rename (TQListViewItem*, int);
    void                 setRenameable (int, bool = 1);
    virtual void         setItemsMovable (bool);
    virtual void         setItemsRenameable (bool);
    virtual void         setDragEnabled (bool);
    virtual void         setAutoOpen (bool);
    virtual void         setDropVisualizer (bool);
    void                 setDropVisualizerWidth (int);
    virtual void         setTooltipColumn (int);
    virtual void         setDropHighlighter (bool);
    virtual void         setCreateChildren (bool);
    void                 setSelectionModeExt (TDEListView::SelectionModeExt);

%If ( KDE_3_1_0 -  )
    void                 setTabOrderedRenaming (bool);
    bool                 tabOrderedRenaming () const;
%End


protected:
    bool                 below (const TQRect&, const TQPoint&);
    bool                 below (TQListViewItem*, const TQPoint&);
    virtual bool         event (TQEvent*);
    void                 emitExecute (TQListViewItem*, const TQPoint&, int);
    virtual void         focusInEvent (TQFocusEvent*);
    virtual void         focusOutEvent (TQFocusEvent*);
    virtual void         leaveEvent (TQEvent*);
    virtual TQString      tooltip (TQListViewItem*, int) const;
    virtual bool         showTooltip (TQListViewItem*, const TQPoint&, int) const;
    virtual void         contentsDragMoveEvent (TQDragMoveEvent*);
    virtual void         contentsMousePressEvent (TQMouseEvent*);
    virtual void         contentsMouseMoveEvent (TQMouseEvent*);
    virtual void         contentsMouseDoubleClickEvent (TQMouseEvent*);
    virtual void         contentsDragLeaveEvent (TQDragLeaveEvent*);
    virtual void         contentsMouseReleaseEvent (TQMouseEvent*);
    virtual void         contentsDropEvent (TQDropEvent*);
    virtual void         contentsDragEnterEvent (TQDragEnterEvent*);
//ig     virtual TQDragObject* dragObject () const;
    virtual bool         acceptDrag (TQDropEvent*) const;
    virtual TQRect        drawDropVisualizer (TQPainter*, TQListViewItem* /Transfer/, TQListViewItem*);
    virtual TQRect        drawItemHighlighter (TQPainter*, TQListViewItem*);
    virtual void         startDrag ();
    virtual void         keyPressEvent (TQKeyEvent*);
    virtual void         viewportPaintEvent (TQPaintEvent*);
    void                 activateAutomaticSelection ();
    void                 deactivateAutomaticSelection ();
    bool                 automaticSelection () const;
    virtual void         viewportResizeEvent (TQResizeEvent*);

%If ( KDE_3_2_0 -  )
    void                 disableAutoSelection ();
    void                 resetAutoSelection ();

%If ( KDE_3_3_0 -  )
    void                 doubleClicked (TQListViewItem*, const TQPoint&, int);
%End

%End


protected slots:
    void                 slotSettingsChanged (int);
    void                 slotMouseButtonClicked (int, TQListViewItem*, const TQPoint&, int);
    void                 doneEditing (TQListViewItem*, int);
    void                 cleanDropVisualizer ();
    void                 cleanItemHighlighter ();
    void                 emitContextMenu (TQListViewItem*, const TQPoint&, int);
    void                 emitContextMenu (TDEListView*, TQListViewItem*);
    void                 slotOnItem (TQListViewItem*);
    void                 slotOnViewport ();
    void                 slotAutoSelect ();

%If ( KDE_3_2_0 -  )
    void                 slotDragExpand ();
%End

    void                 slotHeaderChanged ();

protected:
    virtual void         movableDropEvent (TQListViewItem*, TQListViewItem*);
    virtual void         findDrop (const TQPoint&, TQListViewItem*&, TQListViewItem*&);
    void                 fileManagerKeyPressEvent (TQKeyEvent*);
    int                  depthToPixels (int);

protected:
//igx     virtual void         virtual_hook (int, void*);

signals:

%If (  - KDE_3_3_0 )
    void                 doubleClicked (TQListViewItem*, const TQPoint&, int);
%End


protected:
//force
    virtual TQDragObject* dragObject ();
//end

};  // class TDEListView


class TDEListViewItem : TQListViewItem
{
%TypeHeaderCode
#include <tdelistview.h>
%End


public:
                         TDEListViewItem (TQListView* /TransferThis/);
                         TDEListViewItem (TQListViewItem* /TransferThis/);
                         TDEListViewItem (TQListView* /TransferThis/, TQListViewItem*);
                         TDEListViewItem (TQListViewItem* /TransferThis/, TQListViewItem*);
                         TDEListViewItem (TQListView* /TransferThis/, TQString, TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null );
                         TDEListViewItem (TQListViewItem* /TransferThis/, TQString, TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null );
                         TDEListViewItem (TQListView* /TransferThis/, TQListViewItem*, TQString, TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null );
                         TDEListViewItem (TQListViewItem* /TransferThis/, TQListViewItem*, TQString, TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null , TQString = TQString ::null );

%If ( KDE_3_3_0 -  )
    virtual void         insertItem (TQListViewItem*);
    virtual void         takeItem (TQListViewItem*);
%End

    bool                 isAlternate ();
    const TQColor&        backgroundColor ();

%If ( KDE_3_4_0 -  )
    TQColor               backgroundColor (int);
%End

    virtual void         paintCell (TQPainter*, const TQColorGroup&, int, int, int);

};  // class TDEListViewItem



%MappedType TQPtrList<TQListViewItem>
//converts a Python list of TQListViewItem
{
%TypeHeaderCode
#include <tqptrlist.h>
#include <tqlistview.h>
typedef TQPtrList<TQListViewItem> ListViewItems;
%End

%ConvertFromTypeCode
    if (!sipCpp)
        return PyList_New (0);

    PyObject *pylist;

    // Create the list

    if ((pylist = PyList_New(0)) == NULL)
        return NULL;

    // Get it.

    TQPtrList<TQListViewItem> *cpplist = (TQPtrList<TQListViewItem> *)sipCpp;
    TQListViewItem *cpp;
    PyObject *inst;

    // the loop depends on the type of iterator the  template makes available
    for(cpp = cpplist->first (); cpp != 0; cpp = cpplist->next () )
    {
        if (((inst = sipConvertFromInstance (cpp, sipClass_TQListViewItem, sipTransferObj)) == NULL)
            || PyList_Append (pylist, inst) < 0)
        {
            Py_DECREF (pylist);
            return NULL;
        }
    }

    return pylist;
%End

%ConvertToTypeCode
    if (sipIsErr == NULL)
        return PyList_Check(sipPy);

    TQPtrList<TQListViewItem> *cpplist = new TQPtrList<TQListViewItem>;

    PyObject *elem;
    TQListViewItem *cpp;
    int iserr = 0;

    for (int i = 0; i < PyList_Size (sipPy); i++)
    {
        elem = PyList_GET_ITEM (sipPy, i);
        cpp = (TQListViewItem *)sipForceConvertToType(elem, sipType_TQListViewItem, sipTransferObj, SIP_NO_CONVERTORS, NULL, &iserr);

        if (iserr)
        {
            *sipIsErr = 1;
            delete cpplist;
            return 0;
        }

        cpplist->append (cpp);
    }

    *sipCppPtr = cpplist;

    return 1;
%End
};


