summaryrefslogtreecommitdiffstats
path: root/sidebar/dndlistbox.h
blob: c5e2cfb59808e5bc871ef10be266766886e83646 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

#ifndef DNDLISTBOX_H
#define DNDLISTBOX_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <tdelistbox.h>
#include <tqptrlist.h>
#include <tqstringlist.h>
#include "baghirasidebariface.h"

class DCOPClient;
class TQDragEnterEvent;
class TQDragMoveEvent;
class TQDragLeaveEvent;
class TQDropEvent;
class TQKeyEvent;
class TQPoint;
class TDEPopupMenu;
class LinkConfig;
class ListBoxLink;
class ListBoxDevice;
class TQResizeEvent;

class ResizingLinkBox : public TDEListBox
{
    TQ_OBJECT
    
public:
   ResizingLinkBox( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 );
   ~ResizingLinkBox(){};
   void insertItem( const TQListBoxItem *, int index=-1 );
   void insertItem( const TQListBoxItem *lbi, const TQListBoxItem *after );
   void insertItem( const TQString & icon, const TQString & title, const TQString & url );
   void insertItem( const TQString &text, int index=-1 )
   {
      insertItem( new TQListBoxText(text), index );
   }
   void insertItem( const TQPixmap &pixmap, int index=-1 )
   {
      insertItem( new TQListBoxPixmap(pixmap), index );
   }
   void insertItem( const TQPixmap &pixmap, const TQString &text, int index=-1 ){
      insertItem( new TQListBoxPixmap(pixmap, text), index );
   }
   
   void removeItem( int index );
protected:
   void mousePressEvent ( TQMouseEvent * );
   void mouseReleaseEvent ( TQMouseEvent * );
   void contentsWheelEvent ( TQWheelEvent * );
   TDEPopupMenu *popupMenu;
   uint size_;
private slots:
   void setIconSize(int);
signals:
   void itemNumberChanged(bool);
   void scrolled(int,int);
};

class MediaListBox : public ResizingLinkBox, virtual public BaghiraSidebarIface
{
   TQ_OBJECT
public:
   MediaListBox( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 );
   ~MediaListBox();
   ListBoxDevice *createListBoxDevice(TQStringList & deviceProperties, uint n = 0);
   void mediumAdded(const TQString &name);
   void mediumRemoved(const TQString &name);
   void mediumChanged(const TQString &name);
   int index (const TQString & name );
   void removeItem( int index );
protected:
   void mousePressEvent ( TQMouseEvent * );
   void resizeEvent ( TQResizeEvent * );
private:
   TDEPopupMenu *devicePopup;
   DCOPClient *client;
   ListBoxDevice *currentFloppy;
   typedef TQPtrList<ListBoxDevice> DeviceList;
   DeviceList deviceList;
   TQStringList hiddenDevices;
private slots:
   void kfloppy();
   void toggleDevice(int id);
};

class DnDListBox : public ResizingLinkBox
{
    TQ_OBJECT
    
public:
     DnDListBox( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 );

    /** destructor */
    ~DnDListBox();
   void poof(ListBoxLink *link);

protected:
   void mousePressEvent ( TQMouseEvent * );
   void mouseReleaseEvent ( TQMouseEvent * );
   void mouseMoveEvent ( TQMouseEvent * e );
   void dragEnterEvent ( TQDragEnterEvent * );
//    void dragMoveEvent ( TQDragMoveEvent * );
//    void dragLeaveEvent ( TQDragLeaveEvent * );
   void dropEvent ( TQDropEvent * );
   void startDrag();
private:
   ListBoxLink *currentItem; //TODO: unshadow int TDEListBox::currentItem()
   LinkConfig *dialog;
   bool dragging_;
   void pasteURL(int mode, TQListBoxItem *after = 0);
   bool _draggedMe;
   int _poofIndex;
   TQPixmap *_poofPix;
   TQPixmap *_poofAnimPix;
   TQWidget *_poof;
private slots:
   void configureLink();
   void updateLink();
   void runPoof();
};

#endif