summaryrefslogtreecommitdiffstats
path: root/kdeui/tests/kdockwidgetdemo.h
blob: ff9b1451b866346aba500bf5bc4444fb460854c1 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#ifndef KDOCKWIDGETDEMO_H
#define KDOCKWIDGETDEMO_H

#include <kdockwidget.h>

#include <tqdialog.h>
#include <tqlistview.h>
#include <tqstring.h>
#include <tqfile.h>
#include <tqfileinfo.h>
#include <tqtimer.h>
#include <tqscrollview.h>
#include <tqfiledialog.h>
#include <tqwidgetstack.h>
#include <tqvbox.h>
#include <tqurl.h>
#include <tqpixmap.h>

class TQMultiLineEdit;
class TQTextView;
class TQToolButton;
class TQSpinBox;
class TQShowEvent;
class TQPopupMenu;

class DirectoryView;
class CustomFileDialog;
class Preview;
class DirectoryView;

class SFileDialog : public QDialog
{Q_OBJECT

public:
	SFileDialog( TQString initially = TQString::null,
                                  const TQStringList& filter = "All Files ( * )", const char* name = 0 );
	~SFileDialog();

  static TQString getOpenFileName( TQString initially = TQString::null,
                                  const TQStringList& filter = "All Files ( * )",
                                  const TQString caption = TQString::null, const char* name = 0 );

  static TQStringList getOpenFileNames( TQString initially = TQString::null,
                                  const TQStringList& filter = "All Files ( * )",
                                  const TQString caption = TQString::null, const char* name = 0 );


protected:
  void showEvent( TQShowEvent *e );

protected slots:
  void dockChange();
  void setDockDefaultPos( KDockWidget* );
  void changeDir( const TQString& );

private:
  DirectoryView* dirView;
  CustomFileDialog* fd;
  Preview* preview;

  KDockManager* dockManager;
  KDockWidget* d_dirView;
  KDockWidget* d_preview;
  KDockWidget* d_fd;

  TQToolButton *b_tree;
  TQToolButton *b_preview;
};
/******************************************************************************************************/
class Directory : public QListViewItem
{
public:
    Directory( TQListView * parent, const TQString& filename );
    Directory( Directory * parent, const TQString& filename );

    TQString text( int column ) const;

    TQString fullName();

    void setOpen( bool );
    void setup();

private:
    TQFile f;
    Directory * p;
    bool readable;
};

class DirectoryView : public QListView
{Q_OBJECT
public:
  DirectoryView( TQWidget *parent = 0, const char *name = 0 );
  virtual void setOpen ( TQListViewItem *, bool );

  TQString selectedDir();

public slots:
  void setDir( const TQString & );

signals:
  void folderSelected( const TQString & );

protected slots:
  void slotFolderSelected( TQListViewItem * );

private:
  TQString fullPath(TQListViewItem* item);
};
/******************************************************************************************************/
class PixmapView : public QScrollView
{Q_OBJECT
public:
  PixmapView( TQWidget *parent );
  void setPixmap( const TQPixmap &pix );
  void drawContents( TQPainter *p, int, int, int, int );

private:
  TQPixmap pixmap;
};

class Preview : public QWidgetStack
{Q_OBJECT
public:
  Preview( TQWidget *parent );

public slots:
  void showPreview( const TQString& );

private:
  TQMultiLineEdit *normalText;
  TQTextView *html;
  PixmapView *pixmap;
};

class CustomFileDialog : public QFileDialog
{Q_OBJECT
public:
  CustomFileDialog( TQWidget* parent );
  ~CustomFileDialog();

  void addToolButton( TQButton * b, bool separator = false ){ TQFileDialog::addToolButton(b,separator); }
  void setBookmark( TQStringList& );
  TQStringList getBookmark(){ return bookmarkList; }

public slots:
  void setDir2( const TQString & );

signals:
  void signalDone( int );

protected slots:
  void bookmarkChosen( int i );
  void goHome();
  virtual void done( int );

private:
  TQPopupMenu *bookmarkMenu;
  TQStringList bookmarkList;
  int addId, clearId;
};

#endif