/*
 * Copyright (C) 2012 by
 *   MetraLabs GmbH (MLAB), GERMANY
 *  and
 *   Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
 * All rights reserved.
 *
 * Redistribution and modification of this code is strictly prohibited.
 *
 * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
 * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
 * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
 */

/**
 * @file QColor
 *    Serialization/Deserialization of Qt QColor.
 *
 *    The filename was chosen to match the Qt standard.
 *    Instead of
 *      #include <QColor>
 *    use
 *      #include <serialization/adapters/Qt/QColor>
 *
 * @author Tim Langner, Erik Einhorn
 * @date   2011/01/05
 */

#ifndef _MIRA_QCOLOR_H_
#define _MIRA_QCOLOR_H_

#include <QColor>

#include <serialization/GetterSetter.h>
#include <serialization/PropertyHint.h>

namespace mira {

//////////////////////////////////////////////////////////////////////////////

template<typename Reflector>
void reflect(Reflector& re, QColor& color)
{
	re.property("Red",
	            getter<float>([&color](){ return color.redF(); }),
	            setter<float>([&color](float red){ color.setRedF(red); }),
	            "Red component (0-1)",
	            PropertyHints::limits(0.f, 1.f));
	re.property("Green",
	            getter<float>([&color](){ return color.greenF(); }),
	            setter<float>([&color](float green){ color.setGreenF(green); }),
	            "Green component (0-1)",
	            PropertyHints::limits(0.f, 1.f));
	re.property("Blue",
	            getter<float>([&color](){ return color.blueF(); }),
	            setter<float>([&color](float blue){ color.setBlueF(blue); }),
	            "Blue component (0-1)",
	            PropertyHints::limits(0.f, 1.f));
	re.property("Alpha",
	            getter<float>([&color](){ return color.alphaF();}),
	            setter<float>([&color](float alpha){ color.setAlphaF(alpha);}),
	            "Alpha (0=transparent, 1=opaque)",
	            PropertyHints::limits(0.f, 1.f));
}

//////////////////////////////////////////////////////////////////////////////

}

#endif
