home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / examples / showimg / imagefip.cpp next >
C/C++ Source or Header  |  2001-10-11  |  1KB  |  63 lines

  1. /****************************************************************************
  2. ** $Id:  qt/imagefip.cpp   3.0.0   edited Jun 22 13:24 $
  3. **
  4. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  5. **
  6. ** This file is part of an example program for Qt.  This example
  7. ** program may be used, distributed and modified without limitation.
  8. **
  9. *****************************************************************************/
  10.  
  11. #include "imagefip.h"
  12. #include <qimage.h>
  13.  
  14. /* XPM */
  15. static const char *image_xpm[] = {
  16. "17 15 9 1",
  17. "    c #7F7F7F",
  18. ".    c #FFFFFF",
  19. "X    c #00B6FF",
  20. "o    c #BFBFBF",
  21. "O    c #FF6C00",
  22. "+    c #000000",
  23. "@    c #0000FF",
  24. "#    c #6CFF00",
  25. "$    c #FFB691",
  26. "             ..XX",
  27. " ........o   .XXX",
  28. " .OOOOOOOo.  XXX+",
  29. " .O@@@@@@+++XXX++",
  30. " .O@@@@@@O.XXX+++",
  31. " .O@@@@@@OXXX+++.",
  32. " .O######XXX++...",
  33. " .O#####XXX++....",
  34. " .O##$#$XX+o+....",
  35. " .O#$$$$$+.o+....",
  36. " .O##$$##O.o+....",
  37. " .OOOOOOOO.o+....",
  38. " ..........o+....",
  39. " ooooooooooo+....",
  40. "+++++++++++++...."
  41. };
  42.  
  43. ImageIconProvider::ImageIconProvider( QWidget *parent, const char *name ) :
  44.     QFileIconProvider( parent, name ),
  45.     imagepm(image_xpm)
  46. {
  47.     fmts = QImage::inputFormats();
  48. }
  49.  
  50. ImageIconProvider::~ImageIconProvider()
  51. {
  52. }
  53.  
  54. const QPixmap * ImageIconProvider::pixmap( const QFileInfo &fi )
  55. {
  56.     QString ext = fi.extension().upper();
  57.     if ( fmts.contains(ext) ) {
  58.     return &imagepm;
  59.     } else {
  60.     return QFileIconProvider::pixmap(fi);
  61.     }
  62. }
  63.