/*
 * This file is autogenerated with bcop:
 * The Compiz option code generator
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */


#include <core/core.h>

#include "resizeinfo_options.h"

ResizeinfoOptions::ResizeinfoOptions (bool init /* = true */) :
    mOptions (ResizeinfoOptions::OptionNum),
    mNotify (ResizeinfoOptions::OptionNum)
{
    if (init)
        initOptions ();
}

void
ResizeinfoOptions::initOptions ()
{
    unsigned short color[4];

    // fade_time
    mOptions[ResizeinfoOptions::FadeTime].setName ("fade_time", CompOption::TypeInt);
    mOptions[ResizeinfoOptions::FadeTime].rest ().set (10, 5000);
    mOptions[ResizeinfoOptions::FadeTime].value().set((int) 500);

    // always_show
    mOptions[ResizeinfoOptions::AlwaysShow].setName ("always_show", CompOption::TypeBool);
    mOptions[ResizeinfoOptions::AlwaysShow].value().set(false);

    // resizeinfo_font_bold
    mOptions[ResizeinfoOptions::ResizeinfoFontBold].setName ("resizeinfo_font_bold", CompOption::TypeBool);
    mOptions[ResizeinfoOptions::ResizeinfoFontBold].value().set(true);

    // resizeinfo_font_size
    mOptions[ResizeinfoOptions::ResizeinfoFontSize].setName ("resizeinfo_font_size", CompOption::TypeInt);
    mOptions[ResizeinfoOptions::ResizeinfoFontSize].rest ().set (10, 14);
    mOptions[ResizeinfoOptions::ResizeinfoFontSize].value().set((int) 12);

    // text_color
    mOptions[ResizeinfoOptions::TextColor].setName ("text_color", CompOption::TypeColor);
    color[0] = MAX (0, MIN (0xffff, 0x0000));
    color[1] = MAX (0, MIN (0xffff, 0x0000));
    color[2] = MAX (0, MIN (0xffff, 0x0000));
    color[3] = MAX (0, MIN (0xffff, 0xffff));
    mOptions[ResizeinfoOptions::TextColor].value().set(color);

    // gradient_1
    mOptions[ResizeinfoOptions::Gradient1].setName ("gradient_1", CompOption::TypeColor);
    color[0] = MAX (0, MIN (0xffff, 0xcccc));
    color[1] = MAX (0, MIN (0xffff, 0xcccc));
    color[2] = MAX (0, MIN (0xffff, 0xe665));
    color[3] = MAX (0, MIN (0xffff, 0xcccc));
    mOptions[ResizeinfoOptions::Gradient1].value().set(color);

    // gradient_2
    mOptions[ResizeinfoOptions::Gradient2].setName ("gradient_2", CompOption::TypeColor);
    color[0] = MAX (0, MIN (0xffff, 0xf332));
    color[1] = MAX (0, MIN (0xffff, 0xf332));
    color[2] = MAX (0, MIN (0xffff, 0xf332));
    color[3] = MAX (0, MIN (0xffff, 0xcccc));
    mOptions[ResizeinfoOptions::Gradient2].value().set(color);

    // gradient_3
    mOptions[ResizeinfoOptions::Gradient3].setName ("gradient_3", CompOption::TypeColor);
    color[0] = MAX (0, MIN (0xffff, 0xd998));
    color[1] = MAX (0, MIN (0xffff, 0xd998));
    color[2] = MAX (0, MIN (0xffff, 0xd998));
    color[3] = MAX (0, MIN (0xffff, 0xcccc));
    mOptions[ResizeinfoOptions::Gradient3].value().set(color);

    // outline_color
    mOptions[ResizeinfoOptions::OutlineColor].setName ("outline_color", CompOption::TypeColor);
    color[0] = MAX (0, MIN (0xffff, 0xe665));
    color[1] = MAX (0, MIN (0xffff, 0xe665));
    color[2] = MAX (0, MIN (0xffff, 0xe665));
    color[3] = MAX (0, MIN (0xffff, 0xffff));
    mOptions[ResizeinfoOptions::OutlineColor].value().set(color);

}

ResizeinfoOptions::~ResizeinfoOptions ()
{
}


CompOption::Vector &
ResizeinfoOptions::getOptions ()
{
    return mOptions;
}

bool
ResizeinfoOptions::setOption (const CompString &name, CompOption::Value &value)
{
    CompOption   *o;
    unsigned int index;

    o = CompOption::findOption (mOptions, name, &index);

    if (!o)
        return false;

    switch (index)
    {
        case ResizeinfoOptions::FadeTime:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::FadeTime].empty ())
                    mNotify[ResizeinfoOptions::FadeTime] (o, ResizeinfoOptions::FadeTime);
                return true;
            }
            break;
        case ResizeinfoOptions::AlwaysShow:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::AlwaysShow].empty ())
                    mNotify[ResizeinfoOptions::AlwaysShow] (o, ResizeinfoOptions::AlwaysShow);
                return true;
            }
            break;
        case ResizeinfoOptions::ResizeinfoFontBold:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::ResizeinfoFontBold].empty ())
                    mNotify[ResizeinfoOptions::ResizeinfoFontBold] (o, ResizeinfoOptions::ResizeinfoFontBold);
                return true;
            }
            break;
        case ResizeinfoOptions::ResizeinfoFontSize:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::ResizeinfoFontSize].empty ())
                    mNotify[ResizeinfoOptions::ResizeinfoFontSize] (o, ResizeinfoOptions::ResizeinfoFontSize);
                return true;
            }
            break;
        case ResizeinfoOptions::TextColor:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::TextColor].empty ())
                    mNotify[ResizeinfoOptions::TextColor] (o, ResizeinfoOptions::TextColor);
                return true;
            }
            break;
        case ResizeinfoOptions::Gradient1:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::Gradient1].empty ())
                    mNotify[ResizeinfoOptions::Gradient1] (o, ResizeinfoOptions::Gradient1);
                return true;
            }
            break;
        case ResizeinfoOptions::Gradient2:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::Gradient2].empty ())
                    mNotify[ResizeinfoOptions::Gradient2] (o, ResizeinfoOptions::Gradient2);
                return true;
            }
            break;
        case ResizeinfoOptions::Gradient3:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::Gradient3].empty ())
                    mNotify[ResizeinfoOptions::Gradient3] (o, ResizeinfoOptions::Gradient3);
                return true;
            }
            break;
        case ResizeinfoOptions::OutlineColor:
            if (o->set (value))
            {
                if (!mNotify[ResizeinfoOptions::OutlineColor].empty ())
                    mNotify[ResizeinfoOptions::OutlineColor] (o, ResizeinfoOptions::OutlineColor);
                return true;
            }
            break;
        default:
            break;
    }
    return false;

}

