summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kjanuswidget.h
Unidiff
Diffstat (limited to 'microkde/kdeui/kjanuswidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kjanuswidget.h56
1 files changed, 31 insertions, 25 deletions
diff --git a/microkde/kdeui/kjanuswidget.h b/microkde/kdeui/kjanuswidget.h
index 6d3f23d..72465ea 100644
--- a/microkde/kdeui/kjanuswidget.h
+++ b/microkde/kdeui/kjanuswidget.h
@@ -11,48 +11,54 @@
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA. 17 * Boston, MA 02111-1307, USA.
18 */ 18 */
19 19
20#ifndef _KJANUS_WIDGET_H_ 20#ifndef _KJANUS_WIDGET_H_
21#define _KJANUS_WIDGET_H_ 21#define _KJANUS_WIDGET_H_
22 22
23#include <qptrlist.h> 23#include <q3ptrlist.h>
24#include <qwidget.h> 24#include <qwidget.h>
25#include <qmap.h> 25#include <qmap.h>
26#include <qgrid.h> 26#include <q3grid.h>
27//Added by qt3to4:
28#include <QShowEvent>
29#include <Q3Frame>
30#include <QPixmap>
31#include <QLabel>
32#include <QEvent>
27#include <klistbox.h> 33#include <klistbox.h>
28 34
29/*US 35/*US
30#include <qptrlist.h> 36#include <qptrlist.h>
31#include <qpixmap.h> 37#include <qpixmap.h>
32#include <qsplitter.h> 38#include <qsplitter.h>
33 39
34#include <qstringlist.h> 40#include <qstringlist.h>
35#include <qmap.h> 41#include <qmap.h>
36 42
37*/ 43*/
38 44
39class KSeparator; 45class KSeparator;
40class KListView; 46class KListView;
41class QWidgetStack; 47class Q3WidgetStack;
42class QLabel; 48class QLabel;
43class QTabWidget; 49class QTabWidget;
44class QListViewItem; 50class Q3ListViewItem;
45class QVBox; 51class Q3VBox;
46class QHBox; 52class Q3HBox;
47 53
48/** 54/**
49 * Provides a number of ready to use layouts (faces). It is used 55 * Provides a number of ready to use layouts (faces). It is used
50 * as an internal widget in @ref KDialogBase, but can also used as a 56 * as an internal widget in @ref KDialogBase, but can also used as a
51 * widget of its own. 57 * widget of its own.
52 * 58 *
53 * It provides TreeList, IconList, Tabbed, Plain and Swallow layouts. 59 * It provides TreeList, IconList, Tabbed, Plain and Swallow layouts.
54 * 60 *
55 * The TreeList face provides a list in the left area and pages in the 61 * The TreeList face provides a list in the left area and pages in the
56 * right. The area are separated by a movable splitter. The style is somewhat 62 * right. The area are separated by a movable splitter. The style is somewhat
57 * similar to the layout in the Control Center. A page is raised by 63 * similar to the layout in the Control Center. A page is raised by
58 * selecting the corresponding tree list item. 64 * selecting the corresponding tree list item.
@@ -93,25 +99,25 @@ class QHBox;
93 * 99 *
94 * @short Easy to use widget with many layouts 100 * @short Easy to use widget with many layouts
95 * @author Espen Sand (espen@kde.org) 101 * @author Espen Sand (espen@kde.org)
96 */ 102 */
97class KJanusWidget : public QWidget 103class KJanusWidget : public QWidget
98{ 104{
99 Q_OBJECT 105 Q_OBJECT
100 106
101 private: 107 private:
102 class IconListBox : public KListBox 108 class IconListBox : public KListBox
103 { 109 {
104 public: 110 public:
105 IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 ); 111 IconListBox( QWidget *parent=0, const char *name=0, Qt::WFlags f=0 );
106 void updateMinimumHeight(); 112 void updateMinimumHeight();
107 void updateWidth(); 113 void updateWidth();
108 void invalidateHeight(); 114 void invalidateHeight();
109 void invalidateWidth(); 115 void invalidateWidth();
110 void setShowAll( bool showAll ); 116 void setShowAll( bool showAll );
111 117
112 private: 118 private:
113 bool mShowAll; 119 bool mShowAll;
114 bool mHeightValid; 120 bool mHeightValid;
115 bool mWidthValid; 121 bool mWidthValid;
116 }; 122 };
117 123
@@ -184,141 +190,141 @@ class KJanusWidget : public QWidget
184 * Returns the recommended size for the widget in order to be displayed 190 * Returns the recommended size for the widget in order to be displayed
185 * properly. 191 * properly.
186 * 192 *
187 * @return The recommended size. 193 * @return The recommended size.
188 */ 194 */
189 virtual QSize sizeHint() const; 195 virtual QSize sizeHint() const;
190 196
191 /** 197 /**
192 * Returns the empty widget that is available in Plain mode. 198 * Returns the empty widget that is available in Plain mode.
193 * 199 *
194 * @return The widget or 0 if the face in not Plain. 200 * @return The widget or 0 if the face in not Plain.
195 */ 201 */
196 virtual QFrame *plainPage(); 202 virtual Q3Frame *plainPage();
197 203
198 /** 204 /**
199 * Add a new page when the class is used in TreeList, IconList or Tabbed 205 * Add a new page when the class is used in TreeList, IconList or Tabbed
200 * mode. The returned widget is empty and you must add your widgets 206 * mode. The returned widget is empty and you must add your widgets
201 * as children to this widget. In most cases you must create a layout 207 * as children to this widget. In most cases you must create a layout
202 * manager and associate it with this widget as well. 208 * manager and associate it with this widget as well.
203 * 209 *
204 * Deleting the returned frame will cause the listitem or tab to be 210 * Deleting the returned frame will cause the listitem or tab to be
205 * removed (you can re-add a page with the same name later. 211 * removed (you can re-add a page with the same name later.
206 * 212 *
207 * @param item String used in the list or Tab item. 213 * @param item String used in the list or Tab item.
208 * @param header A longer string used in TreeList and IconList mode to 214 * @param header A longer string used in TreeList and IconList mode to
209 * describe the contents of a page. If empty, the item string 215 * describe the contents of a page. If empty, the item string
210 * will be used instead. 216 * will be used instead.
211 * @param pixmap Used in IconList mode or in TreeList mode. You should 217 * @param pixmap Used in IconList mode or in TreeList mode. You should
212 * prefer a pixmap with size 32x32 pixels. 218 * prefer a pixmap with size 32x32 pixels.
213 * 219 *
214 * @return The empty page or 0 if the face is not TreeList, IconList or 220 * @return The empty page or 0 if the face is not TreeList, IconList or
215 * Tabbed. 221 * Tabbed.
216 */ 222 */
217 virtual QFrame *addPage(const QString &item,const QString &header=QString::null, 223 virtual Q3Frame *addPage(const QString &item,const QString &header=QString::null,
218 const QPixmap &pixmap=QPixmap() ); 224 const QPixmap &pixmap=QPixmap() );
219 225
220 /** 226 /**
221 * This is like addPage just above, with the difference that the first 227 * This is like addPage just above, with the difference that the first
222 * element is a list of strings. These strings are used to form a path 228 * element is a list of strings. These strings are used to form a path
223 * of folders down to the given page. The initial elements are names 229 * of folders down to the given page. The initial elements are names
224 * for the folders, while the last element is the name of the page. 230 * for the folders, while the last element is the name of the page.
225 * Note: This does yet only work for the TreeList face. Later this may 231 * Note: This does yet only work for the TreeList face. Later this may
226 * be added for the IconList face too. In other faces than the 232 * be added for the IconList face too. In other faces than the
227 * TreeList, all the strings except the last one is ignored. 233 * TreeList, all the strings except the last one is ignored.
228 * Deleting the returned frame will cause the listitem or tab to be 234 * Deleting the returned frame will cause the listitem or tab to be
229 * removed (you can re-add a page with the same name later. 235 * removed (you can re-add a page with the same name later.
230 * 236 *
231 * Deleting the returned frame will cause the listitem or tab to be 237 * Deleting the returned frame will cause the listitem or tab to be
232 * removed (you can re-add a page with the same name later. 238 * removed (you can re-add a page with the same name later.
233 **/ 239 **/
234 virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null, 240 virtual Q3Frame *addPage(const QStringList &items, const QString &header=QString::null,
235 const QPixmap &pixmap=QPixmap() ); 241 const QPixmap &pixmap=QPixmap() );
236 242
237 /** 243 /**
238 * Add a new page when the class is used in TreeList, IconList or Tabbed 244 * Add a new page when the class is used in TreeList, IconList or Tabbed
239 * mode. The returned widget is empty and you must add your widgets 245 * mode. The returned widget is empty and you must add your widgets
240 * as children to this widget. The returned widget is a @ref QVBox 246 * as children to this widget. The returned widget is a @ref QVBox
241 * so it contains a QVBoxLayout layout that lines up the child widgets 247 * so it contains a QVBoxLayout layout that lines up the child widgets
242 * are vertically. 248 * are vertically.
243 * 249 *
244 * Deleting the returned frame will cause the listitem or tab to be 250 * Deleting the returned frame will cause the listitem or tab to be
245 * removed (you can re-add a page with the same name later. 251 * removed (you can re-add a page with the same name later.
246 * 252 *
247 * @param item String used in the list or Tab item. 253 * @param item String used in the list or Tab item.
248 * @param header A longer string used in TreeList and IconList mode to 254 * @param header A longer string used in TreeList and IconList mode to
249 * describe the contents of a page. If empty, the item string 255 * describe the contents of a page. If empty, the item string
250 * will be used instead. 256 * will be used instead.
251 * @param pixmap Used in IconList mode or in TreeList mode. You should 257 * @param pixmap Used in IconList mode or in TreeList mode. You should
252 * prefer a pixmap with size 32x32 pixels. 258 * prefer a pixmap with size 32x32 pixels.
253 * 259 *
254 * @return The empty page or 0 if the face is not TreeList, IconList or 260 * @return The empty page or 0 if the face is not TreeList, IconList or
255 * Tabbed. */ 261 * Tabbed. */
256 virtual QVBox *addVBoxPage( const QString &item, 262 virtual Q3VBox *addVBoxPage( const QString &item,
257 const QString &header=QString::null, 263 const QString &header=QString::null,
258 const QPixmap &pixmap=QPixmap() ); 264 const QPixmap &pixmap=QPixmap() );
259 265
260 /** 266 /**
261 * This is like addVBoxPage just above, with the difference that the first 267 * This is like addVBoxPage just above, with the difference that the first
262 * element is a list of strings. These strings are used to form a path 268 * element is a list of strings. These strings are used to form a path
263 * of folders down to the given page. The initial elements are names 269 * of folders down to the given page. The initial elements are names
264 * for the folders, while the last element is the name of the page. 270 * for the folders, while the last element is the name of the page.
265 * Note: This does yet only work for the TreeList face. Later this may 271 * Note: This does yet only work for the TreeList face. Later this may
266 * be added for the IconList face too. In other faces than the 272 * be added for the IconList face too. In other faces than the
267 * TreeList, all the strings except the last one is ignored. 273 * TreeList, all the strings except the last one is ignored.
268 * 274 *
269 * Deleting the returned frame will cause the listitem or tab to be 275 * Deleting the returned frame will cause the listitem or tab to be
270 * removed (you can re-add a page with the same name later. 276 * removed (you can re-add a page with the same name later.
271 **/ 277 **/
272 virtual QVBox *addVBoxPage( const QStringList &items, 278 virtual Q3VBox *addVBoxPage( const QStringList &items,
273 const QString &header=QString::null, 279 const QString &header=QString::null,
274 const QPixmap &pixmap=QPixmap() ); 280 const QPixmap &pixmap=QPixmap() );
275 281
276 /** 282 /**
277 * Add a new page when the class is used in TreeList, IconList or Tabbed 283 * Add a new page when the class is used in TreeList, IconList or Tabbed
278 * mode. The returned widget is empty and you must add your widgets 284 * mode. The returned widget is empty and you must add your widgets
279 * as children to this widget. The returned widget is a @ref QHBox 285 * as children to this widget. The returned widget is a @ref QHBox
280 * so it contains a QHBoxLayout layout that lines up the child widgets 286 * so it contains a QHBoxLayout layout that lines up the child widgets
281 * are horizontally. 287 * are horizontally.
282 * 288 *
283 * Deleting the returned frame will cause the listitem or tab to be 289 * Deleting the returned frame will cause the listitem or tab to be
284 * removed (you can re-add a page with the same name later. 290 * removed (you can re-add a page with the same name later.
285 * 291 *
286 * @param item String used in the list or Tab item. 292 * @param item String used in the list or Tab item.
287 * @param header A longer string used in TreeList and IconList mode to 293 * @param header A longer string used in TreeList and IconList mode to
288 * describe the contents of a page. If empty, the item string 294 * describe the contents of a page. If empty, the item string
289 * will be used instead. 295 * will be used instead.
290 * @param pixmap Used in IconList mode or in TreeList mode. You should 296 * @param pixmap Used in IconList mode or in TreeList mode. You should
291 * prefer a pixmap with size 32x32 pixels. 297 * prefer a pixmap with size 32x32 pixels.
292 * 298 *
293 * @return The empty page or 0 if the face is not TreeList, IconList or 299 * @return The empty page or 0 if the face is not TreeList, IconList or
294 * Tabbed. 300 * Tabbed.
295 */ 301 */
296 virtual QHBox *addHBoxPage( const QString &itemName, 302 virtual Q3HBox *addHBoxPage( const QString &itemName,
297 const QString &header=QString::null, 303 const QString &header=QString::null,
298 const QPixmap &pixmap=QPixmap() ); 304 const QPixmap &pixmap=QPixmap() );
299 305
300 /** 306 /**
301 * This is like addHBoxPage just above, with the difference that the first 307 * This is like addHBoxPage just above, with the difference that the first
302 * element is a list of strings. These strings are used to form a path 308 * element is a list of strings. These strings are used to form a path
303 * of folders down to the given page. The initial elements are names 309 * of folders down to the given page. The initial elements are names
304 * for the folders, while the last element is the name of the page. 310 * for the folders, while the last element is the name of the page.
305 * Note: This does yet only work for the TreeList face. Later this may 311 * Note: This does yet only work for the TreeList face. Later this may
306 * be added for the IconList face too. In other faces than the 312 * be added for the IconList face too. In other faces than the
307 * TreeList, all the strings except the last one is ignored. 313 * TreeList, all the strings except the last one is ignored.
308 * 314 *
309 * Deleting the returned frame will cause the listitem or tab to be 315 * Deleting the returned frame will cause the listitem or tab to be
310 * removed (you can re-add a page with the same name later. 316 * removed (you can re-add a page with the same name later.
311 **/ 317 **/
312 virtual QHBox *addHBoxPage( const QStringList &items, 318 virtual Q3HBox *addHBoxPage( const QStringList &items,
313 const QString &header=QString::null, 319 const QString &header=QString::null,
314 const QPixmap &pixmap=QPixmap() ); 320 const QPixmap &pixmap=QPixmap() );
315 321
316 /** 322 /**
317 * Add a new page when the class is used in either TreeList or Tabbed 323 * Add a new page when the class is used in either TreeList or Tabbed
318 * mode. The returned widget is empty and you must add your widgets 324 * mode. The returned widget is empty and you must add your widgets
319 * as children to this widget. The returned widget is a @ref QGrid 325 * as children to this widget. The returned widget is a @ref QGrid
320 * so it contains a QGridLayout layout that places up the child widgets 326 * so it contains a QGridLayout layout that places up the child widgets
321 * in a grid. 327 * in a grid.
322 * 328 *
323 * Deleting the returned frame will cause the listitem or tab to be 329 * Deleting the returned frame will cause the listitem or tab to be
324 * removed (you can re-add a page with the same name later. 330 * removed (you can re-add a page with the same name later.
@@ -328,43 +334,43 @@ class KJanusWidget : public QWidget
328 * @param dir Can be QGrid::Horizontal or QGrid::Vertical. 334 * @param dir Can be QGrid::Horizontal or QGrid::Vertical.
329 * @param item String used in the list or Tab item. 335 * @param item String used in the list or Tab item.
330 * @param header A longer string used in TreeList and IconList mode to 336 * @param header A longer string used in TreeList and IconList mode to
331 * describe the contents of a page. If empty, the item string 337 * describe the contents of a page. If empty, the item string
332 * will be used instead. 338 * will be used instead.
333 * @param pixmap Used in IconList mode or in TreeList mode. You should 339 * @param pixmap Used in IconList mode or in TreeList mode. You should
334 * prefer a pixmap with size 32x32 pixels. 340 * prefer a pixmap with size 32x32 pixels.
335 * 341 *
336 * @return The empty page or 0 if the face is not TreeList, IconList or 342 * @return The empty page or 0 if the face is not TreeList, IconList or
337 * Tabbed. 343 * Tabbed.
338 */ 344 */
339//US changed Orientation into Direction for compatibility 345//US changed Orientation into Direction for compatibility
340 virtual QGrid *addGridPage( int n, QGrid::Direction dir, 346 virtual Q3Grid *addGridPage( int n, Qt::Orientation dir,
341 const QString &itemName, 347 const QString &itemName,
342 const QString &header=QString::null, 348 const QString &header=QString::null,
343 const QPixmap &pixmap=QPixmap() ); 349 const QPixmap &pixmap=QPixmap() );
344 350
345 /** 351 /**
346 * This is like addGridPage just above, with the difference that the first 352 * This is like addGridPage just above, with the difference that the first
347 * element is a list of strings. These strings are used to form a path 353 * element is a list of strings. These strings are used to form a path
348 * of folders down to the given page. The initial elements are names 354 * of folders down to the given page. The initial elements are names
349 * for the folders, while the last element is the name of the page. 355 * for the folders, while the last element is the name of the page.
350 * Note: This does yet only work for the TreeList face. Later this may 356 * Note: This does yet only work for the TreeList face. Later this may
351 * be added for the IconList face too. In other faces than the 357 * be added for the IconList face too. In other faces than the
352 * TreeList, all the strings except the last one is ignored. 358 * TreeList, all the strings except the last one is ignored.
353 * 359 *
354 * Deleting the returned frame will cause the listitem or tab to be 360 * Deleting the returned frame will cause the listitem or tab to be
355 * removed (you can re-add a page with the same name later. 361 * removed (you can re-add a page with the same name later.
356 **/ 362 **/
357//US changed Orientation into Direction for compatibility 363//US changed Orientation into Direction for compatibility
358 virtual QGrid *addGridPage( int n, QGrid::Direction dir, 364 virtual Q3Grid *addGridPage( int n, Qt::Orientation dir,
359 const QStringList &items, 365 const QStringList &items,
360 const QString &header=QString::null, 366 const QString &header=QString::null,
361 const QPixmap &pixmap=QPixmap() ); 367 const QPixmap &pixmap=QPixmap() );
362 368
363 /** 369 /**
364 * @short Removes a page created with @ref addPage, @ref addVBoxPage, 370 * @short Removes a page created with @ref addPage, @ref addVBoxPage,
365 * @ref addHBoxPage or @ref addGridPage. If the page has already 371 * @ref addHBoxPage or @ref addGridPage. If the page has already
366 * been deleted or has already been removed, nothing happens. The widget 372 * been deleted or has already been removed, nothing happens. The widget
367 * itself is not deleted. 373 * itself is not deleted.
368 * 374 *
369 * @param page The widget returned by @ref addPage , @ref addVBoxPage , 375 * @param page The widget returned by @ref addPage , @ref addVBoxPage ,
370 * @ref addHBoxPage or @ref addGridPage . 376 * @ref addHBoxPage or @ref addGridPage .
@@ -508,56 +514,56 @@ class KJanusWidget : public QWidget
508 * This function is used internally when in IconList mode. If you 514 * This function is used internally when in IconList mode. If you
509 * reimplement this class a make your own event filter, make sure to 515 * reimplement this class a make your own event filter, make sure to
510 * call this function from your filter. 516 * call this function from your filter.
511 * 517 *
512 * @param o Object that has received an event. 518 * @param o Object that has received an event.
513 * @param e The event. 519 * @param e The event.
514 */ 520 */
515 virtual bool eventFilter( QObject *o, QEvent *e ); 521 virtual bool eventFilter( QObject *o, QEvent *e );
516 522
517 private slots: 523 private slots:
518 bool slotShowPage(); 524 bool slotShowPage();
519//US not yet implemented void slotFontChanged(); 525//US not yet implemented void slotFontChanged();
520 void slotItemClicked(QListViewItem *it); 526 void slotItemClicked(Q3ListViewItem *it);
521 void pageGone( QObject *obj); // signal from the added page's "destroyed" signal 527 void pageGone( QObject *obj); // signal from the added page's "destroyed" signal
522 void slotReopen(QListViewItem *item); 528 void slotReopen(Q3ListViewItem *item);
523 529
524 protected: 530 protected:
525 bool showPage( QWidget *w ); 531 bool showPage( QWidget *w );
526 void addPageWidget( QFrame *page, const QStringList &items, 532 void addPageWidget( Q3Frame *page, const QStringList &items,
527 const QString &header, const QPixmap &pixmap ); 533 const QString &header, const QPixmap &pixmap );
528 void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page); 534 void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page);
529 QWidget *FindParent(); 535 QWidget *FindParent();
530 536
531 private: 537 private:
532 bool mValid; 538 bool mValid;
533 539
534 // Obsolete members. Remove in KDE 4. 540 // Obsolete members. Remove in KDE 4.
535 QPtrList<QWidget> *mPageList; 541 Q3PtrList<QWidget> *mPageList;
536 QStringList *mTitleList; 542 QStringList *mTitleList;
537 543
538 int mFace; 544 int mFace;
539 KListView *mTreeList; 545 KListView *mTreeList;
540 IconListBox *mIconList; 546 IconListBox *mIconList;
541 QWidgetStack *mPageStack; 547 Q3WidgetStack *mPageStack;
542 QLabel *mTitleLabel; 548 QLabel *mTitleLabel;
543 QTabWidget *mTabControl; 549 QTabWidget *mTabControl;
544 QFrame *mPlainPage; 550 Q3Frame *mPlainPage;
545 QWidget *mSwallowPage; 551 QWidget *mSwallowPage;
546 QWidget *mActivePageWidget; 552 QWidget *mActivePageWidget;
547 KSeparator *mTitleSep; 553 KSeparator *mTitleSep;
548//US QSplitter::ResizeMode mTreeListResizeMode; 554//US QSplitter::ResizeMode mTreeListResizeMode;
549 bool mShowIconsInTreeList; 555 bool mShowIconsInTreeList;
550 QMap<QListViewItem *, QWidget *> mTreeListToPageStack; 556 QMap<Q3ListViewItem *, QWidget *> mTreeListToPageStack;
551 QMap<QListBoxItem *, QWidget *> mIconListToPageStack; 557 QMap<Q3ListBoxItem *, QWidget *> mIconListToPageStack;
552 QMap<QString, QPixmap> mFolderIconMap; 558 QMap<QString, QPixmap> mFolderIconMap;
553 QMap<QString, QStringList> mChildrenNames; 559 QMap<QString, QStringList> mChildrenNames;
554 QMap<QString, QWidget *> mChildPages; 560 QMap<QString, QWidget *> mChildPages;
555 561
556 public: 562 public:
557 class IconListItem; 563 class IconListItem;
558 protected: 564 protected:
559 virtual void virtual_hook( int id, void* data ); 565 virtual void virtual_hook( int id, void* data );
560 private: 566 private:
561 class KJanusWidgetPrivate; 567 class KJanusWidgetPrivate;
562 KJanusWidgetPrivate *d; 568 KJanusWidgetPrivate *d;
563}; 569};