Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLImageViewer.h 00003 ------------------- 00004 begin : vie mar 23 2007 00005 copyright : (C) 2007 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 /**************************************************************************** 00019 ** $Id: showimg.h,v 1.1.1.9 2006/05/07 17:31:27 chehrlic Exp $ 00020 ** 00021 ** Copyright (C) 1992-2005 Trolltech AS. All rights reserved. 00022 ** 00023 ** This file is part of an example program for Qt. This example 00024 ** program may be used, distributed and modified without limitation. 00025 ** 00026 *****************************************************************************/ 00027 00028 #ifndef IMAGEVIEWER_H 00029 #define IMAGEVIEWER_H 00030 00031 #include <qwidget.h> 00032 #include <qimage.h> 00033 #include <qmenubar.h> 00034 #include <qfiledialog.h> 00035 #include <qmessagebox.h> 00036 #include <qpopupmenu.h> 00037 #include <qlabel.h> 00038 #include <qpainter.h> 00039 #include <qapplication.h> 00040 #include <qclipboard.h> 00041 00042 class FLImageViewerInterface; 00043 00044 class FLImageViewer : public QWidget { 00045 Q_OBJECT 00046 00047 friend class FLImageViewerInterface; 00048 00049 public: 00050 FLImageViewer( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); 00051 ~FLImageViewer(); 00052 bool loadImage( const QString& ); 00053 protected: 00054 void paintEvent( QPaintEvent * ); 00055 void resizeEvent( QResizeEvent * ); 00056 void mousePressEvent( QMouseEvent * ); 00057 void mouseReleaseEvent( QMouseEvent * ); 00058 void mouseMoveEvent( QMouseEvent * ); 00059 00060 private: 00061 void scale(); 00062 int conversion_flags; 00063 bool smooth() const; 00064 bool useColorContext() const; 00065 int alloc_context; 00066 bool convertEvent( QMouseEvent* e, int& x, int& y ); 00067 QString filename; 00068 QImage image; // the loaded image 00069 QPixmap pm; // the converted pixmap 00070 QPixmap pmScaled; // the scaled pixmap 00071 00072 QMenuBar *menubar; 00073 QPopupMenu *file; 00074 QPopupMenu *saveimage; 00075 QPopupMenu *savepixmap; 00076 QPopupMenu *edit; 00077 QPopupMenu *options; 00078 00079 QWidget *helpmsg; 00080 QLabel *status; 00081 int si, sp, ac, co, mo, fd, bd, // Menu item ids 00082 td, ta, ba, fa, au, ad, dd, 00083 ss, cc, t1, t8, t32; 00084 void updateStatus(); 00085 void setMenuItemFlags(); 00086 bool reconvertImage(); 00087 int pickx, picky; 00088 int clickx, clicky; 00089 bool may_be_other; 00090 static FLImageViewer* other; 00091 void setImage( const QImage& newimage ); 00092 00093 public slots: 00094 00095 void openFile(); 00096 00097 private slots: 00098 void to1Bit(); 00099 void to8Bit(); 00100 void to32Bit(); 00101 void toBitDepth( int ); 00102 00103 void copy(); 00104 void paste(); 00105 00106 void hFlip(); 00107 void vFlip(); 00108 void rot180(); 00109 00110 void editText(); 00111 00112 void newWindow(); 00113 void saveImage( int ); 00114 void savePixmap( int ); 00115 void giveHelp(); 00116 void doOption( int ); 00117 void copyFrom( FLImageViewer* ); 00118 }; 00119 00120 00121 #endif // IMAGEVIEWER_H