Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 AQSPixmap_p.h 00003 ------------------- 00004 begin : 14/02/2011 00005 copyright : (C) 2003-2011 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 #ifndef AQSPIXMAP_P_H_ 00020 #define AQSPIXMAP_P_H_ 00021 00022 #include "AQSColor_p.h" 00023 #include "AQSImage_p.h" 00024 #include <qpixmap.h> 00025 00026 // @AQ_PTR_INDIRECTION@ 00027 00028 class AQSPixmap : public AQSVoidPtr 00029 { 00030 Q_OBJECT 00031 00032 Q_PROPERTY(int width READ width) 00033 Q_PROPERTY(int height READ height) 00034 Q_PROPERTY(QSize size READ size) 00035 Q_PROPERTY(QRect rect READ rect) 00036 Q_PROPERTY(int depth READ depth) 00037 Q_PROPERTY(QPixmap toVariant READ toVariant); 00038 00039 AQ_DECLARE_AQS_VOID(Pixmap, VoidPtr); 00040 00041 public: 00042 QPixmap toVariant() const { 00043 if (!o_) 00044 return QPixmap(); 00045 return *o_; 00046 } 00047 00048 protected: 00049 void specializedInternalFinish() { 00050 if (!wrap_) 00051 delete o_; 00052 } 00053 00054 public slots: 00055 QPaintDevice *paintDevice() const { 00056 return static_cast<QPaintDevice *>(o_); 00057 } 00058 00059 //@AQ_BEGIN_DEF_PUB_SLOTS@ 00060 public slots: 00061 bool isNull() const; 00062 int width() const; 00063 int height() const; 00064 QSize size() const; 00065 QRect rect() const; 00066 int depth() const; 00067 void fill(const QColor& = Qt::white); 00068 void fill(QColor *); 00069 void fill(AQSColor *); 00070 void fill(const QWidget *, int, int); 00071 void fill(const QWidget *, const QPoint &); 00072 void resize(int, int); 00073 void resize(const QSize &); 00074 bool selfMask() const; 00075 bool hasAlpha() const; 00076 bool hasAlphaChannel() const; 00077 QPixmap *xForm(QWMatrix *) const; 00078 QPixmap *xForm(AQSWMatrix *) const; 00079 QImage *convertToImage() const; 00080 bool convertFromImage(QImage *, int = 0); 00081 bool convertFromImage(AQSImage *, int = 0); 00082 bool loadFromData(QByteArray *, const char* = 0, int = 0); 00083 bool loadFromData(AQSByteArray *, const char* = 0, int = 0); 00084 bool save(QIODevice *, const char *, int = -1) const; 00085 bool save(AQSIODevice *, const char *, int = -1) const; 00086 bool load(const QString &, const char *, int); 00087 bool save(const QString &, const char *, int = -1) const; 00088 int serialNumber() const; 00089 void setOptimization(uint); 00090 bool isQBitmap() const; 00091 00092 protected: 00093 static void *construct(const QSArgumentList &args) { 00094 QMap<int, QStringList> candidates; 00095 candidates[0].append(QString::null); 00096 candidates[2].append(QString::fromLatin1("int,int")); 00097 candidates[3].append(QString::fromLatin1("int,int,int")); 00098 candidates[4].append(QString::fromLatin1("int,int,int,QPixmap::Optimization")); 00099 candidates[1].append(QString::fromLatin1("QSize")); 00100 candidates[2].append(QString::fromLatin1("QSize,int")); 00101 candidates[3].append(QString::fromLatin1("QSize,int,QPixmap::Optimization")); 00102 candidates[1].append(QString::fromLatin1("QString")); 00103 candidates[2].append(QString::fromLatin1("QString,QString")); 00104 candidates[3].append(QString::fromLatin1("QString,QString,QPixmap::ColorMode")); 00105 candidates[3].append(QString::fromLatin1("QString,QString,int")); 00106 candidates[1].append(QString::fromLatin1("QByteArray*")); 00107 candidates[1].append(QString::fromLatin1("QPixmap*")); 00108 candidates[1].append(QString::fromLatin1("QImage*")); 00109 QString sgt(castArgsSignature(args, candidates)); 00110 if (sgt.isEmpty()) 00111 return new QPixmap; 00112 if (sgt == QString::fromLatin1("int,int")) 00113 return new QPixmap(args[0].variant().toInt(), 00114 args[1].variant().toInt()); 00115 if (sgt == QString::fromLatin1("int,int,int")) 00116 return new QPixmap(args[0].variant().toInt(), 00117 args[1].variant().toInt(), 00118 args[2].variant().toInt()); 00119 if (sgt == QString::fromLatin1("int,int,int,QPixmap::Optimization")) 00120 return new QPixmap(args[0].variant().toInt(), 00121 args[1].variant().toInt(), 00122 args[2].variant().toInt(), 00123 static_cast<QPixmap::Optimization>(args[3].variant().toUInt())); 00124 if (sgt == QString::fromLatin1("QSize")) 00125 return new QPixmap(*(argValue<QSize *>(args[0]))); 00126 if (sgt == QString::fromLatin1("QSize,int")) 00127 return new QPixmap(*(argValue<QSize *>(args[0])), 00128 args[1].variant().toInt()); 00129 if (sgt == QString::fromLatin1("QSize,int,QPixmap::Optimization")) 00130 return new QPixmap(*(argValue<QSize *>(args[0])), 00131 args[1].variant().toInt(), 00132 static_cast<QPixmap::Optimization>(args[2].variant().toUInt())); 00133 if (sgt == QString::fromLatin1("QString")) 00134 return new QPixmap(*(argValue<QString *>(args[0]))); 00135 if (sgt == QString::fromLatin1("QString,QString")) 00136 return new QPixmap(*(argValue<QString *>(args[0])), 00137 *(argValue<QString *>(args[1]))); 00138 if (sgt == QString::fromLatin1("QString,QString,QPixmap::ColorMode")) 00139 return new QPixmap(*(argValue<QString *>(args[0])), 00140 *(argValue<QString *>(args[1])), 00141 static_cast<QPixmap::ColorMode>(args[2].variant().toUInt())); 00142 if (sgt == QString::fromLatin1("QString,QString,int")) 00143 return new QPixmap(*(argValue<QString *>(args[0])), 00144 *(argValue<QString *>(args[1])), 00145 args[2].variant().toInt()); 00146 if (sgt == QString::fromLatin1("QByteArray*")) 00147 return new QPixmap(*argValue<QByteArray *>(args[0])); 00148 if (sgt == QString::fromLatin1("QPixmap*")) 00149 return new QPixmap(*argValue<QPixmap *>(args[0])); 00150 if (sgt == QString::fromLatin1("QImage*")) 00151 return new QPixmap(*argValue<QImage *>(args[0])); 00152 return 0; 00153 } 00154 00155 public: 00156 static QMap<int, QStringList> candidateConstructors() { 00157 QMap<int, QStringList> candidates; 00158 candidates[0].append(QString::null); 00159 candidates[2].append(QString::fromLatin1("int,int")); 00160 candidates[3].append(QString::fromLatin1("int,int,int")); 00161 candidates[4].append(QString::fromLatin1("int,int,int,QPixmap::Optimization")); 00162 candidates[1].append(QString::fromLatin1("QSize")); 00163 candidates[2].append(QString::fromLatin1("QSize,int")); 00164 candidates[3].append(QString::fromLatin1("QSize,int,QPixmap::Optimization")); 00165 candidates[1].append(QString::fromLatin1("QString")); 00166 candidates[2].append(QString::fromLatin1("QString,QString")); 00167 candidates[3].append(QString::fromLatin1("QString,QString,QPixmap::ColorMode")); 00168 candidates[3].append(QString::fromLatin1("QString,QString,int")); 00169 candidates[1].append(QString::fromLatin1("QByteArray*")); 00170 candidates[1].append(QString::fromLatin1("QPixmap*")); 00171 candidates[1].append(QString::fromLatin1("QImage*")); 00172 return candidates; 00173 } 00174 //@AQ_END_DEF_PUB_SLOTS@ 00175 }; 00176 00177 //@AQ_BEGIN_IMP_PUB_SLOTS@ 00178 inline bool AQSPixmap::isNull() const 00179 { 00180 AQ_CALL_RET_V(isNull(), bool); 00181 } 00182 inline int AQSPixmap::width() const 00183 { 00184 AQ_CALL_RET_V(width(), int); 00185 } 00186 inline int AQSPixmap::height() const 00187 { 00188 AQ_CALL_RET_V(height(), int); 00189 } 00190 inline QSize AQSPixmap::size() const 00191 { 00192 AQ_CALL_RET_V(size(), QSize); 00193 } 00194 inline QRect AQSPixmap::rect() const 00195 { 00196 AQ_CALL_RET_V(rect(), QRect); 00197 } 00198 inline int AQSPixmap::depth() const 00199 { 00200 AQ_CALL_RET_V(depth(), int); 00201 } 00202 inline void AQSPixmap::fill(const QColor &arg0) 00203 { 00204 AQ_CALL_VOID(fill(arg0)); 00205 } 00206 inline void AQSPixmap::fill(QColor *arg0) 00207 { 00208 AQ_CALL_VOID(fill(*arg0)); 00209 } 00210 inline void AQSPixmap::fill(AQSColor *arg0) 00211 { 00212 AQ_CALL_VOID(fill(*arg0)); 00213 } 00214 inline void AQSPixmap::fill(const QWidget *arg0, int arg1, int arg2) 00215 { 00216 AQ_CALL_VOID(fill(arg0, arg1, arg2)); 00217 } 00218 inline void AQSPixmap::fill(const QWidget *arg0, const QPoint &arg1) 00219 { 00220 AQ_CALL_VOID(fill(arg0, arg1)); 00221 } 00222 inline void AQSPixmap::resize(int arg0, int arg1) 00223 { 00224 AQ_CALL_VOID(resize(arg0, arg1)); 00225 } 00226 inline void AQSPixmap::resize(const QSize &arg0) 00227 { 00228 AQ_CALL_VOID(resize(arg0)); 00229 } 00230 inline bool AQSPixmap::selfMask() const 00231 { 00232 AQ_CALL_RET_V(selfMask(), bool); 00233 } 00234 inline bool AQSPixmap::hasAlpha() const 00235 { 00236 AQ_CALL_RET_V(hasAlpha(), bool); 00237 } 00238 inline bool AQSPixmap::hasAlphaChannel() const 00239 { 00240 AQ_CALL_RET_V(hasAlphaChannel(), bool); 00241 } 00242 inline QPixmap *AQSPixmap::xForm(QWMatrix *arg0) const 00243 { 00244 AQ_CALL_RET_PTR(xForm(*arg0), QPixmap); 00245 } 00246 inline QPixmap *AQSPixmap::xForm(AQSWMatrix *arg0) const 00247 { 00248 AQ_CALL_RET_PTR(xForm(*arg0), QPixmap); 00249 } 00250 inline QImage *AQSPixmap::convertToImage() const 00251 { 00252 AQ_CALL_RET_PTR(convertToImage(), QImage); 00253 } 00254 inline bool AQSPixmap::convertFromImage(QImage *arg0, int arg1) 00255 { 00256 AQ_CALL_RET_V(convertFromImage(*arg0, arg1), bool); 00257 } 00258 inline bool AQSPixmap::convertFromImage(AQSImage *arg0, int arg1) 00259 { 00260 AQ_CALL_RET_V(convertFromImage(*arg0, arg1), bool); 00261 } 00262 inline bool AQSPixmap::loadFromData(QByteArray *arg0, const char *arg1, int arg2) 00263 { 00264 AQ_CALL_RET_V(loadFromData(*arg0, arg1, arg2), bool); 00265 } 00266 inline bool AQSPixmap::loadFromData(AQSByteArray *arg0, const char *arg1, int arg2) 00267 { 00268 AQ_CALL_RET_V(loadFromData(*arg0, arg1, arg2), bool); 00269 } 00270 inline bool AQSPixmap::save(QIODevice *arg0, const char *arg1, int arg2) const 00271 { 00272 AQ_CALL_RET_V(save(arg0, arg1, arg2), bool); 00273 } 00274 inline bool AQSPixmap::save(AQSIODevice *arg0, const char *arg1, int arg2) const 00275 { 00276 AQ_CALL_RET_V(save(*arg0, arg1, arg2), bool); 00277 } 00278 inline bool AQSPixmap::load(const QString &arg0, const char *arg1, int arg2) 00279 { 00280 AQ_CALL_RET_V(load(arg0, arg1, arg2), bool); 00281 } 00282 inline bool AQSPixmap::save(const QString &arg0, const char *arg1, int arg2) const 00283 { 00284 AQ_CALL_RET_V(save(arg0, arg1, arg2), bool); 00285 } 00286 inline int AQSPixmap::serialNumber() const 00287 { 00288 AQ_CALL_RET_V(serialNumber(), int); 00289 } 00290 inline void AQSPixmap::setOptimization(uint arg0) 00291 { 00292 AQ_CALL_VOID(setOptimization(static_cast<QPixmap::Optimization>(arg0))); 00293 } 00294 inline bool AQSPixmap::isQBitmap() const 00295 { 00296 AQ_CALL_RET_V(isQBitmap(), bool); 00297 } 00298 //@AQ_END_IMP_PUB_SLOTS@ 00299 00300 #endif /* AQSPIXMAP_P_H_ */ 00301 // @AQSVOIDPTR@