Eneboo - Documentación para desarrolladores
src/flbase/aqsobjects/AQSColor_p.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002  AQSColor_p.h
00003  -------------------
00004  begin                : 18/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 AQSCOLOR_P_H_
00020 #define AQSCOLOR_P_H_
00021 
00022 #include "AQSVoidPtr_p.h"
00023 #include <qcolor.h>
00024 
00025 // @AQ_PTR_INDIRECTION@
00026 
00027 class AQSColor : public AQSVoidPtr
00028 {
00029   Q_OBJECT
00030 
00031   Q_PROPERTY(QColor toVariant READ toVariant);
00032 
00033   AQ_DECLARE_AQS_VOID(Color, VoidPtr);
00034 
00035 public:
00036   QColor toVariant() const {
00037     if (!o_)
00038       return QColor();
00039     return *o_;
00040   }
00041 
00042 protected:
00043   void specializedInternalFinish() {
00044     if (!wrap_)
00045       delete o_;
00046   }
00047 
00048   //@AQ_BEGIN_DEF_PUB_SLOTS@
00049 public slots:
00050   bool isValid() const;
00051   QString name() const;
00052   void setNamedColor(const QString &);
00053   QRgb rgb() const;
00054   void setRgb(int, int, int);
00055   void setRgb(QRgb);
00056   int red() const;
00057   int green() const;
00058   int blue() const;
00059   void setHsv(int, int, int);
00060   QColor *light(int = 150) const;
00061   QColor *dark(int = 200) const;
00062 
00063 protected:
00064   static void *construct(const QSArgumentList &args) {
00065     QMap<int, QStringList> candidates;
00066     candidates[0].append(QString::null);
00067     candidates[1].append(QString::fromLatin1("QRgb"));
00068     candidates[2].append(QString::fromLatin1("QRgb,uint"));
00069     candidates[3].append(QString::fromLatin1("int,int,int"));
00070     candidates[4].append(QString::fromLatin1("int,int,int,QColor::Spec"));
00071     candidates[1].append(QString::fromLatin1("QString"));
00072     candidates[1].append(QString::fromLatin1("QColor*"));
00073     QString sgt(castArgsSignature(args, candidates));
00074     if (sgt.isEmpty())
00075       return new QColor;
00076     if (sgt == QString::fromLatin1("QRgb"))
00077       return new QColor(*(argValue<QRgb *>(args[0])));
00078     if (sgt == QString::fromLatin1("QRgb,uint"))
00079       return new QColor(*(argValue<QRgb *>(args[0])),
00080                         args[1].variant().toUInt());
00081     if (sgt == QString::fromLatin1("int,int,int"))
00082       return new QColor(args[0].variant().toInt(),
00083                         args[1].variant().toInt(),
00084                         args[2].variant().toInt());
00085     if (sgt == QString::fromLatin1("int,int,int,QColor::Spec"))
00086       return new QColor(args[0].variant().toInt(),
00087                         args[1].variant().toInt(),
00088                         args[2].variant().toInt(),
00089                         static_cast<QColor::Spec>(args[3].variant().toUInt()));
00090     if (sgt == QString::fromLatin1("QString"))
00091       return new QColor(*(argValue<QString *>(args[0])));
00092     if (sgt == QString::fromLatin1("QColor*"))
00093       return new QColor(*argValue<QColor *>(args[0]));
00094     return 0;
00095   }
00096 
00097 public:
00098   static QMap<int, QStringList> candidateConstructors() {
00099     QMap<int, QStringList> candidates;
00100     candidates[0].append(QString::null);
00101     candidates[1].append(QString::fromLatin1("QRgb"));
00102     candidates[2].append(QString::fromLatin1("QRgb,uint"));
00103     candidates[3].append(QString::fromLatin1("int,int,int"));
00104     candidates[4].append(QString::fromLatin1("int,int,int,QColor::Spec"));
00105     candidates[1].append(QString::fromLatin1("QString"));
00106     candidates[1].append(QString::fromLatin1("QColor*"));
00107     return candidates;
00108   }
00109   //@AQ_END_DEF_PUB_SLOTS@
00110 };
00111 
00112 //@AQ_BEGIN_IMP_PUB_SLOTS@
00113 inline bool AQSColor::isValid() const
00114 {
00115   AQ_CALL_RET_V(isValid(), bool);
00116 }
00117 inline QString AQSColor::name() const
00118 {
00119   AQ_CALL_RET_V(name(), QString);
00120 }
00121 inline void AQSColor::setNamedColor(const QString &arg0)
00122 {
00123   AQ_CALL_VOID(setNamedColor(arg0));
00124 }
00125 inline QRgb AQSColor::rgb() const
00126 {
00127   AQ_CALL_RET_V(rgb(), QRgb);
00128 }
00129 inline void AQSColor::setRgb(int arg0,  int arg1,  int arg2)
00130 {
00131   AQ_CALL_VOID(setRgb(arg0, arg1, arg2));
00132 }
00133 inline void AQSColor::setRgb(QRgb arg0)
00134 {
00135   AQ_CALL_VOID(setRgb(arg0));
00136 }
00137 inline int AQSColor::red() const
00138 {
00139   AQ_CALL_RET_V(red(), int);
00140 }
00141 inline int AQSColor::green() const
00142 {
00143   AQ_CALL_RET_V(green(), int);
00144 }
00145 inline int AQSColor::blue() const
00146 {
00147   AQ_CALL_RET_V(blue(), int);
00148 }
00149 inline void AQSColor::setHsv(int arg0,  int arg1,  int arg2)
00150 {
00151   AQ_CALL_VOID(setHsv(arg0, arg1, arg2));
00152 }
00153 inline QColor *AQSColor::light(int arg0) const
00154 {
00155   AQ_CALL_RET_PTR(light(arg0), QColor);
00156 }
00157 inline QColor *AQSColor::dark(int arg0) const
00158 {
00159   AQ_CALL_RET_PTR(dark(arg0), QColor);
00160 }
00161 //@AQ_END_IMP_PUB_SLOTS@
00162 
00163 #endif /* AQSCOLOR_P_H_ */
00164 // @AQSVOIDPTR@
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'